]>
Commit | Line | Data |
---|---|---|
99345a64 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, 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 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
c081415a | 17 | // Cut class providing cuts to V0 candidates // |
18 | // Selection or deselection of V0 candiates can be done. // | |
99345a64 | 19 | // // |
20 | // Authors: // | |
c081415a | 21 | // Julian Book <Julian.Book@cern.ch> // |
99345a64 | 22 | /* |
23 | ||
24 | ||
25 | ||
26 | */ | |
27 | // // | |
28 | /////////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | ||
31 | #include "AliDielectronV0Cuts.h" | |
32 | #include "AliDielectronVarManager.h" | |
33 | #include "AliDielectronTrackCuts.h" | |
882407d7 | 34 | #include "AliDielectronPID.h" |
99345a64 | 35 | #include "AliESDv0.h" |
36 | ||
37 | ClassImp(AliDielectronV0Cuts) | |
38 | ||
39 | ||
40 | AliDielectronV0Cuts::AliDielectronV0Cuts() : | |
41 | AliDielectronVarCuts(), | |
f2d9961b | 42 | fV0TrackArr(0), |
43 | fExcludeTracks(kTRUE), | |
44 | fMotherPdg(0), | |
45 | fNegPdg(0), | |
46 | fPosPdg(0), | |
882407d7 | 47 | fPID(-1), |
f2d9961b | 48 | fOrbit(0), |
49 | fPeriod(0), | |
50 | fBunchCross(0) | |
99345a64 | 51 | { |
52 | // | |
53 | // Default costructor | |
54 | // | |
55 | } | |
56 | ||
57 | //________________________________________________________________________ | |
58 | AliDielectronV0Cuts::AliDielectronV0Cuts(const char* name, const char* title) : | |
59 | AliDielectronVarCuts(name,title), | |
f2d9961b | 60 | fV0TrackArr(0), |
61 | fExcludeTracks(kTRUE), | |
62 | fMotherPdg(0), | |
63 | fNegPdg(0), | |
64 | fPosPdg(0), | |
882407d7 | 65 | fPID(-1), |
f2d9961b | 66 | fOrbit(0), |
67 | fPeriod(0), | |
68 | fBunchCross(0) | |
99345a64 | 69 | { |
70 | // | |
71 | // Named contructor | |
72 | // | |
73 | } | |
74 | ||
75 | //________________________________________________________________________ | |
76 | AliDielectronV0Cuts::~AliDielectronV0Cuts() | |
77 | { | |
78 | // | |
79 | // Destructor | |
80 | // | |
99345a64 | 81 | |
f2d9961b | 82 | } |
99345a64 | 83 | |
84 | //________________________________________________________________________ | |
f2d9961b | 85 | void AliDielectronV0Cuts::InitEvent(AliVTrack *trk) |
99345a64 | 86 | { |
87 | // | |
88 | // Init the V0 candidates | |
89 | // | |
90 | ||
f2d9961b | 91 | // take current event from the track |
92 | // TODO: this should be simplyfied by AliVTrack::GetEvent() as soon as implemented | |
93 | const AliVEvent *ev=0; | |
94 | if(trk->IsA() == AliAODTrack::Class()) | |
95 | ev=static_cast<const AliVEvent*>((static_cast<const AliAODTrack*>(trk))->GetAODEvent()); | |
96 | else if(trk->IsA() == AliESDtrack::Class()) | |
97 | ev=static_cast<const AliVEvent*>((static_cast<const AliESDtrack*>(trk))->GetESDEvent()); | |
98 | else | |
99 | return; | |
100 | ||
101 | ||
102 | // IsNewEvent | |
103 | if(!ev) return; | |
104 | if(!IsNewEvent(ev)) return; | |
105 | // printf(" Build V0 candidates according to the applied cuts \n"); | |
106 | ||
f2d9961b | 107 | // rest booleans |
108 | fV0TrackArr.ResetAllBits(); | |
99345a64 | 109 | |
110 | // basic quality cut, at least one of the V0 daughters has to fullfill | |
f2d9961b | 111 | AliDielectronVarCuts dauQAcuts1; |
35363fb9 | 112 | dauQAcuts1.AddCut(AliDielectronVarManager::kPt, 0.05, 100.0); |
113 | dauQAcuts1.AddCut(AliDielectronVarManager::kEta, -0.9, 0.9); | |
114 | dauQAcuts1.AddCut(AliDielectronVarManager::kNclsTPC, 50.0, 160.0); | |
115 | dauQAcuts1.AddCut(AliDielectronVarManager::kTPCchi2Cl, 0.0, 4.0); | |
f2d9961b | 116 | AliDielectronTrackCuts dauQAcuts2; |
0caf5fbb | 117 | // dauQAcuts2.SetRequireITSRefit(kTRUE); |
f2d9961b | 118 | dauQAcuts2.SetRequireTPCRefit(kTRUE); |
882407d7 | 119 | AliDielectronPID dauPIDcuts; |
120 | if(fPID>=0) dauPIDcuts.SetDefaults(fPID); | |
99345a64 | 121 | |
061ca303 | 122 | Int_t nV0s = 0; |
123 | Int_t nV0stored = 0; | |
f2d9961b | 124 | AliDielectronPair candidate; |
125 | candidate.SetPdgCode(fMotherPdg); | |
99345a64 | 126 | |
127 | // ESD or AOD event | |
128 | if(ev->IsA() == AliESDEvent::Class()) { | |
129 | const AliESDEvent *esdev = static_cast<const AliESDEvent*>(ev); | |
f2d9961b | 130 | |
b2ad74d0 | 131 | //printf("there are %d V0s in the event \n",esdev->GetNumberOfV0s()); |
99345a64 | 132 | // loop over V0s |
133 | for (Int_t iv=0; iv<esdev->GetNumberOfV0s(); ++iv){ | |
134 | AliESDv0 *v = esdev->GetV0(iv); | |
135 | if(!v) continue; | |
136 | ||
f2d9961b | 137 | // should we make use of AliESDv0Cuts::GetPdgCode() to preselect candiadtes, e.g.: |
138 | // if(fMotherPdg!=v->GetPdgCode()) continue; | |
139 | ||
140 | AliESDtrack *trNeg=esdev->GetTrack(v->GetIndex(0)); | |
141 | AliESDtrack *trPos=esdev->GetTrack(v->GetIndex(1)); | |
142 | if(!trNeg || !trPos){ | |
143 | printf("Error: Couldn't get V0 daughter: %p - %p\n",trNeg,trPos); | |
99345a64 | 144 | continue; |
145 | } | |
146 | ||
882407d7 | 147 | // PID default cuts |
148 | if(fPID>=0) { | |
35363fb9 | 149 | if( !dauPIDcuts.IsSelected(trNeg) ) continue; |
150 | if( !dauPIDcuts.IsSelected(trPos) ) continue; | |
882407d7 | 151 | } |
0caf5fbb | 152 | |
35363fb9 | 153 | // basic track cuts |
154 | if( !dauQAcuts2.IsSelected(trNeg) ) continue; | |
155 | if( !dauQAcuts2.IsSelected(trPos) ) continue; | |
156 | if( !dauQAcuts1.IsSelected(trNeg) ) continue; | |
157 | if( !dauQAcuts1.IsSelected(trPos) ) continue; | |
99345a64 | 158 | |
f2d9961b | 159 | if(fMotherPdg==22) candidate.SetGammaTracks(trNeg, 11, trPos, 11); |
160 | else candidate.SetTracks(trNeg, fNegPdg, trPos, fPosPdg); | |
99345a64 | 161 | // eventually take the external trackparam and build the KFparticles by hand (see AliESDv0::GetKFInfo) |
f2d9961b | 162 | // the folowing is not needed, because the daughters where used in the v0 vertex fit (I guess) |
99345a64 | 163 | // AliKFVertex v0vtx = *v; |
164 | // candidate.SetProductionVertex(v0vtx); | |
165 | ||
f2d9961b | 166 | if(AliDielectronVarCuts::IsSelected(&candidate)) { |
99345a64 | 167 | nV0s++; |
f2d9961b | 168 | //printf(" gamma found for vtx %p dau1id %d dau2id %d \n",v,trNeg->GetID(),trPos->GetID()); |
169 | fV0TrackArr.SetBitNumber(trNeg->GetID()); | |
170 | fV0TrackArr.SetBitNumber(trPos->GetID()); | |
99345a64 | 171 | } |
172 | } | |
f2d9961b | 173 | |
99345a64 | 174 | } |
175 | else if(ev->IsA() == AliAODEvent::Class()) { | |
176 | const AliAODEvent *aodEv = static_cast<const AliAODEvent*>(ev); | |
f2d9961b | 177 | |
99345a64 | 178 | // loop over vertices |
179 | for (Int_t ivertex=0; ivertex<aodEv->GetNumberOfVertices(); ++ivertex){ | |
180 | AliAODVertex *v=aodEv->GetVertex(ivertex); | |
181 | if(v->GetType()!=AliAODVertex::kV0) continue; | |
182 | if(v->GetNDaughters()!=2) continue; | |
183 | ||
f2d9961b | 184 | AliAODTrack *trNeg=dynamic_cast<AliAODTrack*>(v->GetDaughter(0)); |
185 | AliAODTrack *trPos=dynamic_cast<AliAODTrack*>(v->GetDaughter(1)); | |
186 | if(!trNeg || !trPos){ | |
187 | printf("Error: Couldn't get V0 daughter: %p - %p\n",trNeg,trPos); | |
99345a64 | 188 | continue; |
189 | } | |
061ca303 | 190 | nV0stored++; |
99345a64 | 191 | |
882407d7 | 192 | // PID default cuts |
193 | if(fPID>=0) { | |
35363fb9 | 194 | if( !dauPIDcuts.IsSelected(trNeg) ) continue; |
195 | if( !dauPIDcuts.IsSelected(trPos) ) continue; | |
882407d7 | 196 | } |
0caf5fbb | 197 | |
35363fb9 | 198 | // basic track cuts |
199 | if( !dauQAcuts2.IsSelected(trNeg) ) continue; | |
200 | if( !dauQAcuts2.IsSelected(trPos) ) continue; | |
201 | if( !dauQAcuts1.IsSelected(trNeg) ) continue; | |
202 | if( !dauQAcuts1.IsSelected(trPos) ) continue; | |
99345a64 | 203 | |
204 | AliKFVertex v0vtx = *v; | |
f2d9961b | 205 | if(fMotherPdg==22) candidate.SetGammaTracks(trNeg, 11, trPos, 11); |
206 | else candidate.SetTracks(trNeg, (trNeg->Charge()<0?fNegPdg:fPosPdg), trPos, (trPos->Charge()<0?fNegPdg:fPosPdg)); | |
99345a64 | 207 | candidate.SetProductionVertex(v0vtx); |
208 | ||
f2d9961b | 209 | if(AliDielectronVarCuts::IsSelected(&candidate)) { |
99345a64 | 210 | nV0s++; |
f2d9961b | 211 | //printf(" gamma found for vtx %p dau1id %d dau2id %d \n",v,trNeg->GetID(),trPos->GetID()); |
212 | fV0TrackArr.SetBitNumber(trNeg->GetID()); | |
213 | fV0TrackArr.SetBitNumber(trPos->GetID()); | |
99345a64 | 214 | } |
215 | } | |
882407d7 | 216 | //printf("there are %d V0s in the event \n",nV0stored); |
99345a64 | 217 | } |
218 | else | |
219 | return; | |
220 | ||
061ca303 | 221 | // printf(" Number of V0s candiates found %d/%d \n",nV0s,nV0stored); |
99345a64 | 222 | |
223 | } | |
224 | //________________________________________________________________________ | |
225 | Bool_t AliDielectronV0Cuts::IsSelected(TObject* track) | |
226 | { | |
227 | // | |
228 | // Make cut decision | |
229 | // | |
f2d9961b | 230 | |
99345a64 | 231 | if(!track) return kFALSE; |
f2d9961b | 232 | |
99345a64 | 233 | AliVTrack *vtrack = static_cast<AliVTrack*>(track); |
f2d9961b | 234 | InitEvent(vtrack); |
0caf5fbb | 235 | //printf(" track ID %d selected result %d %d \n",vtrack->GetID(),(fV0TrackArr.TestBitNumber(vtrack->GetID())),fExcludeTracks); |
f2d9961b | 236 | return ( (fV0TrackArr.TestBitNumber(vtrack->GetID()))^fExcludeTracks ); |
237 | } | |
238 | ||
239 | //________________________________________________________________________ | |
240 | Bool_t AliDielectronV0Cuts::IsNewEvent(const AliVEvent *ev) | |
241 | { | |
242 | // | |
243 | // check weather we process a new event | |
244 | // | |
99345a64 | 245 | |
f2d9961b | 246 | // printf(" current ev %d %d %d \n",fBunchCross, fOrbit, fPeriod); |
247 | // printf(" new event %p %d %d %d \n",ev, ev->GetBunchCrossNumber(), ev->GetOrbitNumber(), ev->GetPeriodNumber()); | |
99345a64 | 248 | |
f2d9961b | 249 | if( fBunchCross == ev->GetBunchCrossNumber() ) { |
250 | if( fOrbit == ev->GetOrbitNumber() ) { | |
251 | if( fPeriod == ev->GetPeriodNumber() ) { | |
252 | return kFALSE; | |
253 | } | |
254 | } | |
99345a64 | 255 | } |
256 | ||
f2d9961b | 257 | fBunchCross = ev->GetBunchCrossNumber(); |
258 | fOrbit = ev->GetOrbitNumber(); | |
259 | fPeriod = ev->GetPeriodNumber(); | |
260 | return kTRUE; | |
99345a64 | 261 | } |