1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
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 **************************************************************************/
16 // Class for heavy-flavour electron with EMCal triggered events
17 // Author: Shingo Sakai
26 #include "THnSparse.h"
27 #include "TLorentzVector.h"
30 #include "TGraphErrors.h"
32 #include "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
35 #include "AliESDEvent.h"
36 #include "AliESDHandler.h"
37 #include "AliAODEvent.h"
38 #include "AliAODHandler.h"
40 #include "AliMCEventHandler.h"
41 #include "AliMCEvent.h"
42 #include "AliMCParticle.h"
44 #include "AliAnalysisTaskHFECal.h"
45 #include "TGeoGlobalMagField.h"
47 #include "AliAnalysisTaskSE.h"
48 #include "TRefArray.h"
50 #include "AliESDInputHandler.h"
51 #include "AliESDpid.h"
52 #include "AliESDtrackCuts.h"
53 #include "AliPhysicsSelection.h"
54 #include "AliESDCaloCluster.h"
55 #include "AliAODCaloCluster.h"
56 #include "AliEMCALRecoUtils.h"
57 #include "AliEMCALGeometry.h"
58 #include "AliGeomManager.h"
60 #include "TGeoManager.h"
64 #include "AliEMCALTrack.h"
67 #include "AliKFParticle.h"
68 #include "AliKFVertex.h"
71 #include "AliPIDResponse.h"
72 #include "AliHFEcontainer.h"
73 #include "AliHFEcuts.h"
74 #include "AliHFEpid.h"
75 #include "AliHFEpidBase.h"
76 #include "AliHFEpidQAmanager.h"
77 #include "AliHFEtools.h"
78 #include "AliCFContainer.h"
79 #include "AliCFManager.h"
83 #include "AliCentrality.h"
87 ClassImp(AliAnalysisTaskHFECal)
88 //________________________________________________________________________
89 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal(const char *name)
90 : AliAnalysisTaskSE(name)
99 ,fIdentifiedAsOutInz(kFALSE)
100 ,fPassTheEventCut(kFALSE)
101 ,fRejectKinkMother(kFALSE)
107 ,fOpeningAngleCut(0.1)
108 ,fInvmassCut(0) // no mass
109 ,fSetMassConstraint(kTRUE)
141 ,fTrackPtBefTrkCuts(0)
142 ,fTrackPtAftTrkCuts(0)
164 ,fIncpTMCM20hfeAll(0)
165 ,fIncpTMCM20hfeCheck(0)
166 ,fInputHFEMC_weight(0)
167 ,fIncpTMCM20hfeCheck_weight(0)
174 ,fIncpTMCM20pho_pi0e(0)
175 ,fPhoElecPtMCM20_pi0e(0)
176 ,fSameElecPtMCM20_pi0e(0)
177 ,fIncpTMCM20pho_eta(0)
178 ,fPhoElecPtMCM20_eta(0)
179 ,fSameElecPtMCM20_eta(0)
180 ,fIncpTMCpho_pi0e_TPC(0)
181 ,fPhoElecPtMC_pi0e_TPC(0)
182 ,fSameElecPtMC_pi0e_TPC(0)
204 //,fnSigEtaCorr(NULL)
208 fPID = new AliHFEpid("hfePid");
209 fTrackCuts = new AliESDtrackCuts();
211 for(int i=0; i<7; i++)fnSigEtaCorr[i] = 0;
213 // Define input and output slots here
214 // Input slot #0 works with a TChain
215 DefineInput(0, TChain::Class());
216 // Output slot #0 id reserved by the base class for AOD
217 // Output slot #1 writes into a TH1 container
218 // DefineOutput(1, TH1I::Class());
219 DefineOutput(1, TList::Class());
220 // DefineOutput(3, TTree::Class());
223 //________________________________________________________________________
224 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal()
225 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskHFECal")
234 ,fIdentifiedAsOutInz(kFALSE)
235 ,fPassTheEventCut(kFALSE)
236 ,fRejectKinkMother(kFALSE)
242 ,fOpeningAngleCut(0.1)
243 ,fInvmassCut(0) // no mass
244 ,fSetMassConstraint(kTRUE)
276 ,fTrackPtBefTrkCuts(0)
277 ,fTrackPtAftTrkCuts(0)
299 ,fIncpTMCM20hfeAll(0)
300 ,fIncpTMCM20hfeCheck(0)
301 ,fInputHFEMC_weight(0)
302 ,fIncpTMCM20hfeCheck_weight(0)
309 ,fIncpTMCM20pho_pi0e(0)
310 ,fPhoElecPtMCM20_pi0e(0)
311 ,fSameElecPtMCM20_pi0e(0)
312 ,fIncpTMCM20pho_eta(0)
313 ,fPhoElecPtMCM20_eta(0)
314 ,fSameElecPtMCM20_eta(0)
315 ,fIncpTMCpho_pi0e_TPC(0)
316 ,fPhoElecPtMC_pi0e_TPC(0)
317 ,fSameElecPtMC_pi0e_TPC(0)
339 //,fnSigEtaCorr(NULL)
341 //Default constructor
342 fPID = new AliHFEpid("hfePid");
344 fTrackCuts = new AliESDtrackCuts();
346 for(int i=0; i<7; i++)fnSigEtaCorr[i] = 0;
349 // Define input and output slots here
350 // Input slot #0 works with a TChain
351 DefineInput(0, TChain::Class());
352 // Output slot #0 id reserved by the base class for AOD
353 // Output slot #1 writes into a TH1 container
354 // DefineOutput(1, TH1I::Class());
355 DefineOutput(1, TList::Class());
356 //DefineOutput(3, TTree::Class());
358 //_________________________________________
360 AliAnalysisTaskHFECal::~AliAnalysisTaskHFECal()
372 //_________________________________________
374 void AliAnalysisTaskHFECal::UserExec(Option_t*)
377 //Called for each event
379 // create pointer to event
380 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
382 printf("ERROR: fESD not available\n");
387 AliError("HFE cuts not available");
391 if(!fPID->IsInitialized()){
392 // Initialize PID with the given run number
393 AliWarning("PID not initialised, get from Run no");
394 fPID->InitializePID(fESD->GetRunNumber());
397 if(fmcData)fMC = MCEvent();
398 //AliStack* stack = NULL;
399 if(fmcData && fMC)stack = fMC->Stack();
402 AliCentrality *centrality = fESD->GetCentrality();
403 cent = centrality->GetCentralityPercentile("V0M");
405 //---- fill MC track info
408 Int_t nParticles = stack->GetNtrack();
409 for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
410 TParticle* particle = stack->Particle(iParticle);
411 int fPDG = particle->GetPdgCode();
412 double mcZvertex = fMC->GetPrimaryVertex()->GetZ();
413 double pTMC = particle->Pt();
414 double proR = particle->R();
415 double etaMC = particle->Eta();
416 if(fabs(etaMC)>0.6)continue;
417 Bool_t mcInDtoE= kFALSE;
418 Bool_t mcInBtoE= kFALSE;
420 Bool_t MChijing = fMC->IsFromBGEvent(iParticle);
421 //if(!MChijing)printf("not MC hijing");
423 if(!MChijing)iHijing = 0;
427 mcphoinfo[2] = iHijing;
428 //if(fPDG==111)Hpi0pTcheck->Fill(pTMC,iHijing);
429 //if(fPDG==221)HETApTcheck->Fill(pTMC,iHijing);
430 if(fPDG==111)Hpi0pTcheck->Fill(mcphoinfo);
431 if(fPDG==221)HETApTcheck->Fill(mcphoinfo);
432 if(fabs(fPDG)==411 || fabs(fPDG)==413 || fabs(fPDG)==421 || fabs(fPDG)==423 || fabs(fPDG)==431)HDpTcheck->Fill(pTMC,iHijing);
433 if(fabs(fPDG)==511 || fabs(fPDG)==513 || fabs(fPDG)==521 || fabs(fPDG)==523 || fabs(fPDG)==531)HBpTcheck->Fill(pTMC,iHijing);
435 if(particle->GetFirstMother()>-1 && fPDG==22)
437 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
438 if(parentPID==111 || parentPID==221)HphopTcheck->Fill(pTMC,iHijing); // pi0->g & eta->g
441 if(particle->GetFirstMother()>-1 && fabs(fPDG)==11)
443 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
444 double pTMCparent = stack->Particle(particle->GetFirstMother())->Pt();
445 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(fPDG)==11)mcInDtoE = kTRUE;
446 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(fPDG)==11)mcInBtoE = kTRUE;
447 if((mcInBtoE || mcInDtoE) && fabs(mcZvertex)<10.0)
449 fInputHFEMC->Fill(cent,pTMC);
455 mcinfo[4] = pTMCparent;
456 fInputHFEMC_weight->Fill(mcinfo);
461 if(proR<7.0 && fabs(fPDG)==11)fInputAlle->Fill(cent,pTMC);
468 Int_t fNOtrks = fESD->GetNumberOfTracks();
469 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
471 Double_t pVtxZ = -999;
472 pVtxZ = pVtx->GetZ();
474 if(TMath::Abs(pVtxZ)>10) return;
477 if(fNOtrks<1) return;
480 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
482 AliDebug(1, "Using default PID Response");
483 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
486 fPID->SetPIDResponse(pidResponse);
488 fCFM->SetRecEventInfo(fESD);
490 //Float_t cent = -1.;
491 //AliCentrality *centrality = fESD->GetCentrality();
492 //cent = centrality->GetCentralityPercentile("V0M");
495 //if(cent>90.) return;
499 FindTriggerClusters();
503 for(Int_t iCluster=0; iCluster<fESD->GetNumberOfCaloClusters(); iCluster++)
505 AliESDCaloCluster *clust = fESD->GetCaloCluster(iCluster);
506 if(clust && clust->IsEMCAL())
508 double clustE = clust->E();
509 float emcx[3]; // cluster pos
510 clust->GetPosition(emcx);
511 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
512 double emcphi = clustpos.Phi();
513 double emceta = clustpos.Eta();
515 calInfo[0] = emcphi; calInfo[1] = emceta; calInfo[2] = clustE; calInfo[3] = cent; calInfo[4] = clust->Chi2();
516 //fEMCAccE->Fill(calInfo);
517 //if(clustE>3.0)fEMCAccE->Fill(calInfo);
518 //if(fqahist==1 && clustE>1.5)fEMCAccE->Fill(calInfo);
519 hEMCAccE->Fill(cent,clustE);
520 if(clustE>maxE)maxE = clustE;
525 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
526 AliESDtrack* track = fESD->GetTrack(iTracks);
528 printf("ERROR: Could not receive track %d\n", iTracks);
532 int parentlabel = 99999;
533 int parentPID = 99999;
534 int grand_parentlabel = 99999;
535 int grand_parentPID = 99999;
536 Bool_t mcPho = kFALSE;
537 Bool_t mcDtoE= kFALSE;
538 Bool_t mcBtoE= kFALSE;
539 Bool_t mcOrgPi0 = kFALSE;
540 Bool_t mcOrgEta = kFALSE;
543 double mcMompT = 0.0;
544 //double mcGrandMompT = 0.0;
545 double mcWeight = -10.0;
550 if(fmcData && fMC && stack)
552 Int_t label = TMath::Abs(track->GetLabel());
553 mcLabel = track->GetLabel();
558 Bool_t MChijing = fMC->IsFromBGEvent(label);
559 if(!MChijing)iHijing = 0;
561 TParticle* particle = stack->Particle(label);
562 int mcpid = particle->GetPdgCode();
563 mcpT = particle->Pt();
564 //printf("MCpid = %d",mcpid);
565 if(particle->GetFirstMother()>-1)
567 //int parentlabel = particle->GetFirstMother();
568 //int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
569 //mcMompT = stack->Particle(particle->GetFirstMother())->Pt();
570 FindMother(particle, parentlabel, parentPID);
571 mcMompT = stack->Particle(parentlabel)->Pt();
572 if((parentPID==22 || parentPID==111 || parentPID==221)&& fabs(mcpid)==11)mcPho = kTRUE;
573 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(mcpid)==11)mcDtoE = kTRUE;
574 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(mcpid)==11)mcBtoE = kTRUE;
576 // make D->e pT correlation
577 if(mcDtoE)fMomDtoE->Fill(mcpT,mcMompT);
579 //cout << "check PID = " << parentPID << endl;
580 //cout << "check pho = " << mcPho << endl;
581 //cout << "check D or B = " << mcDtoE << endl;
583 if(parentPID==111 && fabs(mcpid)==11 && mcMompT>0.0)
585 //cout << "find pi0->e " << endl;
587 mcWeight = GetMCweight(mcMompT);
590 if(parentPID==221 && fabs(mcpid)==11 && mcMompT>0.0)
592 //cout << "find Eta->e " << endl;
594 mcWeight = GetMCweightEta(mcMompT);
597 // access grand parent
598 TParticle* particle_parent = stack->Particle(parentlabel); // get parent pointer
599 //if(particle_parent->GetFirstMother()>-1 && parentPID==22 && fabs(mcpid)==11) // get grand parent g->e
600 if(particle_parent->GetFirstMother()>-1 && (parentPID==22 || parentPID==111) && fabs(mcpid)==11) // get grand parent g->e
602 //int grand_parentPID = stack->Particle(particle_parent->GetFirstMother())->GetPdgCode();
603 //double pTtmp = stack->Particle(particle_parent->GetFirstMother())->Pt();
604 FindMother(particle_parent, grand_parentlabel, grand_parentPID);
605 double mcGrandpT = stack->Particle(grand_parentlabel)->Pt();
606 if(grand_parentPID==111 && mcGrandpT>0.0)
608 // check eta->pi0 decay !
609 int grand2_parentlabel = 99999; int grand2_parentPID = 99999;
610 TParticle* particle_grand = stack->Particle(grand_parentlabel); // get parent pointer
611 FindMother(particle_grand, grand2_parentlabel, grand2_parentPID);
612 if(grand2_parentPID==221)
614 //cout << "find Eta->e " << endl;
615 double mcGrandpT2 = stack->Particle(grand2_parentlabel)->Pt();
617 mcWeight = GetMCweight(mcGrandpT2);
618 mcMompT = mcGrandpT2;
622 //cout << "find pi0->e " << endl;
624 mcWeight = GetMCweight(mcGrandpT);
629 if(grand_parentPID==221 && mcGrandpT>0.0)
631 //cout << "find Eta->e " << endl;
634 mcWeight = GetMCweightEta(mcGrandpT);
640 //cout << "===================="<<endl;
641 //cout << "mcDtoE : " << mcDtoE << endl;
642 //cout << "mcBtoE : " << mcBtoE << endl;
643 //cout << "mcPho : " << mcPho << endl;
645 if(fabs(mcpid)==11)mcele= 0.;
646 //cout << "check e: " << mcele << endl;
647 if(fabs(mcpid)==11 && mcDtoE)mcele= 1.;
648 //cout << "check D->e: " << mcele << endl;
649 if(fabs(mcpid)==11 && mcBtoE)mcele= 2.;
650 //cout << "check B->e: " << mcele << endl;
651 if(fabs(mcpid)==11 && mcPho)mcele= 3.;
652 //cout << "check Pho->e: " << mcele << endl;
654 //cout << "check PID " << endl;
657 //cout << "!= 11" << endl;
658 //cout << mcpid << endl;
662 //cout << "mcele==-1" << endl;
663 //cout << mcele << endl;
664 //cout << mcpid << endl;
667 } // end of mcLabel>-1
671 //cout << "Pi0 = " << mcOrgPi0 << " ; Eta = " << mcOrgEta << endl;
672 //printf("weight = %f\n",mcWeight);
674 if(TMath::Abs(track->Eta())>0.6) continue;
675 if(TMath::Abs(track->Pt()<2.0)) continue;
677 fTrackPtBefTrkCuts->Fill(track->Pt());
678 // RecKine: ITSTPC cuts
679 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
682 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
683 if(track->GetKinkIndex(0) != 0) continue;
687 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
689 // HFEcuts: ITS layers cuts
690 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
692 // HFE cuts: TPC PID cleanup
693 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
695 int nTPCcl = track->GetTPCNcls();
696 //int nTPCclF = track->GetTPCNclsF(); // warnings
697 int nITS = track->GetNcls(0);
699 fTrackPtAftTrkCuts->Fill(track->Pt());
701 Double_t mom = -999., eop=-999., pt = -999., dEdx=-999., fTPCnSigma=-10, phi=-999., eta=-999.;
705 // Track extrapolation
707 //Int_t charge = track->Charge();
712 dEdx = track->GetTPCsignal();
713 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
715 //cout << "nSigma correctoon-----" << endl;
716 //cout << "org = " << fTPCnSigma << endl;
717 if(!fmcData) // nsigma eta correction
719 double nSigexpCorr = NsigmaCorrection(eta,cent);
720 fTPCnSigma -= nSigexpCorr;
723 //cout << "correction = " << fTPCnSigma << endl;
725 double ncells = -1.0;
729 double rmatch = -1.0;
730 double nmatch = -1.0;
731 double oppstatus = 0.0;
733 Bool_t MaxEmatch = kFALSE;
735 Bool_t fFlagPhotonicElec = kFALSE;
736 Bool_t fFlagConvinatElec = kFALSE;
738 Int_t clsId = track->GetEMCALcluster();
740 AliESDCaloCluster *clust = fESD->GetCaloCluster(clsId);
741 if(clust && clust->IsEMCAL()){
743 double clustE = clust->E();
744 if(clustE==maxE)MaxEmatch = kTRUE;
745 eop = clustE/fabs(mom);
746 //cout << "eop org = "<< eop << endl;
749 double mceopcorr = MCEopMeanCorrection(pt,cent);
752 //cout << "eop corr = " << eop << endl;
754 //double clustT = clust->GetTOF();
755 ncells = clust->GetNCells();
756 m02 = clust->GetM02();
757 m20 = clust->GetM20();
758 disp = clust->GetDispersion();
759 double delphi = clust->GetTrackDx();
760 double deleta = clust->GetTrackDz();
761 rmatch = sqrt(pow(delphi,2)+pow(deleta,2));
762 nmatch = clust->GetNTracksMatched();
763 emctof = clust->GetTOF();
764 //cout << "emctof = " << emctof << endl;
766 if(fTPCnSigma>-1.5 && fTPCnSigma<3.0)
768 SelectPhotonicElectron(iTracks,cent,track,fFlagPhotonicElec,fFlagConvinatElec,fTPCnSigma,m20,eop,mcele,mcWeight,iHijing,mcOrgPi0,mcOrgEta);
770 if(fFlagPhotonicElec)oppstatus = 1.0;
771 if(fFlagConvinatElec)oppstatus = 2.0;
772 if(fFlagPhotonicElec && fFlagConvinatElec)oppstatus = 3.0;
775 valdedx[0] = pt; valdedx[1] = nITS; valdedx[2] = phi; valdedx[3] = eta; valdedx[4] = fTPCnSigma;
776 //valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nTPCclF; valdedx[9] = m20; valdedx[10] = mcpT;
777 valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nmatch; valdedx[9] = m20; valdedx[10] = mcpT;
778 valdedx[11] = cent; valdedx[12] = dEdx; valdedx[13] = oppstatus; valdedx[14] = nTPCcl;
780 //if(fqahist==1)fEleInfo->Fill(valdedx);
786 //Get Cal info PID response
789 Double_t nSigmaEop = fPID->GetPIDResponse()->NumberOfSigmasEMCAL(track,AliPID::kElectron,eop2,ss);
790 if(fTPCnSigma>-1.5 && fTPCnSigma<3.0 && nITS>2.5 && nTPCcl>100)
795 valEop[2] = nSigmaEop;
796 fElenSigma->Fill(valEop);
801 if(nITS<2.5)continue;
802 if(nTPCcl<100)continue;
804 CheckNclust->Fill(nTPCcl);
805 CheckNits->Fill(nITS);
807 fdEdxBef->Fill(mom,fTPCnSigma);
808 fTPCnsigma->Fill(mom,fTPCnSigma);
809 if(fTPCnSigma >= -1.0 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,eop);
813 // check reco eff. with TPC
818 phoval[2] = fTPCnSigma;
822 if((fTPCnSigma >= -1.0 && fTPCnSigma <= 3) && mcele>-1 && mcPho && mcOrgPi0)
824 if(iHijing==1)mcWeight = 1.0;
825 fIncpTMCpho_pi0e_TPC->Fill(phoval,mcWeight);
826 if(fFlagPhotonicElec) fPhoElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
827 if(fFlagConvinatElec) fSameElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
831 AliHFEpidObject hfetrack;
832 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
833 hfetrack.SetRecTrack(track);
835 if((0.0< cent) && (cent<5.0)) binct = 0.5;
836 if((5.0< cent) && (cent<10.0)) binct = 1.5;
837 if((10.0< cent) && (cent<20.0)) binct = 2.5;
838 if((20.0< cent) && (cent<30.0)) binct = 3.5;
839 if((30.0< cent) && (cent<40.0)) binct = 4.5;
840 if((40.0< cent) && (cent<50.0)) binct = 5.5;
841 if((50.0< cent) && (cent<60.0)) binct = 6.5;
842 if((60.0< cent) && (cent<70.0)) binct = 7.5;
843 if((70.0< cent) && (cent<80.0)) binct = 8.5;
844 if((80.0< cent) && (cent<90.0)) binct = 9.5;
845 if((90.0< cent) && (cent<100.0)) binct = 10.5;
847 hfetrack.SetCentrality((int)binct); //added
849 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
851 if(pidpassed==0) continue;
853 fTrkEovPAft->Fill(pt,eop);
854 fdEdxAft->Fill(mom,fTPCnSigma);
857 fIncpT->Fill(cent,pt);
858 if(fFlagPhotonicElec) fPhoElecPt->Fill(cent,pt);
859 if(fFlagConvinatElec) fSameElecPt->Fill(cent,pt);
861 if(m20>0.0 && m20<0.3)
863 fIncpTM20->Fill(cent,pt);
864 ftimingEle->Fill(pt,emctof);
865 if(fFlagPhotonicElec) fPhoElecPtM20->Fill(cent,pt);
866 if(fFlagConvinatElec) fSameElecPtM20->Fill(cent,pt);
872 double recopT = SumpT(iTracks,track);
874 if(m20>0.0 && m20<0.3)
876 if(MaxEmatch)fIncMaxE->Fill(cent,pt);
879 fIncReco->Fill(cent,recopT);
880 if(fFlagPhotonicElec) fPhoReco->Fill(cent,recopT);
881 if(fFlagConvinatElec) fSamReco->Fill(cent,recopT);
884 fIncRecoMaxE->Fill(cent,recopT);
885 if(fFlagPhotonicElec) fPhoRecoMaxE->Fill(cent,recopT);
886 if(fFlagConvinatElec) fSamRecoMaxE->Fill(cent,recopT);
892 // check label for electron candidiates
895 if(mcLabel==0)idlabel = 0;
896 fLabelCheck->Fill(pt,idlabel);
897 if(mcLabel==0)fgeoFake->Fill(phi,eta);
899 if(mcLabel<0 && m20>0.0 && m20<0.3 && fTPCnSigma>-1 && fTPCnSigma<3)
901 fFakeTrk0->Fill(cent,pt);
904 if(mcele>-1) // select MC electrons
907 fIncpTMChfeAll->Fill(cent,pt);
908 if(m20>0.0 && m20<0.3)fIncpTMCM20hfeAll->Fill(cent,pt);
909 if(m20>0.0 && m20<0.3 && fTPCnSigma>-1 && fTPCnSigma<3)fFakeTrk1->Fill(cent,pt);
911 if(mcBtoE || mcDtoE) // select B->e & D->e
913 fIncpTMChfe->Fill(cent,pt);
914 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfe->Fill(cent,pt);
915 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfeCheck->Fill(cent,mcpT);
916 if(m20>0.0 && m20<0.3)
918 //cout << "MC label = " << mcLabel << endl;
919 fIncpTMCM20hfe->Fill(cent,pt);
920 fIncpTMCM20hfeCheck->Fill(cent,mcpT);
921 fIncpTMCM20hfeCheck_weight->Fill(phoval);
925 if(mcPho) // select photonic electrons
928 fIncpTMCpho->Fill(phoval);
929 if(fFlagPhotonicElec) fPhoElecPtMC->Fill(phoval);
930 if(fFlagConvinatElec) fSameElecPtMC->Fill(phoval);
932 if(m20>0.0 && m20<0.3)
934 fIncpTMCM20pho->Fill(phoval);
935 if(fFlagPhotonicElec) fPhoElecPtMCM20->Fill(phoval);
936 if(fFlagConvinatElec) fSameElecPtMCM20->Fill(phoval);
940 if(iHijing==1)mcWeight = 1.0;
943 fIncpTMCM20pho_pi0e->Fill(phoval,mcWeight);
944 if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval,mcWeight);
945 if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval,mcWeight);
946 //fIncpTMCM20pho_pi0e->Fill(phoval); // v5-04-02-AN & v5-04-06-AN
947 //if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval);
948 //if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval);
952 fIncpTMCM20pho_eta->Fill(phoval,mcWeight);
953 if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval,mcWeight);
954 if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval,mcWeight);
955 //fIncpTMCM20pho_eta->Fill(phoval);
956 //if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval);
957 //if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval);
965 PostData(1, fOutputList);
967 //_________________________________________
968 void AliAnalysisTaskHFECal::UserCreateOutputObjects()
972 //Bool_t mcData = kFALSE;
973 if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())
976 printf("+++++ MC Data available");
980 printf("++++++++= MC analysis \n");
984 printf("++++++++ real data analysis \n");
987 printf("+++++++ QA hist %d",fqahist);
990 fGeom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
992 //--------Initialize PID
993 //fPID->SetHasMCData(kFALSE);
994 fPID->SetHasMCData(fmcData);
995 if(!fPID->GetNumberOfPIDdetectors())
997 fPID->AddDetector("TPC", 0);
998 fPID->AddDetector("EMCAL", 1);
1002 const char *cutmodel;
1004 params[0] = -1.0; //sigma min
1005 double maxnSig = 3.0;
1008 params[0] = -5.0; //sigma min
1012 for(Int_t a=0;a<11;a++)fPID->ConfigureTPCcentralityCut(a,cutmodel,params,maxnSig);
1014 fPID->SortDetectors();
1015 fPIDqa = new AliHFEpidQAmanager();
1016 fPIDqa->Initialize(fPID);
1018 //------- fcut --------------
1019 fCuts = new AliHFEcuts();
1020 fCuts->CreateStandardCuts();
1021 //fCuts->SetMinNClustersTPC(100);
1022 fCuts->SetMinNClustersTPC(90);
1023 fCuts->SetMinRatioTPCclusters(0.6);
1024 fCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
1025 //fCuts->SetMinNClustersITS(3);
1026 fCuts->SetMinNClustersITS(2);
1027 fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
1028 fCuts->SetCheckITSLayerStatus(kFALSE);
1029 fCuts->SetVertexRange(10.);
1030 fCuts->SetTOFPIDStep(kFALSE);
1031 fCuts->SetPtRange(2, 50);
1032 fCuts->SetMaxImpactParam(3.,3.);
1034 //--------Initialize correction Framework and Cuts
1035 fCFM = new AliCFManager;
1036 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
1037 fCFM->SetNStepParticle(kNcutSteps);
1038 for(Int_t istep = 0; istep < kNcutSteps; istep++)
1039 fCFM->SetParticleCutsList(istep, NULL);
1042 AliWarning("Cuts not available. Default cuts will be used");
1043 fCuts = new AliHFEcuts;
1044 fCuts->CreateStandardCuts();
1046 fCuts->Initialize(fCFM);
1048 //---------Output Tlist
1049 fOutputList = new TList();
1050 fOutputList->SetOwner();
1051 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
1053 fNoEvents = new TH1F("fNoEvents","",4,-0.5,3.5) ;
1054 fOutputList->Add(fNoEvents);
1056 Int_t binsE[5] = {250, 100, 1000, 200, 10};
1057 Double_t xminE[5] = {1.0, -1, 0.0, 0, -0.5};
1058 Double_t xmaxE[5] = {3.5, 1, 100.0, 100, 9.5};
1059 fEMCAccE = new THnSparseD("fEMCAccE","EMC acceptance & E;#eta;#phi;Energy;Centrality;trugCondition;",5,binsE,xminE,xmaxE);
1060 //if(fqahist==1)fOutputList->Add(fEMCAccE);
1062 hEMCAccE = new TH2F("hEMCAccE","Cluster Energy",200,0,100,100,0,20);
1063 fOutputList->Add(hEMCAccE);
1065 fTrkpt = new TH1F("fTrkpt","track pt",100,0,50);
1066 fOutputList->Add(fTrkpt);
1068 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",100,0,50);
1069 fOutputList->Add(fTrackPtBefTrkCuts);
1071 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",100,0,50);
1072 fOutputList->Add(fTrackPtAftTrkCuts);
1074 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",100,0,50,200,-10,10);
1075 fOutputList->Add(fTPCnsigma);
1077 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",100,0,50,100,0,2);
1078 fOutputList->Add(fTrkEovPBef);
1080 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",100,0,50,100,0,2);
1081 fOutputList->Add(fTrkEovPAft);
1083 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",100,0,50,200,-10,10);
1084 fOutputList->Add(fdEdxBef);
1086 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",100,0,50,200,-10,10);
1087 fOutputList->Add(fdEdxAft);
1089 fIncpT = new TH2F("fIncpT","HFE pid electro vs. centrality",200,0,100,100,0,50);
1090 fOutputList->Add(fIncpT);
1092 fIncpTM20 = new TH2F("fIncpTM20","HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
1093 fOutputList->Add(fIncpTM20);
1095 Int_t nBinspho[9] = { 10, 30, 600, 60, 50, 4, 40, 8, 30};
1096 Double_t minpho[9] = { 0., 0., -0.1, 40, 0, -0.5, 0,-1.5, 0};
1097 Double_t maxpho[9] = {100., 30., 0.5, 100, 1, 3.5, 2, 6.5, 30};
1099 fInvmassLS = new THnSparseD("fInvmassLS", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2); nSigma; angle; m20cut; eop; Mcele;", 9, nBinspho,minpho, maxpho);
1100 if(fqahist==1)fOutputList->Add(fInvmassLS);
1102 fInvmassULS = new THnSparseD("fInvmassULS", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2); nSigma; angle; m20cut; eop; MCele", 9, nBinspho,minpho, maxpho);
1103 if(fqahist==1)fOutputList->Add(fInvmassULS);
1105 fInvmassLSmc = new THnSparseD("fInvmassLSmc", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2); nSigma; angle; m20cut; eop; Mcele;", 9, nBinspho,minpho, maxpho);
1106 if(fqahist==1)fOutputList->Add(fInvmassLSmc);
1108 fInvmassULSmc = new THnSparseD("fInvmassULSmc", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2); nSigma; angle; m20cut; eop; MCele", 9, nBinspho,minpho, maxpho);
1109 if(fqahist==1)fOutputList->Add(fInvmassULSmc);
1111 fInvmassLSreco = new TH2D("fInvmassLSreco", "Inv mass of LS (e,e) reco; cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1112 fInvmassLSreco->Sumw2();
1113 fOutputList->Add(fInvmassLSreco);
1115 fInvmassULSreco = new TH2D("fInvmassULSreco", "Inv mass of ULS (e,e) reco; cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1116 fInvmassULSreco->Sumw2();
1117 fOutputList->Add(fInvmassULSreco);
1119 fInvmassLSmc0 = new TH2D("fInvmassLSmc0", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1120 fInvmassLSmc0->Sumw2();
1121 fOutputList->Add(fInvmassLSmc0);
1123 fInvmassLSmc1 = new TH2D("fInvmassLSmc1", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1124 fInvmassLSmc1->Sumw2();
1125 fOutputList->Add(fInvmassLSmc1);
1127 fInvmassLSmc2 = new TH2D("fInvmassLSmc2", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1128 fInvmassLSmc2->Sumw2();
1129 fOutputList->Add(fInvmassLSmc2);
1131 fInvmassLSmc3 = new TH2D("fInvmassLSmc3", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1132 fInvmassLSmc3->Sumw2();
1133 fOutputList->Add(fInvmassLSmc3);
1135 fInvmassULSmc0 = new TH2D("fInvmassULSmc0", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1136 fInvmassULSmc0->Sumw2();
1137 fOutputList->Add(fInvmassULSmc0);
1139 fInvmassULSmc1 = new TH2D("fInvmassULSmc1", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1140 fInvmassULSmc1->Sumw2();
1141 fOutputList->Add(fInvmassULSmc1);
1143 fInvmassULSmc2 = new TH2D("fInvmassULSmc2", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1144 fInvmassULSmc2->Sumw2();
1145 fOutputList->Add(fInvmassULSmc2);
1147 fInvmassULSmc3 = new TH2D("fInvmassULSmc3", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,600,-0.1,0.5 );
1148 fInvmassULSmc3->Sumw2();
1149 fOutputList->Add(fInvmassULSmc3);
1151 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1152 fOutputList->Add(fOpeningAngleLS);
1154 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1155 fOutputList->Add(fOpeningAngleULS);
1157 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,50);
1158 fOutputList->Add(fPhotoElecPt);
1160 fPhoElecPt = new TH2F("fPhoElecPt", "Pho-inclusive electron pt",200,0,100,100,0,50);
1161 fOutputList->Add(fPhoElecPt);
1163 fPhoElecPtM20 = new TH2F("fPhoElecPtM20", "Pho-inclusive electron pt with M20",200,0,100,100,0,50);
1164 fOutputList->Add(fPhoElecPtM20);
1166 fSameElecPt = new TH2F("fSameElecPt", "Same-inclusive electron pt",200,0,100,100,0,50);
1167 fOutputList->Add(fSameElecPt);
1169 fSameElecPtM20 = new TH2F("fSameElecPtM20", "Same-inclusive electron pt with M20",200,0,100,100,0,50);
1170 fOutputList->Add(fSameElecPtM20);
1172 fCent = new TH1F("fCent","Centrality",200,0,100) ;
1173 fOutputList->Add(fCent);
1175 // Make common binning
1176 const Double_t kMinP = 0.;
1177 const Double_t kMaxP = 20.;
1179 // 1st histogram: TPC dEdx with/without EMCAL (p, pT, TPC Signal, phi, eta, Sig, e/p, ,match, cell, M02, M20, Disp, Centrality, select)
1180 Int_t nBins[16] = { 100, 7, 60, 20, 90, 250, 25, 40, 10, 200, 100, 100, 500, 5, 100, 8};
1181 Double_t min[16] = {kMinP, -0.5, 1.0, -1.0, -5.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, -0.5, 80, -1.5};
1182 Double_t max[16] = {kMaxP, 6.5, 4.0, 1.0, 4.0, 2.5, 0.05, 40, 10, 2.0, 20.0, 100, 100, 4.5, 180, 6.5};
1183 fEleInfo = new THnSparseD("fEleInfo", "Electron Info; pT [GeV/c]; TPC signal;phi;eta;nSig; E/p;Rmatch;Ncell;clsF;M20;mcpT;Centrality;charge;opp;same;trigCond;MCele", 16, nBins, min, max);
1184 if(fqahist==1)fOutputList->Add(fEleInfo);
1186 // Make common binning
1187 Int_t nBinsEop[3] = { 10, 50, 100};
1188 Double_t minEop[3] = { 0, 0, -5};
1189 Double_t maxEop[3] = {100, 50, 5};
1190 fElenSigma= new THnSparseD("fElenSigma", "Electron nSigma; cent; pT [GeV/c]; nSigma", 3, nBinsEop, minEop, maxEop);
1191 fOutputList->Add(fElenSigma);
1196 fClsEBftTrigCut = new TH1F("fClsEBftTrigCut","cluster E before trigger selection",1000,0,100);
1197 fOutputList->Add(fClsEBftTrigCut);
1199 fClsEAftTrigCut = new TH1F("fClsEAftTrigCut","cluster E if cls has 0 trigcut channel",1000,0,100);
1200 fOutputList->Add(fClsEAftTrigCut);
1202 fClsEAftTrigCut1 = new TH1F("fClsEAftTrigCut1","cluster E if cls with trig channel",1000,0,100);
1203 fOutputList->Add(fClsEAftTrigCut1);
1205 fClsEAftTrigCut2 = new TH1F("fClsEAftTrigCut2","cluster E if cls with trigcut channel",1000,0,100);
1206 fOutputList->Add(fClsEAftTrigCut2);
1208 fClsEAftTrigCut3 = new TH1F("fClsEAftTrigCut3","cluster E if cls with trigcut channel + nCell>Ecorrect",1000,0,100);
1209 fOutputList->Add(fClsEAftTrigCut3);
1211 fClsEAftTrigCut4 = new TH1F("fClsEAftTrigCut4","cluster E if cls with trigcut channel + nCell>Ecorrect + cls time cut",1000,0,100);
1212 fOutputList->Add(fClsEAftTrigCut4);
1214 fClsETime = new TH2F("fClsETime", "Cls time vs E; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1215 fOutputList->Add(fClsETime);
1217 fClsETime1 = new TH2F("fClsETime1", "Cls time vs E if cls contains trigger channel; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1218 fOutputList->Add(fClsETime1);
1220 fTrigTimes = new TH1F("fTrigTimes", "Trigger time; time; N;",25,0,25);
1221 fOutputList->Add(fTrigTimes);
1223 fCellCheck = new TH2F("fCellCheck", "Cell vs E; E GeV; Cell ID",10,6,26,12000,0,12000);
1224 fOutputList->Add(fCellCheck);
1228 fInputHFEMC = new TH2F("fInputHFEMC","Input MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1229 fOutputList->Add(fInputHFEMC);
1231 fInputAlle = new TH2F("fInputAlle","Input MC electro vs. centrality",200,0,100,100,0,50);
1232 fOutputList->Add(fInputAlle);
1234 fIncpTMChfe = new TH2F("fIncpTMChfe","MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1235 fOutputList->Add(fIncpTMChfe);
1237 fIncpTMChfeAll = new TH2F("fIncpTMChfeAll","MC Alle pid electro vs. centrality",200,0,100,100,0,50);
1238 fOutputList->Add(fIncpTMChfeAll);
1240 fIncpTMCM20hfe = new TH2F("fIncpTMCM20hfe","MC HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
1241 fOutputList->Add(fIncpTMCM20hfe);
1243 fIncpTMCM20hfeAll = new TH2F("fIncpTMCM20hfeAll","MC Alle pid electro vs. centrality with M20",200,0,100,100,0,50);
1244 fOutputList->Add(fIncpTMCM20hfeAll);
1246 fIncpTMCM20hfeCheck = new TH2F("fIncpTMCM20hfeCheck","MC HFE pid electro vs. centrality with M20 Check",200,0,100,100,0,50);
1247 fOutputList->Add(fIncpTMCM20hfeCheck);
1249 Int_t nBinspho2[5] = { 200, 100, 7, 3, 700};
1250 Double_t minpho2[5] = { 0., 0., -2.5, -0.5, 0.};
1251 Double_t maxpho2[5] = {100., 50., 4.5, 2.5, 70.};
1253 fInputHFEMC_weight = new THnSparseD("fInputHFEMC_weight", "MC HFE electron pt",5,nBinspho2,minpho2,maxpho2);
1254 fOutputList->Add(fInputHFEMC_weight);
1256 fIncpTMCM20hfeCheck_weight = new THnSparseD("fIncpTMCM20hfeCheck_weight", "HFE electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1257 fOutputList->Add(fIncpTMCM20hfeCheck_weight);
1259 fIncpTMCpho = new THnSparseD("fIncpTMCpho","MC Pho pid electro vs. centrality",5,nBinspho2,minpho2,maxpho2);
1260 fOutputList->Add(fIncpTMCpho);
1262 fIncpTMCM20pho = new THnSparseD("fIncpTMCM20pho","MC Pho pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1263 fOutputList->Add(fIncpTMCM20pho);
1265 fPhoElecPtMC = new THnSparseD("fPhoElecPtMC", "MC Pho-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1266 fOutputList->Add(fPhoElecPtMC);
1268 fPhoElecPtMCM20 = new THnSparseD("fPhoElecPtMCM20", "MC Pho-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1269 fOutputList->Add(fPhoElecPtMCM20);
1271 fSameElecPtMC = new THnSparseD("fSameElecPtMC", "MC Same-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1272 fOutputList->Add(fSameElecPtMC);
1274 fSameElecPtMCM20 = new THnSparseD("fSameElecPtMCM20", "MC Same-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1275 fOutputList->Add(fSameElecPtMCM20);
1277 fIncpTMCM20pho_pi0e = new THnSparseD("fIncpTMCM20pho_pi0e","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1278 fIncpTMCM20pho_pi0e->Sumw2();
1279 fOutputList->Add(fIncpTMCM20pho_pi0e);
1281 fPhoElecPtMCM20_pi0e = new THnSparseD("fPhoElecPtMCM20_pi0e", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1282 fPhoElecPtMCM20_pi0e->Sumw2();
1283 fOutputList->Add(fPhoElecPtMCM20_pi0e);
1285 fSameElecPtMCM20_pi0e = new THnSparseD("fSameElecPtMCM20_pi0e", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1286 fSameElecPtMCM20_pi0e->Sumw2();
1287 fOutputList->Add(fSameElecPtMCM20_pi0e);
1289 fIncpTMCM20pho_eta = new THnSparseD("fIncpTMCM20pho_eta","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1290 fIncpTMCM20pho_eta->Sumw2();
1291 fOutputList->Add(fIncpTMCM20pho_eta);
1293 fPhoElecPtMCM20_eta = new THnSparseD("fPhoElecPtMCM20_eta", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1294 fPhoElecPtMCM20_eta->Sumw2();
1295 fOutputList->Add(fPhoElecPtMCM20_eta);
1297 fSameElecPtMCM20_eta = new THnSparseD("fSameElecPtMCM20_eta", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1298 fSameElecPtMCM20_eta->Sumw2();
1299 fOutputList->Add(fSameElecPtMCM20_eta);
1301 fIncpTMCpho_pi0e_TPC = new THnSparseD("fIncpTMCpho_pi0e_TPC","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1302 fIncpTMCpho_pi0e_TPC->Sumw2();
1303 fOutputList->Add(fIncpTMCpho_pi0e_TPC);
1305 fPhoElecPtMC_pi0e_TPC = new THnSparseD("fPhoElecPtMC_pi0e_TPC", "MC Pho-inclusive electron pt with pi0->e",5,nBinspho2,minpho2,maxpho2);
1306 fPhoElecPtMC_pi0e_TPC->Sumw2();
1307 fOutputList->Add(fPhoElecPtMC_pi0e_TPC);
1309 fSameElecPtMC_pi0e_TPC = new THnSparseD("fSameElecPtMC_pi0e_TPC", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1310 fSameElecPtMC_pi0e_TPC->Sumw2();
1311 fOutputList->Add(fSameElecPtMC_pi0e_TPC);
1314 CheckNclust = new TH1D("CheckNclust","cluster check",200,0,200);
1315 fOutputList->Add(CheckNclust);
1317 CheckNits = new TH1D("CheckNits","ITS cluster check",8,-0.5,7.5);
1318 fOutputList->Add(CheckNits);
1320 Hpi0pTcheck = new TH2D("Hpi0pTcheck","Pi0 pT from Hijing",100,0,50,3,-0.5,2.5);
1321 fOutputList->Add(Hpi0pTcheck);
1323 HETApTcheck = new TH2D("HETApTcheck","Eta pT from Hijing",100,0,50,3,-0.5,2.5);
1324 fOutputList->Add(HETApTcheck);
1327 Int_t nBinspho3[3] = { 200, 100, 3};
1328 Double_t minpho3[3] = { 0., 0., -0.5};
1329 Double_t maxpho3[3] = {100., 50., 2.5};
1331 Hpi0pTcheck = new THnSparseD("Hpi0pTcheck","Pi0 pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1332 fOutputList->Add(Hpi0pTcheck);
1334 HETApTcheck = new THnSparseD("HETApTcheck","Eta pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1335 fOutputList->Add(HETApTcheck);
1337 HphopTcheck = new TH2D("HphopTcheck","Pho pT from Hijing",100,0,50,3,-0.5,2.5);
1338 fOutputList->Add(HphopTcheck);
1340 HDpTcheck = new TH2D("HDpTcheck","D pT from Hijing",100,0,50,3,-0.5,2.5);
1341 fOutputList->Add(HDpTcheck);
1343 HBpTcheck = new TH2D("HBpTcheck","B pT from Hijing",100,0,50,3,-0.5,2.5);
1344 fOutputList->Add(HBpTcheck);
1347 fpTCheck = new TH1D("fpTCheck","pT check",500,0,50);
1348 fOutputList->Add(fpTCheck);
1350 fMomDtoE = new TH2D("fMomDtoE","D->E pT correlations;e p_{T} GeV/c;D p_{T} GeV/c",400,0,40,400,0,40);
1351 fOutputList->Add(fMomDtoE);
1353 fLabelCheck = new TH2D("fLabelCheck","MC label",50,0,50,5,-1.5,3.5);
1354 fOutputList->Add(fLabelCheck);
1356 fgeoFake = new TH2D("fgeoFake","Label==0 eta and phi",628,0,6.28,200,-1,1);
1357 fOutputList->Add(fgeoFake);
1359 fFakeTrk0 = new TH2D("fFakeTrk0","fake trakcs",10,0,100,20,0,20);
1360 fOutputList->Add(fFakeTrk0);
1362 fFakeTrk1 = new TH2D("fFakeTrk1","true all e a.f. eID",10,0,100,20,0,20);
1363 fOutputList->Add(fFakeTrk1);
1365 ftimingEle = new TH2D("ftimingEle","electron TOF",100,0,20,100,1e-7,1e-6);
1366 fOutputList->Add(ftimingEle);
1369 // note: parameters 01/31new.TPCnSigmaEtaDep
1370 // 70-90 delta_eta = 0.2
1372 double etaval[12] = {-0.55,-0.45,-0.35,-0.25,-0.15,-0.05,0.05,0.15,0.25,0.35,0.45,0.55};
1373 double corr0[12]= {-0.569177,-0.528844,-0.391979,-0.165494,0.0283495,0.156171,0.266353,0.13103,-0.0250842,-0.274089,-0.45481,-0.536291}; // 0-10 (done)
1374 double corr1[12]= {-0.404742,-0.278953,-0.218069,0.00139927,0.191412,0.354403,0.524594,0.341778,0.244199,-0.112146,-0.160692,-0.352832}; // 10-20 (done)
1375 double corr2[12] = {-0.306007,-0.16821,-0.0248635,0.202233,0.447051,0.497197,0.712251,0.433482,0.337907,0.168426,-0.0693229,-0.0728351}; // 20-30 (done)
1376 double corr3[12] = {-0.13884,-0.0503553,0.104403,0.389773,0.50697,0.539048,0.751642,0.655636,0.518563,0.308156,0.0361159,-0.0491439}; // 30-40 (done)
1377 double corr4[12] = {-0.0319431,0.0808711,0.208774,0.443217,0.557762,0.61453,0.889519,0.808282,0.620394,0.267092,0.15241,-0.0458664}; // 40-50 (done)
1378 double corr5[12] = {-0.130625,0.0189124,0.190344,0.467431,0.546353,0.672251,0.731541,0.802101,0.437108,0.294081,0.193682,0.159074}; // 50-70(done)
1379 double corr6[12] = {0.0600197,0.0600197,0.358366,0.358366,0.973734,0.973734,0.759812,0.759812,0.667861,0.667861,0.415635,0.415635}; // 70-90(done)
1381 fnSigEtaCorr[0] = new TGraphErrors(12,etaval,corr0); // 0-10
1382 fnSigEtaCorr[1] = new TGraphErrors(12,etaval,corr1); // 10-20
1383 fnSigEtaCorr[2] = new TGraphErrors(12,etaval,corr2); // 20-30
1384 fnSigEtaCorr[3] = new TGraphErrors(12,etaval,corr3); // 30-40
1385 fnSigEtaCorr[4] = new TGraphErrors(12,etaval,corr4); // 40-50
1386 fnSigEtaCorr[5] = new TGraphErrors(12,etaval,corr5); // 50-70
1387 fnSigEtaCorr[6] = new TGraphErrors(12,etaval,corr6); // 70-90
1389 fIncMaxE = new TH2D("fIncMaxE","Inc",10,0,100,10,0,100);
1390 fOutputList->Add(fIncMaxE);
1392 fIncReco = new TH2D("fIncReco","Inc",10,0,100,100,0,500);
1393 fOutputList->Add(fIncReco);
1395 fPhoReco = new TH2D("fPhoReco","Pho",10,0,100,100,0,500);
1396 fOutputList->Add(fPhoReco);
1398 fSamReco = new TH2D("fSamReco","Same",10,0,100,100,0,500);
1399 fOutputList->Add(fSamReco);
1401 fIncRecoMaxE = new TH2D("fIncRecoMaxE","Inc",10,0,100,100,0,500);
1402 fOutputList->Add(fIncRecoMaxE);
1404 fPhoRecoMaxE = new TH2D("fPhoRecoMaxE","Pho",10,0,100,100,0,500);
1405 fOutputList->Add(fPhoRecoMaxE);
1407 fSamRecoMaxE = new TH2D("fSamRecoMaxE","Same",10,0,100,100,0,500);
1408 fOutputList->Add(fSamRecoMaxE);
1410 PostData(1,fOutputList);
1413 //________________________________________________________________________
1414 void AliAnalysisTaskHFECal::Terminate(Option_t *)
1416 // Info("Terminate");
1417 AliAnalysisTaskSE::Terminate();
1420 //________________________________________________________________________
1421 Bool_t AliAnalysisTaskHFECal::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1423 // Check single track cuts for a given cut step
1424 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1425 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1428 //_________________________________________
1429 void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec, Bool_t &fFlagConvinatElec, Double_t nSig, Double_t shower, Double_t ep, Double_t mce, Double_t w, Int_t ibgevent, Bool_t tagpi0, Bool_t tageta)
1431 //Identify non-heavy flavour electrons using Invariant mass method
1433 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
1434 fTrackCuts->SetRequireTPCRefit(kTRUE);
1435 fTrackCuts->SetRequireITSRefit(kTRUE);
1436 fTrackCuts->SetEtaRange(-0.9,0.9);
1437 //fTrackCuts->SetRequireSigmaToVertex(kTRUE);
1438 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
1439 fTrackCuts->SetMinNClustersTPC(90);
1441 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
1443 double ptEle = track->Pt(); //add
1444 if(ibgevent==0 && w > 0.0)
1446 fpTCheck->Fill(ptEle,w);
1449 Bool_t flagPhotonicElec = kFALSE;
1450 Bool_t flagConvinatElec = kFALSE;
1455 Int_t label = TMath::Abs(track->GetLabel());
1456 TParticle* particle = stack->Particle(label);
1457 p1 = particle->GetFirstMother();
1460 //for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1461 for(Int_t jTracks = 0; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1462 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
1464 printf("ERROR: Could not receive track %d\n", jTracks);
1467 if(itrack==jTracks)continue;
1473 Int_t label2 = TMath::Abs(trackAsso->GetLabel());
1474 TParticle* particle2 = stack->Particle(label2);
1475 Bool_t MChijing_ass = fMC->IsFromBGEvent(label2);
1476 if(MChijing_ass)jbgevent =1;
1477 if(particle2->GetFirstMother()>-1)
1478 p2 = particle2->GetFirstMother();
1481 Double_t dEdxAsso = -999., ptPrim=-999., ptAsso=-999., openingAngle = -999.;
1482 Double_t mass=999., width = -999;
1483 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
1485 //ptPrim = track->Pt();
1488 dEdxAsso = trackAsso->GetTPCsignal();
1489 ptAsso = trackAsso->Pt();
1490 Int_t chargeAsso = trackAsso->Charge();
1491 Int_t charge = track->Charge();
1494 if(ptAsso <0.5) continue;
1495 if(!fTrackCuts->AcceptTrack(trackAsso)) continue;
1496 if(dEdxAsso <65 || dEdxAsso>100) continue; //11a pass1
1498 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
1499 if(charge>0) fPDGe1 = -11;
1500 if(chargeAsso>0) fPDGe2 = -11;
1502 //printf("chargeAsso = %d\n",chargeAsso);
1503 //printf("charge = %d\n",charge);
1504 if(charge == chargeAsso) fFlagLS = kTRUE;
1505 if(charge != chargeAsso) fFlagULS = kTRUE;
1507 //printf("fFlagLS = %d\n",fFlagLS);
1508 //printf("fFlagULS = %d\n",fFlagULS);
1511 AliKFParticle ge1(*track, fPDGe1);
1512 AliKFParticle ge2(*trackAsso, fPDGe2);
1513 AliKFParticle recg(ge1, ge2);
1516 AliKFVertex primV(*pVtx);
1518 recg.SetProductionVertex(primV);
1521 if(recg.GetNDF()<1) continue;
1522 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1523 Double_t chi2cut = 3.0;
1526 if(fSetMassConstraint)
1528 recg.SetMassConstraint(0,0.0001);
1531 recg.GetMass(mass,width);
1534 openingAngle = ge1.GetAngle(ge2);
1535 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
1536 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
1539 if(shower>0.0 && shower<0.3)ishower = 1;
1543 phoinfo[1] = ptPrim;
1546 //phoinfo[3] = dEdxAsso;
1547 phoinfo[4] = openingAngle;
1548 phoinfo[5] = ishower;
1551 phoinfo[8] = ptAsso;
1553 if(fFlagLS) fInvmassLS->Fill(phoinfo);
1554 if(fFlagULS) fInvmassULS->Fill(phoinfo);
1555 if(fFlagLS && ibgevent==0 && jbgevent==0) fInvmassLSmc->Fill(phoinfo,w);
1556 if(fFlagULS && ibgevent==0 && jbgevent==0)
1558 fInvmassULSmc->Fill(phoinfo,w);
1560 //printf("fInvmassCut %f\n",fInvmassCut);
1561 //printf("openingAngle %f\n",fOpeningAngleCut);
1564 if(openingAngle > fOpeningAngleCut) continue;
1566 //if(TMath::Sqrt(TMath::Abs(chi2recg))>chi2cut) continue;
1567 if(chi2recg>chi2cut) continue;
1569 if(fFlagLS ) fInvmassLSreco->Fill(ptPrim,mass);
1570 if(fFlagULS) fInvmassULSreco->Fill(ptPrim,mass);
1573 //printf("mce =%f\n",mce);
1574 if(mce<-0.5) // mce==-1. is real
1576 //printf("Real data\n");
1577 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
1578 flagPhotonicElec = kTRUE;
1580 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec){
1581 flagConvinatElec = kTRUE;
1587 //printf("MC data\n");
1591 //cout << "tagpi0 = " << tagpi0 << " ; tageta = " << tageta << endl;
1592 if(fFlagLS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassLSmc0->Fill(ptPrim,mass);
1593 if(fFlagULS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassULSmc0->Fill(ptPrim,mass);
1594 if(fFlagLS && ibgevent==0 && jbgevent==0 && tageta) fInvmassLSmc1->Fill(ptPrim,mass);
1595 if(fFlagULS && ibgevent==0 && jbgevent==0 && tageta) fInvmassULSmc1->Fill(ptPrim,mass);
1596 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassLSmc2->Fill(ptPrim,mass);
1597 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassULSmc2->Fill(ptPrim,mass);
1598 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassLSmc3->Fill(ptPrim,mass);
1599 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassULSmc3->Fill(ptPrim,mass);
1602 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (ibgevent==jbgevent)){
1603 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1604 flagPhotonicElec = kTRUE;
1606 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec && (ibgevent==jbgevent)){
1607 flagConvinatElec = kTRUE;
1612 fFlagPhotonicElec = flagPhotonicElec;
1613 fFlagConvinatElec = flagConvinatElec;
1616 //-------------------------------------------
1618 void AliAnalysisTaskHFECal::FindMother(TParticle* part, int &label, int &pid)
1620 //int label = 99999;
1623 if(part->GetFirstMother()>-1)
1625 label = part->GetFirstMother();
1626 pid = stack->Particle(label)->GetPdgCode();
1628 //cout << "Find Mother : label = " << label << " ; pid" << pid << endl;
1631 double AliAnalysisTaskHFECal::GetMCweight(double mcPi0pT)
1633 double weight = 1.0;
1635 if(mcPi0pT>0.0 && mcPi0pT<5.0)
1637 weight = 0.323*mcPi0pT/(TMath::Exp(-1.6+0.767*mcPi0pT+0.0285*mcPi0pT*mcPi0pT));
1641 weight = 115.0/(0.718*mcPi0pT*TMath::Power(mcPi0pT,3.65));
1646 double AliAnalysisTaskHFECal::GetMCweightEta(double mcEtapT)
1648 double weight = 1.0;
1650 weight = 223.3/TMath::Power((TMath::Exp(-0.17*mcEtapT-0.0322*mcEtapT*mcEtapT)+mcEtapT/1.69),5.65);
1655 //_________________________________________
1656 void AliAnalysisTaskHFECal::FindTriggerClusters()
1658 //cout << "finding trigger patch" << endl;
1660 const int nModuleCols = 2;
1661 const int nModuleRows = 5;
1662 const int nColsFeeModule = 48;
1663 const int nRowsFeeModule = 24;
1664 const int nColsFaltroModule = 24;
1665 const int nRowsFaltroModule = 12;
1666 //const int faltroWidthMax = 20;
1668 // part 1, trigger extraction -------------------------------------
1669 Int_t globCol, globRow;
1670 //Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0, trigInCut=0;
1671 Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0;
1673 //Int_t trigtimes[faltroWidthMax];
1674 Double_t cellTime[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1675 Double_t cellEnergy[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1676 //Double_t fTrigCutLow = 6;
1677 //Double_t fTrigCutHigh = 10;
1678 Double_t fTimeCutLow = 469e-09;
1679 Double_t fTimeCutHigh = 715e-09;
1681 AliESDCaloTrigger * fCaloTrigger = fESD->GetCaloTrigger( "EMCAL" );
1683 // erase trigger maps
1684 for(Int_t i = 0; i < nColsFaltroModule*nModuleCols; i++ )
1686 for(Int_t j = 0; j < nRowsFaltroModule*nModuleRows; j++ )
1688 ftriggersCut[i][j] = 0;
1689 ftriggers[i][j] = 0;
1690 ftriggersTime[i][j] = 0;
1694 Int_t iglobCol=0, iglobRow=0;
1695 // go through triggers
1696 if( fCaloTrigger->GetEntries() > 0 )
1699 fCaloTrigger->Reset();
1700 while( fCaloTrigger->Next() )
1702 fCaloTrigger->GetPosition( globCol, globRow );
1703 fCaloTrigger->GetNL0Times( ntimes );
1706 if( ntimes < 1 ) continue;
1707 // get precise timings
1708 fCaloTrigger->GetL0Times( trigtimes );
1710 for(Int_t i = 0; i < ntimes; i++ )
1712 // save the first trigger time in channel
1713 if( i == 0 || triggersTime[globCol][globRow] > trigtimes[i] )
1714 triggersTime[globCol][globRow] = trigtimes[i];
1715 //printf("trigger times: %d\n",trigtimes[i]);
1717 if(trigtimes[i] > fTrigCutLow && trigtimes[i] < fTrigCutHigh )
1720 fTrigTimes->Fill(trigtimes[i]);
1724 //L1 analysis from AliAnalysisTaskEMCALTriggerQA
1726 fCaloTrigger->GetTriggerBits(bit);
1727 //cout << "bit = " << bit << endl;
1730 fCaloTrigger->GetL1TimeSum(ts);
1731 //cout << "ts = " << ts << endl;
1732 if (ts > 0)ftriggers[globCol][globRow] = 1;
1733 // number of triggered channels in event
1736 if(ts>0 && (bit >> 6 & 0x1))
1741 //cout << "ts cut = " << ts << endl;
1742 //cout << "globCol = " << globCol << endl;
1743 //cout << "globRow = " << globRow << endl;
1744 ftriggersCut[globCol][globRow] = 1;
1747 } // calo trigger entries
1748 } // has calo trigger entries
1750 // part 2 go through the clusters here -----------------------------------
1751 //cout << " part 2 go through the clusters here ----------------------------------- " << endl;
1752 Int_t nCluster=0, nCell=0, iCell=0, gCell=0;
1753 Short_t cellAddr, nSACell;
1755 //Int_t nSACell, iSACell, mclabel;
1757 Double_t cellAmp=0, cellTimeT=0, clusterTime=0, efrac=0;
1758 Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta, gphi, geta, feta, fphi;
1760 TRefArray *fCaloClusters = new TRefArray();
1761 fESD->GetEMCALClusters( fCaloClusters );
1762 nCluster = fCaloClusters->GetEntries();
1765 // save all cells times if there are clusters
1768 for(Int_t i = 0; i < nColsFeeModule*nModuleCols; i++ ){
1769 for(Int_t j = 0; j < nRowsFeeModule*nModuleRows; j++ ){
1770 cellTime[i][j] = 0.;
1771 cellEnergy[i][j] = 0.;
1776 AliESDCaloCells *fCaloCells = fESD->GetEMCALCells();
1777 //AliVCaloCells fCaloCells = fESD->GetEMCALCells();
1778 nSACell = fCaloCells->GetNumberOfCells();
1779 for(iSACell = 0; iSACell < nSACell; iSACell++ ){
1780 // get the cell info *fCal
1781 fCaloCells->GetCell( iSACell, cellAddr, cellAmp, cellTimeT , mclabel, efrac);
1783 // get cell position
1784 fGeom->GetCellIndex( cellAddr, nSupMod, nModule, nIphi, nIeta );
1785 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1787 // convert co global phi eta
1788 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1789 geta = ieta + nColsFeeModule*(nSupMod%2);
1791 // save cell time and energy
1792 cellTime[geta][gphi] = cellTimeT;
1793 cellEnergy[geta][gphi] = cellAmp;
1798 Int_t nClusterTrig, nClusterTrigCut;
1799 UShort_t *cellAddrs;
1800 Double_t clsE=-999, clsEta=-999, clsPhi=-999;
1801 Float_t clsPos[3] = {0.,0.,0.};
1803 for(Int_t icl=0; icl<fESD->GetNumberOfCaloClusters(); icl++)
1805 AliESDCaloCluster *cluster = fESD->GetCaloCluster(icl);
1806 if(!cluster || !cluster->IsEMCAL()) continue;
1808 // get cluster cells
1809 nCell = cluster->GetNCells();
1811 // get cluster energy
1812 clsE = cluster->E();
1814 // get cluster position
1815 cluster->GetPosition(clsPos);
1816 TVector3 clsPosVec(clsPos[0],clsPos[1],clsPos[2]);
1817 clsEta = clsPosVec.Eta();
1818 clsPhi = clsPosVec.Phi();
1820 // get the cell addresses
1821 cellAddrs = cluster->GetCellsAbsId();
1823 // check if the cluster contains cell, that was marked as triggered
1825 nClusterTrigCut = 0;
1827 // loop the cells to check, if cluser in acceptance
1828 // any cluster with a cell outside acceptance is not considered
1829 for( iCell = 0; iCell < nCell; iCell++ )
1832 //if(clsE>6.0)fCellCheck->Fill(clsE,cellAddrs[iCell]);
1834 // get cell position
1835 fGeom->GetCellIndex( cellAddrs[iCell], nSupMod, nModule, nIphi, nIeta );
1836 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1838 // convert co global phi eta
1839 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1840 geta = ieta + nColsFeeModule*(nSupMod%2);
1842 if( cellTime[geta][gphi] > 0. ){
1843 clusterTime += cellTime[geta][gphi];
1847 // get corresponding FALTRO
1851 //cout << "fphi = " << fphi << endl;
1852 //cout << "feta = " << feta << endl;
1854 // try to match with a triggered
1855 if( ftriggers[feta][fphi]==1)
1858 if( ftriggersCut[feta][fphi]==1)
1859 { nClusterTrigCut++;
1862 //cout << "nClusterTrigCut : " << nClusterTrigCut << endl;
1868 clusterTime = clusterTime / (Double_t)gCell;
1869 // fix the reconstriction code time 100ns jumps
1870 if( fESD->GetBunchCrossNumber() % 4 < 2 )
1871 clusterTime -= 0.0000001;
1873 //fClsETime->Fill(clsE,clusterTime);
1874 //fClsEBftTrigCut->Fill(clsE);
1877 //fClsETime1->Fill(clsE,clusterTime);
1881 cluster->SetChi2(1);
1882 //fClsEAftTrigCut1->Fill(clsE);
1885 if(nClusterTrigCut>0){
1886 cluster->SetChi2(2);
1887 //fClsEAftTrigCut2->Fill(clsE);
1890 if(nClusterTrigCut>0 && ( nCell > (1 + clsE / 3)))
1892 cluster->SetChi2(3);
1893 //fClsEAftTrigCut3->Fill(clsE);
1896 if(nClusterTrigCut>0 && (nCell > (1 + clsE / 3) )&&( clusterTime > fTimeCutLow && clusterTime < fTimeCutHigh ))
1898 // cluster->SetChi2(4);
1899 //fClsEAftTrigCut4->Fill(clsE);
1901 if(nClusterTrigCut<1)
1903 cluster->SetChi2(0);
1905 //fClsEAftTrigCut->Fill(clsE);
1911 // <-------- only MC correction
1912 double AliAnalysisTaskHFECal::MCEopMeanCorrection(double pTmc, float central)
1914 TF1 *fcorr0 = new TF1("fcorr0","[0]*tanh([1]+[2]*x)");
1915 TF1 *fcorr1 = new TF1("fcorr1","[0]*tanh([1]+[2]*x)");
1919 if(central>0 && central<=10)
1921 fcorr0->SetParameters(1.045,1.288,3.18e-01); //
1922 fcorr1->SetParameters(9.91e-01,3.466,2.344);
1924 else if(central>10 && central<=20)
1926 fcorr0->SetParameters(1.029,8.254e-01,4.07e-01);
1927 fcorr1->SetParameters(0.975,2.276,1.501e-01);
1929 else if(central>20 && central<=30)
1931 fcorr0->SetParameters(1.01,8.795e-01,3.904e-01);
1932 fcorr1->SetParameters(9.675e-01,1.654,2.583e-01);
1934 else if(central>30 && central<=40)
1936 fcorr0->SetParameters(1.00,1.466,2.305e-1);
1937 fcorr1->SetParameters(9.637e-01,1.473,2.754e-01);
1939 else if(central>40 && central<=50)
1941 fcorr0->SetParameters(1.00,1.422,1.518e-01);
1942 fcorr1->SetParameters(9.59e-01,1.421,2.931e-01);
1945 else if(central>50 && central<=70)
1947 fcorr0->SetParameters(0.989,2.495,2.167);
1948 fcorr1->SetParameters(0.961,1.734,1.438e-01);
1950 else if(central>70 && central<=100)
1952 fcorr0->SetParameters(0.981,-3.373,3.93327);
1953 fcorr1->SetParameters(9.574e-01,1.698,1.58e-01);
1957 shift = fcorr0->Eval(pTmc)-fcorr1->Eval(pTmc);
1962 // <-------- only Data correction
1963 double AliAnalysisTaskHFECal::NsigmaCorrection(double tmpeta, float central)
1967 if(central>=0 && central<10)
1971 else if(central>=10 && central<20)
1975 else if(central>=20 && central<30)
1979 else if(central>=30 && central<40)
1983 else if(central>=40 && central<50)
1987 else if(central>=50 && central<70)
1996 double shift = fnSigEtaCorr[icent]->Eval(tmpeta);
1998 //cout << "eta correction"<< endl;
1999 //cout << "cent = "<< central<< endl;
2000 //cout << "icent = "<< icent << endl;
2001 //cout << "shift = "<< shift << endl;
2008 double AliAnalysisTaskHFECal::SumpT(Int_t itrack, AliESDtrack* track)
2011 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
2012 fTrackCuts->SetRequireTPCRefit(kTRUE);
2013 fTrackCuts->SetRequireITSRefit(kTRUE);
2014 fTrackCuts->SetEtaRange(-0.9,0.9);
2015 //fTrackCuts->SetRequireSigmaToVertex(kTRUE);
2016 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
2017 fTrackCuts->SetMinNClustersTPC(90);
2019 double pTrecp = track->Pt();
2020 double phiorg = track->Phi();
2021 double etaorg = track->Eta();
2023 for(Int_t jTracks = 0; jTracks<fESD->GetNumberOfTracks(); jTracks++){
2024 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
2026 printf("ERROR: Could not receive track %d\n", jTracks);
2029 if(itrack==jTracks)continue;
2030 double pTAss = trackAsso->Pt();
2031 double etaAss = trackAsso->Eta();
2032 double phiAss = trackAsso->Phi();
2034 double delphi = phiorg - phiAss;
2035 double deleta = etaorg - etaAss;
2037 double R = sqrt(pow(deleta,2)+pow(delphi,2));
2038 if(pTAss<0.5)continue;
2039 if(R<0.4)pTrecp+=pTAss;