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