]>
Commit | Line | Data |
---|---|---|
3a72645a | 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 | // Signal cuts | |
17 | // Checks whether a particle (reconstructed or MC) is coming from MC Signal | |
18 | // For more information see implementation file | |
19 | // | |
20 | // Autor: | |
21 | // Markus Fasel <M.Fasel@gsi.de> | |
22 | // | |
23 | #include <TClass.h> | |
24 | #include <TMath.h> | |
25 | #include <TParticle.h> | |
26 | #include <TString.h> | |
27 | ||
e156c3bb | 28 | #include "AliAODTrack.h" |
3a72645a | 29 | #include "AliAODMCParticle.h" |
e156c3bb | 30 | #include "AliESDtrack.h" |
3a72645a | 31 | #include "AliLog.h" |
32 | #include "AliMCEvent.h" | |
33 | #include "AliMCParticle.h" | |
34 | #include "AliVParticle.h" | |
76d0b522 | 35 | #include "TClonesArray.h" |
3a72645a | 36 | |
37 | #include "AliHFEsignalCuts.h" | |
38 | #include "AliHFEmcQA.h" | |
39 | ||
40 | ClassImp(AliHFEsignalCuts) | |
41 | ||
42 | //____________________________________________________________ | |
43 | AliHFEsignalCuts::AliHFEsignalCuts(): | |
44 | AliAnalysisCuts(), | |
45 | fMC(NULL), | |
76d0b522 | 46 | fAODArrayMCInfo(NULL), |
3a72645a | 47 | fMCQA(NULL) |
48 | { | |
49 | // | |
50 | // Dummy constructor | |
51 | // | |
52 | } | |
53 | ||
54 | //____________________________________________________________ | |
55 | AliHFEsignalCuts::AliHFEsignalCuts(const Char_t *name, const Char_t *title): | |
56 | AliAnalysisCuts(name, title), | |
57 | fMC(NULL), | |
76d0b522 | 58 | fAODArrayMCInfo(NULL), |
3a72645a | 59 | fMCQA(NULL) |
60 | { | |
61 | // | |
62 | // Default constructor | |
63 | // | |
64 | fMCQA = new AliHFEmcQA; | |
65 | if(fMCQA) fMCQA->Init(); | |
66 | } | |
67 | ||
68 | //____________________________________________________________ | |
69 | AliHFEsignalCuts::AliHFEsignalCuts(const AliHFEsignalCuts &ref): | |
70 | AliAnalysisCuts(ref), | |
71 | fMC(ref.fMC), | |
76d0b522 | 72 | fAODArrayMCInfo(NULL), |
3a72645a | 73 | fMCQA(ref.fMCQA) |
74 | { | |
75 | // | |
76 | // Copy constructor | |
77 | // | |
78 | } | |
79 | ||
80 | //____________________________________________________________ | |
81 | AliHFEsignalCuts &AliHFEsignalCuts::operator=(const AliHFEsignalCuts &ref){ | |
82 | // | |
83 | // Assignment operator | |
84 | // | |
85 | if(this != &ref){ | |
76d0b522 | 86 | //fMC = ref.fMC; |
87 | //fAODArrayMCInfo = ref.fAODArrayMCInfo; | |
3a72645a | 88 | fMCQA = ref.fMCQA; |
89 | } | |
90 | return *this; | |
91 | } | |
92 | ||
93 | //____________________________________________________________ | |
94 | AliHFEsignalCuts::~AliHFEsignalCuts(){ | |
95 | // | |
96 | // Destructor | |
97 | // | |
98 | if(fMCQA) delete fMCQA; | |
99 | } | |
100 | ||
101 | //____________________________________________________________ | |
102 | void AliHFEsignalCuts::SetMCEvent(AliMCEvent *mc){ | |
103 | // | |
104 | // Set mc event | |
105 | // | |
106 | fMC = mc; | |
107 | if(fMCQA) fMCQA->SetMCEvent(mc); | |
108 | } | |
109 | ||
110 | //____________________________________________________________ | |
76d0b522 | 111 | void AliHFEsignalCuts::SetMCAODInfo(TClonesArray *mcarray){ |
112 | // | |
113 | // Set mc array info | |
114 | // | |
115 | fAODArrayMCInfo = mcarray; | |
116 | if(fMCQA) fMCQA->SetMCArray(mcarray); | |
117 | } | |
118 | ||
119 | //____________________________________________________________ | |
959ea9d8 | 120 | Bool_t AliHFEsignalCuts::IsSelected(TObject *o){ |
3a72645a | 121 | // |
122 | // Define signal as electron coming from charm or beauty | |
123 | // @TODO: Implement setter so that also either of them can be defined | |
124 | // as signal alone | |
125 | ||
126 | ||
127 | return IsCharmElectron(o) || IsBeautyElectron(o); | |
128 | /* | |
129 | //saving time? | |
130 | Int_t esources = GetElecSource(dynamic_cast<const AliVParticle *>(o)); | |
131 | if(esources>0)printf("esources= %d\n",esources); | |
132 | if(esources == AliHFEmcQA::kDirectCharm || esources == AliHFEmcQA::kDirectBeauty || esources == AliHFEmcQA::kBeautyCharm) // 1: direct D->e, 2: B->e 3: B->D->e | |
133 | return kTRUE; | |
134 | else | |
135 | return kFALSE; | |
136 | */ | |
137 | ||
138 | } | |
139 | ||
140 | //____________________________________________________________ | |
ff8249bd | 141 | AliHFEsignalCuts::ESignalSource_t AliHFEsignalCuts::GetSignalSource(const TObject *const o) const{ |
142 | // | |
143 | // Get source type of the electron | |
144 | // | |
145 | ESignalSource_t source = kOther; | |
146 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); | |
147 | if(!v) return source; | |
148 | Int_t esources = GetElecSource(v); | |
149 | if(esources == AliHFEmcQA::kDirectCharm) source = kEleCharm; | |
150 | else if(esources == AliHFEmcQA::kDirectBeauty || esources == AliHFEmcQA::kBeautyCharm) source = kEleBeauty; | |
151 | else if(esources >= AliHFEmcQA::kGammaPi0 && esources <= AliHFEmcQA::kGammaRho0) source = kEleGamma; | |
152 | else if(esources == AliHFEmcQA:: kPi0 || esources == AliHFEmcQA::kEta || esources == AliHFEmcQA::kOmega || esources == AliHFEmcQA::kPhi || esources == AliHFEmcQA::kEtaPrime || esources == AliHFEmcQA::kRho0) source = kEleNonHFE; | |
153 | else if(esources == AliHFEmcQA::kJpsi) source = kEleJPsi; | |
154 | else if(esources == AliHFEmcQA::kB2Jpsi) source = kEleBtoJPsi; | |
155 | else if(esources == AliHFEmcQA::kKe3) source = kEleKe3; | |
156 | return source; | |
157 | } | |
158 | ||
159 | /***************************************** | |
160 | * Old legacy code * | |
161 | *****************************************/ | |
162 | ||
163 | //____________________________________________________________ | |
164 | Bool_t AliHFEsignalCuts::IsCharmElectronOld(const TObject * const o) const { | |
3a72645a | 165 | // |
166 | // Check if mother is coming from Charm | |
167 | // | |
91e50e2b | 168 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
169 | if(!v) return kFALSE; | |
170 | Int_t esources = GetElecSource(v); | |
3a72645a | 171 | if(esources == AliHFEmcQA::kDirectCharm) // 1: direct D->e |
172 | return kTRUE; | |
173 | else | |
174 | return kFALSE; | |
175 | } | |
176 | ||
177 | //____________________________________________________________ | |
ff8249bd | 178 | Bool_t AliHFEsignalCuts::IsBeautyElectronOld(const TObject * const o) const { |
3a72645a | 179 | // |
180 | // Check if mother is coming from Beauty | |
181 | // | |
91e50e2b | 182 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
183 | if(!v) return kFALSE; | |
184 | Int_t esources = GetElecSource(v); | |
3a72645a | 185 | if(esources == AliHFEmcQA::kDirectBeauty || esources == AliHFEmcQA::kBeautyCharm) // 2: B->e 3: B->D->e |
186 | return kTRUE; | |
187 | else | |
188 | return kFALSE; | |
189 | } | |
190 | ||
191 | //____________________________________________________________ | |
ff8249bd | 192 | Bool_t AliHFEsignalCuts::IsGammaElectronOld(const TObject * const o) const { |
3a72645a | 193 | // |
c2690925 | 194 | // Check for MC if the electron is coming from Gamma |
3a72645a | 195 | // |
91e50e2b | 196 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
197 | if(!v) return kFALSE; | |
198 | Int_t esources = GetElecSource(v); | |
c2690925 | 199 | if(esources >= AliHFEmcQA::kGammaPi0 && esources <= AliHFEmcQA::kGammaRho0 ) // 4: conversion electrons |
200 | //if(esources == AliHFEmcQA::kGammaPi0 || esources == AliHFEmcQA::kGammaEta || esources == AliHFEmcQA::kGammaOmega || esources == AliHFEmcQA::kGammaPhi || esources == AliHFEmcQA::kGammaEtaPrime || esources == AliHFEmcQA::kGammaRho0 ) // 4: conversion electrons | |
201 | return kTRUE; | |
202 | else | |
203 | return kFALSE; | |
204 | } | |
205 | ||
206 | //____________________________________________________________ | |
ff8249bd | 207 | Bool_t AliHFEsignalCuts::IsNonHFElectronOld(const TObject * const o) const { |
c2690925 | 208 | // |
209 | // Check for MC if the electron is coming from NonHFE except for conversion | |
210 | // | |
91e50e2b | 211 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
212 | if(!v) return kFALSE; | |
213 | Int_t esources = GetElecSource(v); | |
c2690925 | 214 | if(esources == AliHFEmcQA:: kPi0 || esources == AliHFEmcQA::kEta || esources == AliHFEmcQA::kOmega || esources == AliHFEmcQA::kPhi || esources == AliHFEmcQA::kEtaPrime || esources == AliHFEmcQA::kRho0) // 4: conversion electrons |
3a72645a | 215 | return kTRUE; |
216 | else | |
217 | return kFALSE; | |
218 | } | |
11ff28c5 | 219 | |
c2690925 | 220 | //____________________________________________________________ |
ff8249bd | 221 | Bool_t AliHFEsignalCuts::IsJpsiElectronOld(const TObject * const o) const { |
11ff28c5 | 222 | // |
223 | // Check if mother is coming from Charm | |
224 | // | |
91e50e2b | 225 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
226 | if(!v) return kFALSE; | |
227 | Int_t esources = GetElecSource(v); | |
11ff28c5 | 228 | if(esources == AliHFEmcQA::kJpsi) // 5: J/psi->ee |
229 | return kTRUE; | |
230 | else | |
231 | return kFALSE; | |
232 | } | |
233 | ||
234 | //____________________________________________________________ | |
ff8249bd | 235 | Bool_t AliHFEsignalCuts::IsB2JpsiElectronOld(const TObject * const o) const { |
11ff28c5 | 236 | // |
237 | // Check if mother is coming from Charm | |
238 | // | |
91e50e2b | 239 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
240 | if(!v) return kFALSE; | |
241 | Int_t esources = GetElecSource(v); | |
11ff28c5 | 242 | if(esources == AliHFEmcQA::kB2Jpsi) // 6: B->Jpsi->ee |
243 | return kTRUE; | |
244 | else | |
245 | return kFALSE; | |
246 | } | |
247 | ||
248 | //____________________________________________________________ | |
ff8249bd | 249 | Bool_t AliHFEsignalCuts::IsKe3ElectronOld(const TObject * const o) const { |
11ff28c5 | 250 | // |
251 | // Check if mother is coming from Charm | |
252 | // | |
91e50e2b | 253 | const AliVParticle *v = dynamic_cast<const AliVParticle *>(o); |
254 | if(!v) return kFALSE; | |
255 | Int_t esources = GetElecSource(v); | |
11ff28c5 | 256 | if(esources == AliHFEmcQA::kKe3) // 7: K->e |
257 | return kTRUE; | |
258 | else | |
259 | return kFALSE; | |
260 | } | |
3a72645a | 261 | |
262 | /* | |
263 | //____________________________________________________________ | |
264 | Bool_t AliHFEsignalCuts::IsCharmElectron(const TObject * const o) const { | |
265 | // | |
266 | // Check if mother is coming from Charm | |
267 | // | |
268 | if(TMath::Abs(GetTrackPDG(dynamic_cast<const AliVParticle *>(o))) != 11) return kFALSE; | |
269 | Int_t motherpdg = TMath::Abs(GetMotherPDG(dynamic_cast<const AliVParticle *>(o))); | |
270 | AliDebug(1, Form("Mother PDG %d\n", motherpdg)); | |
271 | ||
272 | if((motherpdg % 1000) / 100 == 4) return kTRUE; // charmed meson, 3rd position in pdg code == 4 | |
273 | if(motherpdg / 1000 == 4) return kTRUE; // charmed baryon, 4th position in pdg code == 4 | |
274 | AliDebug(1, "No Charm\n"); | |
275 | return kFALSE; | |
276 | } | |
277 | ||
278 | //____________________________________________________________ | |
279 | Bool_t AliHFEsignalCuts::IsBeautyElectron(const TObject * const o) const { | |
280 | // | |
281 | // Check if mother is coming from Beauty | |
282 | // | |
283 | if(TMath::Abs(GetTrackPDG(dynamic_cast<const AliVParticle *>(o))) != 11) return kFALSE; | |
284 | Int_t motherpdg = TMath::Abs(GetMotherPDG(dynamic_cast<const AliVParticle *>(o))); | |
285 | AliDebug(1, Form("Mother PDG %d\n", motherpdg)); | |
286 | ||
287 | if((motherpdg % 1000) / 100 == 5) return kTRUE; // beauty meson, 3rd position in pdg code == 5 | |
288 | if(motherpdg / 1000 == 5) return kTRUE; // beauty baryon, 4th position in pdg code == 5 | |
289 | AliDebug(1, "No Beauty\n"); | |
290 | return kFALSE; | |
291 | } | |
292 | ||
293 | //____________________________________________________________ | |
294 | Bool_t AliHFEsignalCuts::IsGammaElectron(const TObject * const o) const { | |
295 | // | |
296 | // Check for MC if the electron is coming from Gamma | |
297 | // | |
298 | if(TMath::Abs(GetTrackPDG(dynamic_cast<const AliVParticle *>(o))) != 11) return kFALSE; | |
299 | Int_t motherpdg = TMath::Abs(GetMotherPDG(dynamic_cast<const AliVParticle *>(o))); | |
300 | AliDebug(1, Form("Mother PDG %d\n", motherpdg)); | |
301 | ||
302 | if(motherpdg!=22){ | |
303 | AliDebug(1, "No Gamma"); | |
304 | return kFALSE; | |
305 | } else { | |
306 | AliDebug(1, "Gamma"); | |
307 | return kTRUE; | |
308 | } | |
309 | } | |
310 | */ | |
311 | ||
312 | //____________________________________________________________ | |
313 | Int_t AliHFEsignalCuts::GetMotherPDG(const AliVParticle * const track) const { | |
314 | // | |
315 | // Get Mother Pdg code for reconstructed respectively MC tracks | |
316 | // | |
76d0b522 | 317 | TClass *type = track->IsA(); |
91e50e2b | 318 | //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){ |
319 | // AliDebug(1, "No MC Event Available\n"); | |
320 | // return 0; | |
ff8249bd | 321 | //} |
3a72645a | 322 | const AliVParticle *motherParticle = NULL, *mctrack = NULL; |
76d0b522 | 323 | Int_t label = TMath::Abs(track->GetLabel()); |
324 | if(type == AliESDtrack::Class()){ | |
ff8249bd | 325 | // |
91e50e2b | 326 | if(!fMC) { |
327 | AliDebug(1, "No MC Event Available\n"); | |
328 | return 0; | |
329 | } | |
ff8249bd | 330 | // Reconstructed track |
76d0b522 | 331 | if(label) mctrack = fMC->GetTrack(TMath::Abs(label)); |
332 | ||
333 | } | |
334 | else if(type == AliAODTrack::Class()) { | |
ff8249bd | 335 | // |
91e50e2b | 336 | if(!fAODArrayMCInfo) { |
337 | AliDebug(1, "No MC Event Available\n"); | |
338 | return 0; | |
339 | } | |
ff8249bd | 340 | // MCParticle |
76d0b522 | 341 | if(label && label < fAODArrayMCInfo->GetEntriesFast()) |
342 | mctrack = (AliVParticle *) fAODArrayMCInfo->At(label); | |
343 | } | |
344 | else { | |
345 | mctrack=track; | |
3a72645a | 346 | } |
347 | ||
348 | if(!mctrack) return 0; | |
349 | ||
350 | Int_t motherPDG = 0; | |
351 | if(TString(mctrack->IsA()->GetName()).CompareTo("AliMCParticle") == 0){ | |
352 | // case MC Particle | |
bf892a6a | 353 | const AliMCParticle *esdmctrack = dynamic_cast<const AliMCParticle *>(mctrack); |
91e50e2b | 354 | if(esdmctrack) { |
355 | if(!fMC) { | |
356 | AliDebug(1, "No MC Event Available\n"); | |
357 | return 0; | |
ff8249bd | 358 | } |
91e50e2b | 359 | motherParticle = fMC->GetTrack(esdmctrack->Particle()->GetFirstMother()); |
360 | } | |
bf892a6a | 361 | if(motherParticle){ |
362 | const AliMCParticle *esdmcmother = dynamic_cast<const AliMCParticle *>(motherParticle); | |
363 | if(esdmcmother) motherPDG = TMath::Abs(esdmcmother->Particle()->GetPdgCode()); | |
364 | } | |
ff8249bd | 365 | |
3a72645a | 366 | } else { |
367 | // case AODMCParticle | |
bf892a6a | 368 | const AliAODMCParticle *aodmctrack = dynamic_cast<const AliAODMCParticle *>(mctrack); |
76d0b522 | 369 | if(aodmctrack) { |
91e50e2b | 370 | if(!fAODArrayMCInfo) { |
ff8249bd | 371 | AliDebug(1, "No MC Event Available\n"); |
372 | return 0; | |
91e50e2b | 373 | } |
76d0b522 | 374 | if(aodmctrack->GetMother() && aodmctrack->GetMother() < fAODArrayMCInfo->GetEntriesFast()) |
ff8249bd | 375 | motherParticle = (AliVParticle *) fAODArrayMCInfo->At(aodmctrack->GetMother()); |
76d0b522 | 376 | } |
bf892a6a | 377 | if(motherParticle){ |
378 | const AliAODMCParticle *aodmcmother = dynamic_cast<const AliAODMCParticle *>(motherParticle); | |
379 | if(aodmcmother) motherPDG = TMath::Abs(aodmcmother->GetPdgCode()); | |
380 | } | |
3a72645a | 381 | } |
382 | return motherPDG; | |
383 | } | |
384 | ||
385 | //____________________________________________________________ | |
386 | Int_t AliHFEsignalCuts::GetTrackPDG(const AliVParticle * const track) const { | |
76d0b522 | 387 | // |
388 | // Return PDG code of a particle itself | |
389 | // | |
ff8249bd | 390 | |
391 | ||
76d0b522 | 392 | TClass *type = track->IsA(); |
ff8249bd | 393 | //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){ |
394 | // AliDebug(1, "No MC Event Available\n"); | |
395 | // return 0; | |
396 | //} | |
76d0b522 | 397 | const AliVParticle *mctrack = NULL; |
398 | Int_t label = TMath::Abs(track->GetLabel()); | |
399 | if(type == AliESDtrack::Class()){ | |
ff8249bd | 400 | // |
401 | if(!fMC) { | |
402 | AliDebug(1, "No MC Event Available\n"); | |
403 | return 0; | |
404 | } | |
76d0b522 | 405 | // Reconstructed track |
406 | if(label) mctrack = fMC->GetTrack(TMath::Abs(label)); | |
407 | ||
408 | } | |
409 | else if(type == AliAODTrack::Class()) { | |
ff8249bd | 410 | // |
411 | if(!fAODArrayMCInfo) { | |
412 | AliDebug(1, "No MC Event Available\n"); | |
413 | return 0; | |
414 | } | |
76d0b522 | 415 | // MCParticle |
416 | if(label && label < fAODArrayMCInfo->GetEntriesFast()) | |
417 | mctrack = (AliVParticle *) fAODArrayMCInfo->At(label); | |
418 | } | |
419 | else { | |
420 | mctrack=track; | |
ff8249bd | 421 | } |
422 | ||
423 | if(!mctrack) return 0; | |
76d0b522 | 424 | |
425 | TString mctype = mctrack->IsA()->GetName(); | |
426 | Int_t trackPdg = 0; | |
427 | if(!mctype.CompareTo("AliMCParticle")){ | |
428 | const AliMCParticle *esdmc = dynamic_cast<const AliMCParticle *>(mctrack); | |
429 | if(esdmc) trackPdg = esdmc->Particle()->GetPdgCode(); | |
430 | } else { | |
431 | const AliAODMCParticle *aodmc = dynamic_cast< const AliAODMCParticle *>(mctrack); | |
432 | if(aodmc) trackPdg = aodmc->GetPdgCode(); | |
433 | } | |
434 | return trackPdg; | |
3a72645a | 435 | } |
436 | ||
437 | //____________________________________________________________ | |
438 | Int_t AliHFEsignalCuts::GetElecSource(const AliVParticle * const track) const { | |
76d0b522 | 439 | // |
440 | // Return PDG code of a particle itself | |
441 | // | |
91e50e2b | 442 | if(!track){ |
443 | AliDebug(1, "Track not Available\n"); | |
e3ae862b | 444 | return 0; |
ff8249bd | 445 | } |
446 | ||
91e50e2b | 447 | TClass *type = track->IsA(); |
ff8249bd | 448 | //if((!fMC && (type == AliESDtrack::Class())) || (!fAODArrayMCInfo && (type == AliAODTrack::Class()))){ |
91e50e2b | 449 | // AliDebug(1, "No MC Event Available\n"); |
450 | // return 0; | |
451 | //} | |
e3ae862b | 452 | if(!fMCQA){ |
453 | AliDebug(1, "No MCQA Available\n"); | |
454 | return 0; | |
455 | } | |
91e50e2b | 456 | |
3a72645a | 457 | |
e3ae862b | 458 | const AliVParticle *mctrack = NULL; |
459 | TParticle *mcpart = NULL; | |
76d0b522 | 460 | Int_t label = TMath::Abs(track->GetLabel()); |
ff8249bd | 461 | AliMCParticle *esdmcmother = NULL; |
76d0b522 | 462 | if(type == AliESDtrack::Class()){ |
ff8249bd | 463 | // |
91e50e2b | 464 | if(!fMC) { |
465 | AliDebug(1, "No MC Event Available\n"); | |
466 | return 0; | |
467 | } | |
ff8249bd | 468 | // Reconstructed track |
76d0b522 | 469 | if(label) mctrack = fMC->GetTrack(TMath::Abs(label)); |
470 | ||
471 | } | |
472 | else if(type == AliAODTrack::Class()) { | |
ff8249bd | 473 | // |
91e50e2b | 474 | if(!fAODArrayMCInfo) { |
475 | AliDebug(1, "No MC Event Available\n"); | |
476 | return 0; | |
477 | } | |
ff8249bd | 478 | // MCParticle |
76d0b522 | 479 | if(label && label < fAODArrayMCInfo->GetEntriesFast()) |
480 | mctrack = (AliVParticle *) fAODArrayMCInfo->At(label); | |
481 | } | |
482 | else { | |
483 | mctrack=track; | |
484 | } | |
e3ae862b | 485 | if(!mctrack) return 0; |
3a72645a | 486 | |
e3ae862b | 487 | Int_t eSource = 0; |
e156c3bb | 488 | if(mctrack->IsA() == AliMCParticle::Class()){ |
e3ae862b | 489 | const AliMCParticle *esdmc = dynamic_cast<const AliMCParticle *>(mctrack); |
490 | if(esdmc){ | |
491 | mcpart = esdmc->Particle(); | |
7bdde22f | 492 | eSource=fMCQA->GetElecSource(mcpart,kTRUE); |
ff8249bd | 493 | // considering secondary pions |
494 | if(type == AliESDtrack::Class()){ | |
495 | if(eSource>=AliHFEmcQA::kGammaPi0 && eSource<=AliHFEmcQA::kGammaRho0) { // conversion electron, be careful with the enum odering | |
a8ef1999 | 496 | Int_t glabel=TMath::Abs(esdmc->GetMother()); // gamma label |
497 | if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){ | |
498 | glabel=TMath::Abs(esdmcmother->GetMother()); // gamma's mother's label | |
499 | if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){ | |
ff8249bd | 500 | if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kScdryM; |
a8ef1999 | 501 | } |
502 | } | |
ff8249bd | 503 | } |
504 | else if(eSource==AliHFEmcQA::kPi0 || (eSource>=AliHFEmcQA::kEta && eSource<=AliHFEmcQA::kRho0) ){ // nonHFE except for the conversion electron | |
a8ef1999 | 505 | Int_t glabel=TMath::Abs(esdmc->GetMother()); |
506 | if((esdmcmother= dynamic_cast<AliMCParticle *>(fMC->GetTrack(glabel)))){ | |
ff8249bd | 507 | if(glabel>fMC->GetNumberOfPrimaries()) eSource=AliHFEmcQA::kScdryM; |
a8ef1999 | 508 | } |
ff8249bd | 509 | } |
a8ef1999 | 510 | } |
e3ae862b | 511 | } |
512 | } else { | |
7bdde22f | 513 | eSource=fMCQA->GetElecSource(mctrack,kTRUE); |
e3ae862b | 514 | } |
515 | return eSource; | |
3a72645a | 516 | } |