AliPhysics  fb6b143 (fb6b143)
AliJetModelCopyTracks.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Jet model task to copy tracks while making small change
4 // - make particles massless
5 //
6 // Author: M. Verweij
7 
9 
10 #include <TClonesArray.h>
11 #include <TFolder.h>
12 #include <TLorentzVector.h>
13 #include <TParticle.h>
14 #include <TParticlePDG.h>
15 #include <TRandom3.h>
16 #include <TProfile.h>
17 #include <TGrid.h>
18 #include <TFile.h>
19 #include <TF1.h>
20 #include "AliAnalysisManager.h"
21 #include "AliEMCALDigit.h"
22 #include "AliEMCALGeometry.h"
23 #include "AliEMCALRecPoint.h"
24 #include "AliGenerator.h"
25 #include "AliHeader.h"
26 #include "AliLog.h"
27 #include "AliPicoTrack.h"
28 #include "AliRun.h"
29 #include "AliRunLoader.h"
30 #include "AliStack.h"
31 #include "AliStack.h"
32 #include "AliVCluster.h"
33 #include "AliVEvent.h"
34 
35 ClassImp(AliJetModelCopyTracks)
36 
37 //________________________________________________________________________
40  fTracksOutName(""),
41  fTracksOut(0x0),
42  fParticleMass(kMassive),
43  fHistPtOut(0)
44 {
45  // Default constructor.
46  SetMakeGeneralHistograms(kTRUE);
47 }
48 
49 //________________________________________________________________________
51  AliAnalysisTaskEmcal(name,kTRUE),
52  fTracksOutName(""),
53  fTracksOut(0x0),
54  fParticleMass(kMassive),
55  fHistPtOut(0)
56 {
57  // Standard constructor.
59 }
60 
61 //________________________________________________________________________
63 {
64  // Destructor
65 
66 }
67 
68 //________________________________________________________________________
70 {
71  // Exec only once.
72 
74 
75  if (!fTracksOutName.IsNull()) {
76  fTracksOut = new TClonesArray("AliPicoTrack");
77  fTracksOut->SetName(fTracksOutName);
78  if (InputEvent()->FindListObject(fTracksOutName)) {
79  AliFatal(Form("%s: Collection %s is already present in the event!", GetName(), fTracksOutName.Data()));
80  return;
81  }
82  else {
83  InputEvent()->AddObject(fTracksOut);
84  }
85  }
86 }
87 
88 //________________________________________________________________________
90 {
92 
93  const Int_t nBinPt = 100;
94  Double_t binLimitsPt[nBinPt+1];
95  for(Int_t iPt = 0;iPt <= nBinPt;iPt++){
96  if(iPt == 0){
97  binLimitsPt[iPt] = 0.0;
98  } else {// 1.0
99  binLimitsPt[iPt] = binLimitsPt[iPt-1] + 1.0;
100  }
101  }
102 
103  fHistPtOut = new TH1F("fHistPtOut","fHistPtOut;#it{p}_{T};N",nBinPt,binLimitsPt);
104  fOutput->Add(fHistPtOut);
105 
106  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
107 }
108 
109 
110 //________________________________________________________________________
112 {
113  CopyTracks();
114  return kTRUE;
115 }
116 
117 //________________________________________________________________________
119 {
120  //Apply toy detector simulation to tracks
121  fTracksOut->Delete();
122 
123  Int_t nt = 0;
124  const Int_t nTracks = fTracks->GetEntriesFast();
125  for (Int_t i = 0; i < nTracks; ++i) {
126  AliPicoTrack *picotrack = static_cast<AliPicoTrack*>(fTracks->At(i));
127  if (!picotrack)
128  continue;
129 
130  Double_t mass = picotrack->M();
131  if(fParticleMass==kMassless) mass = 0.;
132  if(fParticleMass==kPionMass) mass = 0.13957;
133 
134  AliPicoTrack *track = new ((*fTracksOut)[nt]) AliPicoTrack(picotrack->Pt(),
135  picotrack->Eta(),
136  picotrack->Phi(),
137  picotrack->Charge(),
138  picotrack->GetLabel(),
139  AliPicoTrack::GetTrackType(picotrack),
140  picotrack->GetTrackEtaOnEMCal(),
141  picotrack->GetTrackPhiOnEMCal(),
142  picotrack->GetTrackPtOnEMCal(),
143  picotrack->IsEMCAL(),
144  mass);
145  track->SetBit(TObject::kBitMask,1);
146  fHistPtOut->Fill(track->Pt());
147  nt++;
148  }
149 }
150 
151 
152 
153 
154 
Double_t GetTrackPhiOnEMCal() const
Definition: AliPicoTrack.h:62
double Double_t
Definition: External.C:58
Base task in the EMCAL framework.
Double_t mass
Double_t GetTrackPtOnEMCal() const
Definition: AliPicoTrack.h:64
Bool_t IsEMCAL() const
Definition: AliPicoTrack.h:53
Int_t GetLabel() const
Definition: AliPicoTrack.h:41
Double_t Eta() const
Definition: AliPicoTrack.h:37
int Int_t
Definition: External.C:63
Double_t M() const
Definition: AliPicoTrack.h:36
Double_t Phi() const
Definition: AliPicoTrack.h:33
Byte_t GetTrackType() const
Definition: AliPicoTrack.h:43
Double_t Pt() const
Definition: AliPicoTrack.h:23
void ExecOnce()
Perform steps needed to initialize the analysis.
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
ParticleMass fParticleMass
output track collection
AliEmcalList * fOutput
!output list
TClonesArray * fTracks
!tracks
void SetMakeGeneralHistograms(Bool_t g)
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
void UserCreateOutputObjects()
Main initialization function on the worker.
Double_t GetTrackEtaOnEMCal() const
Definition: AliPicoTrack.h:63
bool Bool_t
Definition: External.C:53
virtual void UserCreateOutputObjects()
Short_t Charge() const
Definition: AliPicoTrack.h:39