]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliAnalysisTaskElecV2.cxx
Updated treatment of D0/D0bar mass assumption (Carlos)
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskElecV2.cxx
CommitLineData
1d08b6e8 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// Class for heavy-flavour electron v2 with EMCal triggered events
17// Author: Denise Godoy
18
19
20#include "TChain.h"
21#include "TTree.h"
22#include "TH2F.h"
23#include "TMath.h"
24#include "TCanvas.h"
25#include "THnSparse.h"
26#include "TLorentzVector.h"
27#include "TString.h"
28#include "TFile.h"
29
30#include "AliAnalysisTask.h"
31#include "AliAnalysisManager.h"
32
33#include "AliESDEvent.h"
34#include "AliESDHandler.h"
35#include "AliAODEvent.h"
36#include "AliAODHandler.h"
37
38#include "AliAnalysisTaskElecV2.h"
39#include "TGeoGlobalMagField.h"
40#include "AliLog.h"
41#include "AliAnalysisTaskSE.h"
42#include "TRefArray.h"
43#include "TVector.h"
44#include "AliESDInputHandler.h"
45#include "AliESDpid.h"
46#include "AliESDtrackCuts.h"
47#include "AliPhysicsSelection.h"
48#include "AliESDCaloCluster.h"
49#include "AliAODCaloCluster.h"
50#include "AliEMCALRecoUtils.h"
51#include "AliEMCALGeometry.h"
52#include "AliGeomManager.h"
53#include "stdio.h"
54#include "TGeoManager.h"
55#include "iostream"
56#include "fstream"
57
58#include "AliEMCALTrack.h"
59#include "AliMagF.h"
60
61#include "AliKFParticle.h"
62#include "AliKFVertex.h"
63
64#include "AliPID.h"
65#include "AliPIDResponse.h"
66#include "AliHFEcontainer.h"
67#include "AliHFEcuts.h"
68#include "AliHFEpid.h"
69#include "AliHFEpidBase.h"
70#include "AliHFEpidQAmanager.h"
71#include "AliHFEtools.h"
72#include "AliCFContainer.h"
73#include "AliCFManager.h"
74
75#include "AliEventplane.h"
76#include "AliCentrality.h"
77
78ClassImp(AliAnalysisTaskElecV2)
79//________________________________________________________________________
80AliAnalysisTaskElecV2::AliAnalysisTaskElecV2(const char *name)
81 : AliAnalysisTaskSE(name)
82 ,fESD(0)
83 ,fOutputList(0)
84 ,fTrackCuts(0)
85 ,fCuts(0)
86 ,fIdentifiedAsOutInz(kFALSE)
87 ,fPassTheEventCut(kFALSE)
88 ,fRejectKinkMother(kFALSE)
89 ,fVz(0.0)
90 ,fCFM(0)
91 ,fPID(0)
92 ,fPIDqa(0)
93 ,fOpeningAngleCut(0.1)
94 ,fInvmassCut(0.01)
95 ,fNoEvents(0)
96 ,fTrkpt(0)
97 ,fTrkEovPBef(0)
98 ,fTrkEovPAft(0)
99 ,fdEdxBef(0)
100 ,fdEdxAft(0)
101 ,fInvmassLS(0)
102 ,fInvmassULS(0)
103 ,fOpeningAngleLS(0)
104 ,fOpeningAngleULS(0)
105 ,fPhotoElecPt(0)
106 ,fSemiInclElecPt(0)
107 ,fTrackPtBefTrkCuts(0)
108 ,fTrackPtAftTrkCuts(0)
109 ,fTPCnsigma(0)
110 ,fCent(0)
44fdf7ac 111 ,fevPlaneV0A(0)
112 ,fevPlaneV0C(0)
113 ,fevPlaneTPC(0)
1d08b6e8 114 ,fTPCsubEPres(0)
115 ,fEPres(0)
116 ,fCorr(0)
117 ,feTPCV2(0)
118 ,feV2(0)
119 ,fphoteV2(0)
120 ,fChargPartV2(0)
121{
122 //Named constructor
123
124 fPID = new AliHFEpid("hfePid");
125 fTrackCuts = new AliESDtrackCuts();
126
127 // Define input and output slots here
128 // Input slot #0 works with a TChain
129 DefineInput(0, TChain::Class());
130 // Output slot #0 id reserved by the base class for AOD
131 // Output slot #1 writes into a TH1 container
132 // DefineOutput(1, TH1I::Class());
133 DefineOutput(1, TList::Class());
134 // DefineOutput(3, TTree::Class());
135}
136
137//________________________________________________________________________
138AliAnalysisTaskElecV2::AliAnalysisTaskElecV2()
139 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElecHadCorrel")
140 ,fESD(0)
141 ,fOutputList(0)
142 ,fTrackCuts(0)
143 ,fCuts(0)
144 ,fIdentifiedAsOutInz(kFALSE)
145 ,fPassTheEventCut(kFALSE)
146 ,fRejectKinkMother(kFALSE)
147 ,fVz(0.0)
148 ,fCFM(0)
149 ,fPID(0)
150 ,fPIDqa(0)
151 ,fOpeningAngleCut(0.1)
152 ,fInvmassCut(0.01)
153 ,fNoEvents(0)
154 ,fTrkpt(0)
155 ,fTrkEovPBef(0)
156 ,fTrkEovPAft(0)
157 ,fdEdxBef(0)
158 ,fdEdxAft(0)
159 ,fInvmassLS(0)
160 ,fInvmassULS(0)
161 ,fOpeningAngleLS(0)
162 ,fOpeningAngleULS(0)
163 ,fPhotoElecPt(0)
164 ,fSemiInclElecPt(0)
165 ,fTrackPtBefTrkCuts(0)
166 ,fTrackPtAftTrkCuts(0)
167 ,fTPCnsigma(0)
168 ,fCent(0)
44fdf7ac 169 ,fevPlaneV0A(0)
170 ,fevPlaneV0C(0)
171 ,fevPlaneTPC(0)
1d08b6e8 172 ,fTPCsubEPres(0)
173 ,fEPres(0)
174 ,fCorr(0)
175 ,feTPCV2(0)
176 ,feV2(0)
177 ,fphoteV2(0)
178 ,fChargPartV2(0)
179{
180 //Default constructor
181 fPID = new AliHFEpid("hfePid");
182
183 fTrackCuts = new AliESDtrackCuts();
184
185 // Constructor
186 // Define input and output slots here
187 // Input slot #0 works with a TChain
188 DefineInput(0, TChain::Class());
189 // Output slot #0 id reserved by the base class for AOD
190 // Output slot #1 writes into a TH1 container
191 // DefineOutput(1, TH1I::Class());
192 DefineOutput(1, TList::Class());
193 //DefineOutput(3, TTree::Class());
194}
195//_________________________________________
196
197AliAnalysisTaskElecV2::~AliAnalysisTaskElecV2()
198{
199 //Destructor
200
201 delete fOutputList;
202 delete fPID;
203 delete fCFM;
204 delete fPIDqa;
205 delete fTrackCuts;
206}
207//_________________________________________
208
209void AliAnalysisTaskElecV2::UserExec(Option_t*)
210{
211 //Main loop
212 //Called for each event
213
214 // create pointer to event
215 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
216 if (!fESD) {
217 printf("ERROR: fESD not available\n");
218 return;
219 }
220
221 if(!fCuts){
222 AliError("HFE cuts not available");
223 return;
224 }
225
226 if(!fPID->IsInitialized()){
227 // Initialize PID with the given run number
228 AliWarning("PID not initialised, get from Run no");
229 fPID->InitializePID(fESD->GetRunNumber());
230 }
231
232
233 Int_t fNOtrks = fESD->GetNumberOfTracks();
234 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
235
236 Double_t pVtxZ = -999;
237 pVtxZ = pVtx->GetZ();
238
239 if(TMath::Abs(pVtxZ)>10) return;
240 fNoEvents->Fill(0);
241
242 if(fNOtrks<2) return;
243
244 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
245 if(!pidResponse){
246 AliDebug(1, "Using default PID Response");
247 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
248 }
249
250 fPID->SetPIDResponse(pidResponse);
251
252 fCFM->SetRecEventInfo(fESD);
253
254 Float_t cent = -1.;
255 AliCentrality *centrality = fESD->GetCentrality();
256 cent = centrality->GetCentralityPercentile("V0M");
257 fCent->Fill(cent);
258
259 if(cent>90.) return;
260
261 //Event planes
262
263 Double_t evPlaneV0A = TVector2::Phi_0_2pi(fESD->GetEventplane()->GetEventplane("V0A",fESD,2));
264 if(evPlaneV0A > TMath::Pi()) evPlaneV0A = evPlaneV0A - TMath::Pi();
44fdf7ac 265 fevPlaneV0A->Fill(evPlaneV0A);
1d08b6e8 266
267 Double_t evPlaneV0C = TVector2::Phi_0_2pi(fESD->GetEventplane()->GetEventplane("V0C",fESD,2));
268 if(evPlaneV0C > TMath::Pi()) evPlaneV0C = evPlaneV0C - TMath::Pi();
44fdf7ac 269 fevPlaneV0C->Fill(evPlaneV0C);
1d08b6e8 270
271 AliEventplane* esdTPCep = fESD->GetEventplane();
44fdf7ac 272 TVector2 *standardQ = 0x0;
1d08b6e8 273 Double_t qx = -999., qy = -999.;
44fdf7ac 274
275 standardQ = esdTPCep->GetQVector();
1d08b6e8 276 if(standardQ)
277 {
278 qx = standardQ->X();
279 qy = standardQ->Y();
280 }
281 TVector2 qVectorfortrack;
282 qVectorfortrack.Set(qx,qy);
283 Float_t evPlaneTPC = TVector2::Phi_0_2pi(qVectorfortrack.Phi())/2.;
44fdf7ac 284 fevPlaneTPC->Fill(evPlaneTPC);
285
1d08b6e8 286 TVector2 *qsub1a = esdTPCep->GetQsub1();
287 TVector2 *qsub2a = esdTPCep->GetQsub2();
288 Double_t evPlaneResTPC = -999.;
289 if(qsub1a && qsub2a)
290 {
291 evPlaneResTPC = TMath::Cos(2.*TVector2::Phi_0_2pi(qsub1a->Phi()/2.- qsub2a->Phi()/2.));
292 }
293
294 fTPCsubEPres->Fill(evPlaneResTPC,cent);
295
296 Double_t evPlaneRes[4]={GetCos2DeltaPhi(evPlaneV0A,evPlaneV0C),GetCos2DeltaPhi(evPlaneV0A,evPlaneTPC),GetCos2DeltaPhi(evPlaneV0C,evPlaneTPC),cent};
297 fEPres->Fill(evPlaneRes);
298
299 // Track loop
300 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
301 AliESDtrack* track = fESD->GetTrack(iTracks);
302 if (!track) {
303 printf("ERROR: Could not receive track %d\n", iTracks);
304 continue;
305 }
306
307 if(TMath::Abs(track->Eta())>0.7) continue;
308
309 fTrackPtBefTrkCuts->Fill(track->Pt());
310 // RecKine: ITSTPC cuts
311 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
312
313 //RecKink
314 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
315 if(track->GetKinkIndex(0) != 0) continue;
316 }
317
318 // RecPrim
319 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
320
321 // HFEcuts: ITS layers cuts
322 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
323
324 // HFE cuts: TPC PID cleanup
325 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
326
327 fTrackPtAftTrkCuts->Fill(track->Pt());
328
329 Double_t clsE = -999., p = -999., EovP=-999., pt = -999., dEdx=-999., fTPCnSigma=0, phi=-999.;
330
331 // Track extrapolation
332
333 pt = track->Pt();
44fdf7ac 334 if(pt<2) continue;
1d08b6e8 335 fTrkpt->Fill(pt);
336
337 Int_t clsId = track->GetEMCALcluster();
338 if (clsId>0){
339 AliESDCaloCluster *cluster = fESD->GetCaloCluster(clsId);
340 if(cluster && cluster->IsEMCAL()){
341 clsE = cluster->E();
342 }
343 }
344
345 p = track->P();
346 phi = track->Phi();
347 dEdx = track->GetTPCsignal();
348 EovP = clsE/p;
349 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
350 fdEdxBef->Fill(p,dEdx);
351 fTPCnsigma->Fill(p,fTPCnSigma);
352
44fdf7ac 353 Double_t corr[8]={phi,fTPCnSigma,cent,pt,EovP,GetDeltaPhi(phi,evPlaneTPC),GetDeltaPhi(phi,evPlaneV0A),GetDeltaPhi(phi,evPlaneV0C)};
1d08b6e8 354 fCorr->Fill(corr);
355
356 if(fTPCnSigma >= 1.5 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,EovP);
357 Int_t pidpassed = 1;
358
359 //--- track accepted
360 AliHFEpidObject hfetrack;
361 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
362 hfetrack.SetRecTrack(track);
363 hfetrack.SetPbPb();
364 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
365
44fdf7ac 366 Double_t corrV2[7]={phi,cent,pt,EovP,GetCos2DeltaPhi(phi,evPlaneTPC),GetCos2DeltaPhi(phi,evPlaneV0A),GetCos2DeltaPhi(phi,evPlaneV0C)};
1d08b6e8 367 fChargPartV2->Fill(corrV2);
b3bd01b3 368
369 if(fTPCnSigma >= -0.5){
370 Double_t qX = standardQ->X() - esdTPCep->GetQContributionX(track);
371 Double_t qY = standardQ->Y() - esdTPCep->GetQContributionY(track);
372 TVector2 newQVectorfortrack;
373 newQVectorfortrack.Set(qX,qY);
374 Double_t corrV2TPC = -999.;
375 corrV2TPC = TVector2::Phi_0_2pi(newQVectorfortrack.Phi())/2;
376
377 Double_t correctedV2[5]={cent,pt,GetCos2DeltaPhi(phi,corrV2TPC),GetCos2DeltaPhi(phi,evPlaneV0A),GetCos2DeltaPhi(phi,evPlaneV0C)};
378
379 feTPCV2->Fill(correctedV2);
380 }
381
382 if(pidpassed==0) continue;
383
1d08b6e8 384 Double_t qX = standardQ->X() - esdTPCep->GetQContributionX(track);
385 Double_t qY = standardQ->Y() - esdTPCep->GetQContributionY(track);
386 TVector2 newQVectorfortrack;
387 newQVectorfortrack.Set(qX,qY);
388 Double_t corrV2TPC = -999.;
389 corrV2TPC = TVector2::Phi_0_2pi(newQVectorfortrack.Phi())/2;
390
391 Double_t correctedV2[5]={cent,pt,GetCos2DeltaPhi(phi,corrV2TPC),GetCos2DeltaPhi(phi,evPlaneV0A),GetCos2DeltaPhi(phi,evPlaneV0C)};
392
1d08b6e8 393 feV2->Fill(correctedV2);
394
395 fTrkEovPAft->Fill(pt,EovP);
396 fdEdxAft->Fill(p,dEdx);
397
398 Bool_t fFlagPhotonicElec = kFALSE;
399 SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
400
401 if(fFlagPhotonicElec){
402 fphoteV2->Fill(correctedV2);
403 fPhotoElecPt->Fill(pt);
404 }
405
406 if(!fFlagPhotonicElec) fSemiInclElecPt->Fill(pt);
407 }
408 PostData(1, fOutputList);
409}
410//_________________________________________
411void AliAnalysisTaskElecV2::UserCreateOutputObjects()
412{
413 //--------Initialize PID
414 fPID->SetHasMCData(kFALSE);
415 if(!fPID->GetNumberOfPIDdetectors())
416 {
417 fPID->AddDetector("TPC", 0);
418 fPID->AddDetector("EMCAL", 1);
419 }
420
421 fPID->SortDetectors();
422 fPIDqa = new AliHFEpidQAmanager();
423 fPIDqa->Initialize(fPID);
424
425 //--------Initialize correction Framework and Cuts
426 fCFM = new AliCFManager;
427 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
428 fCFM->SetNStepParticle(kNcutSteps);
429 for(Int_t istep = 0; istep < kNcutSteps; istep++)
430 fCFM->SetParticleCutsList(istep, NULL);
431
432 if(!fCuts){
433 AliWarning("Cuts not available. Default cuts will be used");
434 fCuts = new AliHFEcuts;
435 fCuts->CreateStandardCuts();
436 }
437 fCuts->Initialize(fCFM);
438
439 //---------Output Tlist
440 fOutputList = new TList();
441 fOutputList->SetOwner();
442 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
443
444 fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
445 fOutputList->Add(fNoEvents);
446
447 fTrkpt = new TH1F("fTrkpt","track pt",100,0,50);
448 fOutputList->Add(fTrkpt);
449
450 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",100,0,50);
451 fOutputList->Add(fTrackPtBefTrkCuts);
452
453 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",100,0,50);
454 fOutputList->Add(fTrackPtAftTrkCuts);
455
456 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",100,0,50,200,-10,10);
457 fOutputList->Add(fTPCnsigma);
458
459 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",100,0,50,100,0,2);
460 fOutputList->Add(fTrkEovPBef);
461
462 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",100,0,50,100,0,2);
463 fOutputList->Add(fTrkEovPAft);
464
465 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",100,0,50,150,0,150);
466 fOutputList->Add(fdEdxBef);
467
468 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",100,0,50,150,0,150);
469 fOutputList->Add(fdEdxAft);
470
471 fInvmassLS = new TH1F("fInvmassLS", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 500,0,0.5);
472 fOutputList->Add(fInvmassLS);
473
474 fInvmassULS = new TH1F("fInvmassULS", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 500,0,0.5);
475 fOutputList->Add(fInvmassULS);
476
477 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
478 fOutputList->Add(fOpeningAngleLS);
479
480 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
481 fOutputList->Add(fOpeningAngleULS);
482
483 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,50);
484 fOutputList->Add(fPhotoElecPt);
485
486 fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",100,0,50);
487 fOutputList->Add(fSemiInclElecPt);
488
489 fCent = new TH1F("fCent","Centrality",100,0,100) ;
490 fOutputList->Add(fCent);
491
44fdf7ac 492 fevPlaneV0A = new TH1F("fevPlaneV0A","V0A EP",100,0,TMath::Pi()) ;
493 fOutputList->Add(fevPlaneV0A);
494
495 fevPlaneV0C = new TH1F("fevPlaneV0C","V0C EP",100,0,TMath::Pi()) ;
496 fOutputList->Add(fevPlaneV0C);
497
498 fevPlaneTPC = new TH1F("fevPlaneTPC","TPC EP",100,0,TMath::Pi()) ;
499 fOutputList->Add(fevPlaneTPC);
500
1d08b6e8 501 fTPCsubEPres = new TH2F("fTPCsubEPres","TPC subevent plane resolution",100,-1,1,90,0,90);
502 fOutputList->Add(fTPCsubEPres);
503
504 Int_t binsv1[4]={100,100,100,90}; // V0A-V0C, V0A-TPC, V0C-TPC, cent
505 Double_t xminv1[4]={-1,-1,-1,0};
506 Double_t xmaxv1[4]={1,1,1,90};
507 fEPres = new THnSparseD ("fEPres","EP resolution",4,binsv1,xminv1,xmaxv1);
508 fOutputList->Add(fEPres);
509
44fdf7ac 510 Int_t binsv2[8]={100,100,90,100,100,100,100,100}; // phi,fTPCnSigma,cent, pt, EovP, TPCdeltaPhi, V0AdeltaPhi, V0CdeltaPhi
511 Double_t xminv2[8]={0,-3.5,0,0,0,0,0,0};
512 Double_t xmaxv2[8]={2*TMath::Pi(),3.5,90,50,3,TMath::Pi(),TMath::Pi(),TMath::Pi()};
513 fCorr = new THnSparseD ("fCorr","Correlations",8,binsv2,xminv2,xmaxv2);
1d08b6e8 514 fOutputList->Add(fCorr);
515
516 Int_t binsv3[5]={90,100,100,100,100}; // cent, pt, TPCcos2DeltaPhi, V0Acos2DeltaPhi, V0Ccos2DeltaPhi
517 Double_t xminv3[5]={0,0,-1,-1,-1};
518 Double_t xmaxv3[5]={90,50,1,1,1};
519 feV2 = new THnSparseD ("feV2","inclusive electron v2",5,binsv3,xminv3,xmaxv3);
520 fOutputList->Add(feV2);
521
522 Int_t binsv4[5]={90,100,100,100,100}; // cent, pt, TPCdeltaPhi, V0AdeltaPhi, V0CdeltaPhi
523 Double_t xminv4[5]={0,0,-1,-1,-1};
524 Double_t xmaxv4[5]={90,50,1,1,1};
525 fphoteV2 = new THnSparseD ("fphoteV2","photonic electron v2",5,binsv4,xminv4,xmaxv4);
526 fOutputList->Add(fphoteV2);
527
44fdf7ac 528 Int_t binsv5[7]={100,90,100,100,100,100,100}; // phi, cent, pt, EovP, TPCdeltaPhi, V0AdeltaPhi, V0CdeltaPhi
529 Double_t xminv5[7]={0,0,0,0,-1,-1,-1};
530 Double_t xmaxv5[7]={2*TMath::Pi(),90,50,3,1,1,1};
531 fChargPartV2 = new THnSparseD ("fChargPartV2","Charged particle v2",7,binsv5,xminv5,xmaxv5);
1d08b6e8 532 fOutputList->Add(fChargPartV2);
533
534 Int_t binsv6[5]={90,100,100,100,100}; // cent, pt, TPCdeltaPhi, V0AdeltaPhi, V0CdeltaPhi
535 Double_t xminv6[5]={0,0,-1,-1,-1};
536 Double_t xmaxv6[5]={90,50,1,1,1};
537 feTPCV2 = new THnSparseD ("feTPCV2","inclusive electron v2 (TPC)",5,binsv6,xminv6,xmaxv6);
538 fOutputList->Add(feTPCV2);
539
540 PostData(1,fOutputList);
541}
542
543//________________________________________________________________________
544void AliAnalysisTaskElecV2::Terminate(Option_t *)
545{
546 // Info("Terminate");
547 AliAnalysisTaskSE::Terminate();
548}
549
550//________________________________________________________________________
551Bool_t AliAnalysisTaskElecV2::ProcessCutStep(Int_t cutStep, AliVParticle *track)
552{
553 // Check single track cuts for a given cut step
554 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
555 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
556 return kTRUE;
557}
558//_________________________________________
559void AliAnalysisTaskElecV2::SelectPhotonicElectron(Int_t itrack, AliESDtrack *track, Bool_t &fFlagPhotonicElec)
560{
561 //Identify non-heavy flavour electrons using Invariant mass method
562
563 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
564 fTrackCuts->SetRequireTPCRefit(kTRUE);
565 fTrackCuts->SetEtaRange(-0.7,0.7);
566 fTrackCuts->SetRequireSigmaToVertex(kTRUE);
567 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
568 fTrackCuts->SetMinNClustersTPC(100);
569
570 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
571
572 Bool_t flagPhotonicElec = kFALSE;
573
574 for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
575 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
576 if (!trackAsso) {
577 printf("ERROR: Could not receive track %d\n", jTracks);
578 continue;
579 }
580
581 Double_t dEdxAsso = -999., ptAsso=-999., openingAngle = -999.;
582 Double_t mass=999., width = -999;
583 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
584
585 dEdxAsso = trackAsso->GetTPCsignal();
586 ptAsso = trackAsso->Pt();
587 Int_t chargeAsso = trackAsso->Charge();
588 Int_t charge = track->Charge();
589
590 if(ptAsso <0.3) continue;
591 if(!fTrackCuts->AcceptTrack(trackAsso)) continue;
592 if(dEdxAsso <70 || dEdxAsso>100) continue; //11a pass1
593
594 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
595 if(charge>0) fPDGe1 = -11;
596 if(chargeAsso>0) fPDGe2 = -11;
597
598 if(charge == chargeAsso) fFlagLS = kTRUE;
599 if(charge != chargeAsso) fFlagULS = kTRUE;
600
601 AliKFParticle ge1(*track, fPDGe1);
602 AliKFParticle ge2(*trackAsso, fPDGe2);
603 AliKFParticle recg(ge1, ge2);
604
605 if(recg.GetNDF()<1) continue;
606 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
607 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
608
609 AliKFVertex primV(*pVtx);
610 primV += recg;
611 recg.SetProductionVertex(primV);
612
613 recg.SetMassConstraint(0,0.0001);
614
615 openingAngle = ge1.GetAngle(ge2);
616 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
617 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
618
619 if(openingAngle > fOpeningAngleCut) continue;
620
621 recg.GetMass(mass,width);
622
623 if(fFlagLS) fInvmassLS->Fill(mass);
624 if(fFlagULS) fInvmassULS->Fill(mass);
625
626 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
627 flagPhotonicElec = kTRUE;
628 }
629
630 }
631 fFlagPhotonicElec = flagPhotonicElec;
632
633}
634//_________________________________________
635Double_t AliAnalysisTaskElecV2::GetCos2DeltaPhi(Double_t phiA,Double_t phiB) const
636{
637 //Get cos[2(phi-psi_EP)] or cos[2(psi_subEP1 - psi_subEP2)]
638 Double_t dPhi = TVector2::Phi_0_2pi(phiA - phiB);
639 if(dPhi > TMath::Pi()) dPhi = dPhi - TMath::Pi();
640 Double_t cos2DeltaPhi = TMath::Cos(2*dPhi);
641
642 return cos2DeltaPhi;
643}
644
645//_________________________________________
646Double_t AliAnalysisTaskElecV2::GetDeltaPhi(Double_t phiA,Double_t phiB) const
647{
648 //Get phi-psi_EP
649 Double_t dPhi = TVector2::Phi_0_2pi(phiA - phiB);
650 if(dPhi > TMath::Pi()) dPhi = dPhi - TMath::Pi();
651
652 return dPhi;
653}