]>
Commit | Line | Data |
---|---|---|
70da6c5a | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-1999, 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 | // Utility class for V0 PID | |
17 | // Identifies Electrons, Pions and Protons using gamma conversions and | |
18 | // the decays of K0s and Lambdas | |
19 | // Containers with samples of Electrons, Pions and Protons can be accessed | |
20 | // via GetListOfElectrons() etc. | |
21 | // | |
22 | // Authors: | |
23 | // Matus Kalisky <matus.kalisky@cern.ch> | |
24 | // Markus Heide <mheide@uni-muenster.de> | |
25 | // Markus Fasel <M.Fasel@gsi.de> | |
26 | // | |
70da6c5a | 27 | #include <TObjArray.h> |
70da6c5a | 28 | |
29 | #include "AliAODEvent.h" | |
70da6c5a | 30 | #include "AliAODv0.h" |
70da6c5a | 31 | #include "AliESDEvent.h" |
32 | #include "AliESDtrack.h" | |
33 | #include "AliESDv0.h" | |
70da6c5a | 34 | #include "AliKFVertex.h" |
35 | #include "AliVEvent.h" | |
36 | #include "AliVTrack.h" | |
37 | ||
faee3b18 | 38 | #include "AliHFEV0cuts.h" |
39 | #include "AliHFEV0info.h" | |
40 | #include "AliHFEcollection.h" | |
41 | ||
70da6c5a | 42 | #include "AliHFEV0pid.h" |
43 | ClassImp(AliHFEV0pid) | |
44 | ||
45 | //____________________________________________________________ | |
46 | AliHFEV0pid::AliHFEV0pid(): | |
47 | TObject() | |
48 | , fInputEvent(NULL) | |
49 | , fPrimaryVertex(NULL) | |
50 | , fElectrons(NULL) | |
51 | , fPionsK0(NULL) | |
52 | , fPionsL(NULL) | |
53 | , fKaons(NULL) | |
54 | , fProtons(NULL) | |
faee3b18 | 55 | , fGammas(NULL) |
56 | , fK0s(NULL) | |
57 | , fLambdas(NULL) | |
58 | , fAntiLambdas(NULL) | |
70da6c5a | 59 | , fIndices(NULL) |
60 | , fQA(NULL) | |
faee3b18 | 61 | , fV0cuts(NULL) |
62 | , fOutput(NULL) | |
70da6c5a | 63 | { |
64 | // | |
65 | // Default constructor | |
66 | // | |
67 | fElectrons = new TObjArray(); | |
68 | fPionsK0 = new TObjArray(); | |
69 | fPionsL = new TObjArray(); | |
70 | fKaons = new TObjArray(); | |
71 | fProtons = new TObjArray(); | |
faee3b18 | 72 | |
73 | fElectrons->SetOwner(); | |
74 | fPionsK0->SetOwner(); | |
75 | fProtons->SetOwner(); | |
76 | fPionsL->SetOwner(); | |
77 | fKaons->SetOwner(); | |
78 | ||
79 | fGammas = new TObjArray(); | |
80 | fK0s = new TObjArray(); | |
81 | fLambdas = new TObjArray(); | |
82 | fAntiLambdas = new TObjArray(); | |
83 | ||
84 | fIndices = new AliHFEV0pidTrackIndex(); | |
85 | ||
70da6c5a | 86 | } |
87 | ||
88 | //____________________________________________________________ | |
89 | AliHFEV0pid::~AliHFEV0pid(){ | |
90 | // | |
91 | // Destructor | |
92 | // Remove Containers | |
93 | // | |
70da6c5a | 94 | if(fElectrons) delete fElectrons; |
95 | if(fPionsK0) delete fPionsK0; | |
96 | if(fPionsL) delete fPionsL; | |
97 | if(fKaons) delete fKaons; | |
98 | if(fProtons) delete fProtons; | |
faee3b18 | 99 | |
100 | if(fGammas) delete fGammas; | |
101 | if(fK0s) delete fK0s; | |
102 | if(fLambdas) delete fLambdas; | |
103 | if(fAntiLambdas) delete fAntiLambdas; | |
104 | ||
70da6c5a | 105 | if(fIndices) delete fIndices; |
106 | if(fQA) delete fQA; | |
faee3b18 | 107 | if(fV0cuts) delete fV0cuts; |
108 | if(fOutput) delete fOutput; | |
70da6c5a | 109 | } |
110 | ||
111 | //____________________________________________________________ | |
112 | void AliHFEV0pid::InitQA(){ | |
113 | // | |
114 | // Initialize QA histograms | |
115 | // | |
faee3b18 | 116 | |
117 | fOutput = new TList(); | |
118 | ||
119 | fV0cuts = new AliHFEV0cuts(); | |
120 | fV0cuts->Init("V0cuts"); | |
121 | ||
70da6c5a | 122 | if(!fQA){ |
123 | fQA = new AliHFEcollection("v0pidQA", "QA histograms for V0 PID"); | |
124 | ||
faee3b18 | 125 | fQA->CreateTH1F("h_nV0s", "No. of found and accepted V0s", 5, -0.5, 4.5); |
70da6c5a | 126 | |
127 | // QA histograms for invariant mass | |
91c7e1ec | 128 | fQA->CreateTH1F("h_InvMassGamma", "Gamma invariant mass; inv mass [GeV/c^{2}]; counts", 100, 0, 0.25); |
faee3b18 | 129 | fQA->CreateTH1F("h_InvMassK0s", "K0s invariant mass; inv mass [GeV/c^{2}]; counts", 200, 0.4, 0.65); |
70da6c5a | 130 | fQA->CreateTH1F("h_InvMassLambda", "Lambda invariant mass; inv mass [GeV/c^{2}]; counts", 100, 1.05, 1.15); |
131 | ||
91c7e1ec | 132 | // QA histograms for p distribution (of the daughters) |
133 | fQA->CreateTH1F("h_P_electron", "P distribution of the gamma electrons; p (GeV/c); counts", 100, 0.1, 10); | |
134 | fQA->CreateTH1F("h_P_K0pion", "P distribution of the K0 pions; p (GeV/c); counts", 100, 0.1, 10); | |
135 | fQA->CreateTH1F("h_P_Lpion", "P distribution of the Lambda pions; p (GeV/c); counts", 100, 0.1, 10); | |
136 | fQA->CreateTH1F("h_P_Lproton", "P distribution of the Lambda protons; p (GeV/c); counts", 100, 0.1, 10); | |
137 | ||
70da6c5a | 138 | // QA pt of the V0 |
139 | fQA->CreateTH1F("h_Pt_Gamma", "Pt of the gamma conversion; p_{T} (GeV/c); counts", 100, 0, 10); | |
140 | fQA->CreateTH1F("h_Pt_K0", "Pt of the K0; p_{T} (GeV/c); counts", 100, 0, 10); | |
faee3b18 | 141 | fQA->CreateTH1F("h_Pt_Lambda", "Pt of the Lambda; p_{T} (GeV/c); counts", 100, 0, 10); |
142 | ||
70da6c5a | 143 | |
70da6c5a | 144 | } |
145 | } | |
146 | ||
147 | //____________________________________________________________ | |
148 | void AliHFEV0pid::Process(AliVEvent * const inputEvent){ | |
149 | ||
150 | // | |
151 | // Find protons, pions and electrons using V0 decays and | |
152 | // store the pointers in the TObjArray | |
153 | // | |
faee3b18 | 154 | |
70da6c5a | 155 | Int_t nGamma = 0, nK0s = 0, nLambda = 0, nPhi = 0; |
156 | fInputEvent = inputEvent; | |
70da6c5a | 157 | fIndices->Init(fInputEvent->GetNumberOfV0s() * 2); |
158 | fPrimaryVertex = new AliKFVertex(*(fInputEvent->GetPrimaryVertex())); | |
faee3b18 | 159 | if(!fPrimaryVertex) return; |
160 | fV0cuts->SetInputEvent(fInputEvent); | |
161 | fV0cuts->SetPrimaryVertex(fPrimaryVertex); | |
70da6c5a | 162 | Int_t v0status = 0; |
163 | for(Int_t iv0 = 0; iv0 < fInputEvent->GetNumberOfV0s(); iv0++){ | |
164 | if(!TString(fInputEvent->IsA()->GetName()).CompareTo("AliESDEvent")){ | |
165 | // case ESD | |
166 | SetESDanalysis(); | |
167 | AliESDv0 *esdV0 = (dynamic_cast<AliESDEvent *>(fInputEvent))->GetV0(iv0); | |
faee3b18 | 168 | if(!esdV0) continue; |
70da6c5a | 169 | if(!esdV0->GetOnFlyStatus()) continue; // Take only V0s from the On-the-fly v0 finder |
170 | v0status = ProcessV0(esdV0); | |
171 | } else { | |
172 | // case AOD | |
173 | SetAODanalysis(); | |
174 | AliAODv0 *aodV0 = (dynamic_cast<AliAODEvent *>(fInputEvent))->GetV0(iv0); | |
175 | if(aodV0->GetOnFlyStatus()) continue; // Take only V0s from the On-the-fly v0 finder | |
176 | v0status = ProcessV0(aodV0); | |
faee3b18 | 177 | if(kUndef != v0status){ |
178 | } | |
70da6c5a | 179 | } |
180 | switch(v0status){ | |
181 | case kRecoGamma: nGamma++; break; | |
182 | case kRecoK0s: nK0s++; break; | |
183 | case kRecoPhi: nPhi++; break; | |
184 | case kRecoLambda: nLambda++; break; | |
185 | }; | |
186 | } | |
187 | ||
faee3b18 | 188 | |
70da6c5a | 189 | AliDebug(1, Form("Number of gammas : %d", nGamma)); |
190 | AliDebug(1, Form("Number of K0s : %d", nK0s)); | |
191 | AliDebug(1, Form("Number of Phis : %d", nPhi)); | |
192 | AliDebug(1, Form("Number of Lambdas : %d", nLambda)); | |
193 | ||
194 | AliDebug(1, "Number of stored tracks:"); | |
195 | AliDebug(1, Form("Number of electrons : %d", fElectrons->GetEntries())); | |
196 | AliDebug(1, Form("Number of K0 pions : %d", fPionsK0->GetEntries())); | |
197 | AliDebug(1, Form("Number of Lambda pions : %d", fPionsL->GetEntries())); | |
198 | AliDebug(1, Form("Number of Phi kaons : %d", fKaons->GetEntries())); | |
199 | AliDebug(1, Form("Number of protons : %d", fProtons->GetEntries())); | |
200 | ||
201 | delete fPrimaryVertex; | |
202 | } | |
203 | ||
204 | //____________________________________________________________ | |
205 | Int_t AliHFEV0pid::ProcessV0(TObject *v0){ | |
206 | // | |
207 | // Process single V0 | |
208 | // Apply general cut and special cuts for gamma, K0s, Lambda | |
209 | // | |
210 | AliVTrack* daughter[2]; | |
211 | daughter[0] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack((dynamic_cast<AliESDv0 *>(v0))->GetPindex())); | |
faee3b18 | 212 | daughter[1] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack((dynamic_cast<AliESDv0 *>(v0))->GetNindex())); |
70da6c5a | 213 | if(!daughter[0] || !daughter[1]) return kUndef; |
214 | ||
faee3b18 | 215 | |
70da6c5a | 216 | if(IsESDanalysis()){ |
217 | for(Int_t i=0; i<2; ++i){ | |
faee3b18 | 218 | // check common single track cuts |
219 | if(!fV0cuts->TrackCutsCommon(dynamic_cast<AliESDtrack*>(daughter[i]))) return kUndef; | |
70da6c5a | 220 | } |
faee3b18 | 221 | // check commom V0 cuts |
222 | if(!fV0cuts->V0CutsCommon(dynamic_cast<AliESDv0 *>(v0))) return kUndef; | |
70da6c5a | 223 | } |
224 | ||
faee3b18 | 225 | |
226 | // store the resutls | |
227 | if(IsGammaConv(v0)){ | |
228 | fQA->Fill("h_nV0s", kRecoGamma); | |
229 | return kRecoGamma; | |
230 | } | |
231 | else if(IsK0s(v0)){ | |
232 | fQA->Fill("h_nV0s", kRecoK0s); | |
233 | return kRecoK0s; | |
234 | } | |
235 | else if(IsLambda(v0)){ | |
236 | fQA->Fill("h_nV0s", kRecoLambda); | |
237 | return kRecoLambda; | |
238 | } | |
70da6c5a | 239 | else return kUndef; |
faee3b18 | 240 | |
70da6c5a | 241 | } |
242 | //____________________________________________________________ | |
243 | void AliHFEV0pid::Flush(){ | |
244 | // | |
245 | // Clear the Lists | |
246 | // | |
247 | AliDebug(1, "Flushing containers"); | |
faee3b18 | 248 | fProtons->Delete(); |
249 | fPionsK0->Delete(); | |
250 | fPionsL->Delete(); | |
251 | fElectrons->Delete(); | |
70da6c5a | 252 | fIndices->Flush(); |
253 | } | |
70da6c5a | 254 | //____________________________________________________________ |
255 | Bool_t AliHFEV0pid::IsGammaConv(TObject *v0){ | |
256 | // | |
257 | // Identify Gamma | |
258 | // | |
259 | AliVTrack* daughter[2]; | |
260 | Int_t pIndex = 0, nIndex = 0; | |
261 | Double_t invMass = 0.; | |
faee3b18 | 262 | Double_t mPt = 0.; |
263 | Int_t v0id = -1; | |
70da6c5a | 264 | if(IsESDanalysis()){ |
265 | // ESD - cut V0 | |
266 | AliESDv0 *esdV0 = dynamic_cast<AliESDv0 *>(v0); | |
faee3b18 | 267 | v0id = esdV0->GetLabel(); |
268 | // apply FULL gamma cuts | |
269 | if(!fV0cuts->GammaCuts(esdV0)) return kFALSE; | |
270 | invMass = esdV0->GetEffMass(AliPID::kElectron, AliPID::kElectron); | |
70da6c5a | 271 | pIndex = esdV0->GetPindex(); |
272 | nIndex = esdV0->GetNindex(); | |
faee3b18 | 273 | mPt = esdV0->Pt(); |
70da6c5a | 274 | } else { |
275 | // AOD Analysis - not possible to cut | |
276 | AliAODv0 *aodV0 = dynamic_cast<AliAODv0 *>(v0); | |
faee3b18 | 277 | v0id = aodV0->GetID(); |
70da6c5a | 278 | pIndex = aodV0->GetPosID(); |
279 | nIndex = aodV0->GetNegID(); | |
280 | invMass = aodV0->InvMass2Prongs(0, 1, kElectron, kElectron); | |
281 | } | |
282 | daughter[0] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(pIndex)); | |
283 | daughter[1] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(nIndex)); | |
284 | if(!daughter[0] || !daughter[1]) return kFALSE; | |
faee3b18 | 285 | |
286 | // DEBUG | |
287 | AliDebug(1, Form("Gamma identified, daughter IDs: %d,%d", daughter[0]->GetID(), daughter[1]->GetID())); | |
70da6c5a | 288 | |
faee3b18 | 289 | // AFTER all gamma cuts |
70da6c5a | 290 | fQA->Fill("h_Pt_Gamma", mPt); |
faee3b18 | 291 | fQA->Fill("h_InvMassGamma", invMass); |
70da6c5a | 292 | |
70da6c5a | 293 | // Identified gamma - store tracks in the electron containers |
294 | if(!fIndices->Find(daughter[0]->GetID())){ | |
295 | AliDebug(1, Form("Gamma identified, daughter IDs: %d,%d", daughter[0]->GetID(), daughter[1]->GetID())); | |
faee3b18 | 296 | fElectrons->Add(new AliHFEV0info(daughter[0], daughter[1]->GetID(), v0id)); |
70da6c5a | 297 | fIndices->Add(daughter[0]->GetID(), AliHFEV0pid::kRecoElectron); |
298 | } | |
299 | if(!fIndices->Find(daughter[1]->GetID())){ | |
300 | AliDebug(1, Form("Gamma identified, daughter IDs: %d,%d", daughter[1]->GetID(), daughter[1]->GetID())); | |
faee3b18 | 301 | fElectrons->Add(new AliHFEV0info(daughter[1], daughter[0]->GetID(), v0id)); |
70da6c5a | 302 | fIndices->Add(daughter[1]->GetID(), AliHFEV0pid::kRecoElectron); |
303 | } | |
faee3b18 | 304 | fGammas->Add(v0); |
305 | ||
70da6c5a | 306 | return kTRUE; |
307 | } | |
70da6c5a | 308 | //____________________________________________________________ |
309 | Bool_t AliHFEV0pid::IsK0s(TObject *v0){ | |
310 | // | |
311 | // Identify K0s | |
312 | // | |
70da6c5a | 313 | AliVTrack* daughter[2]; |
314 | Int_t pIndex = 0, nIndex = 0; | |
faee3b18 | 315 | Int_t v0id = -1; |
70da6c5a | 316 | Double_t invMass = 0.; |
faee3b18 | 317 | Double_t mPt = 0.; |
70da6c5a | 318 | if(IsESDanalysis()){ |
319 | // ESD - cut V0 | |
320 | AliESDv0 *esdV0 = dynamic_cast<AliESDv0 *>(v0); | |
faee3b18 | 321 | if(!fV0cuts->K0Cuts(esdV0)) return kFALSE; |
322 | v0id = esdV0->GetLabel(); | |
70da6c5a | 323 | pIndex = esdV0->GetPindex(); |
324 | nIndex = esdV0->GetNindex(); | |
faee3b18 | 325 | invMass = esdV0->GetEffMass(AliPID::kPion, AliPID::kPion); |
326 | mPt = esdV0->Pt(); | |
70da6c5a | 327 | } else { |
328 | // AOD Analysis - not possible to cut | |
329 | AliAODv0 *aodV0 = dynamic_cast<AliAODv0 *>(v0); | |
faee3b18 | 330 | aodV0->GetID(); |
70da6c5a | 331 | pIndex = aodV0->GetPosID(); |
332 | nIndex = aodV0->GetNegID(); | |
333 | invMass = aodV0->MassK0Short(); | |
334 | } | |
335 | daughter[0] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(pIndex)); | |
336 | daughter[1] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(nIndex)); | |
337 | if(!daughter[0] || !daughter[1]) return kFALSE; | |
338 | ||
70da6c5a | 339 | fQA->Fill("h_Pt_K0", mPt); |
faee3b18 | 340 | fQA->Fill("h_InvMassK0s", invMass); |
70da6c5a | 341 | |
70da6c5a | 342 | AliDebug(1, Form("K0 identified, daughter IDs: %d,%d", daughter[0]->GetID(), daughter[1]->GetID())); |
343 | ||
faee3b18 | 344 | // AFTER all K0 cuts |
70da6c5a | 345 | // Identified gamma - store tracks in the electron containers |
346 | if(!fIndices->Find(daughter[0]->GetID())){ | |
347 | AliDebug(1, Form("Adding K0 Pion track with ID %d", daughter[0]->GetID())); | |
faee3b18 | 348 | fPionsK0->Add(new AliHFEV0info(daughter[0], daughter[1]->GetID(), v0id)); |
70da6c5a | 349 | fIndices->Add(daughter[0]->GetID(), AliHFEV0pid::kRecoPionK0); |
350 | } | |
351 | if(!fIndices->Find(daughter[1]->GetID())){ | |
352 | AliDebug(1, Form("Adding K0 Pion track with ID %d", daughter[1]->GetID())); | |
faee3b18 | 353 | fPionsK0->Add(new AliHFEV0info(daughter[1], daughter[0]->GetID(), v0id)); |
70da6c5a | 354 | fIndices->Add(daughter[1]->GetID(), AliHFEV0pid::kRecoPionK0); |
355 | } | |
faee3b18 | 356 | fK0s->Add(v0); |
70da6c5a | 357 | return kTRUE; |
358 | } | |
359 | ||
360 | //____________________________________________________________ | |
361 | Bool_t AliHFEV0pid::IsPhi(TObject *v0){ | |
362 | // | |
363 | // Identify Phi - very preliminary - requires diffrent approach (V0 fnder is not effective) | |
364 | // | |
365 | ||
366 | //const Double_t kPhiMass=TDatabasePDG::Instance()->GetParticle(333)->Mass(); // PDG phi mass | |
367 | //AliVTrack* daughter[2]; | |
70da6c5a | 368 | //Double_t invMass = 0.; |
369 | ||
370 | Int_t pIndex = 0, nIndex = 0; | |
371 | if(IsESDanalysis()){ | |
372 | // ESD - cut V0 | |
373 | AliESDv0 *esdV0 = dynamic_cast<AliESDv0 *>(v0); | |
70da6c5a | 374 | pIndex = esdV0->GetPindex(); |
375 | nIndex = esdV0->GetNindex(); | |
376 | } else { | |
377 | // PRELIMINARY - !!! | |
378 | // AOD Analysis - not possible to cut | |
379 | } | |
380 | ||
381 | return kTRUE; | |
382 | } | |
383 | ||
384 | //____________________________________________________________ | |
385 | Bool_t AliHFEV0pid::IsLambda(TObject *v0){ | |
386 | // | |
387 | // Identify Lambda | |
388 | // | |
70da6c5a | 389 | AliVTrack* daughter[2]; |
390 | Int_t pIndex = 0, nIndex = 0; | |
70da6c5a | 391 | Double_t invMass = 0.; |
faee3b18 | 392 | Bool_t isLambda = kTRUE; // Lambda - kTRUE, Anti Lambda - kFALSE |
393 | Int_t v0id = -1; | |
70da6c5a | 394 | if(IsESDanalysis()){ |
395 | // ESD - cut V0 | |
396 | AliESDv0 *esdV0 = dynamic_cast<AliESDv0 *>(v0); | |
faee3b18 | 397 | v0id = esdV0->GetLabel(); |
398 | if(!fV0cuts->LambdaCuts(esdV0,isLambda)) return kFALSE; | |
399 | if(fV0cuts->CheckSigns(esdV0)){ | |
400 | pIndex = esdV0->GetPindex(); | |
401 | nIndex = esdV0->GetNindex(); | |
402 | } | |
403 | else{ | |
404 | pIndex = esdV0->GetNindex(); | |
405 | nIndex = esdV0->GetPindex(); | |
406 | } | |
70da6c5a | 407 | } else { |
408 | // PRELIMINARY - !!! | |
409 | // AOD Analysis - not possible to cut | |
410 | ||
411 | // again - two cases as above | |
412 | AliAODv0 *aodV0 = dynamic_cast<AliAODv0 *>(v0); | |
faee3b18 | 413 | v0id = aodV0->GetID(); |
70da6c5a | 414 | pIndex = aodV0->GetPosID(); |
415 | nIndex = aodV0->GetNegID(); | |
faee3b18 | 416 | invMass = aodV0->MassLambda(); |
417 | } | |
418 | ||
70da6c5a | 419 | daughter[0] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(pIndex)); |
420 | daughter[1] = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(nIndex)); | |
421 | if(!daughter[0] || !daughter[1]) return kFALSE; | |
faee3b18 | 422 | |
423 | // lambda | |
424 | if(isLambda){ | |
425 | if(!fIndices->Find(daughter[0]->GetID())){ | |
426 | fProtons->Add(new AliHFEV0info(daughter[0], daughter[1]->GetID(), v0id)); | |
427 | fIndices->Add(daughter[0]->GetID(), AliHFEV0pid::kRecoProton); | |
70da6c5a | 428 | } |
faee3b18 | 429 | if(!fIndices->Find(daughter[1]->GetID())){ |
430 | fPionsL->Add(new AliHFEV0info(daughter[1], daughter[0]->GetID(), v0id)); | |
431 | fIndices->Add(daughter[1]->GetID(), AliHFEV0pid::kRecoPionL); | |
70da6c5a | 432 | } |
70da6c5a | 433 | } |
faee3b18 | 434 | // antilambda |
435 | else{ | |
436 | if(!fIndices->Find(daughter [1]->GetID())){ | |
437 | fProtons->Add(new AliHFEV0info(daughter[1], daughter[0]->GetID(), v0id)); | |
438 | fIndices->Add(daughter[1]->GetID(), AliHFEV0pid::kRecoProton); | |
439 | } | |
440 | if(!fIndices->Find(daughter [0]->GetID())){ | |
441 | fPionsL->Add(new AliHFEV0info(daughter[0], daughter[1]->GetID(), v0id)); | |
442 | fIndices->Add(daughter [0]->GetID(), AliHFEV0pid::kRecoPionL); | |
70da6c5a | 443 | } |
70da6c5a | 444 | } |
faee3b18 | 445 | if(isLambda) fLambdas->Add(v0); |
446 | else fAntiLambdas->Add(v0); | |
70da6c5a | 447 | |
70da6c5a | 448 | return kTRUE; |
449 | } | |
450 | ||
70da6c5a | 451 | //____________________________________________________________ |
452 | AliHFEV0pid::AliHFEV0pidTrackIndex::AliHFEV0pidTrackIndex(): | |
453 | fNElectrons(0) | |
454 | , fNPionsK0(0) | |
455 | , fNPionsL(0) | |
456 | , fNKaons(0) | |
457 | , fNProtons(0) | |
458 | , fIndexElectron(NULL) | |
459 | , fIndexPionK0(NULL) | |
460 | , fIndexPionL(NULL) | |
461 | , fIndexKaon(NULL) | |
462 | , fIndexProton(NULL) | |
463 | { | |
464 | // | |
465 | // Default Constructor | |
466 | // | |
467 | } | |
468 | ||
469 | //____________________________________________________________ | |
470 | AliHFEV0pid::AliHFEV0pidTrackIndex::~AliHFEV0pidTrackIndex(){ | |
471 | // | |
472 | // Destructor | |
473 | // | |
474 | if(fIndexElectron) delete[] fIndexElectron; | |
475 | if(fIndexPionK0) delete[] fIndexPionK0; | |
476 | if(fIndexPionL) delete[] fIndexPionL; | |
477 | if(fIndexProton) delete[] fIndexProton; | |
478 | } | |
479 | ||
480 | //____________________________________________________________ | |
481 | void AliHFEV0pid::AliHFEV0pidTrackIndex::Flush(){ | |
482 | // | |
483 | // Reset containers | |
484 | // | |
485 | ||
486 | if(fIndexElectron) delete[] fIndexElectron; | |
487 | fIndexElectron = NULL; | |
488 | if(fIndexPionK0) delete[] fIndexPionK0; | |
489 | fIndexPionK0 = NULL; | |
490 | if(fIndexPionL) delete[] fIndexPionL; | |
491 | fIndexPionL = NULL; | |
492 | if(fIndexKaon) delete[] fIndexKaon; | |
493 | fIndexKaon = NULL; | |
494 | if(fIndexProton) delete[] fIndexProton; | |
495 | fIndexProton = NULL; | |
496 | ||
497 | fNElectrons = 0; | |
498 | fNPionsK0 = 0; | |
499 | fNPionsL = 0; | |
500 | fNKaons = 0; | |
501 | fNProtons = 0; | |
502 | } | |
503 | ||
504 | //____________________________________________________________ | |
505 | void AliHFEV0pid::AliHFEV0pidTrackIndex::Init(Int_t capacity){ | |
506 | // | |
507 | // Initialize container | |
508 | // | |
509 | fIndexElectron = new Int_t[capacity]; | |
510 | fIndexPionK0 = new Int_t[capacity]; | |
511 | fIndexPionL = new Int_t[capacity]; | |
512 | fIndexProton = new Int_t[capacity]; | |
513 | } | |
514 | ||
515 | //____________________________________________________________ | |
516 | void AliHFEV0pid::AliHFEV0pidTrackIndex::Add(Int_t index, Int_t species){ | |
517 | // | |
518 | // Add new index to the list of identified particles | |
519 | // | |
520 | switch(species){ | |
521 | case AliHFEV0pid::kRecoElectron: | |
522 | fIndexElectron[fNElectrons++] = index; | |
523 | break; | |
524 | case AliHFEV0pid::kRecoPionK0: | |
525 | fIndexPionK0[fNPionsK0++] = index; | |
526 | break; | |
527 | case AliHFEV0pid::kRecoPionL: | |
528 | fIndexPionL[fNPionsL++] = index; | |
529 | break; | |
530 | case AliHFEV0pid::kRecoProton: | |
531 | fIndexProton[fNProtons++] = index; | |
532 | break; | |
533 | }; | |
534 | } | |
535 | ||
536 | //____________________________________________________________ | |
537 | Bool_t AliHFEV0pid::AliHFEV0pidTrackIndex::Find(Int_t index, Int_t species) const { | |
538 | // | |
539 | // Find track index in the specific sample of particles | |
540 | // | |
541 | ||
542 | Int_t *container = NULL; Int_t n = 0; | |
543 | switch(species){ | |
544 | case AliHFEV0pid::kRecoElectron: | |
545 | container = fIndexElectron; | |
546 | n = fNElectrons; | |
547 | break; | |
548 | case AliHFEV0pid::kRecoPionK0: | |
549 | container = fIndexPionK0; | |
550 | n = fNPionsK0; | |
551 | break; | |
552 | case AliHFEV0pid::kRecoPionL: | |
553 | container = fIndexPionL; | |
554 | n = fNPionsL; | |
555 | break; | |
556 | case AliHFEV0pid::kRecoProton: | |
557 | container = fIndexProton; | |
558 | n = fNProtons; | |
559 | break; | |
560 | } | |
561 | if(!container) return kFALSE; | |
562 | if(n == 0) return kFALSE; | |
563 | Bool_t found = kFALSE; | |
564 | for(Int_t i = 0; i < n; i++){ | |
565 | if(container[i] == index){ | |
566 | found = kTRUE; | |
567 | break; | |
568 | } | |
569 | } | |
570 | return found; | |
571 | } | |
572 | ||
573 | //____________________________________________________________ | |
574 | Bool_t AliHFEV0pid::AliHFEV0pidTrackIndex::Find(Int_t index) const { | |
575 | // | |
576 | // Find index in all samples | |
577 | // | |
578 | if(Find(index, AliHFEV0pid::kRecoElectron)) return kTRUE; | |
579 | else if(Find(index, AliHFEV0pid::kRecoPionK0)) return kTRUE; | |
580 | else if(Find(index, AliHFEV0pid::kRecoPionL)) return kTRUE; | |
581 | else return Find(index, AliHFEV0pid::kRecoProton); | |
582 | } | |
583 | ||
584 | //____________________________________________________________ | |
faee3b18 | 585 | TList *AliHFEV0pid::GetListOfQAhistograms(){ |
70da6c5a | 586 | // |
faee3b18 | 587 | // Getter for V0 PID QA histograms |
70da6c5a | 588 | // |
70da6c5a | 589 | |
faee3b18 | 590 | TList *tmp = fV0cuts->GetList(); |
591 | tmp->SetName("V0cuts"); | |
592 | fOutput->Add(tmp); | |
593 | if(fQA){ | |
594 | tmp = 0x0; | |
595 | tmp = fQA->GetList(); | |
596 | tmp->SetName("V0pid"); | |
597 | fOutput->Add(tmp); | |
598 | } | |
599 | return fOutput; | |
70da6c5a | 600 | } |