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
25 #include "THnSparse.h"
26 #include "TLorentzVector.h"
30 #include "AliAnalysisTask.h"
31 #include "AliAnalysisManager.h"
33 #include "AliESDEvent.h"
34 #include "AliESDHandler.h"
35 #include "AliAODEvent.h"
36 #include "AliAODHandler.h"
38 #include "AliMCEventHandler.h"
39 #include "AliMCEvent.h"
40 #include "AliMCParticle.h"
42 #include "AliAnalysisTaskHFECal.h"
43 #include "TGeoGlobalMagField.h"
45 #include "AliAnalysisTaskSE.h"
46 #include "TRefArray.h"
48 #include "AliESDInputHandler.h"
49 #include "AliESDpid.h"
50 #include "AliESDtrackCuts.h"
51 #include "AliPhysicsSelection.h"
52 #include "AliESDCaloCluster.h"
53 #include "AliAODCaloCluster.h"
54 #include "AliEMCALRecoUtils.h"
55 #include "AliEMCALGeometry.h"
56 #include "AliGeomManager.h"
58 #include "TGeoManager.h"
62 #include "AliEMCALTrack.h"
65 #include "AliKFParticle.h"
66 #include "AliKFVertex.h"
69 #include "AliPIDResponse.h"
70 #include "AliHFEcontainer.h"
71 #include "AliHFEcuts.h"
72 #include "AliHFEpid.h"
73 #include "AliHFEpidBase.h"
74 #include "AliHFEpidQAmanager.h"
75 #include "AliHFEtools.h"
76 #include "AliCFContainer.h"
77 #include "AliCFManager.h"
81 #include "AliCentrality.h"
83 ClassImp(AliAnalysisTaskHFECal)
84 //________________________________________________________________________
85 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal(const char *name)
86 : AliAnalysisTaskSE(name)
95 ,fIdentifiedAsOutInz(kFALSE)
96 ,fPassTheEventCut(kFALSE)
97 ,fRejectKinkMother(kFALSE)
103 ,fOpeningAngleCut(0.1)
134 ,fTrackPtBefTrkCuts(0)
135 ,fTrackPtAftTrkCuts(0)
156 ,fIncpTMCM20hfeAll(0)
157 ,fIncpTMCM20hfeCheck(0)
158 ,fInputHFEMC_weight(0)
159 ,fIncpTMCM20hfeCheck_weight(0)
166 ,fIncpTMCM20pho_pi0e(0)
167 ,fPhoElecPtMCM20_pi0e(0)
168 ,fSameElecPtMCM20_pi0e(0)
169 ,fIncpTMCM20pho_eta(0)
170 ,fPhoElecPtMCM20_eta(0)
171 ,fSameElecPtMCM20_eta(0)
172 ,fIncpTMCpho_pi0e_TPC(0)
173 ,fPhoElecPtMC_pi0e_TPC(0)
174 ,fSameElecPtMC_pi0e_TPC(0)
189 fPID = new AliHFEpid("hfePid");
190 fTrackCuts = new AliESDtrackCuts();
192 // Define input and output slots here
193 // Input slot #0 works with a TChain
194 DefineInput(0, TChain::Class());
195 // Output slot #0 id reserved by the base class for AOD
196 // Output slot #1 writes into a TH1 container
197 // DefineOutput(1, TH1I::Class());
198 DefineOutput(1, TList::Class());
199 // DefineOutput(3, TTree::Class());
202 //________________________________________________________________________
203 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal()
204 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskHFECal")
213 ,fIdentifiedAsOutInz(kFALSE)
214 ,fPassTheEventCut(kFALSE)
215 ,fRejectKinkMother(kFALSE)
221 ,fOpeningAngleCut(0.1)
252 ,fTrackPtBefTrkCuts(0)
253 ,fTrackPtAftTrkCuts(0)
274 ,fIncpTMCM20hfeAll(0)
275 ,fIncpTMCM20hfeCheck(0)
276 ,fInputHFEMC_weight(0)
277 ,fIncpTMCM20hfeCheck_weight(0)
284 ,fIncpTMCM20pho_pi0e(0)
285 ,fPhoElecPtMCM20_pi0e(0)
286 ,fSameElecPtMCM20_pi0e(0)
287 ,fIncpTMCM20pho_eta(0)
288 ,fPhoElecPtMCM20_eta(0)
289 ,fSameElecPtMCM20_eta(0)
290 ,fIncpTMCpho_pi0e_TPC(0)
291 ,fPhoElecPtMC_pi0e_TPC(0)
292 ,fSameElecPtMC_pi0e_TPC(0)
305 //Default constructor
306 fPID = new AliHFEpid("hfePid");
308 fTrackCuts = new AliESDtrackCuts();
311 // Define input and output slots here
312 // Input slot #0 works with a TChain
313 DefineInput(0, TChain::Class());
314 // Output slot #0 id reserved by the base class for AOD
315 // Output slot #1 writes into a TH1 container
316 // DefineOutput(1, TH1I::Class());
317 DefineOutput(1, TList::Class());
318 //DefineOutput(3, TTree::Class());
320 //_________________________________________
322 AliAnalysisTaskHFECal::~AliAnalysisTaskHFECal()
334 //_________________________________________
336 void AliAnalysisTaskHFECal::UserExec(Option_t*)
339 //Called for each event
341 // create pointer to event
342 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
344 printf("ERROR: fESD not available\n");
349 AliError("HFE cuts not available");
353 if(!fPID->IsInitialized()){
354 // Initialize PID with the given run number
355 AliWarning("PID not initialised, get from Run no");
356 fPID->InitializePID(fESD->GetRunNumber());
359 if(fmcData)fMC = MCEvent();
360 //AliStack* stack = NULL;
361 if(fmcData && fMC)stack = fMC->Stack();
364 AliCentrality *centrality = fESD->GetCentrality();
365 cent = centrality->GetCentralityPercentile("V0M");
367 //---- fill MC track info
370 Int_t nParticles = stack->GetNtrack();
371 for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
372 TParticle* particle = stack->Particle(iParticle);
373 int fPDG = particle->GetPdgCode();
374 double mcZvertex = fMC->GetPrimaryVertex()->GetZ();
375 double pTMC = particle->Pt();
376 double proR = particle->R();
377 double etaMC = particle->Eta();
378 if(fabs(etaMC)>0.6)continue;
379 Bool_t mcInDtoE= kFALSE;
380 Bool_t mcInBtoE= kFALSE;
382 Bool_t MChijing = fMC->IsFromBGEvent(iParticle);
383 //if(!MChijing)printf("not MC hijing");
385 if(!MChijing)iHijing = 0;
389 mcphoinfo[2] = iHijing;
390 //if(fPDG==111)Hpi0pTcheck->Fill(pTMC,iHijing);
391 //if(fPDG==221)HETApTcheck->Fill(pTMC,iHijing);
392 if(fPDG==111)Hpi0pTcheck->Fill(mcphoinfo);
393 if(fPDG==221)HETApTcheck->Fill(mcphoinfo);
394 if(fabs(fPDG)==411 || fabs(fPDG)==413 || fabs(fPDG)==421 || fabs(fPDG)==423 || fabs(fPDG)==431)HDpTcheck->Fill(pTMC,iHijing);
395 if(fabs(fPDG)==511 || fabs(fPDG)==513 || fabs(fPDG)==521 || fabs(fPDG)==523 || fabs(fPDG)==531)HBpTcheck->Fill(pTMC,iHijing);
397 if(particle->GetFirstMother()>-1 && fPDG==22)
399 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
400 if(parentPID==111 || parentPID==221)HphopTcheck->Fill(pTMC,iHijing); // pi0->g & eta->g
403 if(particle->GetFirstMother()>-1 && fabs(fPDG)==11)
405 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
406 double pTMCparent = stack->Particle(particle->GetFirstMother())->Pt();
407 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(fPDG)==11)mcInDtoE = kTRUE;
408 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(fPDG)==11)mcInBtoE = kTRUE;
409 if((mcInBtoE || mcInDtoE) && fabs(mcZvertex)<10.0)
411 fInputHFEMC->Fill(cent,pTMC);
417 mcinfo[4] = pTMCparent;
418 fInputHFEMC_weight->Fill(mcinfo);
423 if(proR<7.0 && fabs(fPDG)==11)fInputAlle->Fill(cent,pTMC);
430 Int_t fNOtrks = fESD->GetNumberOfTracks();
431 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
433 Double_t pVtxZ = -999;
434 pVtxZ = pVtx->GetZ();
436 if(TMath::Abs(pVtxZ)>10) return;
439 if(fNOtrks<1) return;
442 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
444 AliDebug(1, "Using default PID Response");
445 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
448 fPID->SetPIDResponse(pidResponse);
450 fCFM->SetRecEventInfo(fESD);
452 //Float_t cent = -1.;
453 //AliCentrality *centrality = fESD->GetCentrality();
454 //cent = centrality->GetCentralityPercentile("V0M");
457 //if(cent>90.) return;
461 FindTriggerClusters();
464 for(Int_t iCluster=0; iCluster<fESD->GetNumberOfCaloClusters(); iCluster++)
466 AliESDCaloCluster *clust = fESD->GetCaloCluster(iCluster);
467 if(clust && clust->IsEMCAL())
469 double clustE = clust->E();
470 float emcx[3]; // cluster pos
471 clust->GetPosition(emcx);
472 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
473 double emcphi = clustpos.Phi();
474 double emceta = clustpos.Eta();
476 calInfo[0] = emcphi; calInfo[1] = emceta; calInfo[2] = clustE; calInfo[3] = cent; calInfo[4] = clust->Chi2();
477 //fEMCAccE->Fill(calInfo);
478 //if(clustE>3.0)fEMCAccE->Fill(calInfo);
479 //if(fqahist==1 && clustE>1.5)fEMCAccE->Fill(calInfo);
480 hEMCAccE->Fill(cent,clustE);
485 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
486 AliESDtrack* track = fESD->GetTrack(iTracks);
488 printf("ERROR: Could not receive track %d\n", iTracks);
492 int parentlabel = 99999;
493 int parentPID = 99999;
494 int grand_parentlabel = 99999;
495 int grand_parentPID = 99999;
496 Bool_t mcPho = kFALSE;
497 Bool_t mcDtoE= kFALSE;
498 Bool_t mcBtoE= kFALSE;
499 Bool_t mcOrgPi0 = kFALSE;
500 Bool_t mcOrgEta = kFALSE;
503 double mcMompT = 0.0;
504 //double mcGrandMompT = 0.0;
505 double mcWeight = -10.0;
510 if(fmcData && fMC && stack)
512 Int_t label = TMath::Abs(track->GetLabel());
513 mcLabel = track->GetLabel();
518 Bool_t MChijing = fMC->IsFromBGEvent(label);
519 if(!MChijing)iHijing = 0;
521 TParticle* particle = stack->Particle(label);
522 int mcpid = particle->GetPdgCode();
523 mcpT = particle->Pt();
524 //printf("MCpid = %d",mcpid);
525 if(particle->GetFirstMother()>-1)
527 //int parentlabel = particle->GetFirstMother();
528 //int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
529 //mcMompT = stack->Particle(particle->GetFirstMother())->Pt();
530 FindMother(particle, parentlabel, parentPID);
531 mcMompT = stack->Particle(parentlabel)->Pt();
532 if((parentPID==22 || parentPID==111 || parentPID==221)&& fabs(mcpid)==11)mcPho = kTRUE;
533 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(mcpid)==11)mcDtoE = kTRUE;
534 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(mcpid)==11)mcBtoE = kTRUE;
536 // make D->e pT correlation
537 if(mcDtoE)fMomDtoE->Fill(mcpT,mcMompT);
539 //cout << "check PID = " << parentPID << endl;
540 //cout << "check pho = " << mcPho << endl;
541 //cout << "check D or B = " << mcDtoE << endl;
543 if(parentPID==111 && fabs(mcpid)==11 && mcMompT>0.0)
545 //cout << "find pi0->e " << endl;
547 mcWeight = GetMCweight(mcMompT);
550 if(parentPID==221 && fabs(mcpid)==11 && mcMompT>0.0)
552 //cout << "find Eta->e " << endl;
554 mcWeight = GetMCweightEta(mcMompT);
557 // access grand parent
558 TParticle* particle_parent = stack->Particle(parentlabel); // get parent pointer
559 //if(particle_parent->GetFirstMother()>-1 && parentPID==22 && fabs(mcpid)==11) // get grand parent g->e
560 if(particle_parent->GetFirstMother()>-1 && (parentPID==22 || parentPID==111) && fabs(mcpid)==11) // get grand parent g->e
562 //int grand_parentPID = stack->Particle(particle_parent->GetFirstMother())->GetPdgCode();
563 //double pTtmp = stack->Particle(particle_parent->GetFirstMother())->Pt();
564 FindMother(particle_parent, grand_parentlabel, grand_parentPID);
565 double mcGrandpT = stack->Particle(grand_parentlabel)->Pt();
566 if(grand_parentPID==111 && mcGrandpT>0.0)
568 // check eta->pi0 decay !
569 int grand2_parentlabel = 99999; int grand2_parentPID = 99999;
570 TParticle* particle_grand = stack->Particle(grand_parentlabel); // get parent pointer
571 FindMother(particle_grand, grand2_parentlabel, grand2_parentPID);
572 if(grand2_parentPID==221)
574 //cout << "find Eta->e " << endl;
575 double mcGrandpT2 = stack->Particle(grand2_parentlabel)->Pt();
577 mcWeight = GetMCweight(mcGrandpT2);
578 mcMompT = mcGrandpT2;
582 //cout << "find pi0->e " << endl;
584 mcWeight = GetMCweight(mcGrandpT);
589 if(grand_parentPID==221 && mcGrandpT>0.0)
591 //cout << "find Eta->e " << endl;
594 mcWeight = GetMCweightEta(mcGrandpT);
600 if(fabs(mcpid)==11 && mcDtoE)mcele= 1.;
601 if(fabs(mcpid)==11 && mcBtoE)mcele= 2.;
602 if(fabs(mcpid)==11 && mcPho)mcele= 3.;
604 } // end of mcLabel>-1
608 //cout << "Pi0 = " << mcOrgPi0 << " ; Eta = " << mcOrgEta << endl;
609 //printf("weight = %f\n",mcWeight);
611 if(TMath::Abs(track->Eta())>0.6) continue;
612 if(TMath::Abs(track->Pt()<2.0)) continue;
614 fTrackPtBefTrkCuts->Fill(track->Pt());
615 // RecKine: ITSTPC cuts
616 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
619 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
620 if(track->GetKinkIndex(0) != 0) continue;
624 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
626 // HFEcuts: ITS layers cuts
627 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
629 // HFE cuts: TPC PID cleanup
630 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
632 int nTPCcl = track->GetTPCNcls();
633 //int nTPCclF = track->GetTPCNclsF(); // warnings
634 int nITS = track->GetNcls(0);
636 fTrackPtAftTrkCuts->Fill(track->Pt());
638 Double_t mom = -999., eop=-999., pt = -999., dEdx=-999., fTPCnSigma=-10, phi=-999., eta=-999.;
642 // Track extrapolation
644 Int_t charge = track->Charge();
649 dEdx = track->GetTPCsignal();
650 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
651 if(mcLabel==-1) // nsigma mean correction
653 double mean_corr = NsigCorr(cent);
654 printf("correction %f\n",mean_corr);
655 fTPCnSigma -= mean_corr;
658 double ncells = -1.0;
662 double rmatch = -1.0;
663 double nmatch = -1.0;
664 double oppstatus = 0.0;
666 Bool_t fFlagPhotonicElec = kFALSE;
667 Bool_t fFlagConvinatElec = kFALSE;
669 Int_t clsId = track->GetEMCALcluster();
671 AliESDCaloCluster *clust = fESD->GetCaloCluster(clsId);
672 if(clust && clust->IsEMCAL()){
674 double clustE = clust->E();
675 eop = clustE/fabs(mom);
676 //double clustT = clust->GetTOF();
677 ncells = clust->GetNCells();
678 m02 = clust->GetM02();
679 m20 = clust->GetM20();
680 disp = clust->GetDispersion();
681 double delphi = clust->GetTrackDx();
682 double deleta = clust->GetTrackDz();
683 rmatch = sqrt(pow(delphi,2)+pow(deleta,2));
684 nmatch = clust->GetNTracksMatched();
686 if(fTPCnSigma>-1.5 && fTPCnSigma<3.0)
688 SelectPhotonicElectron(iTracks,cent,track,fFlagPhotonicElec,fFlagConvinatElec,fTPCnSigma,m20,eop,mcele,mcWeight,iHijing,mcOrgPi0,mcOrgEta);
690 if(fFlagPhotonicElec)oppstatus = 1.0;
691 if(fFlagConvinatElec)oppstatus = 2.0;
692 if(fFlagPhotonicElec && fFlagConvinatElec)oppstatus = 3.0;
695 valdedx[0] = pt; valdedx[1] = nITS; valdedx[2] = phi; valdedx[3] = eta; valdedx[4] = fTPCnSigma;
696 //valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nTPCclF; valdedx[9] = m20; valdedx[10] = mcpT;
697 valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nmatch; valdedx[9] = m20; valdedx[10] = mcpT;
698 valdedx[11] = cent; valdedx[12] = charge; valdedx[13] = oppstatus; valdedx[14] = nTPCcl;
700 if(fqahist==1)fEleInfo->Fill(valdedx);
706 if(nITS<2.5)continue;
707 if(nTPCcl<100)continue;
709 CheckNclust->Fill(nTPCcl);
710 CheckNits->Fill(nITS);
712 fdEdxBef->Fill(mom,fTPCnSigma);
713 fTPCnsigma->Fill(mom,fTPCnSigma);
714 if(fTPCnSigma >= -1.0 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,eop);
718 // check reco eff. with TPC
723 phoval[2] = fTPCnSigma;
727 if((fTPCnSigma >= -1.0 && fTPCnSigma <= 3) && mcele>0 && mcPho && mcOrgPi0)
729 if(iHijing==1)mcWeight = 1.0;
730 fIncpTMCpho_pi0e_TPC->Fill(phoval,mcWeight);
731 if(fFlagPhotonicElec) fPhoElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
732 if(fFlagConvinatElec) fSameElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
736 AliHFEpidObject hfetrack;
737 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
738 hfetrack.SetRecTrack(track);
740 if((0.0< cent) && (cent<5.0)) binct = 0.5;
741 if((5.0< cent) && (cent<10.0)) binct = 1.5;
742 if((10.0< cent) && (cent<20.0)) binct = 2.5;
743 if((20.0< cent) && (cent<30.0)) binct = 3.5;
744 if((30.0< cent) && (cent<40.0)) binct = 4.5;
745 if((40.0< cent) && (cent<50.0)) binct = 5.5;
746 if((50.0< cent) && (cent<60.0)) binct = 6.5;
747 if((60.0< cent) && (cent<70.0)) binct = 7.5;
748 if((70.0< cent) && (cent<80.0)) binct = 8.5;
749 if((80.0< cent) && (cent<90.0)) binct = 9.5;
750 if((90.0< cent) && (cent<100.0)) binct = 10.5;
752 hfetrack.SetCentrality((int)binct); //added
754 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
756 if(pidpassed==0) continue;
758 fTrkEovPAft->Fill(pt,eop);
759 fdEdxAft->Fill(mom,fTPCnSigma);
762 fIncpT->Fill(cent,pt);
763 if(fFlagPhotonicElec) fPhoElecPt->Fill(cent,pt);
764 if(fFlagConvinatElec) fSameElecPt->Fill(cent,pt);
766 if(m20>0.0 && m20<0.3)
768 fIncpTM20->Fill(cent,pt);
769 if(fFlagPhotonicElec) fPhoElecPtM20->Fill(cent,pt);
770 if(fFlagConvinatElec) fSameElecPtM20->Fill(cent,pt);
774 // check label for electron candidiates
777 if(mcLabel==0)idlabel = 0;
778 fLabelCheck->Fill(pt,idlabel);
779 if(mcLabel==0)fgeoFake->Fill(phi,eta);
781 if(mcele>0) // select MC electrons
784 fIncpTMChfeAll->Fill(cent,pt);
785 if(m20>0.0 && m20<0.3)fIncpTMCM20hfeAll->Fill(cent,pt);
787 if(mcBtoE || mcDtoE) // select B->e & D->e
789 fIncpTMChfe->Fill(cent,pt);
790 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfe->Fill(cent,pt);
791 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfeCheck->Fill(cent,mcpT);
792 if(m20>0.0 && m20<0.3)
794 cout << "MC label = " << mcLabel << endl;
795 fIncpTMCM20hfe->Fill(cent,pt);
796 fIncpTMCM20hfeCheck->Fill(cent,mcpT);
797 fIncpTMCM20hfeCheck_weight->Fill(phoval);
801 if(mcPho) // select photonic electrons
804 fIncpTMCpho->Fill(phoval);
805 if(fFlagPhotonicElec) fPhoElecPtMC->Fill(phoval);
806 if(fFlagConvinatElec) fSameElecPtMC->Fill(phoval);
808 if(m20>0.0 && m20<0.3)
810 fIncpTMCM20pho->Fill(phoval);
811 if(fFlagPhotonicElec) fPhoElecPtMCM20->Fill(phoval);
812 if(fFlagConvinatElec) fSameElecPtMCM20->Fill(phoval);
816 if(iHijing==1)mcWeight = 1.0;
819 fIncpTMCM20pho_pi0e->Fill(phoval,mcWeight);
820 if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval,mcWeight);
821 if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval,mcWeight);
822 //fIncpTMCM20pho_pi0e->Fill(phoval); // v5-04-02-AN & v5-04-06-AN
823 //if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval);
824 //if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval);
828 fIncpTMCM20pho_eta->Fill(phoval,mcWeight);
829 if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval,mcWeight);
830 if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval,mcWeight);
831 //fIncpTMCM20pho_eta->Fill(phoval);
832 //if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval);
833 //if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval);
841 PostData(1, fOutputList);
843 //_________________________________________
844 void AliAnalysisTaskHFECal::UserCreateOutputObjects()
848 //Bool_t mcData = kFALSE;
849 if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())
852 printf("+++++ MC Data available");
856 printf("++++++++= MC analysis \n");
860 printf("++++++++ real data analysis \n");
863 printf("+++++++ QA hist %d",fqahist);
866 fGeom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
868 //--------Initialize PID
869 //fPID->SetHasMCData(kFALSE);
870 fPID->SetHasMCData(fmcData);
871 if(!fPID->GetNumberOfPIDdetectors())
873 fPID->AddDetector("TPC", 0);
874 fPID->AddDetector("EMCAL", 1);
878 const char *cutmodel;
880 params[0] = -1.0; //sigma min
881 double maxnSig = 3.0;
884 params[0] = -5.0; //sigma min
888 for(Int_t a=0;a<11;a++)fPID->ConfigureTPCcentralityCut(a,cutmodel,params,maxnSig);
890 fPID->SortDetectors();
891 fPIDqa = new AliHFEpidQAmanager();
892 fPIDqa->Initialize(fPID);
894 //------- fcut --------------
895 fCuts = new AliHFEcuts();
896 fCuts->CreateStandardCuts();
897 //fCuts->SetMinNClustersTPC(100);
898 fCuts->SetMinNClustersTPC(90);
899 fCuts->SetMinRatioTPCclusters(0.6);
900 fCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
901 //fCuts->SetMinNClustersITS(3);
902 fCuts->SetMinNClustersITS(2);
903 fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
904 fCuts->SetCheckITSLayerStatus(kFALSE);
905 fCuts->SetVertexRange(10.);
906 fCuts->SetTOFPIDStep(kFALSE);
907 fCuts->SetPtRange(2, 50);
908 fCuts->SetMaxImpactParam(3.,3.);
910 //--------Initialize correction Framework and Cuts
911 fCFM = new AliCFManager;
912 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
913 fCFM->SetNStepParticle(kNcutSteps);
914 for(Int_t istep = 0; istep < kNcutSteps; istep++)
915 fCFM->SetParticleCutsList(istep, NULL);
918 AliWarning("Cuts not available. Default cuts will be used");
919 fCuts = new AliHFEcuts;
920 fCuts->CreateStandardCuts();
922 fCuts->Initialize(fCFM);
924 //---------Output Tlist
925 fOutputList = new TList();
926 fOutputList->SetOwner();
927 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
929 fNoEvents = new TH1F("fNoEvents","",4,-0.5,3.5) ;
930 fOutputList->Add(fNoEvents);
932 Int_t binsE[5] = {250, 100, 1000, 200, 10};
933 Double_t xminE[5] = {1.0, -1, 0.0, 0, -0.5};
934 Double_t xmaxE[5] = {3.5, 1, 100.0, 100, 9.5};
935 fEMCAccE = new THnSparseD("fEMCAccE","EMC acceptance & E;#eta;#phi;Energy;Centrality;trugCondition;",5,binsE,xminE,xmaxE);
936 if(fqahist==1)fOutputList->Add(fEMCAccE);
938 hEMCAccE = new TH2F("hEMCAccE","Cluster Energy",200,0,100,100,0,20);
939 fOutputList->Add(hEMCAccE);
941 fTrkpt = new TH1F("fTrkpt","track pt",100,0,50);
942 fOutputList->Add(fTrkpt);
944 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",100,0,50);
945 fOutputList->Add(fTrackPtBefTrkCuts);
947 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",100,0,50);
948 fOutputList->Add(fTrackPtAftTrkCuts);
950 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",100,0,50,200,-10,10);
951 fOutputList->Add(fTPCnsigma);
953 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",100,0,50,100,0,2);
954 fOutputList->Add(fTrkEovPBef);
956 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",100,0,50,100,0,2);
957 fOutputList->Add(fTrkEovPAft);
959 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",100,0,50,200,-10,10);
960 fOutputList->Add(fdEdxBef);
962 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",100,0,50,200,-10,10);
963 fOutputList->Add(fdEdxAft);
965 fIncpT = new TH2F("fIncpT","HFE pid electro vs. centrality",200,0,100,100,0,50);
966 fOutputList->Add(fIncpT);
968 fIncpTM20 = new TH2F("fIncpTM20","HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
969 fOutputList->Add(fIncpTM20);
971 Int_t nBinspho[9] = { 200, 100, 500, 12, 50, 4, 200, 8, 100};
972 Double_t minpho[9] = { 0., 0., 0., -2.5, 0, -0.5, 0,-1.5, 0};
973 Double_t maxpho[9] = {100., 50., 0.5, 3.5, 1, 3.5, 2, 6.5, 50};
975 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);
976 if(fqahist==1)fOutputList->Add(fInvmassLS);
978 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);
979 if(fqahist==1)fOutputList->Add(fInvmassULS);
981 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);
982 if(fqahist==1)fOutputList->Add(fInvmassLSmc);
984 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);
985 if(fqahist==1)fOutputList->Add(fInvmassULSmc);
987 fInvmassLSmc0 = new TH2D("fInvmassLSmc0", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
988 fInvmassLSmc0->Sumw2();
989 fOutputList->Add(fInvmassLSmc0);
991 fInvmassLSmc1 = new TH2D("fInvmassLSmc1", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
992 fInvmassLSmc1->Sumw2();
993 fOutputList->Add(fInvmassLSmc1);
995 fInvmassLSmc2 = new TH2D("fInvmassLSmc2", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
996 fInvmassLSmc2->Sumw2();
997 fOutputList->Add(fInvmassLSmc2);
999 fInvmassLSmc3 = new TH2D("fInvmassLSmc3", "Inv mass of LS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
1000 fInvmassLSmc3->Sumw2();
1001 fOutputList->Add(fInvmassLSmc3);
1003 fInvmassULSmc0 = new TH2D("fInvmassULSmc0", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
1004 fInvmassULSmc0->Sumw2();
1005 fOutputList->Add(fInvmassULSmc0);
1007 fInvmassULSmc1 = new TH2D("fInvmassULSmc1", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
1008 fInvmassULSmc1->Sumw2();
1009 fOutputList->Add(fInvmassULSmc1);
1011 fInvmassULSmc2 = new TH2D("fInvmassULSmc2", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
1012 fInvmassULSmc2->Sumw2();
1013 fOutputList->Add(fInvmassULSmc2);
1015 fInvmassULSmc3 = new TH2D("fInvmassULSmc3", "Inv mass of ULS (e,e); cent; p_{T} (GeV/c); mass(GeV/c^2)",20,0,20,500,0,0.5 );
1016 fInvmassULSmc3->Sumw2();
1017 fOutputList->Add(fInvmassULSmc3);
1019 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1020 fOutputList->Add(fOpeningAngleLS);
1022 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1023 fOutputList->Add(fOpeningAngleULS);
1025 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,50);
1026 fOutputList->Add(fPhotoElecPt);
1028 fPhoElecPt = new TH2F("fPhoElecPt", "Pho-inclusive electron pt",200,0,100,100,0,50);
1029 fOutputList->Add(fPhoElecPt);
1031 fPhoElecPtM20 = new TH2F("fPhoElecPtM20", "Pho-inclusive electron pt with M20",200,0,100,100,0,50);
1032 fOutputList->Add(fPhoElecPtM20);
1034 fSameElecPt = new TH2F("fSameElecPt", "Same-inclusive electron pt",200,0,100,100,0,50);
1035 fOutputList->Add(fSameElecPt);
1037 fSameElecPtM20 = new TH2F("fSameElecPtM20", "Same-inclusive electron pt with M20",200,0,100,100,0,50);
1038 fOutputList->Add(fSameElecPtM20);
1040 fCent = new TH1F("fCent","Centrality",200,0,100) ;
1041 fOutputList->Add(fCent);
1043 // Make common binning
1044 const Double_t kMinP = 0.;
1045 const Double_t kMaxP = 50.;
1046 //const Double_t kTPCSigMim = 40.;
1047 //const Double_t kTPCSigMax = 140.;
1049 // 1st histogram: TPC dEdx with/without EMCAL (p, pT, TPC Signal, phi, eta, Sig, e/p, ,match, cell, M02, M20, Disp, Centrality, select)
1050 Int_t nBins[16] = { 250, 10, 60, 20, 100, 300, 50, 40, 200, 200, 250, 200, 3, 5, 100, 8};
1051 Double_t min[16] = {kMinP, -0.5, 1.0, -1.0, -6.0, 0, 0, 0, 0.0, 0.0, 0.0, 0, -1.5, -0.5, 80, -1.5};
1052 Double_t max[16] = {kMaxP, 9.5, 4.0, 1.0, 4.0, 3.0, 0.1, 40, 200, 2.0, 50.0, 100, 1.5, 4.5, 180, 6.5};
1053 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);
1054 if(fqahist==1)fOutputList->Add(fEleInfo);
1058 fClsEBftTrigCut = new TH1F("fClsEBftTrigCut","cluster E before trigger selection",1000,0,100);
1059 fOutputList->Add(fClsEBftTrigCut);
1061 fClsEAftTrigCut = new TH1F("fClsEAftTrigCut","cluster E if cls has 0 trigcut channel",1000,0,100);
1062 fOutputList->Add(fClsEAftTrigCut);
1064 fClsEAftTrigCut1 = new TH1F("fClsEAftTrigCut1","cluster E if cls with trig channel",1000,0,100);
1065 fOutputList->Add(fClsEAftTrigCut1);
1067 fClsEAftTrigCut2 = new TH1F("fClsEAftTrigCut2","cluster E if cls with trigcut channel",1000,0,100);
1068 fOutputList->Add(fClsEAftTrigCut2);
1070 fClsEAftTrigCut3 = new TH1F("fClsEAftTrigCut3","cluster E if cls with trigcut channel + nCell>Ecorrect",1000,0,100);
1071 fOutputList->Add(fClsEAftTrigCut3);
1073 fClsEAftTrigCut4 = new TH1F("fClsEAftTrigCut4","cluster E if cls with trigcut channel + nCell>Ecorrect + cls time cut",1000,0,100);
1074 fOutputList->Add(fClsEAftTrigCut4);
1076 fClsETime = new TH2F("fClsETime", "Cls time vs E; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1077 fOutputList->Add(fClsETime);
1079 fClsETime1 = new TH2F("fClsETime1", "Cls time vs E if cls contains trigger channel; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1080 fOutputList->Add(fClsETime1);
1082 fTrigTimes = new TH1F("fTrigTimes", "Trigger time; time; N;",25,0,25);
1083 fOutputList->Add(fTrigTimes);
1085 fCellCheck = new TH2F("fCellCheck", "Cell vs E; E GeV; Cell ID",10,6,26,12000,0,12000);
1086 fOutputList->Add(fCellCheck);
1090 fInputHFEMC = new TH2F("fInputHFEMC","Input MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1091 fOutputList->Add(fInputHFEMC);
1093 fInputAlle = new TH2F("fInputAlle","Input MC electro vs. centrality",200,0,100,100,0,50);
1094 fOutputList->Add(fInputAlle);
1096 fIncpTMChfe = new TH2F("fIncpTMChfe","MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1097 fOutputList->Add(fIncpTMChfe);
1099 fIncpTMChfeAll = new TH2F("fIncpTMChfeAll","MC Alle pid electro vs. centrality",200,0,100,100,0,50);
1100 fOutputList->Add(fIncpTMChfeAll);
1102 fIncpTMCM20hfe = new TH2F("fIncpTMCM20hfe","MC HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
1103 fOutputList->Add(fIncpTMCM20hfe);
1105 fIncpTMCM20hfeAll = new TH2F("fIncpTMCM20hfeAll","MC Alle pid electro vs. centrality with M20",200,0,100,100,0,50);
1106 fOutputList->Add(fIncpTMCM20hfeAll);
1108 fIncpTMCM20hfeCheck = new TH2F("fIncpTMCM20hfeCheck","MC HFE pid electro vs. centrality with M20 Check",200,0,100,100,0,50);
1109 fOutputList->Add(fIncpTMCM20hfeCheck);
1111 Int_t nBinspho2[5] = { 200, 100, 7, 3, 700};
1112 Double_t minpho2[5] = { 0., 0., -2.5, -0.5, 0.};
1113 Double_t maxpho2[5] = {100., 50., 4.5, 2.5, 70.};
1115 fInputHFEMC_weight = new THnSparseD("fInputHFEMC_weight", "MC HFE electron pt",5,nBinspho2,minpho2,maxpho2);
1116 fOutputList->Add(fInputHFEMC_weight);
1118 fIncpTMCM20hfeCheck_weight = new THnSparseD("fIncpTMCM20hfeCheck_weight", "HFE electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1119 fOutputList->Add(fIncpTMCM20hfeCheck_weight);
1121 fIncpTMCpho = new THnSparseD("fIncpTMCpho","MC Pho pid electro vs. centrality",5,nBinspho2,minpho2,maxpho2);
1122 fOutputList->Add(fIncpTMCpho);
1124 fIncpTMCM20pho = new THnSparseD("fIncpTMCM20pho","MC Pho pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1125 fOutputList->Add(fIncpTMCM20pho);
1127 fPhoElecPtMC = new THnSparseD("fPhoElecPtMC", "MC Pho-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1128 fOutputList->Add(fPhoElecPtMC);
1130 fPhoElecPtMCM20 = new THnSparseD("fPhoElecPtMCM20", "MC Pho-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1131 fOutputList->Add(fPhoElecPtMCM20);
1133 fSameElecPtMC = new THnSparseD("fSameElecPtMC", "MC Same-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1134 fOutputList->Add(fSameElecPtMC);
1136 fSameElecPtMCM20 = new THnSparseD("fSameElecPtMCM20", "MC Same-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1137 fOutputList->Add(fSameElecPtMCM20);
1139 fIncpTMCM20pho_pi0e = new THnSparseD("fIncpTMCM20pho_pi0e","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1140 fIncpTMCM20pho_pi0e->Sumw2();
1141 fOutputList->Add(fIncpTMCM20pho_pi0e);
1143 fPhoElecPtMCM20_pi0e = new THnSparseD("fPhoElecPtMCM20_pi0e", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1144 fPhoElecPtMCM20_pi0e->Sumw2();
1145 fOutputList->Add(fPhoElecPtMCM20_pi0e);
1147 fSameElecPtMCM20_pi0e = new THnSparseD("fSameElecPtMCM20_pi0e", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1148 fSameElecPtMCM20_pi0e->Sumw2();
1149 fOutputList->Add(fSameElecPtMCM20_pi0e);
1151 fIncpTMCM20pho_eta = new THnSparseD("fIncpTMCM20pho_eta","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1152 fIncpTMCM20pho_eta->Sumw2();
1153 fOutputList->Add(fIncpTMCM20pho_eta);
1155 fPhoElecPtMCM20_eta = new THnSparseD("fPhoElecPtMCM20_eta", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1156 fPhoElecPtMCM20_eta->Sumw2();
1157 fOutputList->Add(fPhoElecPtMCM20_eta);
1159 fSameElecPtMCM20_eta = new THnSparseD("fSameElecPtMCM20_eta", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1160 fSameElecPtMCM20_eta->Sumw2();
1161 fOutputList->Add(fSameElecPtMCM20_eta);
1163 fIncpTMCpho_pi0e_TPC = new THnSparseD("fIncpTMCpho_pi0e_TPC","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1164 fIncpTMCpho_pi0e_TPC->Sumw2();
1165 fOutputList->Add(fIncpTMCpho_pi0e_TPC);
1167 fPhoElecPtMC_pi0e_TPC = new THnSparseD("fPhoElecPtMC_pi0e_TPC", "MC Pho-inclusive electron pt with pi0->e",5,nBinspho2,minpho2,maxpho2);
1168 fPhoElecPtMC_pi0e_TPC->Sumw2();
1169 fOutputList->Add(fPhoElecPtMC_pi0e_TPC);
1171 fSameElecPtMC_pi0e_TPC = new THnSparseD("fSameElecPtMC_pi0e_TPC", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1172 fSameElecPtMC_pi0e_TPC->Sumw2();
1173 fOutputList->Add(fSameElecPtMC_pi0e_TPC);
1176 CheckNclust = new TH1D("CheckNclust","cluster check",200,0,200);
1177 fOutputList->Add(CheckNclust);
1179 CheckNits = new TH1D("CheckNits","ITS cluster check",8,-0.5,7.5);
1180 fOutputList->Add(CheckNits);
1182 Hpi0pTcheck = new TH2D("Hpi0pTcheck","Pi0 pT from Hijing",100,0,50,3,-0.5,2.5);
1183 fOutputList->Add(Hpi0pTcheck);
1185 HETApTcheck = new TH2D("HETApTcheck","Eta pT from Hijing",100,0,50,3,-0.5,2.5);
1186 fOutputList->Add(HETApTcheck);
1189 Int_t nBinspho3[3] = { 200, 100, 3};
1190 Double_t minpho3[3] = { 0., 0., -0.5};
1191 Double_t maxpho3[3] = {100., 50., 2.5};
1193 Hpi0pTcheck = new THnSparseD("Hpi0pTcheck","Pi0 pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1194 fOutputList->Add(Hpi0pTcheck);
1196 HETApTcheck = new THnSparseD("HETApTcheck","Eta pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1197 fOutputList->Add(HETApTcheck);
1199 HphopTcheck = new TH2D("HphopTcheck","Pho pT from Hijing",100,0,50,3,-0.5,2.5);
1200 fOutputList->Add(HphopTcheck);
1202 HDpTcheck = new TH2D("HDpTcheck","D pT from Hijing",100,0,50,3,-0.5,2.5);
1203 fOutputList->Add(HDpTcheck);
1205 HBpTcheck = new TH2D("HBpTcheck","B pT from Hijing",100,0,50,3,-0.5,2.5);
1206 fOutputList->Add(HBpTcheck);
1209 fpTCheck = new TH1D("fpTCheck","pT check",500,0,50);
1210 fOutputList->Add(fpTCheck);
1212 fMomDtoE = new TH2D("fMomDtoE","D->E pT correlations;e p_{T} GeV/c;D p_{T} GeV/c",400,0,40,400,0,40);
1213 fOutputList->Add(fMomDtoE);
1215 fLabelCheck = new TH2D("fLabelCheck","MC label",50,0,50,5,-1.5,3.5);
1216 fOutputList->Add(fLabelCheck);
1218 fgeoFake = new TH2D("fgeoFake","Label==0 eta and phi",628,0,6.28,200,-1,1);
1219 fOutputList->Add(fgeoFake);
1221 PostData(1,fOutputList);
1224 //________________________________________________________________________
1225 void AliAnalysisTaskHFECal::Terminate(Option_t *)
1227 // Info("Terminate");
1228 AliAnalysisTaskSE::Terminate();
1231 //________________________________________________________________________
1232 Bool_t AliAnalysisTaskHFECal::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1234 // Check single track cuts for a given cut step
1235 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1236 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1239 //_________________________________________
1240 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec)
1241 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec, Bool_t &fFlagConvinatElec, Double_t nSig)
1242 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)
1244 //Identify non-heavy flavour electrons using Invariant mass method
1246 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
1247 fTrackCuts->SetRequireTPCRefit(kTRUE);
1248 fTrackCuts->SetRequireITSRefit(kTRUE);
1249 fTrackCuts->SetEtaRange(-0.9,0.9);
1250 //fTrackCuts->SetRequireSigmaToVertex(kTRUE);
1251 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
1252 fTrackCuts->SetMinNClustersTPC(90);
1254 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
1256 double ptEle = track->Pt(); //add
1257 if(ibgevent==0 && w > 0.0)
1259 fpTCheck->Fill(ptEle,w);
1262 Bool_t flagPhotonicElec = kFALSE;
1263 Bool_t flagConvinatElec = kFALSE;
1268 Int_t label = TMath::Abs(track->GetLabel());
1269 TParticle* particle = stack->Particle(label);
1270 p1 = particle->GetFirstMother();
1273 //for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1274 for(Int_t jTracks = 0; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1275 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
1277 printf("ERROR: Could not receive track %d\n", jTracks);
1280 if(itrack==jTracks)continue;
1286 Int_t label2 = TMath::Abs(trackAsso->GetLabel());
1287 TParticle* particle2 = stack->Particle(label2);
1288 Bool_t MChijing_ass = fMC->IsFromBGEvent(label2);
1289 if(MChijing_ass)jbgevent =1;
1290 if(particle2->GetFirstMother()>-1)
1291 p2 = particle2->GetFirstMother();
1294 Double_t dEdxAsso = -999., ptPrim=-999., ptAsso=-999., openingAngle = -999.;
1295 Double_t mass=999., width = -999;
1296 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
1298 //ptPrim = track->Pt();
1301 dEdxAsso = trackAsso->GetTPCsignal();
1302 ptAsso = trackAsso->Pt();
1303 Int_t chargeAsso = trackAsso->Charge();
1304 Int_t charge = track->Charge();
1307 if(ptAsso <0.5) continue;
1308 if(!fTrackCuts->AcceptTrack(trackAsso)) continue;
1309 if(dEdxAsso <65 || dEdxAsso>100) continue; //11a pass1
1311 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
1312 if(charge>0) fPDGe1 = -11;
1313 if(chargeAsso>0) fPDGe2 = -11;
1315 //printf("chargeAsso = %d\n",chargeAsso);
1316 //printf("charge = %d\n",charge);
1317 if(charge == chargeAsso) fFlagLS = kTRUE;
1318 if(charge != chargeAsso) fFlagULS = kTRUE;
1320 //printf("fFlagLS = %d\n",fFlagLS);
1321 //printf("fFlagULS = %d\n",fFlagULS);
1324 AliKFParticle ge1(*track, fPDGe1);
1325 AliKFParticle ge2(*trackAsso, fPDGe2);
1326 AliKFParticle recg(ge1, ge2);
1328 if(recg.GetNDF()<1) continue;
1329 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1330 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
1332 // for v5-03-70-AN comment
1333 AliKFVertex primV(*pVtx);
1335 recg.SetProductionVertex(primV);
1337 recg.SetMassConstraint(0,0.0001);
1339 openingAngle = ge1.GetAngle(ge2);
1340 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
1341 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
1344 recg.GetMass(mass,width);
1347 if(shower>0.0 && shower<0.3)ishower = 1;
1351 phoinfo[1] = ptPrim;
1354 phoinfo[4] = openingAngle;
1355 phoinfo[5] = ishower;
1358 phoinfo[8] = ptAsso;
1360 if(fFlagLS) fInvmassLS->Fill(phoinfo);
1361 if(fFlagULS) fInvmassULS->Fill(phoinfo);
1362 if(fFlagLS && ibgevent==0 && jbgevent==0) fInvmassLSmc->Fill(phoinfo,w);
1363 if(fFlagULS && ibgevent==0 && jbgevent==0)
1365 fInvmassULSmc->Fill(phoinfo,w);
1367 //printf("fInvmassCut %f\n",fInvmassCut);
1368 //printf("openingAngle %f\n",fOpeningAngleCut);
1370 if(openingAngle > fOpeningAngleCut) continue;
1373 //printf("mce =%f\n",mce);
1374 if(mce<-0.5) // mce==-1. is real
1376 //printf("Real data\n");
1377 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
1378 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1379 flagPhotonicElec = kTRUE;
1381 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec){
1382 flagConvinatElec = kTRUE;
1388 //printf("MC data\n");
1392 //cout << "tagpi0 = " << tagpi0 << " ; tageta = " << tageta << endl;
1393 if(fFlagLS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassLSmc0->Fill(ptPrim,mass,w);
1394 if(fFlagULS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassULSmc0->Fill(ptPrim,mass,w);
1395 if(fFlagLS && ibgevent==0 && jbgevent==0 && tageta) fInvmassLSmc1->Fill(ptPrim,mass,w);
1396 if(fFlagULS && ibgevent==0 && jbgevent==0 && tageta) fInvmassULSmc1->Fill(ptPrim,mass,w);
1397 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassLSmc2->Fill(ptPrim,mass,w);
1398 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassULSmc2->Fill(ptPrim,mass,w);
1399 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassLSmc3->Fill(ptPrim,mass,w);
1400 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassULSmc3->Fill(ptPrim,mass,w);
1402 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (ibgevent==jbgevent)){
1403 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1404 flagPhotonicElec = kTRUE;
1406 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec && (ibgevent==jbgevent)){
1407 flagConvinatElec = kTRUE;
1412 fFlagPhotonicElec = flagPhotonicElec;
1413 fFlagConvinatElec = flagConvinatElec;
1416 //-------------------------------------------
1418 void AliAnalysisTaskHFECal::FindMother(TParticle* part, int &label, int &pid)
1420 //int label = 99999;
1423 if(part->GetFirstMother()>-1)
1425 label = part->GetFirstMother();
1426 pid = stack->Particle(label)->GetPdgCode();
1428 //cout << "Find Mother : label = " << label << " ; pid" << pid << endl;
1431 double AliAnalysisTaskHFECal::GetMCweight(double mcPi0pT)
1433 double weight = 1.0;
1435 if(mcPi0pT>0.0 && mcPi0pT<5.0)
1437 weight = 0.323*mcPi0pT/(TMath::Exp(-1.6+0.767*mcPi0pT+0.0285*mcPi0pT*mcPi0pT));
1441 weight = 115.0/(0.718*mcPi0pT*TMath::Power(mcPi0pT,3.65));
1446 double AliAnalysisTaskHFECal::GetMCweightEta(double mcEtapT)
1448 double weight = 1.0;
1450 weight = 223.3/TMath::Power((TMath::Exp(-0.17*mcEtapT-0.0322*mcEtapT*mcEtapT)+mcEtapT/1.69),5.65);
1455 //_________________________________________
1456 void AliAnalysisTaskHFECal::FindTriggerClusters()
1458 //cout << "finding trigger patch" << endl;
1460 const int nModuleCols = 2;
1461 const int nModuleRows = 5;
1462 const int nColsFeeModule = 48;
1463 const int nRowsFeeModule = 24;
1464 const int nColsFaltroModule = 24;
1465 const int nRowsFaltroModule = 12;
1466 //const int faltroWidthMax = 20;
1468 // part 1, trigger extraction -------------------------------------
1469 Int_t globCol, globRow;
1470 //Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0, trigInCut=0;
1471 Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0;
1473 //Int_t trigtimes[faltroWidthMax];
1474 Double_t cellTime[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1475 Double_t cellEnergy[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1476 //Double_t fTrigCutLow = 6;
1477 //Double_t fTrigCutHigh = 10;
1478 Double_t fTimeCutLow = 469e-09;
1479 Double_t fTimeCutHigh = 715e-09;
1481 AliESDCaloTrigger * fCaloTrigger = fESD->GetCaloTrigger( "EMCAL" );
1483 // erase trigger maps
1484 for(Int_t i = 0; i < nColsFaltroModule*nModuleCols; i++ )
1486 for(Int_t j = 0; j < nRowsFaltroModule*nModuleRows; j++ )
1488 ftriggersCut[i][j] = 0;
1489 ftriggers[i][j] = 0;
1490 ftriggersTime[i][j] = 0;
1494 Int_t iglobCol=0, iglobRow=0;
1495 // go through triggers
1496 if( fCaloTrigger->GetEntries() > 0 )
1499 fCaloTrigger->Reset();
1500 while( fCaloTrigger->Next() )
1502 fCaloTrigger->GetPosition( globCol, globRow );
1503 fCaloTrigger->GetNL0Times( ntimes );
1506 if( ntimes < 1 ) continue;
1507 // get precise timings
1508 fCaloTrigger->GetL0Times( trigtimes );
1510 for(Int_t i = 0; i < ntimes; i++ )
1512 // save the first trigger time in channel
1513 if( i == 0 || triggersTime[globCol][globRow] > trigtimes[i] )
1514 triggersTime[globCol][globRow] = trigtimes[i];
1515 //printf("trigger times: %d\n",trigtimes[i]);
1517 if(trigtimes[i] > fTrigCutLow && trigtimes[i] < fTrigCutHigh )
1520 fTrigTimes->Fill(trigtimes[i]);
1524 //L1 analysis from AliAnalysisTaskEMCALTriggerQA
1526 fCaloTrigger->GetTriggerBits(bit);
1527 //cout << "bit = " << bit << endl;
1530 fCaloTrigger->GetL1TimeSum(ts);
1531 //cout << "ts = " << ts << endl;
1532 if (ts > 0)ftriggers[globCol][globRow] = 1;
1533 // number of triggered channels in event
1536 if(ts>0 && (bit >> 6 & 0x1))
1541 //cout << "ts cut = " << ts << endl;
1542 //cout << "globCol = " << globCol << endl;
1543 //cout << "globRow = " << globRow << endl;
1544 ftriggersCut[globCol][globRow] = 1;
1547 } // calo trigger entries
1548 } // has calo trigger entries
1550 // part 2 go through the clusters here -----------------------------------
1551 //cout << " part 2 go through the clusters here ----------------------------------- " << endl;
1552 Int_t nCluster=0, nCell=0, iCell=0, gCell=0;
1553 Short_t cellAddr, nSACell;
1555 //Int_t nSACell, iSACell, mclabel;
1557 Double_t cellAmp=0, cellTimeT=0, clusterTime=0, efrac=0;
1558 Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta, gphi, geta, feta, fphi;
1560 TRefArray *fCaloClusters = new TRefArray();
1561 fESD->GetEMCALClusters( fCaloClusters );
1562 nCluster = fCaloClusters->GetEntries();
1565 // save all cells times if there are clusters
1568 for(Int_t i = 0; i < nColsFeeModule*nModuleCols; i++ ){
1569 for(Int_t j = 0; j < nRowsFeeModule*nModuleRows; j++ ){
1570 cellTime[i][j] = 0.;
1571 cellEnergy[i][j] = 0.;
1576 AliESDCaloCells *fCaloCells = fESD->GetEMCALCells();
1577 //AliVCaloCells fCaloCells = fESD->GetEMCALCells();
1578 nSACell = fCaloCells->GetNumberOfCells();
1579 for(iSACell = 0; iSACell < nSACell; iSACell++ ){
1580 // get the cell info *fCal
1581 fCaloCells->GetCell( iSACell, cellAddr, cellAmp, cellTimeT , mclabel, efrac);
1583 // get cell position
1584 fGeom->GetCellIndex( cellAddr, nSupMod, nModule, nIphi, nIeta );
1585 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1587 // convert co global phi eta
1588 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1589 geta = ieta + nColsFeeModule*(nSupMod%2);
1591 // save cell time and energy
1592 cellTime[geta][gphi] = cellTimeT;
1593 cellEnergy[geta][gphi] = cellAmp;
1598 Int_t nClusterTrig, nClusterTrigCut;
1599 UShort_t *cellAddrs;
1600 Double_t clsE=-999, clsEta=-999, clsPhi=-999;
1601 Float_t clsPos[3] = {0.,0.,0.};
1603 for(Int_t icl=0; icl<fESD->GetNumberOfCaloClusters(); icl++)
1605 AliESDCaloCluster *cluster = fESD->GetCaloCluster(icl);
1606 if(!cluster || !cluster->IsEMCAL()) continue;
1608 // get cluster cells
1609 nCell = cluster->GetNCells();
1611 // get cluster energy
1612 clsE = cluster->E();
1614 // get cluster position
1615 cluster->GetPosition(clsPos);
1616 TVector3 clsPosVec(clsPos[0],clsPos[1],clsPos[2]);
1617 clsEta = clsPosVec.Eta();
1618 clsPhi = clsPosVec.Phi();
1620 // get the cell addresses
1621 cellAddrs = cluster->GetCellsAbsId();
1623 // check if the cluster contains cell, that was marked as triggered
1625 nClusterTrigCut = 0;
1627 // loop the cells to check, if cluser in acceptance
1628 // any cluster with a cell outside acceptance is not considered
1629 for( iCell = 0; iCell < nCell; iCell++ )
1632 //if(clsE>6.0)fCellCheck->Fill(clsE,cellAddrs[iCell]);
1634 // get cell position
1635 fGeom->GetCellIndex( cellAddrs[iCell], nSupMod, nModule, nIphi, nIeta );
1636 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1638 // convert co global phi eta
1639 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1640 geta = ieta + nColsFeeModule*(nSupMod%2);
1642 if( cellTime[geta][gphi] > 0. ){
1643 clusterTime += cellTime[geta][gphi];
1647 // get corresponding FALTRO
1651 //cout << "fphi = " << fphi << endl;
1652 //cout << "feta = " << feta << endl;
1654 // try to match with a triggered
1655 if( ftriggers[feta][fphi]==1)
1658 if( ftriggersCut[feta][fphi]==1)
1659 { nClusterTrigCut++;
1662 //cout << "nClusterTrigCut : " << nClusterTrigCut << endl;
1668 clusterTime = clusterTime / (Double_t)gCell;
1669 // fix the reconstriction code time 100ns jumps
1670 if( fESD->GetBunchCrossNumber() % 4 < 2 )
1671 clusterTime -= 0.0000001;
1673 //fClsETime->Fill(clsE,clusterTime);
1674 //fClsEBftTrigCut->Fill(clsE);
1677 //fClsETime1->Fill(clsE,clusterTime);
1681 cluster->SetChi2(1);
1682 //fClsEAftTrigCut1->Fill(clsE);
1685 if(nClusterTrigCut>0){
1686 cluster->SetChi2(2);
1687 //fClsEAftTrigCut2->Fill(clsE);
1690 if(nClusterTrigCut>0 && ( nCell > (1 + clsE / 3)))
1692 cluster->SetChi2(3);
1693 //fClsEAftTrigCut3->Fill(clsE);
1696 if(nClusterTrigCut>0 && (nCell > (1 + clsE / 3) )&&( clusterTime > fTimeCutLow && clusterTime < fTimeCutHigh ))
1698 // cluster->SetChi2(4);
1699 //fClsEAftTrigCut4->Fill(clsE);
1701 if(nClusterTrigCut<1)
1703 cluster->SetChi2(0);
1705 //fClsEAftTrigCut->Fill(clsE);
1712 double AliAnalysisTaskHFECal::NsigCorr(float cent)
1715 if(cent>=20 && cent<30)shift = 0.156;
1716 if(cent>=30 && cent<40)shift = 0.316;
1717 if(cent>=40 && cent<50)shift = 0.336;
1718 if(cent>=50 && cent<70)shift = 0.440;
1719 if(cent>=70 && cent<90)shift = 0.534;