]>
Commit | Line | Data |
---|---|---|
bde49c8a | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
410ff8cc | 16 | // ---------------------------------------------------- |
17 | // MC particle level cuts for azimuthal isotropic | |
18 | // expansion in highly central collisions analysis | |
19 | // author: Cristian Andrei | |
20 | // acristian@niham.nipne.ro | |
21 | // ---------------------------------------------------- | |
bde49c8a | 22 | |
23 | #include <TParticle.h> | |
24 | ||
25 | #include "AliMCEvent.h" | |
26 | #include "AliStack.h" | |
27 | #include "AliMCParticle.h" | |
28 | ||
29 | #include "AliAnalysisCentralCutMC.h" | |
410ff8cc | 30 | |
31 | class TObject; | |
32 | ||
bde49c8a | 33 | //____________________________________________________________________ |
34 | ClassImp(AliAnalysisCentralCutMC) | |
35 | ||
36 | //____________________________________________________________________ | |
37 | AliAnalysisCentralCutMC::AliAnalysisCentralCutMC(const Char_t* name, const Char_t* title) | |
38 | :AliAnalysisCuts(name,title) | |
39 | ,fOnlyPrim(0) | |
40 | ,fMCEvt(0) | |
41 | ,fPDGCode(0) | |
42 | ,fPtMin(0) | |
43 | ,fPtMax(0) | |
44 | ,fEtaMin(0) | |
45 | ,fEtaMax(0) | |
46 | { | |
47 | //constructor | |
0fb1f0cf | 48 | |
49 | fOnlyPrim = kFALSE; | |
50 | ||
bde49c8a | 51 | SetPDGCode(); |
52 | SetPtRange(); | |
53 | SetEtaRange(); | |
410ff8cc | 54 | |
bde49c8a | 55 | } |
56 | ||
57 | //____________________________________________________________________ | |
58 | AliAnalysisCentralCutMC::~AliAnalysisCentralCutMC(){ | |
59 | // Destructor | |
60 | ||
61 | if(fMCEvt) delete fMCEvt; | |
62 | ||
63 | } | |
64 | ||
65 | //___________________________________________________________________________ | |
9eeae5d5 | 66 | Bool_t AliAnalysisCentralCutMC::IsSelected(TObject* const obj){ |
bde49c8a | 67 | // Check if the particle passes the cuts |
68 | ||
69 | AliMCParticle *part = dynamic_cast<AliMCParticle *>(obj); | |
70 | ||
71 | if(!part){ | |
72 | printf("AliAnalysisCentralCutMC:IsSelected ->Can't get particle!\n"); | |
73 | return kFALSE; | |
74 | } | |
0fb1f0cf | 75 | |
bde49c8a | 76 | if(!fMCEvt){ |
77 | printf("AliAnalysisCentralCutMC:IsSelected ->Can't get MCEvent!\n"); | |
78 | return kFALSE; | |
79 | } | |
0fb1f0cf | 80 | |
bde49c8a | 81 | AliStack *stack = fMCEvt->Stack(); |
82 | if(!stack){ | |
83 | printf("AliAnalysisCentralCutMC:IsSelected ->Can't get Stack!\n"); | |
84 | return kFALSE; | |
85 | } | |
86 | ||
87 | Double_t pt = part->Pt(); | |
88 | ||
89 | Double_t eta = part->Eta(); | |
90 | ||
bde49c8a | 91 | if(fOnlyPrim){ |
92 | if(!IsPrimary(part, stack)) return kFALSE; | |
93 | } | |
0fb1f0cf | 94 | |
bde49c8a | 95 | if(fPDGCode != 0){ |
96 | if(!CheckPDG(part, fPDGCode)) return kFALSE; | |
0fb1f0cf | 97 | } |
bde49c8a | 98 | |
99 | if((pt < fPtMin) || (pt > fPtMax)) return kFALSE; | |
0fb1f0cf | 100 | |
bde49c8a | 101 | if((eta < fEtaMin) || (eta > fEtaMax)) return kFALSE; |
102 | ||
103 | ||
104 | return kTRUE; | |
105 | } | |
106 | ||
107 | //___________________________________________________________________________ | |
108 | Bool_t AliAnalysisCentralCutMC::IsPrimary(AliMCParticle* const part, AliStack* const stack){ | |
109 | // Check if the particle is primary | |
110 | ||
111 | Int_t index = part->GetLabel(); | |
0fb1f0cf | 112 | |
bde49c8a | 113 | TParticle* p = stack->Particle(index); |
114 | if(!p){ | |
115 | printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n"); | |
116 | return kFALSE; | |
117 | } | |
118 | ||
119 | Int_t ist = p->GetStatusCode(); | |
120 | ||
121 | if (ist > 1) return kFALSE; | |
122 | ||
123 | // Int_t pdg = TMath::Abs(p->GetPdgCode()); | |
124 | ||
125 | if (index < stack->GetNprimary()) { | |
126 | return kTRUE; | |
127 | } | |
128 | else return kFALSE; | |
129 | ||
130 | } | |
131 | ||
132 | ||
133 | void AliAnalysisCentralCutMC::ReceiveEvt(TObject* mcEvent) { | |
134 | // Receive the event send from the task | |
135 | // The event is needed in order to get the Stack | |
136 | ||
137 | if (!mcEvent){ | |
138 | printf("Pointer to MC Event is null! \n"); | |
139 | return; | |
140 | } | |
141 | ||
142 | fMCEvt = dynamic_cast<AliMCEvent*> (mcEvent); | |
143 | if(!fMCEvt){ | |
144 | printf("AliAnalysisCentralCutMC:ReceiveEvt -> Can't get fMCEvt!\n"); | |
145 | return; | |
146 | } | |
147 | ||
148 | } | |
149 | ||
150 | ||
151 | Bool_t AliAnalysisCentralCutMC::CheckPDG(AliMCParticle* const mcPart, Int_t const pdg) { | |
152 | // Checks if the particle is of the wanted type | |
153 | ||
154 | TParticle* part = mcPart->Particle(); | |
155 | ||
156 | if(!part){ | |
157 | printf("AliAnalysisCentralCutMC:IsPrimary -> Can't get TParticle!\n"); | |
158 | return kFALSE; | |
159 | } | |
160 | ||
161 | Int_t pdgCode = part->GetPdgCode(); | |
162 | ||
163 | if (pdgCode != pdg ) return kFALSE; | |
0fb1f0cf | 164 | |
bde49c8a | 165 | return kTRUE; |
0fb1f0cf | 166 | |
bde49c8a | 167 | } |