]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliAnalysisTaskElecHadronCorrel.cxx
Using a conservative 3% estimate for the K0s signal extraction systematics. Using...
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskElecHadronCorrel.cxx
CommitLineData
57189f04 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// Task for Heavy Flavour Electron-Hadron DeltaPhi Correlation //
20// Non-Photonic Electron identified with Invariant mass //
21// analysis methos in function SelectPhotonicElectron //
22// DeltaPhi calculated in function ElectronHadCorrel //
23// //
24// Author: Deepa Thomas (Utrecht University) //
25// //
26////////////////////////////////////////////////////////////////////////
27
28#include "TChain.h"
29#include "TTree.h"
30#include "TH2F.h"
31#include "TMath.h"
32#include "TCanvas.h"
33#include "THnSparse.h"
34#include "TLorentzVector.h"
35#include "TString.h"
36#include "TFile.h"
37
38#include "AliAnalysisTask.h"
39#include "AliAnalysisManager.h"
40
41#include "AliESDEvent.h"
42#include "AliESDHandler.h"
43#include "AliAODEvent.h"
44#include "AliAODHandler.h"
45
46#include "AliAnalysisTaskElecHadronCorrel.h"
47#include "TGeoGlobalMagField.h"
48#include "AliLog.h"
49#include "AliAnalysisTaskSE.h"
50#include "TRefArray.h"
51#include "TVector.h"
52#include "AliESDInputHandler.h"
53#include "AliESDpid.h"
54#include "AliESDtrackCuts.h"
55#include "AliPhysicsSelection.h"
56#include "AliESDCaloCluster.h"
57#include "AliAODCaloCluster.h"
520a29a8 58#include "AliESDCaloTrigger.h"
57189f04 59#include "AliEMCALRecoUtils.h"
60#include "AliEMCALGeometry.h"
61#include "AliGeomManager.h"
62#include "stdio.h"
63#include "TGeoManager.h"
64#include "iostream"
65#include "fstream"
487ae960 66/*
67#include "AliEventPoolManager.h"
4e01b68c 68#include "AliAnalysisTaskPhiCorrelations.h"
487ae960 69*/
520a29a8 70#include "AliCentrality.h"
57189f04 71#include "AliEMCALTrack.h"
520a29a8 72//#include "AliEMCALTracker.h"
57189f04 73#include "AliMagF.h"
74
75#include "AliKFParticle.h"
76#include "AliKFVertex.h"
77
78#include "AliPID.h"
79#include "AliPIDResponse.h"
80#include "AliHFEcontainer.h"
81#include "AliHFEcuts.h"
82#include "AliHFEpid.h"
83#include "AliHFEpidBase.h"
84#include "AliHFEpidQAmanager.h"
85#include "AliHFEtools.h"
86#include "AliCFContainer.h"
87#include "AliCFManager.h"
88
89ClassImp(AliAnalysisTaskElecHadronCorrel)
90//________________________________________________________________________
520a29a8 91 AliAnalysisTaskElecHadronCorrel::AliAnalysisTaskElecHadronCorrel(const char *name)
57189f04 92 : AliAnalysisTaskSE(name)
93 ,fESD(0)
94 ,fGeom(0)
95 ,fOutputList(0)
520a29a8 96 ,fTrackCuts1(new AliESDtrackCuts)
97 ,fTrackCuts2(new AliESDtrackCuts)
57189f04 98 ,fCuts(0)
99 ,fIdentifiedAsOutInz(kFALSE)
100 ,fPassTheEventCut(kFALSE)
101 ,fRejectKinkMother(kFALSE)
102 ,fVz(0.0)
103 ,fCFM(0)
104 ,fPID(0)
105 ,fPIDqa(0)
106 ,fOpeningAngleCut(0.1)
107 ,fInvmassCut(0.01)
4e01b68c 108// ,fPoolMgr(0x0)
57189f04 109 ,fNoEvents(0)
110 ,fTrkpt(0)
111 ,fTrkEovPBef(0)
520a29a8 112 ,fTrkEovPBefHad(0)
57189f04 113 ,fTrkEovPAft(0)
520a29a8 114 ,fTrkEovPAftOwn(0)
57189f04 115 ,fdEdxBef(0)
116 ,fdEdxAft(0)
520a29a8 117 ,fdEdxAftOwn(0)
57189f04 118 ,fOpeningAngleLS(0)
119 ,fOpeningAngleULS(0)
120 ,fSemiIncElecDphi(0)
487ae960 121 ,fSemiIncElecDphi1(0)
122 ,fSemiIncElecDphi2(0)
123 ,fSemiIncElecDphi3(0)
124 ,fSemiIncElecDphi4(0)
57189f04 125 ,fPhotElecDphi(0)
487ae960 126 ,fPhotElecDphi1(0)
127 ,fPhotElecDphi2(0)
128 ,fPhotElecDphi3(0)
129 ,fPhotElecDphi4(0)
57189f04 130 ,fInclusiveElecDphi(0)
487ae960 131 ,fInclusiveElecDphi1(0)
132 ,fInclusiveElecDphi2(0)
133 ,fInclusiveElecDphi3(0)
134 ,fInclusiveElecDphi4(0)
57189f04 135 ,fDphiULSMassLow(0)
487ae960 136 ,fDphiULSMassLow1(0)
137 ,fDphiULSMassLow2(0)
138 ,fDphiULSMassLow3(0)
139 ,fDphiULSMassLow4(0)
57189f04 140 ,fDphiLSMassLow(0)
487ae960 141 ,fDphiLSMassLow1(0)
142 ,fDphiLSMassLow2(0)
143 ,fDphiLSMassLow3(0)
144 ,fDphiLSMassLow4(0)
520a29a8 145 ,fDphiULSMassLowNoPartner(0)
487ae960 146 ,fDphiULSMassLowNoPartner1(0)
147 ,fDphiULSMassLowNoPartner2(0)
148 ,fDphiULSMassLowNoPartner3(0)
149 ,fDphiULSMassLowNoPartner4(0)
520a29a8 150 ,fDphiLSMassLowNoPartner(0)
487ae960 151 ,fDphiLSMassLowNoPartner1(0)
152 ,fDphiLSMassLowNoPartner2(0)
153 ,fDphiLSMassLowNoPartner3(0)
154 ,fDphiLSMassLowNoPartner4(0)
57189f04 155 ,fPhotoElecPt(0)
156 ,fSemiInclElecPt(0)
520a29a8 157 ,fInclusiveElecPt(0)
158 ,fULSElecPt(0)
159 ,fLSElecPt(0)
57189f04 160 ,fTrackPtBefTrkCuts(0)
161 ,fTrackPtAftTrkCuts(0)
520a29a8 162 ,fTPCnsigma(0)
163 ,fTPCnsigmaAft(0)
164 ,fTPCnsigmaAftOwn(0)
165 ,fNCellv1(0)
166 ,fClsEv1(0)
167 ,fNClusv1(0)
168 ,fKFParticleP(0)
169 ,fKFParticleE(0)
170 ,fInvmassLS1(0)
487ae960 171 ,fInvmassLS2(0)
172 ,fInvmassLS3(0)
173 ,fInvmassLS4(0)
174 ,fInvmassLS5(0)
520a29a8 175 ,fInvmassULS1(0)
487ae960 176 ,fInvmassULS2(0)
177 ,fInvmassULS3(0)
178 ,fInvmassULS4(0)
179 ,fInvmassULS5(0)
520a29a8 180 ,fcentrality(0)
181 ,fElecPhi(0)
4e01b68c 182 ,fElecPhiTPC(0)
183 ,fElecPhiTPCEovP(0)
520a29a8 184 ,fHadronPhi(0)
4e01b68c 185 ,fTrackHFEcuts(0)
186 ,fTrakPhiSPD1(0)
187 ,fTrakPhiSPD2(0)
188 ,fTrakPhiSPDOr(0)
189 ,fTrakPhiSPDAnd(0)
190 ,fTrackHFEcutsITS(0)
191/* ,fNoMixedEvents(0)
192 ,fMixStat(0)
193 ,fMixStat1(0)
194 ,fMixedIncElecDphi(0)
195 ,fMixedPhotElecDphi(0)
196 ,fMixedSemiIncElecDphi(0)
197 ,fMixedDphiULSMassLow(0)
198 ,fMixedDphiLSMassLow(0)
487ae960 199*/ ,fNLSminus(0)
200 ,fNLSplus(0)
201 ,fNULS(0)
202 ,fHadronIPxy(0)
203 ,fHadronIPz(0)
520a29a8 204// ,fSparseElectron(0)
205// ,fvalueElectron(0)
57189f04 206{
207 //Named constructor
520a29a8 208
57189f04 209 fPID = new AliHFEpid("hfePid");
520a29a8 210// fvalueElectron = new Double_t[8];
57189f04 211
212 // Define input and output slots here
213 // Input slot #0 works with a TChain
214 DefineInput(0, TChain::Class());
215 // Output slot #0 id reserved by the base class for AOD
216 // Output slot #1 writes into a TH1 container
217 // DefineOutput(1, TH1I::Class());
218 DefineOutput(1, TList::Class());
219 // DefineOutput(3, TTree::Class());
220}
221
222//________________________________________________________________________
223AliAnalysisTaskElecHadronCorrel::AliAnalysisTaskElecHadronCorrel()
224 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisElecHadCorrel")
225 ,fESD(0)
226 ,fGeom(0)
227 ,fOutputList(0)
520a29a8 228 ,fTrackCuts1(new AliESDtrackCuts)
229 ,fTrackCuts2(new AliESDtrackCuts)
57189f04 230 ,fCuts(0)
231 ,fIdentifiedAsOutInz(kFALSE)
232 ,fPassTheEventCut(kFALSE)
233 ,fRejectKinkMother(kFALSE)
4e01b68c 234 ,fVz(0.0)
235 ,fCFM(0)
236 ,fPID(0)
237 ,fPIDqa(0)
238 ,fOpeningAngleCut(0.1)
57189f04 239 ,fInvmassCut(0.01)
4e01b68c 240// ,fPoolMgr(0x0)
57189f04 241 ,fNoEvents(0)
242 ,fTrkpt(0)
243 ,fTrkEovPBef(0)
520a29a8 244 ,fTrkEovPBefHad(0)
57189f04 245 ,fTrkEovPAft(0)
520a29a8 246 ,fTrkEovPAftOwn(0)
57189f04 247 ,fdEdxBef(0)
248 ,fdEdxAft(0)
520a29a8 249 ,fdEdxAftOwn(0)
57189f04 250 ,fOpeningAngleLS(0)
251 ,fOpeningAngleULS(0)
252 ,fSemiIncElecDphi(0)
487ae960 253 ,fSemiIncElecDphi1(0)
254 ,fSemiIncElecDphi2(0)
255 ,fSemiIncElecDphi3(0)
256 ,fSemiIncElecDphi4(0)
57189f04 257 ,fPhotElecDphi(0)
487ae960 258 ,fPhotElecDphi1(0)
259 ,fPhotElecDphi2(0)
260 ,fPhotElecDphi3(0)
261 ,fPhotElecDphi4(0)
57189f04 262 ,fInclusiveElecDphi(0)
487ae960 263 ,fInclusiveElecDphi1(0)
264 ,fInclusiveElecDphi2(0)
265 ,fInclusiveElecDphi3(0)
266 ,fInclusiveElecDphi4(0)
57189f04 267 ,fDphiULSMassLow(0)
487ae960 268 ,fDphiULSMassLow1(0)
269 ,fDphiULSMassLow2(0)
270 ,fDphiULSMassLow3(0)
271 ,fDphiULSMassLow4(0)
57189f04 272 ,fDphiLSMassLow(0)
487ae960 273 ,fDphiLSMassLow1(0)
274 ,fDphiLSMassLow2(0)
275 ,fDphiLSMassLow3(0)
276 ,fDphiLSMassLow4(0)
520a29a8 277 ,fDphiULSMassLowNoPartner(0)
487ae960 278 ,fDphiULSMassLowNoPartner1(0)
279 ,fDphiULSMassLowNoPartner2(0)
280 ,fDphiULSMassLowNoPartner3(0)
281 ,fDphiULSMassLowNoPartner4(0)
520a29a8 282 ,fDphiLSMassLowNoPartner(0)
487ae960 283 ,fDphiLSMassLowNoPartner1(0)
284 ,fDphiLSMassLowNoPartner2(0)
285 ,fDphiLSMassLowNoPartner3(0)
286 ,fDphiLSMassLowNoPartner4(0)
57189f04 287 ,fPhotoElecPt(0)
288 ,fSemiInclElecPt(0)
520a29a8 289 ,fInclusiveElecPt(0)
290 ,fULSElecPt(0)
291 ,fLSElecPt(0)
57189f04 292 ,fTrackPtBefTrkCuts(0)
293 ,fTrackPtAftTrkCuts(0)
520a29a8 294 ,fTPCnsigma(0)
295 ,fTPCnsigmaAft(0)
296 ,fTPCnsigmaAftOwn(0)
297 ,fNCellv1(0)
298 ,fClsEv1(0)
299 ,fNClusv1(0)
300 ,fKFParticleP(0)
301 ,fKFParticleE(0)
302 ,fInvmassLS1(0)
487ae960 303 ,fInvmassLS2(0)
304 ,fInvmassLS3(0)
305 ,fInvmassLS4(0)
306 ,fInvmassLS5(0)
520a29a8 307 ,fInvmassULS1(0)
487ae960 308 ,fInvmassULS2(0)
309 ,fInvmassULS3(0)
310 ,fInvmassULS4(0)
311 ,fInvmassULS5(0)
520a29a8 312 ,fcentrality(0)
313 ,fElecPhi(0)
4e01b68c 314 ,fElecPhiTPC(0)
315 ,fElecPhiTPCEovP(0)
520a29a8 316 ,fHadronPhi(0)
4e01b68c 317 ,fTrackHFEcuts(0)
318 ,fTrakPhiSPD1(0)
319 ,fTrakPhiSPD2(0)
320 ,fTrakPhiSPDOr(0)
321 ,fTrakPhiSPDAnd(0)
322 ,fTrackHFEcutsITS(0)
323/* ,fNoMixedEvents(0)
324 ,fMixStat(0)
325 ,fMixStat1(0)
326 ,fMixedIncElecDphi(0)
327 ,fMixedPhotElecDphi(0)
328 ,fMixedSemiIncElecDphi(0)
329 ,fMixedDphiULSMassLow(0)
330 ,fMixedDphiLSMassLow(0)
487ae960 331*/ ,fNLSminus(0)
332 ,fNLSplus(0)
333 ,fNULS(0)
334 ,fHadronIPxy(0)
335 ,fHadronIPz(0)
4e01b68c 336 // ,fSparseElectron(0)
337 // ,fvalueElectron(0)
57189f04 338{
520a29a8 339 //Default constructor
340 fPID = new AliHFEpid("hfePid");
4e01b68c 341 // fvalueElectron = new Double_t[8];
57189f04 342
520a29a8 343 // Constructor
4e01b68c 344 // Define input and output slots here
345 // Input slot #0 works with a TChain
346 DefineInput(0, TChain::Class());
347 // Output slot #0 id reserved by the base class for AOD
348 // Output slot #1 writes into a TH1 container
349 // DefineOutput(1, TH1I::Class());
350 DefineOutput(1, TList::Class());
351 //DefineOutput(3, TTree::Class());
57189f04 352}
353//_________________________________________
354
355AliAnalysisTaskElecHadronCorrel::~AliAnalysisTaskElecHadronCorrel()
356{
4e01b68c 357 //Destructor
358
359 delete fOutputList;
360 delete fGeom;
361 delete fPID;
362 delete fCFM;
363 delete fPIDqa;
364 delete fTrackCuts1;
365 delete fTrackCuts2;
366 // delete fSparseElectron;
367 // delete []fvalueElectron;
57189f04 368}
369//_________________________________________
370
371void AliAnalysisTaskElecHadronCorrel::UserExec(Option_t*)
372{
4e01b68c 373 //Main loop
374 //Called for each event
375
376 // create pointer to event
377 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
378 if (!fESD) {
379 printf("ERROR: fESD not available\n");
380 return;
381 }
520a29a8 382
4e01b68c 383 if(!fCuts){
384 AliError("HFE cuts not available");
385 return;
386 }
387
388 if(!fPID->IsInitialized()){
389 // Initialize PID with the given run number
390 AliWarning("PID not initialised, get from Run no");
391 fPID->InitializePID(fESD->GetRunNumber());
392 }
393
394 //-------trigger selection
395 UInt_t res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
396 if (res==0)
397 return;
398
399 // if( (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kFastOnly) )
400 // return;
520a29a8 401
4e01b68c 402 if(!(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kCentral))) return;
520a29a8 403
4e01b68c 404 AliCentrality *fCentrality = (AliCentrality*)fESD->GetCentrality();
520a29a8 405
4e01b68c 406 Float_t centvalue = fCentrality->GetCentralityPercentile("V0M");
407 fcentrality->Fill(centvalue);
311833c9 408 // cout << "cent val" << centvalue <<endl;
4e01b68c 409 if(centvalue<0 || centvalue>10) return;
520a29a8 410
311833c9 411 // cout << "event no : " <<fESD->GetRunNumber() <<endl;
4e01b68c 412 Int_t fNOtrks = fESD->GetNumberOfTracks();
413 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
520a29a8 414
4e01b68c 415 Double_t pVtxZ = -999;
416 pVtxZ = pVtx->GetZ();
520a29a8 417
4e01b68c 418 // Event cut
419 // if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fESD)) return;
420
421 if(TMath::Abs(pVtxZ)>10) return;
422 fNoEvents->Fill(0);
423
424 if(fNOtrks<2) return;
425
426 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
427 if(!pidResponse){
428 AliDebug(1, "Using default PID Response");
520a29a8 429 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
430 }
431
432 fPID->SetPIDResponse(pidResponse);
433
434 fCFM->SetRecEventInfo(fESD);
4e01b68c 435/*
436 //Event mixing
437 AliEventPool* pool = fPoolMgr->GetEventPool(centvalue, pVtxZ); // Get the buffer associated with the current centrality and z-vtx
438 if (!pool)
439 AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centvalue, pVtxZ));
440
441 TObjArray* tracksClone = CloneAndReduceTrackList();
442 tracksClone->SetOwner();
443 pool->UpdatePool(tracksClone);
444*/
520a29a8 445 // Track loop
446 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
447 AliESDtrack* track = fESD->GetTrack(iTracks);
448 if (!track) {
449 printf("ERROR: Could not receive track %d\n", iTracks);
450 continue;
451 }
4e01b68c 452
453 if(track->Pt()<1) continue;
520a29a8 454
455 fTrackPtBefTrkCuts->Fill(track->Pt());
4e01b68c 456
520a29a8 457 // RecKine: ITSTPC cuts
458 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
459
460 //RecKink
461 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
462 if(track->GetKinkIndex(0) != 0) continue;
463 }
464
465 // RecPrim
466 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
467
4e01b68c 468 // HFE cuts: TPC PID cleanup
469 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
470
471 fTrackHFEcuts->Fill(track->Phi());
472
473 //track phi distribution for diff ITS layer hit
474 if(track->HasPointOnITSLayer(0)) fTrakPhiSPD1->Fill(track->Phi());
475 if(track->HasPointOnITSLayer(1)) fTrakPhiSPD2->Fill(track->Phi());
476
477 if(track->HasPointOnITSLayer(0) || track->HasPointOnITSLayer(1)) fTrakPhiSPDOr->Fill(track->Phi());
478 if(track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)) fTrakPhiSPDAnd->Fill(track->Phi());
479
520a29a8 480 // HFEcuts: ITS layers cuts
481 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
482
4e01b68c 483 fTrackHFEcutsITS->Fill(track->Phi());
520a29a8 484
485 fTrackPtAftTrkCuts->Fill(track->Pt());
4e01b68c 486
520a29a8 487 Double_t fClsE = -999, p = -999, fEovP=-999, pt = -999, dEdx=-999, fTPCnSigma=0;
4e01b68c 488 pt = track->Pt();
489 p = track->P();
490 dEdx = track->GetTPCsignal();
491 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
492
493 //TPC electron phi
494 if(fTPCnSigma >= -2 && fTPCnSigma <= 2){
495 fElecPhiTPC->Fill(track->Phi());
496 }
497
498 //eta cut (-0.7,0.7)
499 if(track->Eta() < -0.7 || track->Eta() > 0.7) continue;
500
501 // Track extrapolation to EMCAL
520a29a8 502 Int_t fClsId = track->GetEMCALcluster();
503 if(fClsId <0) continue;
504 AliESDCaloCluster *cluster = fESD->GetCaloCluster(fClsId);
505 if(TMath::Abs(cluster->GetTrackDx())>0.05 || TMath::Abs(cluster->GetTrackDz())>0.05) continue;
4e01b68c 506 fdEdxBef->Fill(p,dEdx);
507 fTPCnsigma->Fill(p,fTPCnSigma);
520a29a8 508
520a29a8 509 fTrkpt->Fill(pt);
510 fClsE = cluster->E();
520a29a8 511 fEovP = fClsE/p;
4e01b68c 512 /*
513 fvalueElectron[0] = pt;
514 fvalueElectron[1] = p;
515 fvalueElectron[2] = fTPCnSigma;
516 fvalueElectron[3] = dEdx;
517 fvalueElectron[4] = fEovP;
518 fvalueElectron[5] = cluster->GetM20();
519 fvalueElectron[6] = cluster->GetM02();
520 fvalueElectron[7] = cluster->GetDispersion();
521
522 fSparseElectron->Fill(fvalueElectron);
523 */
524 if(fTPCnSigma >= -2 && fTPCnSigma <= 2){
525 fTrkEovPBef->Fill(pt,fEovP);
526 }
527 if(fTPCnSigma < -3.5)fTrkEovPBefHad->Fill(pt,fEovP);
528 /*
529 Int_t pidpassed = 0;
520a29a8 530 //--- track accepted, do PID
531 AliHFEpidObject hfetrack;
532 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
533 hfetrack.SetRecTrack(track);
534 hfetrack.SetPbPb();
535 if(fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 1;
536
537 if(pidpassed==1){
4e01b68c 538 cout << "dedx, E/p : "<< dEdx << ", " << fEovP <<endl;
539 fTrkEovPAft->Fill(pt,fEovP);
540 fdEdxAft->Fill(p,dEdx);
541 fTPCnsigmaAft->Fill(p,fTPCnSigma);
520a29a8 542 }
4e01b68c 543 */
544
545 //Electron id with TPC and E/p
546 if(fTPCnSigma >= -2 && fTPCnSigma <= 2 && fEovP >= 0.8 && fEovP <=1.2) {
547 fElecPhiTPCEovP->Fill(track->Phi());
548
549 //Electron id with shower shape
550 if(cluster->GetM20()<0.2 && cluster->GetM02()< 0.5 && cluster->GetDispersion()<1){
3db00c72 551 fElecPhi->Fill(track->Phi());
552 fTrkEovPAftOwn->Fill(pt,fEovP);
553 fdEdxAftOwn->Fill(p,dEdx);
554 fTPCnsigmaAftOwn->Fill(p,fTPCnSigma);
555
556 Bool_t fFlagPhotonicElec = kFALSE;
557 // select photonic electron
558 SelectPhotonicElectron(iTracks,track,fFlagPhotonicElec);
559 //Inclusive electron-hadron correlation
487ae960 560 ElectronHadCorrel(iTracks, track, fInclusiveElecDphi, fInclusiveElecDphi1,fInclusiveElecDphi2,fInclusiveElecDphi3,fInclusiveElecDphi4);
3db00c72 561 fInclusiveElecPt->Fill(pt);
487ae960 562// MixedEvent(track,fMixedIncElecDphi);
4e01b68c 563
3db00c72 564 // photonic electron
565 if(fFlagPhotonicElec){
4e01b68c 566 //Electron hadron correlation
487ae960 567 ElectronHadCorrel(iTracks, track, fPhotElecDphi,fPhotElecDphi1,fPhotElecDphi2,fPhotElecDphi3,fPhotElecDphi4);
4e01b68c 568 fPhotoElecPt->Fill(pt);
487ae960 569// MixedEvent(track,fMixedPhotElecDphi);
3db00c72 570 }
571
572 // Semi inclusive electron
573 if(!fFlagPhotonicElec){
574 //Electron hadron correlation
487ae960 575 ElectronHadCorrel(iTracks, track, fSemiIncElecDphi, fSemiIncElecDphi1,fSemiIncElecDphi2,fSemiIncElecDphi3,fSemiIncElecDphi4);
3db00c72 576 fSemiInclElecPt->Fill(pt);
487ae960 577// MixedEvent(track,fMixedSemiIncElecDphi);
3db00c72 578 }
4e01b68c 579
520a29a8 580 }
581 }
582 }
583
584 //EMC clusters
585 Int_t clsNo = fESD->GetNumberOfCaloClusters();
586 fNClusv1->Fill(clsNo);
587 for(Int_t iclus=0; iclus<clsNo ; iclus++){
588 AliESDCaloCluster* clus = fESD->GetCaloCluster(iclus);
589 if(!clus->IsEMCAL()) continue;
590 fNCellv1->Fill(clus->GetNCells());
591 fClsEv1->Fill(clus->E());
592 }
593
594
595 PostData(1, fOutputList);
57189f04 596}
597//_________________________________________
598void AliAnalysisTaskElecHadronCorrel::UserCreateOutputObjects()
599{
600 //Create histograms
520a29a8 601 // TGeoManager::Import("geometry.root");
602 // fGeom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
603
57189f04 604 //--------Initialize PID
605 fPID->SetHasMCData(kFALSE);
606 if(!fPID->GetNumberOfPIDdetectors())
520a29a8 607 {
608 fPID->AddDetector("TPC", 0);
609 fPID->AddDetector("EMCAL", 1);
610 }
611
57189f04 612 fPID->SortDetectors();
613 fPIDqa = new AliHFEpidQAmanager();
614 fPIDqa->Initialize(fPID);
520a29a8 615
57189f04 616 //--------Initialize correction Framework and Cuts
617 fCFM = new AliCFManager;
618 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
619 fCFM->SetNStepParticle(kNcutSteps);
620 for(Int_t istep = 0; istep < kNcutSteps; istep++)
621 fCFM->SetParticleCutsList(istep, NULL);
520a29a8 622
57189f04 623 if(!fCuts){
624 AliWarning("Cuts not available. Default cuts will be used");
625 fCuts = new AliHFEcuts;
626 fCuts->CreateStandardCuts();
627 }
628 fCuts->Initialize(fCFM);
4e01b68c 629/*
630 //Mixed event initialising
631 Int_t trackDepth = 2000;
632 Int_t poolsize = 1000;
633
634 Int_t nCentralityBins = 5;
635 Double_t CentralityBins[] = {0,2,4,6,8,10};
520a29a8 636
487ae960 637 Int_t nZvtxBins = 4;
638 Double_t vertexBins[] = {-10,-5,0,5,10};
4e01b68c 639
640 fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, (Double_t*) CentralityBins, nZvtxBins, (Double_t*) vertexBins);
641*/
57189f04 642 //---------Output Tlist
643 fOutputList = new TList();
644 fOutputList->SetOwner();
645 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
520a29a8 646
57189f04 647 fNoEvents = new TH1F("fNoEvents","",1,0,1) ;
648 fOutputList->Add(fNoEvents);
520a29a8 649
650 fcentrality = new TH1F("fcentrality","centrality", 100,0,100);
651 fOutputList->Add(fcentrality);
652
57189f04 653 fTrkpt = new TH1F("fTrkpt","track pt",1000,0,50);
654 fOutputList->Add(fTrkpt);
520a29a8 655
57189f04 656 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",1000,0,50);
657 fOutputList->Add(fTrackPtBefTrkCuts);
520a29a8 658
57189f04 659 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",1000,0,50);
660 fOutputList->Add(fTrackPtAftTrkCuts);
520a29a8 661
57189f04 662 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",1000,0,50,200,-10,10);
663 fOutputList->Add(fTPCnsigma);
520a29a8 664
665 fTPCnsigmaAft = new TH2F("fTPCnsigmaAft", "TPC - n sigma after hfepid",1000,0,50,200,-10,10);
666 fOutputList->Add(fTPCnsigmaAft);
667
668 fTPCnsigmaAftOwn = new TH2F("fTPCnsigmaAftOwn", "TPC - n sigma after own pid",1000,0,50,200,-10,10);
669 fOutputList->Add(fTPCnsigmaAftOwn);
670
57189f04 671 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",1000,0,50,100,0,2);
672 fOutputList->Add(fTrkEovPBef);
520a29a8 673
674 fTrkEovPBefHad = new TH2F("fTrkEovPBefHad","track E/p for TPCnsig < 3.5",1000,0,50,100,0,2);
675 fOutputList->Add(fTrkEovPBefHad);
676
57189f04 677 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",1000,0,50,100,0,2);
678 fOutputList->Add(fTrkEovPAft);
520a29a8 679
680 fTrkEovPAftOwn = new TH2F("fTrkEovPAftOwn","track E/p after own pid",1000,0,50,100,0,2);
681 fOutputList->Add(fTrkEovPAftOwn);
682
57189f04 683 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",1000,0,50,150,0,150);
684 fOutputList->Add(fdEdxBef);
520a29a8 685
57189f04 686 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",1000,0,50,150,0,150);
687 fOutputList->Add(fdEdxAft);
520a29a8 688
689 fdEdxAftOwn = new TH2F("fdEdxAftOwn","track dEdx vs p own HFE pid",1000,0,50,150,0,150);
690 fOutputList->Add(fdEdxAftOwn);
691
692 fElecPhi = new TH1F("fElecPhi", "Electron phi",1000,0,6.28);
693 fOutputList->Add(fElecPhi);
694
4e01b68c 695 fElecPhiTPC = new TH1F("fElecPhiTPC", "Electron phi after TPC cut",1000,0,6.28);
696 fOutputList->Add(fElecPhiTPC);
697
698 fElecPhiTPCEovP = new TH1F("fElecPhiTPCEovP", "Electron phi after TPC and E/p cut",1000,0,6.28);
699 fOutputList->Add(fElecPhiTPCEovP);
700
520a29a8 701 fHadronPhi = new TH1F("fHadronPhi", "Hadron phi",1000,0,6.28);
702 fOutputList->Add(fHadronPhi);
703
4e01b68c 704 fTrackHFEcuts = new TH1F("fTrackHFEcuts","Track phi for HFE cuts",1000,0,6.28);
705 fOutputList->Add(fTrackHFEcuts);
706
707 fTrakPhiSPD1 = new TH1F("fTrakPhiSPD1","Track phi for hit in SPD layer 1",1000,0,6.28);
708 fOutputList->Add(fTrakPhiSPD1);
709
710 fTrakPhiSPD2 = new TH1F("fTrakPhiSPD2","Track phi for hit in SPD layer 2",1000,0,6.28);
711 fOutputList->Add(fTrakPhiSPD2);
712
713 fTrakPhiSPDOr = new TH1F("fTrakPhiSPDOr","Track phi for hit in any SPD layer",1000,0,6.28);
714 fOutputList->Add(fTrakPhiSPDOr);
715
716 fTrakPhiSPDAnd = new TH1F("fTrakPhiSPDAnd","Track phi for hit in both SPD layer",1000,0,6.28);
717 fOutputList->Add(fTrakPhiSPDAnd);
718
719 fTrackHFEcutsITS = new TH1F("fTrackHFEcutsITS","Track phi for HFE cuts + ITS HFE cuts",1000,0,6.28);
720 fOutputList->Add(fTrackHFEcutsITS);
520a29a8 721
57189f04 722 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
723 fOutputList->Add(fOpeningAngleLS);
520a29a8 724
57189f04 725 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
726 fOutputList->Add(fOpeningAngleULS);
520a29a8 727
487ae960 728 fSemiIncElecDphi = new TH2F("fSemiIncElecDphi", "Semi Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
57189f04 729 fOutputList->Add(fSemiIncElecDphi);
520a29a8 730
487ae960 731 fSemiIncElecDphi1 = new TH2F("fSemiIncElecDphi1", "Semi Inclusive elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
732 fOutputList->Add(fSemiIncElecDphi1);
733
734 fSemiIncElecDphi2 = new TH2F("fSemiIncElecDphi2", "Semi Inclusive elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
735 fOutputList->Add(fSemiIncElecDphi2);
736
737 fSemiIncElecDphi3 = new TH2F("fSemiIncElecDphi3", "Semi Inclusive elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
738 fOutputList->Add(fSemiIncElecDphi3);
739
740 fSemiIncElecDphi4 = new TH2F("fSemiIncElecDphi4", "Semi Inclusive elec-had Dphi correlation for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
741 fOutputList->Add(fSemiIncElecDphi4);
742
743 fPhotElecDphi = new TH2F("fPhotElecDphi", "Photon elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
57189f04 744 fOutputList->Add(fPhotElecDphi);
520a29a8 745
487ae960 746 fPhotElecDphi1 = new TH2F("fPhotElecDphi1", "Photon elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
747 fOutputList->Add(fPhotElecDphi1);
748
749 fPhotElecDphi2 = new TH2F("fPhotElecDphi2", "Photon elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
750 fOutputList->Add(fPhotElecDphi2);
751
752 fPhotElecDphi3 = new TH2F("fPhotElecDphi3", "Photon elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
753 fOutputList->Add(fPhotElecDphi3);
754
755 fPhotElecDphi4 = new TH2F("fPhotElecDphi4", "Photon elec-had Dphi correlation for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
756 fOutputList->Add(fPhotElecDphi4);
757
758 fInclusiveElecDphi = new TH2F("fInclusiveElecDphi", "Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
57189f04 759 fOutputList->Add(fInclusiveElecDphi);
520a29a8 760
487ae960 761 fInclusiveElecDphi1 = new TH2F("fInclusiveElecDphi1", "Inclusive elec-had Dphi correlation for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
762 fOutputList->Add(fInclusiveElecDphi1);
763
764 fInclusiveElecDphi2 = new TH2F("fInclusiveElecDphi2", "Inclusive elec-had Dphi correlation for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
765 fOutputList->Add(fInclusiveElecDphi2);
766
767 fInclusiveElecDphi3 = new TH2F("fInclusiveElecDphi3", "Inclusive elec-had Dphi correlation for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
768 fOutputList->Add(fInclusiveElecDphi3);
769
770 fInclusiveElecDphi4 = new TH2F("fInclusiveElecDphi4", "Inclusive elec-had Dphi correlation for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
771 fOutputList->Add(fInclusiveElecDphi4);
772
773 fDphiULSMassLow = new TH2F("fDphiULSMassLow", "e-h Dphi ULS, mass<cut",200,0,20,100,-1.57,4.71);
57189f04 774 fOutputList->Add(fDphiULSMassLow);
520a29a8 775
487ae960 776 fDphiULSMassLow1 = new TH2F("fDphiULSMassLow1", "e-h Dphi ULS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
777 fOutputList->Add(fDphiULSMassLow1);
778
779 fDphiULSMassLow2 = new TH2F("fDphiULSMassLow2", "e-h Dphi ULS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
780 fOutputList->Add(fDphiULSMassLow2);
781
782 fDphiULSMassLow3 = new TH2F("fDphiULSMassLow3", "e-h Dphi ULS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
783 fOutputList->Add(fDphiULSMassLow3);
784
785 fDphiULSMassLow4 = new TH2F("fDphiULSMassLow4", "e-h Dphi ULS, mass<cut for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
786 fOutputList->Add(fDphiULSMassLow4);
787
788 fDphiLSMassLow = new TH2F("fDphiLSMassLow", "e-h Dphi LS, mass<cut",200,0,20,100,-1.57,4.71);
57189f04 789 fOutputList->Add(fDphiLSMassLow);
520a29a8 790
487ae960 791 fDphiLSMassLow1 = new TH2F("fDphiLSMassLow1", "e-h Dphi LS, mass<cut for 2<pt^{asso}<4",200,0,20,100,-1.57,4.71);
792 fOutputList->Add(fDphiLSMassLow1);
793
794 fDphiLSMassLow2 = new TH2F("fDphiLSMassLow2", "e-h Dphi LS, mass<cut for 4<pt^{asso}<6",200,0,20,100,-1.57,4.71);
795 fOutputList->Add(fDphiLSMassLow2);
796
797 fDphiLSMassLow3 = new TH2F("fDphiLSMassLow3", "e-h Dphi LS, mass<cut for 6<pt^{asso}<8",200,0,20,100,-1.57,4.71);
798 fOutputList->Add(fDphiLSMassLow3);
799
800 fDphiLSMassLow4 = new TH2F("fDphiLSMassLow4", "e-h Dphi LS, mass<cut for 8<pt^{asso}<10",200,0,20,100,-1.57,4.71);
801 fOutputList->Add(fDphiLSMassLow4);
802
803 fDphiULSMassLowNoPartner = new TH2F("fDphiULSMassLowNoPartner", "e-h Dphi ULS with no partner, mass<mass cut,",200,0,20,100,-1.57,4.71);
520a29a8 804 fOutputList->Add(fDphiULSMassLowNoPartner);
805
487ae960 806 fDphiULSMassLowNoPartner1 = new TH2F("fDphiULSMassLowNoPartner1", "e-h Dphi ULS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
807 fOutputList->Add(fDphiULSMassLowNoPartner1);
808
809 fDphiULSMassLowNoPartner2 = new TH2F("fDphiULSMassLowNoPartner2", "e-h Dphi ULS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
810 fOutputList->Add(fDphiULSMassLowNoPartner2);
811
812 fDphiULSMassLowNoPartner3 = new TH2F("fDphiULSMassLowNoPartner3", "e-h Dphi ULS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
813 fOutputList->Add(fDphiULSMassLowNoPartner3);
814
815 fDphiULSMassLowNoPartner4 = new TH2F("fDphiULSMassLowNoPartner4", "e-h Dphi ULS with no partner, mass<mass cut for 8<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
816 fOutputList->Add(fDphiULSMassLowNoPartner4);
817
818 fDphiLSMassLowNoPartner = new TH2F("fDphiLSMassLowNoPartner", "e-h Dphi LS with no partner, mass<mass cut",200,0,20,100,-1.57,4.71);
520a29a8 819 fOutputList->Add(fDphiLSMassLowNoPartner);
820
487ae960 821 fDphiLSMassLowNoPartner1 = new TH2F("fDphiLSMassLowNoPartner1", "e-h Dphi LS with no partner, mass<mass cut for 2<pt^{asso}<4,",200,0,20,100,-1.57,4.71);
822 fOutputList->Add(fDphiLSMassLowNoPartner1);
823
824 fDphiLSMassLowNoPartner2 = new TH2F("fDphiLSMassLowNoPartner2", "e-h Dphi LS with no partner, mass<mass cut for 4<pt^{asso}<6,",200,0,20,100,-1.57,4.71);
825 fOutputList->Add(fDphiLSMassLowNoPartner2);
826
827 fDphiLSMassLowNoPartner3 = new TH2F("fDphiLSMassLowNoPartner3", "e-h Dphi LS with no partner, mass<mass cut for 6<pt^{asso}<8,",200,0,20,100,-1.57,4.71);
828 fOutputList->Add(fDphiLSMassLowNoPartner3);
829
830 fDphiLSMassLowNoPartner4 = new TH2F("fDphiLSMassLowNoPartner4", "e-h Dphi LS with no partner, mass<mass cut for 8<pt^{asso}<10,",200,0,20,100,-1.57,4.71);
831 fOutputList->Add(fDphiLSMassLowNoPartner4);
832
57189f04 833 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",1000,0,100);
834 fOutputList->Add(fPhotoElecPt);
520a29a8 835
57189f04 836 fSemiInclElecPt = new TH1F("fSemiInclElecPt", "Semi-inclusive electron pt",1000,0,100);
837 fOutputList->Add(fSemiInclElecPt);
520a29a8 838
839 fInclusiveElecPt = new TH1F("fInclElecPt", "Inclusive electron pt",1000,0,100);
840 fOutputList->Add(fInclusiveElecPt);
841
842 fULSElecPt = new TH1F("fULSElecPt", "ULS electron pt",1000,0,100);
843 fOutputList->Add(fULSElecPt);
844
845 fLSElecPt = new TH1F("fLSElecPt", "LS electron pt",1000,0,100);
846 fOutputList->Add(fLSElecPt);
847
848 fNCellv1 = new TH1F("fNCellv1","Ncell in clus (v1); NCell; count",100,0,100) ;
849 fOutputList->Add(fNCellv1);
850
851 fClsEv1 = new TH1F("fClsEv1", "Clus E(v1); Cls E; count",1000,0,100);
852 fOutputList->Add(fClsEv1);
853
854 fNClusv1 = new TH1F("fNClusv1","Nclus in event (v1); NClus; count",500,0,500) ;
855 fOutputList->Add(fNClusv1);
856
857 fKFParticleP = new TH1F("fKFParticleP","KFparticle rec P; P(GeV/c)",1000,0,50);
858 fOutputList->Add(fKFParticleP);
859
860 fKFParticleE = new TH1F("fKFParticleE", "KfParticle rec E; E; count",1000,0,100);
861 fOutputList->Add(fKFParticleE);
862
863 fInvmassLS1 = new TH1F("fInvmassLS1", "Inv mass of LS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
864 fOutputList->Add(fInvmassLS1);
865
866 fInvmassULS1 = new TH1F("fInvmassULS1", "Inv mass of ULS (e,e); mass(GeV/c^2); counts;", 1000,0,1.0);
867 fOutputList->Add(fInvmassULS1);
487ae960 868
869 fInvmassLS2 = new TH1F("fInvmassLS2", "Inv mass of LS (e,e) for pt^{e}>1; mass(GeV/c^2); counts;", 1000,0,1.0);
870 fOutputList->Add(fInvmassLS2);
871
872 fInvmassULS2 = new TH1F("fInvmassULS2", "Inv mass of ULS (e,e) for pt^{e}>1; mass(GeV/c^2); counts;", 1000,0,1.0);
873 fOutputList->Add(fInvmassULS2);
874
875 fInvmassLS3 = new TH1F("fInvmassLS3", "Inv mass of LS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
876 fOutputList->Add(fInvmassLS3);
877
878 fInvmassULS3 = new TH1F("fInvmassULS3", "Inv mass of ULS (e,e) for pt^{e}>2; mass(GeV/c^2); counts;", 1000,0,1.0);
879 fOutputList->Add(fInvmassULS3);
880
881 fInvmassLS4 = new TH1F("fInvmassLS4", "Inv mass of LS (e,e) for pt^{e}>3; mass(GeV/c^2); counts;", 1000,0,1.0);
882 fOutputList->Add(fInvmassLS4);
883
884 fInvmassULS4 = new TH1F("fInvmassULS4", "Inv mass of ULS (e,e) for pt^{e}>3; mass(GeV/c^2); counts;", 1000,0,1.0);
885 fOutputList->Add(fInvmassULS4);
886
887 fInvmassLS5 = new TH1F("fInvmassLS5", "Inv mass of LS (e,e) for pt^{e}>4; mass(GeV/c^2); counts;", 1000,0,1.0);
888 fOutputList->Add(fInvmassLS5);
889
890 fInvmassULS5 = new TH1F("fInvmassULS5", "Inv mass of ULS (e,e) for pt^{e}>4; mass(GeV/c^2); counts;", 1000,0,1.0);
891 fOutputList->Add(fInvmassULS5);
4e01b68c 892/*
893 fNoMixedEvents = new TH1F("fNoMixedEvents","",1,0,1) ;
894 fOutputList->Add(fNoMixedEvents);
895
896 fMixStat = new TH2F("fMixStat","no of events in pool vs multiplicity;Nevent in pool;N hadrons",200,0,200,500,0,500);
897 fOutputList->Add(fMixStat);
898
899 fMixStat1 = new TH2F("fMixStat1","no of events in pool vs zvtx;Nevents in pool;zvtx",200,0,200,200,-11,11);
900 fOutputList->Add(fMixStat1);
901
487ae960 902 fMixedIncElecDphi = new TH2F("fMixedIncElecDphi", "Mixed event - Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
4e01b68c 903 fOutputList->Add(fMixedIncElecDphi);
904
487ae960 905 fMixedSemiIncElecDphi = new TH2F("fMixedSemiIncElecDphi", "Mixed event - Semi Inclusive elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
4e01b68c 906 fOutputList->Add(fMixedSemiIncElecDphi);
907
487ae960 908 fMixedPhotElecDphi = new TH2F("fMixedPhotElecDphi", "Mixed event - Photo elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
4e01b68c 909 fOutputList->Add(fMixedPhotElecDphi);
910
487ae960 911 fMixedDphiULSMassLow = new TH2F("fMixedDphiULSMassLow", "Mixed event - ULS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
4e01b68c 912 fOutputList->Add(fMixedDphiULSMassLow);
913
487ae960 914 fMixedDphiLSMassLow = new TH2F("fMixedDphiLSMassLow", "Mixed event - LS mass < cut elec-had Dphi correlation",200,0,20,100,-1.57,4.71);
4e01b68c 915 fOutputList->Add(fMixedDphiLSMassLow);
487ae960 916*/
917 fNLSminus = new TH1F("fNLSminus","No of LS negative pairs (e-,e-) ",1000,-0.5,999.5);
918 fOutputList->Add(fNLSminus);
919
920 fNLSplus = new TH1F("fNLSplus","No of LS positive pairs (e+,e+)",1000,-0.5,999.5);
921 fOutputList->Add(fNLSplus);
922
923 fNULS = new TH1F("fNULS","No of ULS pairs (e+,e-)",1000,-0.5,999.5);
924 fOutputList->Add(fNULS);
925
926 fHadronIPxy = new TH1F("fHadronIPxy", "hadron impact paramter XY",1000,-5,5);
927 fOutputList->Add(fHadronIPxy);
928
929 fHadronIPz = new TH1F("fHadronIPz", "hadron impact paramter Z",1000,-20,20);
930 fOutputList->Add(fHadronIPz);
931
520a29a8 932 /*
933 Int_t binsv1[8]={1000,1000,200,150,100,100,100,100}; //pt, p, TPCnsig, dEdx, E/p, M20, M02, dispersion
934 Double_t xminv1[8]={0,0,-10,0,0,0,0,0};
935 Double_t xmaxv1[8]={50,50,10,150,2,2,2,2};
936 fSparseElectron = new THnSparseD ("Electron","Electron",8,binsv1,xminv1,xmaxv1);
937 fOutputList->Add(fSparseElectron);
938 */
57189f04 939 PostData(1,fOutputList);
940}
941
942//________________________________________________________________________
943void AliAnalysisTaskElecHadronCorrel::Terminate(Option_t *)
944{
945 // Info("Terminate");
520a29a8 946 AliAnalysisTaskSE::Terminate();
57189f04 947}
948
949//________________________________________________________________________
950Bool_t AliAnalysisTaskElecHadronCorrel::ProcessCutStep(Int_t cutStep, AliVParticle *track)
951{
952 // Check single track cuts for a given cut step
953 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
954 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
955 return kTRUE;
956}
957//_________________________________________
958void AliAnalysisTaskElecHadronCorrel::SelectPhotonicElectron(Int_t itrack, AliESDtrack *track, Bool_t &fFlagPhotonicElec)
959{
960 //Identify non-heavy flavour electrons using Invariant mass method
520a29a8 961
57189f04 962 fTrackCuts1->SetAcceptKinkDaughters(kFALSE);
963 fTrackCuts1->SetRequireTPCRefit(kTRUE);
964 fTrackCuts1->SetEtaRange(-0.9,0.9);
965 fTrackCuts1->SetRequireSigmaToVertex(kTRUE);
966 fTrackCuts1->SetMaxChi2PerClusterTPC(3.5);
967 fTrackCuts1->SetMinNClustersTPC(80);
520a29a8 968
4e01b68c 969 // const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
520a29a8 970
57189f04 971 Bool_t flagPhotonicElec = kFALSE;
487ae960 972 Int_t NLS_plus=0, NLS_minus=0, NULS=0;
520a29a8 973
57189f04 974 for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
975 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
976 if (!trackAsso) {
977 printf("ERROR: Could not receive track %d\n", jTracks);
978 continue;
979 }
520a29a8 980
487ae960 981 Double_t dEdxAsso = -999., ptAsso=-999., openingAngle = -999.,nsigma=-999.0;
520a29a8 982 Double_t mass=-999., width = -999;
57189f04 983 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
520a29a8 984
57189f04 985 dEdxAsso = trackAsso->GetTPCsignal();
487ae960 986 nsigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(trackAsso, AliPID::kElectron) : 1000;
57189f04 987 ptAsso = trackAsso->Pt();
988 Int_t chargeAsso = trackAsso->Charge();
989 Int_t charge = track->Charge();
520a29a8 990
57189f04 991 if(ptAsso <0.3) continue;
992 if(!fTrackCuts1->AcceptTrack(trackAsso)) continue;
487ae960 993// if(dEdxAsso <70 || dEdxAsso>100) continue; //11a pass1
994 if(nsigma < -3 || nsigma > 3) continue;
520a29a8 995
57189f04 996 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
997 if(charge>0) fPDGe1 = -11;
998 if(chargeAsso>0) fPDGe2 = -11;
520a29a8 999
57189f04 1000 if(charge == chargeAsso) fFlagLS = kTRUE;
1001 if(charge != chargeAsso) fFlagULS = kTRUE;
520a29a8 1002
1003 AliKFParticle ge1 = AliKFParticle(*track, fPDGe1);
1004 AliKFParticle ge2 = AliKFParticle(*trackAsso, fPDGe2);
57189f04 1005 AliKFParticle recg(ge1, ge2);
487ae960 1006
57189f04 1007 if(recg.GetNDF()<1) continue;
1008 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1009 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
520a29a8 1010
57189f04 1011 openingAngle = ge1.GetAngle(ge2);
1012 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
1013 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
520a29a8 1014
4e01b68c 1015 // if(openingAngle > fOpeningAngleCut) continue;
520a29a8 1016
487ae960 1017 recg.GetMass(mass,width);
1018
1019 if(fFlagLS){
1020 if(track->Charge() > 0 ) NLS_plus++;
1021 if(track->Charge() < 0 ) NLS_minus++;
1022 }
1023 if(fFlagULS) NULS++;
1024
1025 if(fFlagLS) {
1026 fInvmassLS1->Fill(mass);
1027 if(track->Pt()> 1) fInvmassLS2->Fill(mass);
1028 if(track->Pt()>2) fInvmassLS3->Fill(mass);
1029 if(track->Pt()>3) fInvmassLS4->Fill(mass);
1030 if(track->Pt()>4) fInvmassLS5->Fill(mass);
1031 }
1032 if(fFlagULS) {
1033 fInvmassULS1->Fill(mass);
1034 if(track->Pt() >1) fInvmassULS2->Fill(mass);
1035 if(track->Pt() >2) fInvmassULS3->Fill(mass);
1036 if(track->Pt() >3) fInvmassULS4->Fill(mass);
1037 if(track->Pt() >4) fInvmassULS5->Fill(mass);
1038 }
520a29a8 1039
520a29a8 1040 if(mass<fInvmassCut){
1041 if(fFlagULS)
1042 {
487ae960 1043 ElectronHadCorrel(itrack,track,fDphiULSMassLow, fDphiULSMassLow1,fDphiULSMassLow2,fDphiULSMassLow3,fDphiULSMassLow4);
520a29a8 1044 fULSElecPt->Fill(track->Pt());
487ae960 1045// MixedEvent(track,fMixedDphiULSMassLow);
520a29a8 1046 }
1047 if(fFlagLS)
1048 {
487ae960 1049 ElectronHadCorrel(itrack,track,fDphiLSMassLow,fDphiLSMassLow1,fDphiLSMassLow2,fDphiLSMassLow3,fDphiLSMassLow4);
520a29a8 1050 fLSElecPt->Fill(track->Pt());
487ae960 1051// MixedEvent(track,fMixedDphiLSMassLow);
520a29a8 1052 }
487ae960 1053 if(fFlagLS) ElectronHadCorrelNoPartner(itrack,jTracks,track,fDphiLSMassLowNoPartner, fDphiLSMassLowNoPartner1,fDphiLSMassLowNoPartner2,fDphiLSMassLowNoPartner3,fDphiLSMassLowNoPartner4);
1054 if(fFlagULS) ElectronHadCorrelNoPartner(itrack,jTracks,track,fDphiULSMassLowNoPartner, fDphiULSMassLowNoPartner1,fDphiULSMassLowNoPartner2,fDphiULSMassLowNoPartner3,fDphiULSMassLowNoPartner4);
57189f04 1055 }
520a29a8 1056
57189f04 1057 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
1058 flagPhotonicElec = kTRUE;
1059 }
520a29a8 1060 // }
1061
57189f04 1062 }
1063 fFlagPhotonicElec = flagPhotonicElec;
520a29a8 1064
487ae960 1065 fNLSminus->Fill(NLS_minus);
1066 fNLSplus->Fill(NLS_plus);
1067 fNULS->Fill(NULS);
1068
57189f04 1069}
1070//_________________________________________
487ae960 1071void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrel(Int_t itrack, AliESDtrack *track, TH2F *DphiPt, TH2F *DphiPt1,TH2F *DphiPt2,TH2F *DphiPt3,TH2F *DphiPt4)
57189f04 1072{
1073 //Construct Delta Phi between electrons and hadrons
520a29a8 1074
57189f04 1075 fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
1076 fTrackCuts2->SetRequireTPCRefit(kTRUE);
1077 fTrackCuts2->SetRequireITSRefit(kTRUE);
1078 fTrackCuts2->SetEtaRange(-0.9,0.9);
1079 fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
1080 fTrackCuts2->SetMaxChi2PerClusterTPC(3.5);
1081 fTrackCuts2->SetMinNClustersTPC(80);
520a29a8 1082
57189f04 1083 for(Int_t ktracks = 0; ktracks<fESD->GetNumberOfTracks(); ktracks++){
1084 AliESDtrack* trackHad = fESD->GetTrack(ktracks);
1085 if (!trackHad) {
1086 printf("ERROR: Could not receive track %d\n", ktracks);
1087 continue;
1088 }
1089 if(ktracks == itrack) continue; //do not select the same electron
520a29a8 1090
57189f04 1091 Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
1092 Double_t ptEle = -999;
1093 Double_t phiEle = -999, phiHad = -999, Dphi = -999;
1094 Double_t pi = 3.14;
520a29a8 1095
57189f04 1096 dEdxHad = trackHad->GetTPCsignal();
1097 ptHad = trackHad->Pt();
1098 pHad = trackHad->P();
4e01b68c 1099 ptEle = track->Pt();
520a29a8 1100
487ae960 1101// if(ptHad <2) continue;
4e01b68c 1102 if(ptHad > ptEle) continue;
57189f04 1103 if(!fTrackCuts2->AcceptTrack(trackHad)) continue;
487ae960 1104
1105 Float_t IPxy=-999.0, IPz=-999.0;
1106 trackHad->GetImpactParameters(IPxy,IPz);
311833c9 1107 //cout << "xy,z: " << IPxy << ", " << IPz <<endl;
487ae960 1108 fHadronIPxy->Fill(IPxy);
1109 fHadronIPz->Fill(IPz);
1110
520a29a8 1111 fHadronPhi->Fill(trackHad->Phi());
4e01b68c 1112
57189f04 1113 phiEle = track->Phi();
1114 phiHad = trackHad->Phi();
1115 Dphi = phiEle - phiHad;
520a29a8 1116 if (Dphi > 3*pi/2)
57189f04 1117 Dphi = Dphi - 2*pi;
520a29a8 1118 if (Dphi < -pi/2)
57189f04 1119 Dphi = Dphi + 2*pi;
520a29a8 1120
487ae960 1121 if(ptHad>2) DphiPt->Fill(ptEle,Dphi);
1122 if(ptHad>2 && ptHad<4) DphiPt1->Fill(ptEle,Dphi);
1123 if(ptHad>4 && ptHad<6) DphiPt2->Fill(ptEle,Dphi);
1124 if(ptHad>6 && ptHad<8) DphiPt3->Fill(ptEle,Dphi);
1125 if(ptHad>8 && ptHad<10) DphiPt4->Fill(ptEle,Dphi);
4e01b68c 1126
57189f04 1127 }
1128}
1129//_________________________________________
487ae960 1130void AliAnalysisTaskElecHadronCorrel::ElectronHadCorrelNoPartner(Int_t itrack,Int_t jtrack, AliESDtrack *track, TH2F *DphiPtNew, TH2F *DphiPtNew1,TH2F *DphiPtNew2,TH2F *DphiPtNew3,TH2F *DphiPtNew4)
57189f04 1131{
520a29a8 1132 //Construct Delta Phi between electrons and hadrons for electrons from invariant mass calculation excluding associated track
57189f04 1133
520a29a8 1134 fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
1135 fTrackCuts2->SetRequireTPCRefit(kTRUE);
1136 fTrackCuts2->SetRequireITSRefit(kTRUE);
1137 fTrackCuts2->SetEtaRange(-0.9,0.9);
1138 fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
1139 fTrackCuts2->SetMaxChi2PerClusterTPC(3.5);
1140 fTrackCuts2->SetMinNClustersTPC(80);
1141
1142 for(Int_t ktracks = 0; ktracks<fESD->GetNumberOfTracks(); ktracks++){
1143 AliESDtrack* trackHad = fESD->GetTrack(ktracks);
1144 if (!trackHad) {
1145 printf("ERROR: Could not receive track %d\n", ktracks);
1146 continue;
1147 }
1148 if(ktracks == itrack || ktracks == jtrack) continue; //do not select the same electron and associated track from inv mass cal
1149
1150
1151 Double_t ptHad= -999, pHad=-999., dEdxHad = -999;
1152 Double_t ptEle = -999;
1153 Double_t phiEle = -999, phiHad = -999, Dphi = -999;
1154 Double_t pi = 3.14;
1155
1156 dEdxHad = trackHad->GetTPCsignal();
1157 ptHad = trackHad->Pt();
1158 pHad = trackHad->P();
4e01b68c 1159 ptEle = track->Pt();
520a29a8 1160
4e01b68c 1161 if(ptHad <2) continue;
1162 if(ptHad > ptEle) continue;
520a29a8 1163 if(!fTrackCuts2->AcceptTrack(trackHad)) continue;
1164
1165 phiEle = track->Phi();
1166 phiHad = trackHad->Phi();
1167 Dphi = phiEle - phiHad;
1168 if (Dphi > 3*pi/2)
1169 Dphi = Dphi - 2*pi;
1170 if (Dphi < -pi/2)
1171 Dphi = Dphi + 2*pi;
57189f04 1172
487ae960 1173 if(ptHad>2) DphiPtNew->Fill(ptEle,Dphi);
1174 if(ptHad>2 && ptHad<4) DphiPtNew1->Fill(ptEle,Dphi);
1175 if(ptHad>4 && ptHad<6) DphiPtNew2->Fill(ptEle,Dphi);
1176 if(ptHad>6 && ptHad<8) DphiPtNew3->Fill(ptEle,Dphi);
1177 if(ptHad>8 && ptHad<10) DphiPtNew4->Fill(ptEle,Dphi);
520a29a8 1178 }
1179}
4e01b68c 1180/*
1181//_________________________________________
1182void AliAnalysisTaskElecHadronCorrel::MixedEvent(AliESDtrack *track, TH2F *DphiPt)
1183{
1184
1185 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
1186 Double_t zVtx;
1187 zVtx = pVtx->GetZ();
1188
1189
1190 AliCentrality *fCentrality = (AliCentrality*)fESD->GetCentrality();
1191 Double_t centvalue = fCentrality->GetCentralityPercentile("V0M");
1192
1193 AliEventPool* pool = fPoolMgr->GetEventPool(centvalue, zVtx); // Get the buffer associated with the current centrality and z-vtx
1194 if (!pool)
1195 AliFatal(Form("No pool found for centrality = %f, zVtx = %f", centvalue, zVtx));
1196
1197 // pool->PrintInfo();
1198 if (pool->GetCurrentNEvents() >= 5) // start mixing when 5 events are in the buffer
1199 {
1200 Int_t nMix = pool->GetCurrentNEvents();
1201 fNoMixedEvents->Fill(0);
1202 fMixStat->Fill(pool->GetCurrentNEvents(),centvalue);
1203 fMixStat1->Fill(pool->GetCurrentNEvents(),zVtx);
1204
487ae960 1205 // cout << "nMix = " << nMix << " tracks in pool = " << pool->NTracksInPool() << endl;
4e01b68c 1206 for (Int_t jMix=0; jMix<pool->GetCurrentNEvents(); jMix++) // mix with each event in the buffer
1207 {
1208 TObjArray* bgTracks = pool->GetEvent(jMix);
1209 for (Int_t i=0;i<bgTracks->GetEntriesFast(); i++)
1210 {
1211 AliVParticle* mixtrk = (AliVParticle*) bgTracks->At(i);
1212
1213 Double_t mixtrkPhi = -999;
1214 Double_t ptEle = -999;
1215 Double_t phiEle = -999, Dphi = -999;
1216 Double_t pi = 3.14;
1217 Double_t ptmixtrk = -999;
1218
1219 ptEle = track->Pt();
1220 if(ptmixtrk > ptEle) continue;
1221
1222 mixtrkPhi = mixtrk->Phi();
1223 phiEle = track->Phi();
1224 Dphi = phiEle - mixtrkPhi;
1225
1226 if (Dphi > 3*pi/2)
1227 Dphi = Dphi - 2*pi;
1228 if (Dphi < -pi/2)
1229 Dphi = Dphi + 2*pi;
4e01b68c 1230 DphiPt->Fill(ptEle,Dphi);
1231 }
1232 }
1233
1234 }
1235
1236}
1237//___________________________________________
1238TObjArray* AliAnalysisTaskElecHadronCorrel::CloneAndReduceTrackList()
1239{
1240 // clones a track list by using AliDPhiBasicParticle which uses much less memory (used for event mixing)
1241
1242 fTrackCuts2->SetAcceptKinkDaughters(kFALSE);
1243 fTrackCuts2->SetRequireTPCRefit(kTRUE);
1244 fTrackCuts2->SetRequireITSRefit(kTRUE);
1245 fTrackCuts2->SetEtaRange(-0.9,0.9);
1246 fTrackCuts2->SetRequireSigmaToVertex(kTRUE);
1247 fTrackCuts2->SetMaxChi2PerClusterTPC(3.5);
1248 fTrackCuts2->SetMinNClustersTPC(80);
1249
1250 TObjArray* tracksClone = new TObjArray;
1251 tracksClone->SetOwner(kTRUE);
1252
1253 for(Int_t ktracks = 0; ktracks<fESD->GetNumberOfTracks(); ktracks++){
1254 AliESDtrack* track = fESD->GetTrack(ktracks);
1255 if (!track) {
1256 printf("ERROR: Could not receive track %d\n", ktracks);
1257 continue;
1258 }
1259
1260 // if(ktracks == iTrack) continue;
1261 Double_t ptHad= -999, pHad=-999.;
1262 ptHad = track->Pt();
1263 pHad = track->P();
1264
1265 if(ptHad <2) continue;
1266 if(!fTrackCuts2->AcceptTrack(track)) continue;
1267
4e01b68c 1268 AliVParticle* particle = (AliVParticle*) fESD->GetTrack(ktracks);
1269 tracksClone->Add(new AliDPhiBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge()));
1270 }
1271
1272 return tracksClone;
1273}
1274*/