]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFENonPhotonicElectron.cxx
add EMCal trigger in eh analysis. add hists. in Raa study
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFENonPhotonicElectron.cxx
CommitLineData
76d0b522 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
17/*************************************************************************************
18 * *
19 * Class for the Selection of Non-Heavy-Flavour-Electrons trought *
20 * the invariant mass method. The selection can be done from two *
21 * different algorithms, which can be choosed calling the function *
22 * "SetAlgorithm(TString Algorithm)". *
23 * *
24 * Authors: R.Bailhache, C.A.Schmidt *
25 * *
26 *************************************************************************************/
27
28#include "TVector2.h"
29#include "THnSparse.h"
30#include "TMath.h"
31#include "TLorentzVector.h"
32#include "TParticle.h"
33#include "TList.h"
34#include "TDatabasePDG.h"
35
36#include "AliVEvent.h"
37#include "AliMCEvent.h"
38#include "AliESDEvent.h"
39#include "AliMCParticle.h"
40#include "AliAODMCParticle.h"
41#include "AliAODEvent.h"
42#include "AliAODVertex.h"
43#include "AliAODTrack.h"
44#include "AliVTrack.h"
45#include "AliESDtrack.h"
46#include "AliESDtrackCuts.h"
47#include "AliPIDResponse.h"
8a9b2231 48#include "AliPID.h"
76d0b522 49
50#include "AliKFParticle.h"
51#include "AliKFVertex.h"
52
53#include "AliHFEcuts.h"
54#include "AliHFEpid.h"
55#include "AliHFEpidQAmanager.h"
56#include "AliHFEtools.h"
57
58#include "AliHFENonPhotonicElectron.h"
59
60ClassImp(AliHFENonPhotonicElectron)
61//________________________________________________________________________
62AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Char_t *title)
8a9b2231 63 :TNamed (name, title)
64 ,fIsAOD (kFALSE)
65 ,fMCEvent (NULL)
66 ,fAODArrayMCInfo (NULL)
67 ,fHFEBackgroundCuts (NULL)
68 ,fPIDBackground (0x0)
69 ,fPIDBackgroundQA (0)
70 ,fkPIDRespons (NULL)
71 ,fAlgorithmMA (kTRUE)
72 ,fUseFilterAOD (kTRUE)
73 ,fFilter (-1)
74 ,fChi2OverNDFCut (3.0)
75 ,fMaxDCA (3.0)
76// ,fMaxOpeningTheta (0.02)
77// ,fMaxOpeningPhi (0.1)
78 ,fMaxOpening3D (TMath::Pi())
79 ,fMaxInvMass (1000)
80 ,fSetMassConstraint (kFALSE)
81 ,fArraytrack (NULL)
82 ,fCounterPoolBackground (0)
83 ,fnumberfound (0)
84 ,fListOutput (NULL)
85 ,fAssElectron (NULL)
86 ,fIncElectron (NULL)
87 ,fUSign (NULL)
88 ,fLSign (NULL)
c3e32eae 89 ,fUSmatches(NULL)
90 ,fLSmatches(NULL)
8a9b2231 91// ,fUSignAngle (NULL)
92// ,fLSignAngle (NULL)
76d0b522 93{
94 //
95 // Constructor
96 //
8a9b2231 97 fPIDBackground = new AliHFEpid("hfePidBackground");
76d0b522 98 fPIDBackgroundQA = new AliHFEpidQAmanager;
99}
100
101//________________________________________________________________________
102AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
8a9b2231 103 :TNamed ()
104 ,fIsAOD (kFALSE)
105 ,fMCEvent (NULL)
106 ,fAODArrayMCInfo (NULL)
107 ,fHFEBackgroundCuts (NULL)
108 ,fPIDBackground (0x0)
109 ,fPIDBackgroundQA (0)
110 ,fkPIDRespons (NULL)
111 ,fAlgorithmMA (kTRUE)
112 ,fUseFilterAOD (kTRUE)
113 ,fFilter (-1)
114 ,fChi2OverNDFCut (3.0)
115 ,fMaxDCA (3.0)
116// ,fMaxOpeningTheta (0.02)
117// ,fMaxOpeningPhi (0.1)
118 ,fMaxOpening3D (TMath::TwoPi())
119 ,fMaxInvMass (1000)
120 ,fSetMassConstraint (kFALSE)
121 ,fArraytrack (NULL)
122 ,fCounterPoolBackground (0)
123 ,fnumberfound (0)
124 ,fListOutput (NULL)
125 ,fAssElectron (NULL)
126 ,fIncElectron (NULL)
127 ,fUSign (NULL)
128 ,fLSign (NULL)
c3e32eae 129 ,fUSmatches(NULL)
130 ,fLSmatches(NULL)
8a9b2231 131// ,fUSignAngle (NULL)
132// ,fLSignAngle (NULL)
76d0b522 133{
134 //
135 // Constructor
136 //
137 fPIDBackground = new AliHFEpid("hfePidBackground");
138 fPIDBackgroundQA = new AliHFEpidQAmanager;
139}
140
141//________________________________________________________________________
142AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElectron &ref)
143 :TNamed(ref)
8a9b2231 144 ,fIsAOD (ref.fIsAOD)
145 ,fMCEvent (NULL)
146 ,fAODArrayMCInfo (NULL)
147 ,fHFEBackgroundCuts (ref.fHFEBackgroundCuts)
148 ,fPIDBackground (ref.fPIDBackground)
149 ,fPIDBackgroundQA (ref.fPIDBackgroundQA)
150 ,fkPIDRespons (ref.fkPIDRespons)
151 ,fAlgorithmMA (ref.fAlgorithmMA)
152 ,fUseFilterAOD (ref.fUseFilterAOD)
153 ,fFilter (ref.fFilter)
154 ,fChi2OverNDFCut (ref.fChi2OverNDFCut)
155 ,fMaxDCA (ref.fMaxDCA)
156// ,fMaxOpeningTheta (ref.fMaxOpeningTheta)
157// ,fMaxOpeningPhi (ref.fMaxOpeningPhi)
158 ,fMaxOpening3D (ref.fMaxOpening3D)
159 ,fMaxInvMass (ref.fMaxInvMass)
160 ,fSetMassConstraint (ref.fSetMassConstraint)
161 ,fArraytrack (NULL)
162 ,fCounterPoolBackground (0)
163 ,fnumberfound (0)
164 ,fListOutput (ref.fListOutput)
165 ,fAssElectron (ref.fAssElectron)
166 ,fIncElectron (ref.fIncElectron)
167 ,fUSign (ref.fUSign)
168 ,fLSign (ref.fLSign)
c3e32eae 169 ,fUSmatches(ref.fUSmatches)
170 ,fLSmatches(ref.fLSmatches)
8a9b2231 171// ,fUSignAngle (ref.fUSignAngle)
172// ,fLSignAngle (ref.fLSignAngle)
76d0b522 173{
174 //
175 // Copy Constructor
176 //
177 ref.Copy(*this);
178}
179
180//____________________________________________________________
181AliHFENonPhotonicElectron &AliHFENonPhotonicElectron::operator=(const AliHFENonPhotonicElectron &ref){
182 //
183 // Assignment operator
184 //
185 if(this == &ref) ref.Copy(*this);
186 return *this;
187}
188
189//_________________________________________
190AliHFENonPhotonicElectron::~AliHFENonPhotonicElectron()
191{
192 //
193 // Destructor
194 //
8a9b2231 195 if(fArraytrack) delete fArraytrack;
196 //if(fHFEBackgroundCuts) delete fHFEBackgroundCuts;
197 if(fPIDBackground) delete fPIDBackground;
198 if(fPIDBackgroundQA) delete fPIDBackgroundQA;
76d0b522 199}
200
201//_____________________________________________________________________________________________
202void AliHFENonPhotonicElectron::Init()
203{
204 //
205 // Init
206 //
207
8a9b2231 208 //printf("Analysis Mode for AliHFENonPhotonicElectron: %s Analysis\n", fIsAOD ? "AOD" : "ESD");
209
76d0b522 210 if(!fListOutput) fListOutput = new TList;
211 fListOutput->SetName("HFENonPhotonicElectron");
212 fListOutput->SetOwner();
213
8a9b2231 214 if(!fHFEBackgroundCuts) fHFEBackgroundCuts = new AliHFEcuts();
215 if(fIsAOD) fHFEBackgroundCuts->SetAOD();
216 fHFEBackgroundCuts->Initialize();
217 if(fHFEBackgroundCuts->IsQAOn()) {
218 fListOutput->Add(fHFEBackgroundCuts->GetQAhistograms());
219 }
76d0b522 220
221 // Initialize PID
222 if(!fPIDBackground) fPIDBackground = new AliHFEpid("default pid");
8a9b2231 223 if(fMCEvent || fAODArrayMCInfo) fPIDBackground->SetHasMCData(kTRUE); // does nothing since the fMCEvent are set afterwards at the moment
224 if(!fPIDBackground->GetNumberOfPIDdetectors())
225 {
226 //fPIDBackground->AddDetector("TOF", 0);
227 fPIDBackground->AddDetector("TPC", 0);
228 }
76d0b522 229 AliInfo("PID Background QA switched on");
230 fPIDBackgroundQA->Initialize(fPIDBackground);
231 fListOutput->Add(fPIDBackgroundQA->MakeList("HFENP_PID_Background"));
232 fPIDBackground->SortDetectors();
233
8a9b2231 234 Int_t nBinsPt = 35;
235 //Double_t binLimPt[25] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 3., 3.5, 4., 5., 6.};
236 Double_t binLimPt[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
237
238 Int_t nBinsP = 400;
239 Double_t minP = 0.0;
240 Double_t maxP = 20.0;
241 Double_t binLimP[nBinsP+1];
242 for(Int_t i=0; i<=nBinsP; i++) binLimP[i]=(Double_t)minP + (maxP-minP)/nBinsP*(Double_t)i ;
76d0b522 243
244 Int_t nBinsC = 11;
245 Double_t minC = 0.0;
246 Double_t maxC = 11.0;
247 Double_t binLimC[nBinsC+1];
248 for(Int_t i=0; i<=nBinsC; i++) binLimC[i]=(Double_t)minC + (maxC-minC)/nBinsC*(Double_t)i ;
249
250 Int_t nBinsSource = 10;
251 Double_t minSource = 0.;
252 Double_t maxSource = 10.;
253 Double_t binLimSource[nBinsSource+1];
254 for(Int_t i=0; i<=nBinsSource; i++) binLimSource[i]=(Double_t)minSource + (maxSource-minSource)/nBinsSource*(Double_t)i ;
255
8a9b2231 256 Int_t nBinsInvMass = 1000;
76d0b522 257 Double_t minInvMass = 0.;
8a9b2231 258 Double_t maxInvMass = 10.;
76d0b522 259 Double_t binLimInvMass[nBinsInvMass+1];
260 for(Int_t i=0; i<=nBinsInvMass; i++) binLimInvMass[i]=(Double_t)minInvMass + (maxInvMass-minInvMass)/nBinsInvMass*(Double_t)i ;
261
262 Int_t nBinsPhi = 180;
263 Double_t minPhi = 0.0;
264 Double_t maxPhi = TMath::Pi();
265 Double_t binLimPhi[nBinsPhi+1];
266 for(Int_t i=0; i<=nBinsPhi; i++)
267 {
268 binLimPhi[i]=(Double_t)minPhi + (maxPhi-minPhi)/nBinsPhi*(Double_t)i ;
269 AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));
270 }
271
272 Int_t nBinsAngle = 180;
273 Double_t minAngle = 0.0;
274 Double_t maxAngle = TMath::Pi();
275 Double_t binLimAngle[nBinsAngle+1];
276 for(Int_t i=0; i<=nBinsAngle; i++)
277 {
278 binLimAngle[i]=(Double_t)minAngle + (maxAngle-minAngle)/nBinsAngle*(Double_t)i ;
8a9b2231 279 AliDebug(2,Form("bin phi is %f for %d",binLimAngle[i],i));
280 }
281
8a9b2231 282 // Associated Electron
c3e32eae 283 const Int_t nDimAssElectron=3;
284 Int_t nBinAssElectron[nDimAssElectron] = {nBinsC,nBinsPt,nBinsSource};
8a9b2231 285 fAssElectron = new THnSparseF("fAssElectron","fAssElectron",nDimAssElectron,nBinAssElectron);
286 fAssElectron->SetBinEdges(0,binLimC);
287 fAssElectron->SetBinEdges(1,binLimPt);
288 fAssElectron->SetBinEdges(2,binLimSource);
8a9b2231 289 fAssElectron->Sumw2();
290 AliDebug(2,"AliHFENonPhotonicElectron: fAssElectron");
291
292 // Inclusive Electron
c3e32eae 293 const Int_t nDimIncElectron=3;
294 Int_t nBinIncElectron[nDimIncElectron] = {nBinsC,nBinsPt,nBinsSource};
8a9b2231 295 fIncElectron = new THnSparseF("fIncElectron","fIncElectron",nDimIncElectron,nBinIncElectron);
296 fIncElectron->SetBinEdges(0,binLimC);
297 fIncElectron->SetBinEdges(1,binLimPt);
298 fIncElectron->SetBinEdges(2,binLimSource);
8a9b2231 299 fIncElectron->Sumw2();
300 AliDebug(2,"AliHFENonPhotonicElectron: fIncElectron");
76d0b522 301
302 // ee invariant mass Unlike Sign
8a9b2231 303 const Int_t nDimUSign=7;
304 Int_t nBinUSign[nDimUSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource,nBinsAngle,nBinsPt};
959ea9d8 305 fUSign = new THnSparseF("fUSign","fUSign",nDimUSign,nBinUSign);
306 fUSign->SetBinEdges(0,binLimPhi);
307 fUSign->SetBinEdges(1,binLimC);
308 fUSign->SetBinEdges(2,binLimPt);
309 fUSign->SetBinEdges(3,binLimInvMass);
310 fUSign->SetBinEdges(4,binLimSource);
311 fUSign->SetBinEdges(5,binLimAngle);
8a9b2231 312 fUSign->SetBinEdges(6,binLimPt);
959ea9d8 313 fUSign->Sumw2();
314 AliDebug(2,"AliHFENonPhotonicElectron: fUSign");
76d0b522 315
316 // ee invariant mass Like Sign
8a9b2231 317 const Int_t nDimLSign=7;
318 Int_t nBinLSign[nDimLSign] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource,nBinsAngle,nBinsPt};
959ea9d8 319 fLSign = new THnSparseF("fLSign","fLSign",nDimLSign,nBinLSign);
320 fLSign->SetBinEdges(0,binLimPhi);
321 fLSign->SetBinEdges(1,binLimC);
322 fLSign->SetBinEdges(2,binLimPt);
323 fLSign->SetBinEdges(3,binLimInvMass);
324 fLSign->SetBinEdges(4,binLimSource);
325 fLSign->SetBinEdges(5,binLimAngle);
8a9b2231 326 fLSign->SetBinEdges(6,binLimPt);
959ea9d8 327 fLSign->Sumw2();
328 AliDebug(2,"AliHFENonPhotonicElectron: fLSign");
329
c3e32eae 330 // Histograms counting the number of like sign / unlike sign matches per inclusive track
331 const Int_t nBinsMatches = 50;
332 Double_t binLimMatches[nBinsMatches+1];
333 for(int ib = 0; ib <= nBinsMatches; ib++) binLimMatches[ib] = ib;
334 const Int_t nDimMatches = 3; // centrality, pt_inc, number of matches
335 const Int_t nBinsMatchHist[nDimMatches] = {nBinsC, nBinsPt, nBinsMatches};
336 fUSmatches = new THnSparseF("fUSmatches", "fUSmatches", nDimMatches, nBinsMatchHist);
337 fUSmatches->SetBinEdges(0,binLimC);
338 fUSmatches->SetBinEdges(1,binLimPt);
339 fUSmatches->SetBinEdges(2,binLimMatches);
340
341 fLSmatches = new THnSparseF("fLSmatches", "fLSmatches", nDimMatches, nBinsMatchHist);
342 fLSmatches->SetBinEdges(0,binLimC);
343 fLSmatches->SetBinEdges(1,binLimPt);
344 fLSmatches->SetBinEdges(2,binLimMatches);
345
959ea9d8 346/*
76d0b522 347 // ee angle Unlike Sign
348 const Int_t nDimUSignAngle=3;
349 Int_t nBinUSignAngle[nDimUSignAngle] = {nBinsAngle,nBinsC,nBinsSource};
350 fUSignAngle = new THnSparseF("fUSignAngle","fUSignAngle",nDimUSignAngle,nBinUSignAngle);
351 fUSignAngle->SetBinEdges(0,binLimAngle);
352 fUSignAngle->SetBinEdges(1,binLimC);
353 fUSignAngle->SetBinEdges(2,binLimSource);
76d0b522 354 fUSignAngle->Sumw2();
355 AliDebug(2,"AliHFENonPhotonicElectron: fUSignAngle");
356
357 // ee angle Like Sign
358 const Int_t nDimLSignAngle=3;
359 Int_t nBinLSignAngle[nDimLSignAngle] = {nBinsAngle,nBinsC,nBinsSource};
360 fLSignAngle = new THnSparseF("fLSignAngle","fLSignAngle",nDimLSignAngle,nBinLSignAngle);
361 fLSignAngle->SetBinEdges(0,binLimAngle);
362 fLSignAngle->SetBinEdges(1,binLimC);
363 fLSignAngle->SetBinEdges(2,binLimSource);
76d0b522 364 fLSignAngle->Sumw2();
365 AliDebug(2,"AliHFENonPhotonicElectron: fLSignAngle");
959ea9d8 366*/
76d0b522 367
8a9b2231 368 fListOutput->Add(fAssElectron);
369 fListOutput->Add(fIncElectron);
959ea9d8 370 fListOutput->Add(fUSign);
371 fListOutput->Add(fLSign);
c3e32eae 372 fListOutput->Add(fUSmatches);
373 fListOutput->Add(fLSmatches);
959ea9d8 374// fListOutput->Add(fUSignAngle);
375// fListOutput->Add(fLSignAngle);
76d0b522 376
377}
378
379//_____________________________________________________________________________________________
663a2523 380void AliHFENonPhotonicElectron::InitRun(const AliVEvent *inputEvent,const AliPIDResponse *pidResponse)
76d0b522 381{
382 //
383 // Init run
384 //
385
386 if(!pidResponse)
387 {
388 AliDebug(1, "Using default PID Response");
389 Bool_t hasmc = kFALSE;
390 if(fMCEvent || fAODArrayMCInfo) hasmc=kTRUE;
391 pidResponse = AliHFEtools::GetDefaultPID(hasmc, inputEvent->IsA() == AliESDEvent::Class());
392 }
393
394 if(!fPIDBackground) return;
395 fPIDBackground->SetPIDResponse(pidResponse);
396
397 if(!fPIDBackground->IsInitialized())
398 {
399 // Initialize PID with the given run number
400 fPIDBackground->InitializePID(inputEvent->GetRunNumber());
401 }
402
403}
404
405//_____________________________________________________________________________________________
8a9b2231 406Int_t AliHFENonPhotonicElectron::FillPoolAssociatedTracks(AliVEvent *inputEvent, Int_t binct)
76d0b522 407{
408 //
409 // Fill the pool of associated tracks
410 // Return the number of associated tracks
411 //
412
8a9b2231 413 fnumberfound = 0;
414
76d0b522 415 Int_t nbtracks = inputEvent->GetNumberOfTracks();
416
417 if( fArraytrack )
418 {
419 fArraytrack->~TArrayI();
420 new(fArraytrack) TArrayI(nbtracks);
421 }
422 else
423 {
424 fArraytrack = new TArrayI(nbtracks);
425 }
426
427 fCounterPoolBackground = 0;
428
429 for(Int_t k = 0; k < nbtracks; k++)
430 {
431 AliVTrack *track = (AliVTrack *) inputEvent->GetTrack(k);
432 if(!track) continue;
433
434 // Track cuts
435 Bool_t survivedbackground = kTRUE;
436 AliAODEvent *aodeventu = dynamic_cast<AliAODEvent *>(inputEvent);
437
438 if(aodeventu)
439 {
959ea9d8 440 /** **
441 * AOD Analysis *
442 ** **/
443
76d0b522 444 AliAODTrack *aodtrack = dynamic_cast<AliAODTrack *>(track);
445 if(aodtrack)
446 {
c3e32eae 447 // filter
448 if(fUseFilterAOD)
449 {
450 if(!(aodtrack->TestFilterBit(fFilter))) survivedbackground = kFALSE;
451 }
76d0b522 452
76d0b522 453 }
454 }
8a9b2231 455
456 if(!fHFEBackgroundCuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *) track)) survivedbackground = kFALSE;
457 if(!fHFEBackgroundCuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *) track)) survivedbackground = kFALSE;
76d0b522 458
459 // PID
460 if(survivedbackground)
461 {
462 // PID track cuts
463 AliHFEpidObject hfetrack2;
464
959ea9d8 465 if(!aodeventu) hfetrack2.SetAnalysisType(AliHFEpidObject::kESDanalysis);
466 else hfetrack2.SetAnalysisType(AliHFEpidObject::kAODanalysis);
76d0b522 467
468 hfetrack2.SetRecTrack(track);
469 if(binct>-1)
470 {
c3e32eae 471 hfetrack2.SetCentrality((Int_t)binct);
472 AliDebug(2,Form("centrality %d and %d",binct,hfetrack2.GetCentrality()));
473 hfetrack2.SetPbPb();
76d0b522 474 }
475
476 if(fPIDBackground->IsSelected(&hfetrack2,0x0,"recTrackCont",fPIDBackgroundQA))
477 {
c3e32eae 478 fArraytrack->AddAt(k,fCounterPoolBackground);
479 fCounterPoolBackground++;
480 AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));
76d0b522 481 }
482 }
483 } // loop tracks
484
8a9b2231 485 //printf(Form("Associated Pool: Tracks %d, fCounterPoolBackground %d \n", nbtracks, fCounterPoolBackground));
76d0b522 486
487 return fCounterPoolBackground;
8a9b2231 488
489}
490
491//_____________________________________________________________________________________________
492Int_t AliHFENonPhotonicElectron::CountPoolAssociated(AliVEvent *inputEvent, Int_t binct)
493{
494 //
495 // Count the pool of assiocated tracks
496 //
497
498
499 if(fnumberfound > 0) //!count only events with an inclusive electron
500 {
c3e32eae 501 Double_t valueAssElectron[3] = { binct, -1, -1}; //Centrality Pt Source
8a9b2231 502 Int_t iTrack2 = 0;
503 Int_t indexmother2 = -1;
504 AliVTrack *track2 = 0x0;
505
c3e32eae 506 for(Int_t ii = 0; ii < fCounterPoolBackground; ii++){
8a9b2231 507 iTrack2 = fArraytrack->At(ii);
508 AliDebug(2,Form("track %d",iTrack2));
509 track2 = (AliVTrack *)inputEvent->GetTrack(iTrack2);
510
c3e32eae 511 if(!track2){
512 //printf("ERROR: Could not receive track %d", iTrack2);
513 continue;
8a9b2231 514 }
515
516 // if MC look
c3e32eae 517 if(fMCEvent || fAODArrayMCInfo) valueAssElectron[2] = FindMother(TMath::Abs(track2->GetLabel()), indexmother2) ;
8a9b2231 518
519 fkPIDRespons = fPIDBackground->GetPIDResponse();
520
521 valueAssElectron[1] = track2->Pt() ;
8a9b2231 522
523 fAssElectron->Fill( valueAssElectron) ;
524 }
525 //printf(Form("Associated Pool: fCounterPoolBackground %d \n", fCounterPoolBackground));
526 }
527 return fnumberfound;
76d0b522 528}
529
530//_____________________________________________________________________________________________
531Int_t AliHFENonPhotonicElectron::LookAtNonHFE(Int_t iTrack1, AliVTrack *track1, AliVEvent *vEvent, Double_t weight, Int_t binct, Double_t deltaphi, Int_t source, Int_t indexmother)
532{
533 //
534 // Look At Non HFE
535 //
536
537 /***********************************************************************************
538 * *
539 * iTrack1: index of the tagged electrons in AliVEvent *
540 * track1: tagged electron *
541 * vEvent: event *
542 * weight: weight in pt if not realistic *
543 * binct: centrality bin *
544 * deltaphi: phi-phi event plane for v2 *
545 * source: MC sources *
546 * indexmother: MC index mother *
547 * *
548 * *
549 * return -1 if nothing *
550 * return 2 if opposite charge within the mass range *
551 * return 4 if like charge within the mass range *
552 * return 6 if opposite & like charge within the mass range *
553 * *
554 ***********************************************************************************/
555
556 AliAODEvent *aodeventu = dynamic_cast<AliAODEvent*>(vEvent);
557 Int_t taggedphotonic = -1;
558
559 AliDebug(2,Form("fCounterPoolBackground %d in LookAtNonHFE!!!",fCounterPoolBackground));
560 if(!fArraytrack) return taggedphotonic;
561 AliDebug(2,Form("process track %d",iTrack1));
562
8a9b2231 563 fkPIDRespons = fPIDBackground->GetPIDResponse();
76d0b522 564
8a9b2231 565 //Set Fill-Arrays for THnSparse
c3e32eae 566 Double_t valueIncElectron[3] = { binct, track1->Pt(), source}; //Centrality Pt Source P
8a9b2231 567 Double_t valueSign[7] = { deltaphi, binct, track1->Pt(), -1, source, -1, -1}; //DeltaPhi Centrality Pt InvariantMass Source Angle Pt
568 //Double_t valueAngle[3] = { -1, binct, source}; //Angle Centrality Source
76d0b522 569
570 Int_t pdg1 = CheckPdg(TMath::Abs(track1->GetLabel()));
8a9b2231 571 Double_t eMass = TDatabasePDG::Instance()->GetParticle(11)->Mass(); //Electron mass in GeV
572 Double_t bfield = vEvent->GetMagneticField();
573
574 AliVTrack *track2 = 0x0;
76d0b522 575 Int_t iTrack2 = 0;
76d0b522 576 Int_t indexmother2 = -1;
8a9b2231 577 Int_t pdg2 = -100;
578 Int_t source2 = -1;
76d0b522 579 Int_t fPDGtrack2 = 0;
8a9b2231 580 Float_t fCharge2 = 0;
581
c3e32eae 582 // count number of matches with opposite/same sign track in the given mass range
583 Int_t countsMatchLikesign(0),
584 countsMatchUnlikesign(0);
585
8a9b2231 586 Double_t dca12 = 0;
587
588 TLorentzVector electron1;
589 TLorentzVector electron2;
590 TLorentzVector mother;
76d0b522 591
76d0b522 592 Double_t xt1 = 0; //radial position track 1 at the DCA point
593 Double_t xt2 = 0; //radial position track 2 at the DCA point
594 Double_t p1[3] = {0,0,0};
595 Double_t p2[3] = {0,0,0};
8a9b2231 596 Double_t angleESD = -1;
597 Double_t invmassESD = -1;
76d0b522 598
8a9b2231 599 Double_t chi2OverNDF = -1;
76d0b522 600 Double_t width = 0;
8a9b2231 601 Double_t angleAOD = -1;
602 Double_t invmassAOD = -1;
76d0b522 603
8a9b2231 604 AliKFVertex primV(*(vEvent->GetPrimaryVertex()));
76d0b522 605
8a9b2231 606 Float_t fCharge1 = track1->Charge(); //Charge from track1
607 Int_t fPDGtrack1 = 11;
608 if(fCharge1>0) fPDGtrack1 = -11;
609 AliKFParticle ktrack1(*track1, fPDGtrack1);
610 AliESDtrack *esdtrack1 = dynamic_cast<AliESDtrack *>(track1); //ESD-track1
76d0b522 611
8a9b2231 612 AliESDtrack *esdtrack2 = 0x0;
76d0b522 613
8a9b2231 614 Bool_t kUSignPhotonic = kFALSE;
615 Bool_t kLSignPhotonic = kFALSE;
616 Bool_t kHasdcaT1 = kFALSE;
617 Bool_t kHasdcaT2 = kFALSE;
76d0b522 618
8a9b2231 619 //! FILL Inclusive Electron
620 fIncElectron->Fill(valueIncElectron,weight);
621 fnumberfound++;
622 //printf(Form("Inclusive Pool: TrackNr. %d, fnumberfound %d \n", iTrack1, fnumberfound));
76d0b522 623
c3e32eae 624 for(Int_t idex = 0; idex < fCounterPoolBackground; idex++){
76d0b522 625 iTrack2 = fArraytrack->At(idex);
626 AliDebug(2,Form("track %d",iTrack2));
627 track2 = (AliVTrack *)vEvent->GetTrack(iTrack2);
628
c3e32eae 629 if(!track2){
8a9b2231 630 //printf("ERROR: Could not receive track %d", iTrack2);
76d0b522 631 continue;
632 }
633
76d0b522 634 fCharge2 = track2->Charge(); //Charge from track2
635
636 // Reset the MC info
959ea9d8 637 //valueAngle[2] = source;
638 valueSign[4] = source;
8a9b2231 639 valueSign[6] = track2->Pt();
76d0b522 640
641 // track cuts and PID already done
642
8a9b2231 643 // Checking if it is the same Track!
644 if(iTrack2==iTrack1) continue;
645 AliDebug(2,"Different");
646
76d0b522 647 // if MC look
c3e32eae 648 if(fMCEvent || fAODArrayMCInfo){
76d0b522 649 source2 = FindMother(TMath::Abs(track2->GetLabel()), indexmother2);
650 pdg2 = CheckPdg(TMath::Abs(track2->GetLabel()));
651
c3e32eae 652 if(source2 >=0 ){
653 if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0)){
654 switch(source){
655 case kElectronfromconversion:
656 valueSign[4] = kElectronfromconversionboth;
657 break;
658 case kElectronfrompi0:
659 valueSign[4] = kElectronfrompi0both;
660 break;
661 case kElectronfrometa:
662 valueSign[4] = kElectronfrometaboth;
663 break;
664 };
665 }
76d0b522 666 }
667 }
668
8a9b2231 669
c3e32eae 670 if(fAlgorithmMA && (!aodeventu)){
76d0b522 671 /** *
672 * ESD-Analysis *
673 ** */
674
76d0b522 675 esdtrack2 = dynamic_cast<AliESDtrack *>(track2); //ESD-track2
676 if((!esdtrack1) || (!esdtrack2)) continue;
677
678 dca12 = esdtrack2->GetDCA(esdtrack1,bfield,xt2,xt1); //DCA track1-track2
679
680 if(dca12 > fMaxDCA) continue; //! Cut on DCA
681
682 //Momento of the track extrapolated to DCA track-track
8a9b2231 683 kHasdcaT1 = esdtrack1->GetPxPyPzAt(xt1,bfield,p1); //Track1
684 kHasdcaT2 = esdtrack2->GetPxPyPzAt(xt2,bfield,p2); //Track2
685 if(!kHasdcaT1 || !kHasdcaT2) AliWarning("It could be a problem in the extrapolation");
686
687 electron1.SetXYZM(p1[0], p1[1], p1[2], eMass);
688 electron2.SetXYZM(p2[0], p2[1], p2[2], eMass);
76d0b522 689
8a9b2231 690// electron1.SetXYZM(esdtrack1->Px(), esdtrack1->Py(), esdtrack1->Pz(), eMass);
691// electron2.SetXYZM(esdtrack2->Px(), esdtrack2->Py(), esdtrack2->Pz(), eMass);
76d0b522 692
693 mother = electron1 + electron2;
694 invmassESD = mother.M();
695 angleESD = TVector2::Phi_0_2pi(electron1.Angle(electron2.Vect()));
696
959ea9d8 697 //valueAngle[0] = angleESD;
8a9b2231 698 valueSign[3] = invmassESD;
959ea9d8 699 valueSign[5] = angleESD;
76d0b522 700
959ea9d8 701 //if((fCharge1*fCharge2)>0.0) fLSignAngle->Fill(&valueAngle[0],weight);
702 //else fUSignAngle->Fill(&valueAngle[0],weight);
76d0b522 703
704 if(angleESD > fMaxOpening3D) continue; //! Cut on Opening Angle
76d0b522 705 if(invmassESD > fMaxInvMass) continue; //! Cut on Invariant Mass
706
c3e32eae 707 if((fCharge1*fCharge2)>0.0){
708 fLSign->Fill( valueSign, weight);
709 // count like-sign background matched pairs per inclusive based on mass cut
710 if(invmassESD < 0.14) countsMatchLikesign++;
711 } else {
712 fUSign->Fill( valueSign, weight);
713 // count unlike-sign matched pairs per inclusive based on mass cut
714 if(invmassESD < 0.14) countsMatchUnlikesign++;
715 }
8a9b2231 716
717 if((fCharge1*fCharge2)>0.0) kLSignPhotonic=kTRUE;
718 else kUSignPhotonic=kTRUE;
c3e32eae 719 } else {
76d0b522 720 /** *
959ea9d8 721 * AOD-AliKF-Analysis *
76d0b522 722 ** */
723
8a9b2231 724 //printf("AOD HFE non photonic\n");
76d0b522 725
8a9b2231 726 fPDGtrack2 = 11;
76d0b522 727 if(fCharge2>0) fPDGtrack2 = -11;
728
c3e32eae 729 AliKFParticle::SetField(vEvent->GetMagneticField());
8a9b2231 730 AliKFParticle ktrack2(*track2, fPDGtrack2);
731 AliKFParticle recoGamma(ktrack1,ktrack2);
76d0b522 732
733 if(recoGamma.GetNDF()<1) continue; //! Cut on Reconstruction
734
735 chi2OverNDF = recoGamma.GetChi2()/recoGamma.GetNDF();
736 if(TMath::Sqrt(TMath::Abs(chi2OverNDF))>fChi2OverNDFCut) continue;
737
738 // DCA
739 //Double_t dca12 = ktrack1.GetDistanceFromParticle(ktrack2);
740 //if(dca12 > fMaxDCA) continue;
741
742 // if set mass constraint
743 if(fSetMassConstraint) //&& pVtx)
744 {
c3e32eae 745 primV += recoGamma;
746 primV -= ktrack1;
747 primV -= ktrack2;
748 recoGamma.SetProductionVertex(primV);
749 recoGamma.SetMassConstraint(0,0.0001);
76d0b522 750 }
751
752 recoGamma.GetMass(invmassAOD,width);
8a9b2231 753 angleAOD = ktrack1.GetAngle(ktrack2);
76d0b522 754
959ea9d8 755 //valueAngle[0] = angleAOD;
8a9b2231 756 valueSign[3] = invmassAOD;
959ea9d8 757 valueSign[5] = angleAOD;
76d0b522 758
959ea9d8 759 //if((fCharge1*fCharge2)>0.0) fLSignAngle->Fill(&valueAngle[0],weight);
760 //else fUSignAngle->Fill(&valueAngle[0],weight);
76d0b522 761
762 if(angleAOD > fMaxOpening3D) continue; //! Cut on Opening Angle
76d0b522 763 if(invmassAOD > fMaxInvMass) continue; //! Cut on Invariant Mass
764
c3e32eae 765 if((fCharge1*fCharge2)>0.0){
766 fLSign->Fill( valueSign, weight);
767 // count like-sign background matched pairs per inclusive based on mass cut
768 if(invmassAOD < 0.14) countsMatchLikesign++;
769 } else {
770 fUSign->Fill( valueSign, weight);
771 // count unlike-sign matched pairs per inclusive based on mass cut
772 if(invmassAOD < 0.14) countsMatchUnlikesign++;
773 }
8a9b2231 774
775 if((fCharge1*fCharge2)>0.0) kLSignPhotonic=kTRUE;
776 else kUSignPhotonic=kTRUE;
76d0b522 777 }
778 }
779
c3e32eae 780 // Fill counted
781 Double_t valCountsLS[3] = {binct, track1->Pt(), countsMatchLikesign},
782 valCountsUS[3] = {binct, track1->Pt(), countsMatchUnlikesign};
783 fUSmatches->Fill(valCountsUS);
784 fLSmatches->Fill(valCountsLS);
785
8a9b2231 786 if( kUSignPhotonic && kLSignPhotonic) taggedphotonic = 6;
787 if(!kUSignPhotonic && kLSignPhotonic) taggedphotonic = 4;
788 if( kUSignPhotonic && !kLSignPhotonic) taggedphotonic = 2;
76d0b522 789
790 return taggedphotonic;
791}
792
793//_________________________________________________________________________
794Int_t AliHFENonPhotonicElectron::FindMother(Int_t tr, Int_t &indexmother){
795 //
796 // Find the mother if MC
797 //
798
799 if(!fMCEvent && !fAODArrayMCInfo) return 0;
800
801 Int_t pdg = CheckPdg(tr);
802 if(TMath::Abs(pdg)!= 11)
803 {
804 indexmother = -1;
805 return kNoElectron;
806 }
807
808 indexmother = IsMotherGamma(tr);
809 if(indexmother > 0) return kElectronfromconversion;
810 indexmother = IsMotherPi0(tr);
811 if(indexmother > 0) return kElectronfrompi0;
812 indexmother = IsMotherC(tr);
813 if(indexmother > 0) return kElectronfromC;
814 indexmother = IsMotherB(tr);
815 if(indexmother > 0) return kElectronfromB;
816 indexmother = IsMotherEta(tr);
817 if(indexmother > 0) return kElectronfrometa;
818
819 return kElectronfromother;
820}
821
822//________________________________________________________________________________________________
823Int_t AliHFENonPhotonicElectron::CheckPdg(Int_t tr) {
824
825 //
826 // Return the pdg of the particle
827 //
828
829 Int_t pdgcode = -1;
830 if(tr < 0) return pdgcode;
831
832 if(fMCEvent)
833 {
834 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
835 if(!mctrack) return -1;
836 AliMCParticle *mctrackesd = NULL;
837 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return pdgcode;
838 pdgcode = mctrackesd->PdgCode();
839 }
840
841 if(fAODArrayMCInfo)
842 {
843 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
844 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
845 if(!mctrackaod) return pdgcode;
846 pdgcode = mctrackaod->GetPdgCode();
847 }
848
849 return pdgcode;
850}
851
852//_______________________________________________________________________________________________
853Int_t AliHFENonPhotonicElectron::IsMotherGamma(Int_t tr) {
854
855 //
856 // Return the lab of gamma mother or -1 if not gamma
857 //
858
859 if(tr < 0) return -1;
860
861 if(fMCEvent)
862 {
863 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
864 if(!mctrack) return -1;
865 AliMCParticle *mctrackesd = NULL;
866 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return -1;
867 TParticle *particle = 0x0;
868 particle = mctrackesd->Particle();
869
870 // Take mother
871 if(!particle) return -1;
872 Int_t imother = particle->GetFirstMother();
873 if(imother < 0) return -1;
874 AliMCParticle *mothertrack = NULL;
875 if(!(mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(imother))))) return -1;
876 TParticle * mother = mothertrack->Particle();
877 if(!mother) return -1;
878
879 // Check gamma
880 Int_t pdg = mother->GetPdgCode();
881 if(TMath::Abs(pdg) == 22) return imother;
882 if(TMath::Abs(pdg) == 11)
883 {
884 return IsMotherGamma(imother);
885 }
886
887 return -1;
888 }
889
890 if(fAODArrayMCInfo)
891 {
892 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
893 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
894 if(!mctrackaod) return -1;
895
896 // Take mother
897 Int_t imother = mctrackaod->GetMother();
898 if(imother < 0 || ((imother+1)>fAODArrayMCInfo->GetEntriesFast())) return -1;
899 AliAODMCParticle *mothertrack = NULL;
900 if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(imother))))) return -1;
901
902 // Check gamma
903 Int_t pdg = mothertrack->GetPdgCode();
904 if(TMath::Abs(pdg) == 22) return imother;
905 if(TMath::Abs(pdg) == 11)
906 {
907 return IsMotherGamma(imother);
908 }
909
910 return -1;
911 }
912
913 return -1;
914}
915
916//________________________________________________________________________________________________
917Int_t AliHFENonPhotonicElectron::IsMotherPi0(Int_t tr) {
918
919 //
920 // Return the lab of pi0 mother or -1 if not pi0
921 //
922
923 if(tr < 0) return -1;
924
925 if(fMCEvent)
926 {
927 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
928 if(!mctrack) return -1;
929 AliMCParticle *mctrackesd = NULL;
930 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return -1;
931 TParticle *particle = 0x0;
932 particle = mctrackesd->Particle();
933 // Take mother
934 if(!particle) return -1;
935 Int_t imother = particle->GetFirstMother();
936 if(imother < 0) return -1;
937 AliMCParticle *mothertrack = NULL;
938 if(!(mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(imother))))) return -1;
939 TParticle * mother = mothertrack->Particle();
940 if(!mother) return -1;
941 // Check pi0
942 Int_t pdg = mother->GetPdgCode();
943 if(TMath::Abs(pdg) == 111) return imother;
944 if(TMath::Abs(pdg) == 11)
945 {
946 return IsMotherPi0(imother);
947 }
948
949 return -1;
950 }
951
952 if(fAODArrayMCInfo) {
953
954 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
955 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
956 if(!mctrackaod) return -1;
957
958 // Take mother
959 Int_t imother = mctrackaod->GetMother();
960 if(imother < 0 || ((imother+1)>fAODArrayMCInfo->GetEntriesFast())) return -1;
961 AliAODMCParticle *mothertrack = NULL;
962 if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(imother))))) return -1;
963 // Check pi0
964 Int_t pdg = mothertrack->GetPdgCode();
965 if(TMath::Abs(pdg) == 111) return imother;
966 if(TMath::Abs(pdg) == 11)
967 {
968 return IsMotherPi0(imother);
969 }
970
971 return -1;
972 }
973
974 return -1;
975}
976//________________________________________________________________________________________________
977Int_t AliHFENonPhotonicElectron::IsMotherC(Int_t tr) {
978
979 //
980 // Return the lab of signal mother or -1 if not from C
981 //
982
983 if(tr < 0) return -1;
984
985 if(fMCEvent)
986 {
987 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
988 if(!mctrack) return -1;
989 AliMCParticle *mctrackesd = NULL;
990 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return -1;
991 TParticle *particle = 0x0;
992 particle = mctrackesd->Particle();
993
994 // Take mother
995 if(!particle) return -1;
996 Int_t imother = particle->GetFirstMother();
997 if(imother < 0) return -1;
998 AliMCParticle *mothertrack = NULL;
999 if(!(mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(imother))))) return -1;
1000 TParticle * mother = mothertrack->Particle();
1001 if(!mother) return -1;
1002
1003 // Check C
1004 Int_t pdg = mother->GetPdgCode();
1005 if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
1006 if(TMath::Abs(pdg) == 11)
1007 {
1008 return IsMotherC(imother);
1009 }
1010
1011 return -1;
1012 }
1013
1014 if(fAODArrayMCInfo)
1015 {
1016 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
1017 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
1018 if(!mctrackaod) return -1;
1019
1020 // Take mother
1021 Int_t imother = mctrackaod->GetMother();
1022 if(imother < 0 || ((imother+1)>fAODArrayMCInfo->GetEntriesFast())) return -1;
1023 AliAODMCParticle *mothertrack = NULL;
1024 if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(imother))))) return -1;
1025
1026 // Check C
1027 Int_t pdg = mothertrack->GetPdgCode();
1028 if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
1029 if(TMath::Abs(pdg) == 11)
1030 {
1031 return IsMotherC(imother);
1032 }
1033
1034 return -1;
1035 }
1036
1037 return -1;
1038}
1039//_______________________________________________________________________________________________
1040Int_t AliHFENonPhotonicElectron::IsMotherB(Int_t tr) {
1041
1042 //
1043 // Return the lab of signal mother or -1 if not B
1044 //
1045
1046 if(tr < 0) return -1;
1047
1048 if(fMCEvent)
1049 {
1050 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
1051 if(!mctrack) return -1;
1052 AliMCParticle *mctrackesd = NULL;
1053 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return -1;
1054 TParticle *particle = 0x0;
1055 particle = mctrackesd->Particle();
1056
1057 // Take mother
1058 if(!particle) return -1;
1059 Int_t imother = particle->GetFirstMother();
1060 if(imother < 0) return -1;
1061 AliMCParticle *mothertrack = NULL;
1062 if(!(mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(imother))))) return -1;
1063 TParticle * mother = mothertrack->Particle();
1064 if(!mother) return -1;
1065
1066 // Check B
1067 Int_t pdg = mother->GetPdgCode();
1068 if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
1069 if(TMath::Abs(pdg) == 11)
1070 {
1071 return IsMotherB(imother);
1072 }
1073
1074 return -1;
1075 }
1076
1077 if(fAODArrayMCInfo)
1078 {
1079 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
1080 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
1081 if(!mctrackaod) return -1;
1082
1083 // Take mother
1084 Int_t imother = mctrackaod->GetMother();
1085 if(imother < 0 || ((imother+1)>fAODArrayMCInfo->GetEntriesFast())) return -1;
1086 AliAODMCParticle *mothertrack = NULL;
1087 if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(imother))))) return -1;
1088 // Check B
1089 Int_t pdg = mothertrack->GetPdgCode();
1090 if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
1091 if(TMath::Abs(pdg) == 11)
1092 {
1093 return IsMotherB(imother);
1094 }
1095
1096 return -1;
1097 }
1098
1099 return -1;
1100}
1101
1102//_______________________________________________________________________________________________
1103Int_t AliHFENonPhotonicElectron::IsMotherEta(Int_t tr) {
1104
1105 //
1106 // Return the lab of eta mother or -1 if not eta
1107 //
1108
1109 if(tr < 0) return -1;
1110
1111 if(fMCEvent)
1112 {
1113 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
1114 if(!mctrack) return -1;
1115 AliMCParticle *mctrackesd = NULL;
1116 if(!(mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) return -1;
1117 TParticle *particle = 0x0;
1118 particle = mctrackesd->Particle();
1119
1120 // Take mother
1121 if(!particle) return -1;
1122 Int_t imother = particle->GetFirstMother();
1123 if(imother < 0) return -1;
1124 AliMCParticle *mothertrack = NULL;
1125 if(!(mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(imother))))) return -1;
1126 TParticle * mother = mothertrack->Particle();
1127 if(!mother) return -1;
1128
1129 // Check eta
1130 Int_t pdg = mother->GetPdgCode();
1131 if(TMath::Abs(pdg) == 221) return imother;
1132 if(TMath::Abs(pdg) == 11)
1133 {
1134 return IsMotherEta(imother);
1135 }
1136
1137 return -1;
1138 }
1139
1140 if(fAODArrayMCInfo)
1141 {
1142 if((tr+1)>fAODArrayMCInfo->GetEntriesFast()) return -1;
1143 AliAODMCParticle *mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
1144 if(!mctrackaod) return -1;
1145
1146 // Take mother
1147 Int_t imother = mctrackaod->GetMother();
1148 if(imother < 0 || ((imother+1)>fAODArrayMCInfo->GetEntriesFast())) return -1;
1149 AliAODMCParticle *mothertrack = NULL;
1150 if(!(mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(imother))))) return -1;
1151
1152 // Check eta
1153 Int_t pdg = mothertrack->GetPdgCode();
1154 if(TMath::Abs(pdg) == 221) return imother;
1155 if(TMath::Abs(pdg) == 11)
1156 {
1157 return IsMotherEta(imother);
1158 }
1159
1160 return -1;
1161 }
1162
1163 return -1;
1164}