1 /*************************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
16 *************************************************************************************/
18 /*************************************************************************************
20 * Class for the Selection of Non-Heavy-Flavour-Electrons trought *
21 * the invariant mass method. The selection can be done from two *
22 * different algorithms, which can be choosed calling the function *
23 * "SetAlgorithm(TString Algorithm)". *
25 * Authors: R.Bailhache, C.A.Schmidt *
27 *************************************************************************************/
30 #include "THnSparse.h"
32 #include "TLorentzVector.h"
33 #include "TParticle.h"
35 #include "TDatabasePDG.h"
37 #include "AliVEvent.h"
38 #include "AliMCEvent.h"
39 #include "AliESDEvent.h"
40 #include "AliMCParticle.h"
41 #include "AliAODMCParticle.h"
42 #include "AliAODEvent.h"
43 #include "AliAODVertex.h"
44 #include "AliAODTrack.h"
45 #include "AliVTrack.h"
46 #include "AliESDtrack.h"
47 #include "AliESDtrackCuts.h"
48 #include "AliPIDResponse.h"
52 #include "AliKFParticle.h"
53 #include "AliKFVertex.h"
55 #include "AliHFEcuts.h"
56 #include "AliHFEpid.h"
57 #include "AliHFEpidQAmanager.h"
58 #include "AliHFEtools.h"
59 #include "AliHFEmcQA.h"
61 #include "AliHFENonPhotonicElectron.h"
63 ClassImp(AliHFENonPhotonicElectron)
64 //________________________________________________________________________
65 AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Char_t *title)
69 ,fAODArrayMCInfo (NULL)
71 ,fHFEBackgroundCuts (NULL)
78 ,fStudyRadius (kFALSE)
80 ,fChi2OverNDFCut (3.0)
82 // ,fMaxOpeningTheta (0.02)
83 // ,fMaxOpeningPhi (0.1)
84 ,fMaxOpening3D (TMath::Pi())
86 ,fSetMassConstraint (kFALSE)
87 ,fSelectCategory1tracks(kTRUE)
88 ,fSelectCategory2tracks(kFALSE)
93 ,fEtaDalitzWeightFactor(1.0)
95 ,fCounterPoolBackground (0)
105 ,fWeightsSource(NULL)
106 ,fIncElectronRadius(NULL)
107 ,fRecElectronRadius(NULL)
108 // ,fUSignAngle (NULL)
109 // ,fLSignAngle (NULL)
111 ,fNumberofGenerations(1)
112 ,fDisplayMCStack(kFALSE)
117 fPIDBackground = new AliHFEpid("hfePidBackground");
118 fPIDBackgroundQA = new AliHFEpidQAmanager;
121 //________________________________________________________________________
122 AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
126 ,fAODArrayMCInfo (NULL)
128 ,fHFEBackgroundCuts (NULL)
129 ,fPIDBackground (0x0)
130 ,fPIDBackgroundQA (0)
135 ,fStudyRadius (kFALSE)
136 ,fAlgorithmMA (kTRUE)
137 ,fChi2OverNDFCut (3.0)
139 // ,fMaxOpeningTheta (0.02)
140 // ,fMaxOpeningPhi (0.1)
141 ,fMaxOpening3D (TMath::TwoPi())
143 ,fSetMassConstraint (kFALSE)
144 ,fSelectCategory1tracks(kTRUE)
145 ,fSelectCategory2tracks(kFALSE)
150 ,fEtaDalitzWeightFactor(1.0)
152 ,fCounterPoolBackground (0)
162 ,fWeightsSource(NULL)
163 ,fIncElectronRadius(NULL)
164 ,fRecElectronRadius(NULL)
165 // ,fUSignAngle (NULL)
166 // ,fLSignAngle (NULL)
168 ,fNumberofGenerations(1)
169 ,fDisplayMCStack(kFALSE)
174 fPIDBackground = new AliHFEpid("hfePidBackground");
175 fPIDBackgroundQA = new AliHFEpidQAmanager;
178 //________________________________________________________________________
179 AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElectron &ref)
183 ,fAODArrayMCInfo (NULL)
184 ,fLevelBack (ref.fLevelBack)
185 ,fHFEBackgroundCuts (ref.fHFEBackgroundCuts)
186 ,fPIDBackground (ref.fPIDBackground)
187 ,fPIDBackgroundQA (ref.fPIDBackgroundQA)
188 ,fkPIDRespons (ref.fkPIDRespons)
189 ,fPtBinning (ref.fPtBinning)
190 ,fEtaBinning (ref.fEtaBinning)
191 ,fInvMassBinning (ref.fInvMassBinning)
192 ,fStudyRadius (ref.fStudyRadius)
193 ,fAlgorithmMA (ref.fAlgorithmMA)
194 ,fChi2OverNDFCut (ref.fChi2OverNDFCut)
195 ,fMaxDCA (ref.fMaxDCA)
196 // ,fMaxOpeningTheta (ref.fMaxOpeningTheta)
197 // ,fMaxOpeningPhi (ref.fMaxOpeningPhi)
198 ,fMaxOpening3D (ref.fMaxOpening3D)
199 ,fMaxInvMass (ref.fMaxInvMass)
200 ,fSetMassConstraint (ref.fSetMassConstraint)
201 ,fSelectCategory1tracks(ref.fSelectCategory1tracks)
202 ,fSelectCategory2tracks(ref.fSelectCategory2tracks)
203 ,fITSmeanShift(ref.fITSmeanShift)
204 ,fITSnSigmaHigh(ref.fITSnSigmaHigh)
205 ,fITSnSigmaLow(ref.fITSnSigmaLow)
207 ,fEtaDalitzWeightFactor(ref.fEtaDalitzWeightFactor)
209 ,fCounterPoolBackground (0)
211 ,fListOutput (ref.fListOutput)
212 ,fAssElectron (ref.fAssElectron)
213 ,fIncElectron (ref.fIncElectron)
216 ,fUSmatches(ref.fUSmatches)
217 ,fLSmatches(ref.fLSmatches)
218 ,fHnsigmaITS(ref.fHnsigmaITS)
219 ,fWeightsSource(ref.fWeightsSource)
220 ,fIncElectronRadius(ref.fIncElectronRadius)
221 ,fRecElectronRadius(ref.fRecElectronRadius)
222 // ,fUSignAngle (ref.fUSignAngle)
223 // ,fLSignAngle (ref.fLSignAngle)
225 ,fNumberofGenerations(1)
226 ,fDisplayMCStack(kFALSE)
234 //____________________________________________________________
235 AliHFENonPhotonicElectron &AliHFENonPhotonicElectron::operator=(const AliHFENonPhotonicElectron &ref){
237 // Assignment operator
239 if(this == &ref) ref.Copy(*this);
243 //_________________________________________
244 AliHFENonPhotonicElectron::~AliHFENonPhotonicElectron()
249 if(fArraytrack) delete fArraytrack;
250 //if(fHFEBackgroundCuts) delete fHFEBackgroundCuts;
251 if(fPIDBackground) delete fPIDBackground;
252 if(fPIDBackgroundQA) delete fPIDBackgroundQA;
255 //_____________________________________________________________________________________________
256 void AliHFENonPhotonicElectron::Init()
262 //printf("Analysis Mode for AliHFENonPhotonicElectron: %s Analysis\n", fIsAOD ? "AOD" : "ESD");
264 if(!fListOutput) fListOutput = new TList;
265 fListOutput->SetName("HFENonPhotonicElectron");
266 fListOutput->SetOwner();
268 if(!fHFEBackgroundCuts) fHFEBackgroundCuts = new AliHFEcuts();
269 if(fIsAOD) fHFEBackgroundCuts->SetAOD();
270 fHFEBackgroundCuts->Initialize();
271 if(fHFEBackgroundCuts->IsQAOn()) {
272 fListOutput->Add(fHFEBackgroundCuts->GetQAhistograms());
276 if(!fPIDBackground) fPIDBackground = new AliHFEpid("default pid");
277 if(fMCEvent || fAODArrayMCInfo) fPIDBackground->SetHasMCData(kTRUE); // does nothing since the fMCEvent are set afterwards at the moment
278 if(!fPIDBackground->GetNumberOfPIDdetectors())
280 //fPIDBackground->AddDetector("TOF", 0);
281 fPIDBackground->AddDetector("TPC", 0);
283 AliInfo("PID Background QA switched on");
284 fPIDBackgroundQA->Initialize(fPIDBackground);
285 fListOutput->Add(fPIDBackgroundQA->MakeList("HFENP_PID_Background"));
286 fPIDBackground->SortDetectors();
288 const Int_t kBinsPtDefault = 35;
289 Double_t binLimPtDefault[kBinsPtDefault+1] = {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.};
290 const Int_t kBinsEtaInclusiveDefault = 8;
291 Double_t binLimEtaInclusiveDefault[kBinsEtaInclusiveDefault+1] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
292 const Int_t kBinsEtaAssociated = 15;
293 Double_t binLimEtaAssociat[kBinsEtaAssociated+1] = {-1.5,-1.3,-1.1,-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9,1.1,1.3,1.5};
295 if(!fPtBinning.GetSize()) fPtBinning.Set(kBinsPtDefault+1, binLimPtDefault);
296 if(!fEtaBinning.GetSize()) fEtaBinning.Set(kBinsEtaInclusiveDefault+1, binLimEtaInclusiveDefault);
298 //Int_t nBinsP = 400;
299 //Double_t minP = 0.0;
300 //Double_t maxP = 20.0;
301 //Double_t binLimP[nBinsP+1];
302 //for(Int_t i=0; i<=nBinsP; i++) binLimP[i]=(Double_t)minP + (maxP-minP)/nBinsP*(Double_t)i ;
306 Double_t maxC = 11.0;
307 Double_t binLimC[nBinsC+1];
308 for(Int_t i=0; i<=nBinsC; i++) binLimC[i]=(Double_t)minC + (maxC-minC)/nBinsC*(Double_t)i ;
310 Int_t nBinsSource = 12;
311 Double_t minSource = 0.;
312 Double_t maxSource = 12.;
313 Double_t binLimSource[nBinsSource+1];
314 for(Int_t i=0; i<=nBinsSource; i++) binLimSource[i]=(Double_t)minSource + (maxSource-minSource)/nBinsSource*(Double_t)i ;
316 Int_t nBinsInvMass = 30;
317 Double_t minInvMass = 0.;
318 Double_t maxInvMass = 0.3;
319 Double_t binLimInvMass[nBinsInvMass+1];
320 for(Int_t i=0; i<=nBinsInvMass; i++) binLimInvMass[i]=(Double_t)minInvMass + (maxInvMass-minInvMass)/nBinsInvMass*(Double_t)i ;
321 if(!fInvMassBinning.GetSize()) fInvMassBinning.Set(nBinsInvMass+1, binLimInvMass);
324 Double_t minPhi = 0.0;
325 Double_t maxPhi = TMath::Pi();
326 Double_t binLimPhi[nBinsPhi+1];
327 for(Int_t i=0; i<=nBinsPhi; i++)
329 binLimPhi[i]=(Double_t)minPhi + (maxPhi-minPhi)/nBinsPhi*(Double_t)i ;
330 AliDebug(2,Form("bin phi is %f for %d",binLimPhi[i],i));
333 //now used for pair generation
334 Int_t nBinsGen = fNumberofGenerations;
336 Double_t maxGen = fNumberofGenerations;
337 Double_t binLimGen[nBinsGen+1];
338 for(Int_t i=0; i<=nBinsGen; i++)
340 binLimGen[i]=(Double_t)minGen + (maxGen-minGen)/nBinsGen*(Double_t)i ;
341 AliDebug(2,Form("bin Generation is %f for %d",binLimGen[i],i));
344 // Constrain histograms
345 const Int_t nDimSingle=4;
346 const Int_t nDimPair=9;
347 Int_t nBinPair[nDimPair] = {nBinsPhi,nBinsC,fPtBinning.GetSize()-1,fInvMassBinning.GetSize()-1,nBinsSource,nBinsGen,fPtBinning.GetSize()-1,fEtaBinning.GetSize()-1,kBinsEtaAssociated};
349 // Associated Electron
350 Int_t nBinAssElectron[nDimSingle] = {nBinsC,fPtBinning.GetSize()-1,nBinsSource,kBinsEtaAssociated};
351 fAssElectron = new THnSparseF("fAssElectron","fAssElectron",nDimSingle,nBinAssElectron);
352 fAssElectron->SetBinEdges(0,binLimC);
353 fAssElectron->SetBinEdges(1,fPtBinning.GetArray());
354 fAssElectron->SetBinEdges(2,binLimSource);
355 fAssElectron->SetBinEdges(3,binLimEtaAssociat);
356 fAssElectron->Sumw2();
357 AliDebug(2,"AliHFENonPhotonicElectron: fAssElectron");
359 // Inclusive Electron
360 Int_t nBinIncElectron[nDimSingle] = {nBinsC,fPtBinning.GetSize()-1,nBinsSource,fEtaBinning.GetSize()-1};
361 fIncElectron = new THnSparseF("fIncElectron","fIncElectron",nDimSingle,nBinIncElectron);
362 fIncElectron->SetBinEdges(0,binLimC);
363 fIncElectron->SetBinEdges(1,fPtBinning.GetArray());
364 fIncElectron->SetBinEdges(2,binLimSource);
365 fIncElectron->SetBinEdges(3,fEtaBinning.GetArray());
366 fIncElectron->Sumw2();
367 AliDebug(2,"AliHFENonPhotonicElectron: fIncElectron");
369 // ee invariant mass Unlike Sign
370 fUSign = new THnSparseF("fUSign","fUSign",nDimPair,nBinPair);
371 fUSign->SetBinEdges(0,binLimPhi);
372 fUSign->SetBinEdges(1,binLimC);
373 fUSign->SetBinEdges(2,fPtBinning.GetArray());
374 fUSign->SetBinEdges(3,fInvMassBinning.GetArray());
375 fUSign->SetBinEdges(4,binLimSource);
376 fUSign->SetBinEdges(5,binLimGen);
377 fUSign->SetBinEdges(6,fPtBinning.GetArray());
378 fUSign->SetBinEdges(7,fEtaBinning.GetArray());
379 fUSign->SetBinEdges(8,binLimEtaAssociat);
381 AliDebug(2,"AliHFENonPhotonicElectron: fUSign");
383 // ee invariant mass Like Sign
384 fLSign = new THnSparseF("fLSign","fLSign",nDimPair,nBinPair);
385 fLSign->SetBinEdges(0,binLimPhi);
386 fLSign->SetBinEdges(1,binLimC);
387 fLSign->SetBinEdges(2,fPtBinning.GetArray());
388 fLSign->SetBinEdges(3,fInvMassBinning.GetArray());
389 fLSign->SetBinEdges(4,binLimSource);
390 fLSign->SetBinEdges(5,binLimGen);
391 fLSign->SetBinEdges(6,fPtBinning.GetArray());
392 fLSign->SetBinEdges(7,fEtaBinning.GetArray());
393 fLSign->SetBinEdges(8,binLimEtaAssociat);
395 AliDebug(2,"AliHFENonPhotonicElectron: fLSign");
397 // Histograms counting the number of like sign / unlike sign matches per inclusive track
398 const Int_t nBinsMatches = 50;
399 Double_t binLimMatches[nBinsMatches+1];
400 for(Int_t ib = 0; ib <= nBinsMatches; ib++) binLimMatches[ib] = ib;
401 const Int_t nDimMatches = 3; // centrality, pt_inc, number of matches
402 const Int_t nBinsMatchHist[nDimMatches] = {nBinsC, fPtBinning.GetSize()-1, nBinsMatches};
403 fUSmatches = new THnSparseF("fUSmatches", "fUSmatches", nDimMatches, nBinsMatchHist);
404 fUSmatches->SetBinEdges(0,binLimC);
405 fUSmatches->SetBinEdges(1,fPtBinning.GetArray());
406 fUSmatches->SetBinEdges(2,binLimMatches);
408 fLSmatches = new THnSparseF("fLSmatches", "fLSmatches", nDimMatches, nBinsMatchHist);
409 fLSmatches->SetBinEdges(0,binLimC);
410 fLSmatches->SetBinEdges(1,fPtBinning.GetArray());
411 fLSmatches->SetBinEdges(2,binLimMatches);
413 // Histograms for radius studies
414 Int_t nBinsradius = 13;
415 Double_t minradius = 0.0;
416 Double_t maxradius = 25.0;
417 Double_t binLimradius[nBinsradius+1];
418 for(Int_t i=0; i<=nBinsradius; i++) binLimradius[i]=(Double_t)minradius + (maxradius-minradius)/nBinsradius*(Double_t)i ;
419 const Int_t nDimIncElectronRadius = 4; // centrality, pt_inc, radius
420 const Int_t nBinsIncElectronRadius[nDimIncElectronRadius] = {nBinsC, fPtBinning.GetSize()-1, nBinsradius, nBinsSource};
421 fIncElectronRadius = new THnSparseF("fIncElectronRadius", "fIncElectronRadius", nDimIncElectronRadius, nBinsIncElectronRadius);
422 fIncElectronRadius->SetBinEdges(0,binLimC);
423 fIncElectronRadius->SetBinEdges(1,fPtBinning.GetArray());
424 fIncElectronRadius->SetBinEdges(2,binLimradius);
425 fIncElectronRadius->SetBinEdges(3,binLimSource);
426 fIncElectronRadius->Sumw2();
428 fRecElectronRadius = new THnSparseF("fRecElectronRadius", "fRecElectronRadius", nDimIncElectronRadius, nBinsIncElectronRadius);
429 fRecElectronRadius->SetBinEdges(0,binLimC);
430 fRecElectronRadius->SetBinEdges(1,fPtBinning.GetArray());
431 fRecElectronRadius->SetBinEdges(2,binLimradius);
432 fRecElectronRadius->SetBinEdges(3,binLimSource);
433 fRecElectronRadius->Sumw2();
436 // ee angle Unlike Sign
437 const Int_t nDimUSignAngle=3;
438 Int_t nBinUSignAngle[nDimUSignAngle] = {nBinsAngle,nBinsC,nBinsSource};
439 fUSignAngle = new THnSparseF("fUSignAngle","fUSignAngle",nDimUSignAngle,nBinUSignAngle);
440 fUSignAngle->SetBinEdges(0,binLimAngle);
441 fUSignAngle->SetBinEdges(1,binLimC);
442 fUSignAngle->SetBinEdges(2,binLimSource);
443 fUSignAngle->Sumw2();
444 AliDebug(2,"AliHFENonPhotonicElectron: fUSignAngle");
446 // ee angle Like Sign
447 const Int_t nDimLSignAngle=3;
448 Int_t nBinLSignAngle[nDimLSignAngle] = {nBinsAngle,nBinsC,nBinsSource};
449 fLSignAngle = new THnSparseF("fLSignAngle","fLSignAngle",nDimLSignAngle,nBinLSignAngle);
450 fLSignAngle->SetBinEdges(0,binLimAngle);
451 fLSignAngle->SetBinEdges(1,binLimC);
452 fLSignAngle->SetBinEdges(2,binLimSource);
453 fLSignAngle->Sumw2();
454 AliDebug(2,"AliHFENonPhotonicElectron: fLSignAngle");
457 // control histogram for ITS PID
458 fHnsigmaITS = new TH2F("fHnsigmaITS", "Number of sigmas in the ITS", 30, 0., 0.3, 1200, -10., 10.);
460 // control histogram for weights sources
461 fWeightsSource = new TH2F("fWeightsSource", "Source code for weights", 13, -1.5, 11.5, 29, -1.5, 27.5);
463 fListOutput->Add(fAssElectron);
464 fListOutput->Add(fIncElectron);
465 fListOutput->Add(fUSign);
466 fListOutput->Add(fLSign);
467 fListOutput->Add(fUSmatches);
468 fListOutput->Add(fLSmatches);
469 fListOutput->Add(fHnsigmaITS);
470 fListOutput->Add(fWeightsSource);
471 fListOutput->Add(fIncElectronRadius);
472 fListOutput->Add(fRecElectronRadius);
473 // fListOutput->Add(fUSignAngle);
474 // fListOutput->Add(fLSignAngle);
478 //_____________________________________________________________________________________________
479 void AliHFENonPhotonicElectron::SetWithWeights(Int_t levelBack)
482 // Init the HFE level
484 if(levelBack >= 0) fLevelBack = levelBack;
488 //_____________________________________________________________________________________________
489 void AliHFENonPhotonicElectron::SetMCEvent(AliMCEvent *mcEvent)
499 //_____________________________________________________________________________________________
500 void AliHFENonPhotonicElectron::SetAODArrayMCInfo(TClonesArray *aodArrayMCInfo)
503 // Pass the mcEvent info
506 fAODArrayMCInfo = aodArrayMCInfo;
510 //_____________________________________________________________________________________________
511 void AliHFENonPhotonicElectron::InitRun(const AliVEvent *inputEvent,const AliPIDResponse *pidResponse)
519 AliDebug(1, "Using default PID Response");
520 Bool_t hasmc = kFALSE;
521 if(fMCEvent || fAODArrayMCInfo) hasmc=kTRUE;
522 pidResponse = AliHFEtools::GetDefaultPID(hasmc, inputEvent->IsA() == AliESDEvent::Class());
525 if(!fPIDBackground) return;
526 fPIDBackground->SetPIDResponse(pidResponse);
528 if(!fPIDBackground->IsInitialized())
530 // Initialize PID with the given run number
531 fPIDBackground->InitializePID(inputEvent->GetRunNumber());
536 //_____________________________________________________________________________________________
537 Int_t AliHFENonPhotonicElectron::FillPoolAssociatedTracks(AliVEvent *inputEvent, Int_t binct)
540 // Fill the pool of associated tracks
541 // Return the number of associated tracks
546 fHFEBackgroundCuts->SetRecEvent(inputEvent);
547 Int_t nbtracks = inputEvent->GetNumberOfTracks();
550 fArraytrack->~TArrayI();
551 new(fArraytrack) TArrayI(nbtracks);
553 fArraytrack = new TArrayI(nbtracks);
556 fCounterPoolBackground = 0;
558 Bool_t isSelected(kFALSE);
559 Bool_t isAOD = (dynamic_cast<AliAODEvent *>(inputEvent) != NULL);
560 AliDebug(2, Form("isAOD: %s", isAOD ? "yes" : "no"));
561 for(Int_t k = 0; k < nbtracks; k++) {
562 AliVTrack *track = (AliVTrack *) inputEvent->GetTrack(k);
567 if(fSelectCategory1tracks && FilterCategory1Track(track, isAOD, binct)) isSelected = kTRUE;
568 else if(fSelectCategory2tracks && FilterCategory2Track(track, isAOD)) isSelected = kTRUE;
571 AliDebug(2,Form("fCounterPoolBackground %d, track %d",fCounterPoolBackground,k));
572 fArraytrack->AddAt(k,fCounterPoolBackground);
573 fCounterPoolBackground++;
577 //printf(Form("Associated Pool: Tracks %d, fCounterPoolBackground %d \n", nbtracks, fCounterPoolBackground));
579 return fCounterPoolBackground;
583 //_____________________________________________________________________________________________
584 Int_t AliHFENonPhotonicElectron::CountPoolAssociated(AliVEvent *inputEvent, Int_t binct)
587 // Count the pool of assiocated tracks
591 if(fnumberfound > 0) //!count only events with an inclusive electron
593 Double_t valueAssElectron[4] = {(Double_t) binct, -1, -1}; //Centrality Pt Source
595 Int_t indexmother2 = -1;
596 AliVTrack *track2 = 0x0;
598 for(Int_t ii = 0; ii < fCounterPoolBackground; ii++){
599 iTrack2 = fArraytrack->At(ii);
600 AliDebug(2,Form("track %d",iTrack2));
601 track2 = (AliVTrack *)inputEvent->GetTrack(iTrack2);
604 //printf("ERROR: Could not receive track %d", iTrack2);
609 if(fMCEvent || fAODArrayMCInfo) valueAssElectron[2] = FindMother(TMath::Abs(track2->GetLabel()), indexmother2) ;
611 fkPIDRespons = fPIDBackground->GetPIDResponse();
613 valueAssElectron[1] = track2->Pt() ;
614 valueAssElectron[3] = track2->Eta() ;
616 fAssElectron->Fill( valueAssElectron) ;
618 //printf(Form("Associated Pool: fCounterPoolBackground %d \n", fCounterPoolBackground));
623 //_____________________________________________________________________________________________
624 Int_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,Int_t mcQAsource)
630 /***********************************************************************************
632 * iTrack1: index of the tagged electrons in AliVEvent *
633 * track1: tagged electron *
635 * weight: weight in pt if not realistic *
636 * binct: centrality bin *
637 * deltaphi: phi-phi event plane for v2 *
638 * source: MC sources *
639 * indexmother: MC index mother *
642 * return -1 if nothing *
643 * return 2 if opposite charge within the mass range *
644 * return 4 if like charge within the mass range *
645 * return 6 if opposite & like charge within the mass range *
647 ***********************************************************************************/
649 //printf("weight %f and source %d\n",weight,source);
652 AliAODEvent *aodeventu = dynamic_cast<AliAODEvent*>(vEvent);
653 Int_t taggedphotonic = -1;
655 AliDebug(2,Form("fCounterPoolBackground %d in LookAtNonHFE!!!",fCounterPoolBackground));
656 if(!fArraytrack) return taggedphotonic;
657 AliDebug(2,Form("process track %d",iTrack1));
658 AliDebug(1,Form("Inclusive source is %d\n", source));
660 fkPIDRespons = fPIDBackground->GetPIDResponse();
662 //Set Fill-Arrays for THnSparse
663 Double_t valueIncElectron[4] = { (Double_t) binct, track1->Pt(), (Double_t)source, track1->Eta()}; //Centrality Pt Source P
664 Double_t valueSign[9] = { deltaphi, (Double_t)binct, track1->Pt(), -1, (Double_t)source, -1, -1, track1->Eta(), -1}; //DeltaPhi Centrality Pt InvariantMass Source Angle Pt
665 //Double_t valueAngle[3] = { -1, binct, source};
666 Double_t valueradius[4] = { (Double_t)binct, track1->Pt(), 0.,(Double_t)source};
669 Int_t pdg1 = CheckPdg(TMath::Abs(track1->GetLabel()));
670 Double_t radius = Radius(TMath::Abs(track1->GetLabel()));
671 AliKFParticle::SetField(vEvent->GetMagneticField());
672 AliKFVertex primV(*(vEvent->GetPrimaryVertex()));
673 valueradius[2] = radius;
675 AliVTrack *track2(NULL);
677 Int_t indexmother2 = -1;
680 Float_t fCharge2 = 0;
682 // count number of matches with opposite/same sign track in the given mass range
683 Int_t countsMatchLikesign(0),
684 countsMatchUnlikesign(0);
688 Double_t invmass(-1);
690 Float_t fCharge1 = track1->Charge(); //Charge from track1
692 Bool_t kUSignPhotonic = kFALSE;
693 Bool_t kLSignPhotonic = kFALSE;
697 //changes the weighting factor for electrons from Eta Dalitz decays
699 if(mcQAsource == AliHFEmcQA::kEta) weight *= fEtaDalitzWeightFactor;
701 // --------------------------
702 // | Switches for Generations |
703 // --------------------------
704 // Number of Generations
705 // Display MC stack for likesign pairs with common mother in generation 1.
707 //! FILL Inclusive Electron
708 fWeightsSource->Fill(source,mcQAsource);
709 fIncElectron->Fill(valueIncElectron,weight);
711 if(fStudyRadius) fIncElectronRadius->Fill(valueradius,weight);
713 //printf(Form("Inclusive Pool: TrackNr. %d, fnumberfound %d \n", iTrack1, fnumberfound));
715 for(Int_t idex = 0; idex < fCounterPoolBackground; idex++){
716 iTrack2 = fArraytrack->At(idex);
717 AliDebug(2,Form("track %d",iTrack2));
718 track2 = (AliVTrack *)vEvent->GetTrack(iTrack2);
721 //printf("ERROR: Could not receive track %d", iTrack2);
725 fCharge2 = track2->Charge(); //Charge from track2
728 //valueAngle[2] = source;
729 valueradius[3] = source;
730 valueSign[4] = source;
731 valueSign[6] = track2->Pt();
732 valueSign[8] = track2->Eta();
734 // track cuts and PID already done
736 // Checking if it is the same Track!
737 if(iTrack2==iTrack1) continue;
738 AliDebug(2,"Different");
741 if(fMCEvent || fAODArrayMCInfo){
742 AliDebug(2, "Checking for source");
743 source2 = FindMother(TMath::Abs(track2->GetLabel()), indexmother2);
744 AliDebug(2, Form("source is %d", source2));
745 AliDebug(2, Form("sourceindex is %i", indexmother2));
746 AliDebug(2, Form("getlabel: %i", track2->GetLabel()));
747 pdg2 = CheckPdg(TMath::Abs(track2->GetLabel()));
749 if(source == kElectronfromconversion){
750 AliDebug(2, Form("Electron from conversion (source %d), paired with source %d", source, source2));
751 AliDebug(2, Form("Index of the mothers: incl %d, associated %d", indexmother, indexmother2));
752 AliDebug(2, Form("PDGs: incl %d, associated %d", pdg1, pdg2));
756 AliDebug(1,"------------------------------------ \n");
757 if((indexmother2 == indexmother) && (source == source2) && ((pdg1*pdg2)<0.0)){
758 AliDebug(1, "Real pair");
760 case kElectronfromconversion:
761 valueSign[4] = kElectronfromconversionboth;
762 valueradius[3] = kElectronfromconversionboth;
764 case kElectronfrompi0:
765 valueSign[4] = kElectronfrompi0both;
766 valueradius[3] = kElectronfrompi0both;
768 case kElectronfrometa:
769 valueSign[4] = kElectronfrometaboth;
770 valueradius[3] = kElectronfrometaboth;
772 case kElectronfromomega:
773 valueSign[4] = kElectronfromomegaboth;
774 valueradius[3] = kElectronfromomegaboth;
781 Int_t MotherArray1[fNumberofGenerations];
782 Int_t MotherArray2[fNumberofGenerations];
783 for(Int_t i = 0; i < fNumberofGenerations;++i){
787 FillMotherArray(TMath::Abs(track1->GetLabel()),0,MotherArray1,fNumberofGenerations);
788 FillMotherArray(TMath::Abs(track2->GetLabel()),0,MotherArray2,fNumberofGenerations);
789 AliDebug(2,Form(" indextrack inclusive: %i pdg: %i || indextrack assoc: %i pdg: %i \n",track1->GetLabel(),pdg1 , track2->GetLabel(),pdg2));
790 AliDebug(2,Form(" Mother Gen 1: %i || Mother Gen 1: %i \n", MotherArray1[0],MotherArray2[0]));
791 AliDebug(2,Form(" Mother Gen 2: %i || Mother Gen 2: %i \n", MotherArray1[1],MotherArray2[1]));
792 AliDebug(2,Form(" Mother Gen 3: %i || Mother Gen 3: %i \n", MotherArray1[2],MotherArray2[2]));
793 AliDebug(2,Form(" Mother Gen 4: %i || Mother Gen 4: %i \n", MotherArray1[3],MotherArray2[3]));
794 valueSign[5] = FindGeneration(MotherArray1,MotherArray2,fNumberofGenerations);
800 // Use TLorentzVector
801 if(!MakePairDCA(track1, track2, vEvent, (aodeventu != NULL), invmass, angle)) continue;
804 if(!MakePairKF(track1, track2, primV, invmass, angle)) continue;
807 valueSign[3] = invmass;
808 // valueSign[5] = angle;
810 //if((fCharge1*fCharge2)>0.0) fLSignAngle->Fill(&valueAngle[0],weight);
811 //else fUSignAngle->Fill(&valueAngle[0],weight);
813 if(angle > fMaxOpening3D) continue; //! Cut on Opening Angle
814 if(invmass > fMaxInvMass) continue; //! Cut on Invariant Mass
816 if((fCharge1*fCharge2)>0.0){
818 fLSign->Fill( valueSign, weight);
819 //if switched on produces mcstackdump for likesign with commonmother in gen 1
820 if(fDisplayMCStack && fMCEvent && valueSign[5] == 1) {
821 AliStack* stack = fMCEvent->Stack();
822 if(!stack) AliError("No Stack");
823 else stack->DumpPStack();
827 // count like-sign background matched pairs per inclusive based on mass cut
828 if(invmass < 0.14) countsMatchLikesign++;
829 AliDebug(1, "-> Selected Like sign");
832 fUSign->Fill( valueSign, weight);
834 // count unlike-sign matched pairs per inclusive based on mass cut
836 countsMatchUnlikesign++;
837 if(fStudyRadius) fRecElectronRadius->Fill(valueradius,weight);
839 AliDebug(1, "-> Selected Unlike sign");
844 if((fCharge1*fCharge2)>0.0) kLSignPhotonic=kTRUE;
845 else kUSignPhotonic=kTRUE;
849 Double_t valCountsLS[3] = {(Double_t)binct, track1->Pt(),(Double_t)countsMatchLikesign},
850 valCountsUS[3] = {(Double_t)binct, track1->Pt(),(Double_t)countsMatchUnlikesign};
851 fUSmatches->Fill(valCountsUS);
852 fLSmatches->Fill(valCountsLS);
854 if( kUSignPhotonic && kLSignPhotonic) taggedphotonic = 6;
855 if(!kUSignPhotonic && kLSignPhotonic) taggedphotonic = 4;
856 if( kUSignPhotonic && !kLSignPhotonic) taggedphotonic = 2;
858 AliDebug(1,"------------------------------------ \n");
859 return taggedphotonic;
862 //_________________________________________________________________________
863 Int_t AliHFENonPhotonicElectron::FindMother(Int_t tr, Int_t &indexmother) const {
865 // Find the mother if MC
868 if(!fMCEvent && !fAODArrayMCInfo) return -1;
870 Int_t pdg = CheckPdg(tr);
871 if(TMath::Abs(pdg)!= 11)
877 indexmother = IsMotherGamma(tr);
878 if(indexmother > 0) return kElectronfromconversion;
879 indexmother = IsMotherPi0(tr);
880 if(indexmother > 0) return kElectronfrompi0;
881 indexmother = IsMotherC(tr);
882 if(indexmother > 0) return kElectronfromC;
883 indexmother = IsMotherB(tr);
884 if(indexmother > 0) return kElectronfromB;
885 indexmother = IsMotherEta(tr);
886 if(indexmother > 0) return kElectronfrometa;
887 indexmother = IsMotherOmega(tr);
888 if(indexmother > 0) return kElectronfromomega;
890 return kElectronfromother;
893 //________________________________________________________________________________________________
894 Int_t AliHFENonPhotonicElectron::CheckPdg(Int_t tr) const {
897 // Return the pdg of the particle
901 if(tr < 0) return pdgcode;
903 AliMCParticle *mctrackesd = NULL; AliAODMCParticle *mctrackaod = NULL;
905 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
907 if((mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) pdgcode = mctrackesd->PdgCode();
908 else if((mctrackaod = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) pdgcode = mctrackaod->GetPdgCode();
910 } else if(fAODArrayMCInfo) {
911 if(tr < fAODArrayMCInfo->GetEntriesFast()){
912 mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
913 if(mctrackaod) return pdgcode = mctrackaod->GetPdgCode();
920 //________________________________________________________________________________________________
921 Double_t AliHFENonPhotonicElectron::Radius(Int_t tr) const {
924 // Return the production vertex radius
927 Double_t radius = 0.;
928 if(tr < 0) return radius;
930 AliMCParticle *mctrackesd = NULL; AliAODMCParticle *mctrackaod = NULL;
932 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
934 if((mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) radius = TMath::Sqrt(mctrackesd->Xv()*mctrackesd->Xv()+mctrackesd->Yv()*mctrackesd->Yv());
935 else if((mctrackaod = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))) radius = TMath::Sqrt(mctrackaod->Xv()*mctrackaod->Xv()+mctrackaod->Yv()*mctrackaod->Yv());
937 } else if(fAODArrayMCInfo) {
938 if(tr < fAODArrayMCInfo->GetEntriesFast()){
939 mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
940 if(mctrackaod) return radius = TMath::Sqrt(mctrackaod->Xv()*mctrackaod->Xv()+mctrackaod->Yv()*mctrackaod->Yv());
947 //_______________________________________________________________________________________________
948 Int_t AliHFENonPhotonicElectron::GetMotherPDG(Int_t tr, Int_t &motherIndex) const {
950 // Returns the mother PDG of the track (return value) and the index of the
953 if(tr < 0) return -1;
956 AliMCParticle *mctrackesd(NULL); AliAODMCParticle *mctrackaod(NULL);
960 AliDebug(2, "Using MC Event");
961 AliVParticle *mctrack = fMCEvent->GetTrack(tr);
963 if((mctrackesd = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))){
965 TParticle *particle = mctrackesd->Particle();
969 motherIndex = particle->GetFirstMother();
970 if(motherIndex >= 0){
971 AliMCParticle *mothertrack = NULL;
972 if((mothertrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(motherIndex))))){
973 TParticle * mother = mothertrack->Particle();
974 pdg = mother->GetPdgCode();
978 } else if((mctrackaod = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(TMath::Abs(tr))))){
981 motherIndex = mctrackaod->GetMother();
982 if(motherIndex >= 0){
983 AliAODMCParticle *mothertrack = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(motherIndex));
984 if(mothertrack) pdg = mothertrack->GetPdgCode();
988 } else if(fAODArrayMCInfo) {
989 AliDebug(2, "Using AOD list");
990 if(tr < fAODArrayMCInfo->GetEntriesFast()){
991 mctrackaod = (AliAODMCParticle *) fAODArrayMCInfo->At(tr);
995 motherIndex = mctrackaod->GetMother();
996 if(motherIndex >= 0 && motherIndex < fAODArrayMCInfo->GetEntriesFast()){
997 AliAODMCParticle *mothertrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(TMath::Abs(motherIndex)));
998 if(mothertrack) pdg = mothertrack->GetPdgCode();
1006 //_______________________________________________________________________________________________
1007 Int_t AliHFENonPhotonicElectron::IsMotherGamma(Int_t tr) const {
1010 // Return the lab of gamma mother or -1 if not gamma
1013 Int_t imother(-1), pdg(-1);
1014 pdg = GetMotherPDG(tr, imother);
1018 if(TMath::Abs(pdg) == 22){
1019 AliDebug(2, "Gamma Mother selected");
1022 if(TMath::Abs(pdg) == 11){
1023 AliDebug(2, "Mother is electron - look further in hierarchy");
1024 return IsMotherGamma(imother);
1026 AliDebug(2, "Nothing selected");
1029 AliDebug(2, "Not mother");
1033 //________________________________________________________________________________________________
1034 Int_t AliHFENonPhotonicElectron::IsMotherPi0(Int_t tr) const {
1037 // Return the lab of pi0 mother or -1 if not pi0
1040 Int_t imother(-1), pdg(-1);
1041 pdg = GetMotherPDG(tr, imother);
1045 if(TMath::Abs(pdg) == 111){
1046 AliDebug(2, "Pi0 Mother selected");
1049 if(TMath::Abs(pdg) == 11){
1050 AliDebug(2, "Mother is electron - look further in hierarchy");
1051 return IsMotherPi0(imother);
1053 AliDebug(2, "Nothing selected");
1056 AliDebug(2, "Not mother");
1059 //________________________________________________________________________________________________
1060 Int_t AliHFENonPhotonicElectron::IsMotherC(Int_t tr) const {
1063 // Return the lab of signal mother or -1 if not from C
1066 Int_t imother(-1), pdg(-1);
1067 pdg = GetMotherPDG(tr, imother);
1071 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)){
1072 AliDebug(2, "Charm Mother selected");
1075 if(TMath::Abs(pdg) == 11){
1076 AliDebug(2, "Mother is electron - look further in hierarchy");
1077 return IsMotherC(imother);
1079 AliDebug(2, "Nothing selected");
1082 AliDebug(2, "Not mother");
1086 //_______________________________________________________________________________________________
1087 Int_t AliHFENonPhotonicElectron::IsMotherB(Int_t tr) const {
1090 // Return the lab of signal mother or -1 if not B
1093 Int_t imother(-1), pdg(-1);
1094 pdg = GetMotherPDG(tr, imother);
1098 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)){
1099 AliDebug(2, "Bottom Mother selected");
1102 if(TMath::Abs(pdg) == 11){
1103 return IsMotherB(imother);
1104 AliDebug(2, "Mother is electron - look further in hierarchy");
1106 AliDebug(2, "Nothing selected");
1109 AliDebug(2, "Not mother");
1113 //_______________________________________________________________________________________________
1114 Int_t AliHFENonPhotonicElectron::IsMotherEta(Int_t tr) const {
1117 // Return the lab of eta mother or -1 if not eta
1120 Int_t imother(-1), pdg(-1);
1121 pdg = GetMotherPDG(tr, imother);
1125 if(TMath::Abs(pdg) == 221){
1126 AliDebug(2, "Eta mother selected");
1129 if(TMath::Abs(pdg) == 11){
1130 AliDebug(2, "Mother is electron - look further in hierarchy");
1131 return IsMotherEta(imother);
1133 AliDebug(2, "Nothing selected");
1136 AliDebug(2, "Not mother");
1140 //_______________________________________________________________________________________________
1141 Int_t AliHFENonPhotonicElectron::IsMotherOmega(Int_t tr) const {
1144 // Return the lab of omega mother or -1 if not omega
1147 Int_t imother(-1), pdg(-1);
1148 pdg = GetMotherPDG(tr, imother);
1152 if(TMath::Abs(pdg) == 223){
1153 AliDebug(2, "Omega mother selected");
1156 if(TMath::Abs(pdg) == 11){
1157 AliDebug(2, "Mother is electron - look further in hierarchy");
1158 return IsMotherOmega(imother);
1160 AliDebug(2, "Nothing selected");
1163 AliDebug(2, "Not mother");
1167 //_______________________________________________________________________________________________
1168 Bool_t AliHFENonPhotonicElectron::MakePairDCA(const AliVTrack *inclusive, const AliVTrack *associated, AliVEvent *vEvent, Bool_t isAOD, Double_t &invMass, Double_t &angle) const {
1170 // Make Pairs of electrons using TLorentzVector
1172 Double_t eMass = TDatabasePDG::Instance()->GetParticle(11)->Mass(); //Electron mass in GeV
1173 Double_t bfield = vEvent->GetMagneticField();
1175 AliESDtrack *esdtrack1, *esdtrack2;
1177 // call copy constructor for AODs
1178 esdtrack1 = new AliESDtrack(inclusive);
1179 esdtrack2 = new AliESDtrack(associated);
1181 // call copy constructor for ESDs
1182 esdtrack1 = new AliESDtrack(*(static_cast<const AliESDtrack *>(inclusive)));
1183 esdtrack2 = new AliESDtrack(*(static_cast<const AliESDtrack *>(associated)));
1185 if((!esdtrack1) || (!esdtrack2)){
1191 Double_t xt1 = 0; //radial position track 1 at the DCA point
1192 Double_t xt2 = 0; //radial position track 2 at the DCA point
1193 Double_t dca = esdtrack2->GetDCA(esdtrack1,bfield,xt2,xt1); //DCA track1-track2
1195 // Apply DCA cut already in the function
1201 //Momenta of the track extrapolated to DCA track-track
1202 Double_t p1[3] = {0,0,0};
1203 Double_t p2[3] = {0,0,0};
1204 Bool_t kHasdcaT1 = esdtrack1->GetPxPyPzAt(xt1,bfield,p1); //Track1
1205 Bool_t kHasdcaT2 = esdtrack2->GetPxPyPzAt(xt2,bfield,p2); //Track2
1206 if(!kHasdcaT1 || !kHasdcaT2) AliWarning("It could be a problem in the extrapolation");
1208 TLorentzVector electron1, electron2, mother;
1209 electron1.SetXYZM(p1[0], p1[1], p1[2], eMass);
1210 electron2.SetXYZM(p2[0], p2[1], p2[2], eMass);
1212 mother = electron1 + electron2;
1213 invMass = mother.M();
1214 angle = TVector2::Phi_0_2pi(electron1.Angle(electron2.Vect()));
1221 //_______________________________________________________________________________________________
1222 Bool_t AliHFENonPhotonicElectron::MakePairKF(const AliVTrack *inclusive, const AliVTrack *associated, AliKFVertex &primV, Double_t &invMass, Double_t &angle) const {
1224 // Make pairs of electrons using the AliKF package
1227 //printf("AOD HFE non photonic\n");
1229 Int_t fPDGtrack1 = 11;
1230 if(inclusive->Charge()>0) fPDGtrack1 = -11;
1231 Int_t fPDGtrack2 = 11;
1232 if(associated->Charge()>0) fPDGtrack2 = -11;
1234 AliKFParticle ktrack1(*inclusive, fPDGtrack1);
1235 AliKFParticle ktrack2(*associated, fPDGtrack2);
1236 AliKFParticle recoGamma(ktrack1,ktrack2);
1238 if(recoGamma.GetNDF()<1) return kFALSE; //! Cut on Reconstruction
1240 Double_t chi2OverNDF = recoGamma.GetChi2()/recoGamma.GetNDF();
1241 if(TMath::Sqrt(TMath::Abs(chi2OverNDF))>fChi2OverNDFCut) return kFALSE;
1243 if(fSetMassConstraint){
1247 recoGamma.SetProductionVertex(primV);
1248 recoGamma.SetMassConstraint(0,0.0001);
1252 recoGamma.GetMass(invMass,width);
1253 angle = ktrack1.GetAngle(ktrack2);
1257 //_______________________________________________________________________________________________
1258 Bool_t AliHFENonPhotonicElectron::FilterCategory1Track(const AliVTrack * const track, Bool_t isAOD, Int_t binct){
1260 // Selection of good associated tracks for the pool
1261 // selection is done using strong cuts
1262 // Tracking in the TPC and the ITS is a minimal requirement
1264 Bool_t survivedbackground = kTRUE;
1266 if(!fHFEBackgroundCuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *) track)) survivedbackground = kFALSE;
1267 AliDebug(3, Form("First cut: %s\n", survivedbackground == kTRUE ? "yes" : "no"));
1268 if(!fHFEBackgroundCuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *) track)) survivedbackground = kFALSE;
1269 AliDebug(3, Form("Second cut: %s\n", survivedbackground == kTRUE ? "yes" : "no"));
1271 if(survivedbackground){
1273 AliHFEpidObject hfetrack2;
1275 if(!isAOD) hfetrack2.SetAnalysisType(AliHFEpidObject::kESDanalysis);
1276 else hfetrack2.SetAnalysisType(AliHFEpidObject::kAODanalysis);
1278 hfetrack2.SetRecTrack(track);
1280 hfetrack2.SetCentrality((Int_t)binct);
1281 AliDebug(3,Form("centrality %d and %d",binct,hfetrack2.GetCentrality()));
1282 hfetrack2.SetPbPb();
1285 if(fPIDBackground->IsSelected(&hfetrack2,0x0,"recTrackCont",fPIDBackgroundQA)){
1286 survivedbackground = kTRUE;
1287 } else survivedbackground = kFALSE;
1289 AliDebug(3, Form("PID: %s\n", survivedbackground == kTRUE ? "yes" : "no"));
1290 return survivedbackground;
1293 //_______________________________________________________________________________________________
1294 Bool_t AliHFENonPhotonicElectron::FilterCategory2Track(const AliVTrack * const track, Bool_t isAOD){
1296 // Selection of category 2 tracks: These tracks are exclusively low pt tracks below
1297 // 300 MeV/c which have at least 2 hits in the 4 outer ITS layers and are identified as
1298 // electron candidates by the ITS
1300 if(TMath::Abs(track->Pt()) > 0.3) return kFALSE;
1301 if(TMath::Abs(track->Pt()) < fminPt) return kFALSE;
1302 Int_t nclustersITS(0), nclustersOuter(0);
1304 const AliAODTrack *aodtrack = static_cast<const AliAODTrack *>(track);
1305 if(!(aodtrack->TestFilterBit(AliAODTrack::kTrkGlobalNoDCA) || aodtrack->TestFilterBit(AliAODTrack::kTrkITSsa))) return kFALSE;
1306 if(!aodtrack->IsOn(AliAODTrack::kITSrefit)) return kFALSE;
1307 nclustersITS = aodtrack->GetITSNcls();
1308 for(Int_t ily = 2; ily < 5; ily++)
1309 if(aodtrack->HasPointOnITSLayer(ily)) nclustersOuter++;
1311 const AliESDtrack *esdtrack = static_cast<const AliESDtrack *>(track);
1312 if(esdtrack->GetStatus() & AliESDtrack::kITSpureSA) return kFALSE;
1313 if(esdtrack->GetStatus() & AliESDtrack::kTPCin) return kFALSE;
1314 if(!(esdtrack->GetStatus() & AliESDtrack::kITSrefit)) return kFALSE;
1315 nclustersITS = esdtrack->GetITSclusters(NULL);
1316 for(Int_t ily = 2; ily < 5; ily++)
1317 if(esdtrack->HasPointOnITSLayer(ily)) nclustersOuter++;
1319 if(nclustersITS < 4) return kFALSE;
1320 if(nclustersOuter < 3) return kFALSE;
1323 Double_t nsigmaITS = fPIDBackground->GetPIDResponse()->NumberOfSigmasITS(track, AliPID::kElectron);
1324 fHnsigmaITS->Fill(track->Pt(), nsigmaITS);
1325 if((nsigmaITS - fITSmeanShift) > fITSnSigmaHigh ) return kFALSE;
1326 if((nsigmaITS - fITSmeanShift) < fITSnSigmaLow ) return kFALSE;
1327 // if global track, we apply also TPC PID
1331 //_______________________________________________________________________________________________
1332 void AliHFENonPhotonicElectron::FillMotherArray(Int_t tr, Int_t index, Int_t a[], Int_t NumberofGenerations){
1334 // Fill an array of mothers for a particle of a given trackid
1336 Int_t imother(-1),pdg(-1);
1337 pdg = GetMotherPDG(tr,imother);
1338 if(index < NumberofGenerations){
1339 if(TMath::Abs(pdg) == 11){
1340 AliDebug(2, "Mother is electron, look further to fill motherarray");
1341 FillMotherArray(imother,index,a,NumberofGenerations);
1345 FillMotherArray(imother,index,a,NumberofGenerations);
1351 //_______________________________________________________________________________________________
1352 Int_t AliHFENonPhotonicElectron::FindGeneration(Int_t a[], Int_t b[], Int_t NumberofGenerations){
1354 // Find the common mother in 2 given arrays and return its generation.
1356 Int_t Generation = 0;
1357 for(Int_t iGeneration = 0; iGeneration < NumberofGenerations; iGeneration++){
1358 for(Int_t jGeneration = 0; jGeneration < NumberofGenerations; jGeneration++){
1359 if(a[iGeneration] == b[jGeneration] && a[iGeneration]!= -1 && b[jGeneration]!= -1){
1360 AliDebug(3,Form("* compared a and b %i == %i \n", a[iGeneration], b[jGeneration]));
1361 if(iGeneration > jGeneration){
1362 Generation = iGeneration + 1;
1364 Generation = jGeneration + 1;
1366 AliDebug(1,Form(" Found common mother gen: %i \n",Generation));
1371 AliDebug(1,Form(" Found common mother gen: %i \n",Generation));