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