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)
190 fPID = new AliHFEpid("hfePid");
191 fTrackCuts = new AliESDtrackCuts();
193 // Define input and output slots here
194 // Input slot #0 works with a TChain
195 DefineInput(0, TChain::Class());
196 // Output slot #0 id reserved by the base class for AOD
197 // Output slot #1 writes into a TH1 container
198 // DefineOutput(1, TH1I::Class());
199 DefineOutput(1, TList::Class());
200 // DefineOutput(3, TTree::Class());
203 //________________________________________________________________________
204 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal()
205 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskHFECal")
214 ,fIdentifiedAsOutInz(kFALSE)
215 ,fPassTheEventCut(kFALSE)
216 ,fRejectKinkMother(kFALSE)
222 ,fOpeningAngleCut(0.1)
253 ,fTrackPtBefTrkCuts(0)
254 ,fTrackPtAftTrkCuts(0)
275 ,fIncpTMCM20hfeAll(0)
276 ,fIncpTMCM20hfeCheck(0)
277 ,fInputHFEMC_weight(0)
278 ,fIncpTMCM20hfeCheck_weight(0)
285 ,fIncpTMCM20pho_pi0e(0)
286 ,fPhoElecPtMCM20_pi0e(0)
287 ,fSameElecPtMCM20_pi0e(0)
288 ,fIncpTMCM20pho_eta(0)
289 ,fPhoElecPtMCM20_eta(0)
290 ,fSameElecPtMCM20_eta(0)
291 ,fIncpTMCpho_pi0e_TPC(0)
292 ,fPhoElecPtMC_pi0e_TPC(0)
293 ,fSameElecPtMC_pi0e_TPC(0)
307 //Default constructor
308 fPID = new AliHFEpid("hfePid");
310 fTrackCuts = new AliESDtrackCuts();
313 // Define input and output slots here
314 // Input slot #0 works with a TChain
315 DefineInput(0, TChain::Class());
316 // Output slot #0 id reserved by the base class for AOD
317 // Output slot #1 writes into a TH1 container
318 // DefineOutput(1, TH1I::Class());
319 DefineOutput(1, TList::Class());
320 //DefineOutput(3, TTree::Class());
322 //_________________________________________
324 AliAnalysisTaskHFECal::~AliAnalysisTaskHFECal()
336 //_________________________________________
338 void AliAnalysisTaskHFECal::UserExec(Option_t*)
341 //Called for each event
343 // create pointer to event
344 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
346 printf("ERROR: fESD not available\n");
351 AliError("HFE cuts not available");
355 if(!fPID->IsInitialized()){
356 // Initialize PID with the given run number
357 AliWarning("PID not initialised, get from Run no");
358 fPID->InitializePID(fESD->GetRunNumber());
361 if(fmcData)fMC = MCEvent();
362 //AliStack* stack = NULL;
363 if(fmcData && fMC)stack = fMC->Stack();
366 AliCentrality *centrality = fESD->GetCentrality();
367 cent = centrality->GetCentralityPercentile("V0M");
369 //---- fill MC track info
372 Int_t nParticles = stack->GetNtrack();
373 for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
374 TParticle* particle = stack->Particle(iParticle);
375 int fPDG = particle->GetPdgCode();
376 double mcZvertex = fMC->GetPrimaryVertex()->GetZ();
377 double pTMC = particle->Pt();
378 double proR = particle->R();
379 double etaMC = particle->Eta();
380 if(fabs(etaMC)>0.6)continue;
381 Bool_t mcInDtoE= kFALSE;
382 Bool_t mcInBtoE= kFALSE;
384 Bool_t MChijing = fMC->IsFromBGEvent(iParticle);
385 //if(!MChijing)printf("not MC hijing");
387 if(!MChijing)iHijing = 0;
391 mcphoinfo[2] = iHijing;
392 //if(fPDG==111)Hpi0pTcheck->Fill(pTMC,iHijing);
393 //if(fPDG==221)HETApTcheck->Fill(pTMC,iHijing);
394 if(fPDG==111)Hpi0pTcheck->Fill(mcphoinfo);
395 if(fPDG==221)HETApTcheck->Fill(mcphoinfo);
396 if(fabs(fPDG)==411 || fabs(fPDG)==413 || fabs(fPDG)==421 || fabs(fPDG)==423 || fabs(fPDG)==431)HDpTcheck->Fill(pTMC,iHijing);
397 if(fabs(fPDG)==511 || fabs(fPDG)==513 || fabs(fPDG)==521 || fabs(fPDG)==523 || fabs(fPDG)==531)HBpTcheck->Fill(pTMC,iHijing);
399 if(particle->GetFirstMother()>-1 && fPDG==22)
401 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
402 if(parentPID==111 || parentPID==221)HphopTcheck->Fill(pTMC,iHijing); // pi0->g & eta->g
405 if(particle->GetFirstMother()>-1 && fabs(fPDG)==11)
407 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
408 double pTMCparent = stack->Particle(particle->GetFirstMother())->Pt();
409 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(fPDG)==11)mcInDtoE = kTRUE;
410 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(fPDG)==11)mcInBtoE = kTRUE;
411 if((mcInBtoE || mcInDtoE) && fabs(mcZvertex)<10.0)
413 fInputHFEMC->Fill(cent,pTMC);
419 mcinfo[4] = pTMCparent;
420 fInputHFEMC_weight->Fill(mcinfo);
425 if(proR<7.0 && fabs(fPDG)==11)fInputAlle->Fill(cent,pTMC);
432 Int_t fNOtrks = fESD->GetNumberOfTracks();
433 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
435 Double_t pVtxZ = -999;
436 pVtxZ = pVtx->GetZ();
438 if(TMath::Abs(pVtxZ)>10) return;
441 if(fNOtrks<1) return;
444 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
446 AliDebug(1, "Using default PID Response");
447 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
450 fPID->SetPIDResponse(pidResponse);
452 fCFM->SetRecEventInfo(fESD);
454 //Float_t cent = -1.;
455 //AliCentrality *centrality = fESD->GetCentrality();
456 //cent = centrality->GetCentralityPercentile("V0M");
459 //if(cent>90.) return;
463 FindTriggerClusters();
466 for(Int_t iCluster=0; iCluster<fESD->GetNumberOfCaloClusters(); iCluster++)
468 AliESDCaloCluster *clust = fESD->GetCaloCluster(iCluster);
469 if(clust && clust->IsEMCAL())
471 double clustE = clust->E();
472 float emcx[3]; // cluster pos
473 clust->GetPosition(emcx);
474 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
475 double emcphi = clustpos.Phi();
476 double emceta = clustpos.Eta();
478 calInfo[0] = emcphi; calInfo[1] = emceta; calInfo[2] = clustE; calInfo[3] = cent; calInfo[4] = clust->Chi2();
479 //fEMCAccE->Fill(calInfo);
480 //if(clustE>3.0)fEMCAccE->Fill(calInfo);
481 //if(fqahist==1 && clustE>1.5)fEMCAccE->Fill(calInfo);
482 hEMCAccE->Fill(cent,clustE);
487 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
488 AliESDtrack* track = fESD->GetTrack(iTracks);
490 printf("ERROR: Could not receive track %d\n", iTracks);
494 int parentlabel = 99999;
495 int parentPID = 99999;
496 int grand_parentlabel = 99999;
497 int grand_parentPID = 99999;
498 Bool_t mcPho = kFALSE;
499 Bool_t mcDtoE= kFALSE;
500 Bool_t mcBtoE= kFALSE;
501 Bool_t mcOrgPi0 = kFALSE;
502 Bool_t mcOrgEta = kFALSE;
505 double mcMompT = 0.0;
506 //double mcGrandMompT = 0.0;
507 double mcWeight = -10.0;
512 if(fmcData && fMC && stack)
514 Int_t label = TMath::Abs(track->GetLabel());
515 mcLabel = track->GetLabel();
520 Bool_t MChijing = fMC->IsFromBGEvent(label);
521 if(!MChijing)iHijing = 0;
523 TParticle* particle = stack->Particle(label);
524 int mcpid = particle->GetPdgCode();
525 mcpT = particle->Pt();
526 //printf("MCpid = %d",mcpid);
527 if(particle->GetFirstMother()>-1)
529 //int parentlabel = particle->GetFirstMother();
530 //int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
531 //mcMompT = stack->Particle(particle->GetFirstMother())->Pt();
532 FindMother(particle, parentlabel, parentPID);
533 mcMompT = stack->Particle(parentlabel)->Pt();
534 if((parentPID==22 || parentPID==111 || parentPID==221)&& fabs(mcpid)==11)mcPho = kTRUE;
535 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(mcpid)==11)mcDtoE = kTRUE;
536 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(mcpid)==11)mcBtoE = kTRUE;
538 // make D->e pT correlation
539 if(mcDtoE)fMomDtoE->Fill(mcpT,mcMompT);
541 //cout << "check PID = " << parentPID << endl;
542 //cout << "check pho = " << mcPho << endl;
543 //cout << "check D or B = " << mcDtoE << endl;
545 if(parentPID==111 && fabs(mcpid)==11 && mcMompT>0.0)
547 //cout << "find pi0->e " << endl;
549 mcWeight = GetMCweight(mcMompT);
552 if(parentPID==221 && fabs(mcpid)==11 && mcMompT>0.0)
554 //cout << "find Eta->e " << endl;
556 mcWeight = GetMCweightEta(mcMompT);
559 // access grand parent
560 TParticle* particle_parent = stack->Particle(parentlabel); // get parent pointer
561 //if(particle_parent->GetFirstMother()>-1 && parentPID==22 && fabs(mcpid)==11) // get grand parent g->e
562 if(particle_parent->GetFirstMother()>-1 && (parentPID==22 || parentPID==111) && fabs(mcpid)==11) // get grand parent g->e
564 //int grand_parentPID = stack->Particle(particle_parent->GetFirstMother())->GetPdgCode();
565 //double pTtmp = stack->Particle(particle_parent->GetFirstMother())->Pt();
566 FindMother(particle_parent, grand_parentlabel, grand_parentPID);
567 double mcGrandpT = stack->Particle(grand_parentlabel)->Pt();
568 if(grand_parentPID==111 && mcGrandpT>0.0)
570 // check eta->pi0 decay !
571 int grand2_parentlabel = 99999; int grand2_parentPID = 99999;
572 TParticle* particle_grand = stack->Particle(grand_parentlabel); // get parent pointer
573 FindMother(particle_grand, grand2_parentlabel, grand2_parentPID);
574 if(grand2_parentPID==221)
576 //cout << "find Eta->e " << endl;
577 double mcGrandpT2 = stack->Particle(grand2_parentlabel)->Pt();
579 mcWeight = GetMCweight(mcGrandpT2);
580 mcMompT = mcGrandpT2;
584 //cout << "find pi0->e " << endl;
586 mcWeight = GetMCweight(mcGrandpT);
591 if(grand_parentPID==221 && mcGrandpT>0.0)
593 //cout << "find Eta->e " << endl;
596 mcWeight = GetMCweightEta(mcGrandpT);
602 //cout << "===================="<<endl;
603 //cout << "mcDtoE : " << mcDtoE << endl;
604 //cout << "mcBtoE : " << mcBtoE << endl;
605 //cout << "mcPho : " << mcPho << endl;
607 if(fabs(mcpid)==11)mcele= 0.;
608 //cout << "check e: " << mcele << endl;
609 if(fabs(mcpid)==11 && mcDtoE)mcele= 1.;
610 //cout << "check D->e: " << mcele << endl;
611 if(fabs(mcpid)==11 && mcBtoE)mcele= 2.;
612 //cout << "check B->e: " << mcele << endl;
613 if(fabs(mcpid)==11 && mcPho)mcele= 3.;
614 //cout << "check Pho->e: " << mcele << endl;
616 } // end of mcLabel>-1
620 //cout << "Pi0 = " << mcOrgPi0 << " ; Eta = " << mcOrgEta << endl;
621 //printf("weight = %f\n",mcWeight);
623 if(TMath::Abs(track->Eta())>0.6) continue;
624 if(TMath::Abs(track->Pt()<2.0)) continue;
626 fTrackPtBefTrkCuts->Fill(track->Pt());
627 // RecKine: ITSTPC cuts
628 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
631 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
632 if(track->GetKinkIndex(0) != 0) continue;
636 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
638 // HFEcuts: ITS layers cuts
639 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
641 // HFE cuts: TPC PID cleanup
642 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
644 int nTPCcl = track->GetTPCNcls();
645 //int nTPCclF = track->GetTPCNclsF(); // warnings
646 int nITS = track->GetNcls(0);
648 fTrackPtAftTrkCuts->Fill(track->Pt());
650 Double_t mom = -999., eop=-999., pt = -999., dEdx=-999., fTPCnSigma=-10, phi=-999., eta=-999.;
654 // Track extrapolation
656 Int_t charge = track->Charge();
661 dEdx = track->GetTPCsignal();
662 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
663 if(mcLabel==-1) // nsigma mean correction
665 double mean_corr = NsigCorr(cent);
666 printf("correction %f\n",mean_corr);
667 fTPCnSigma -= mean_corr;
670 double ncells = -1.0;
674 double rmatch = -1.0;
675 double nmatch = -1.0;
676 double oppstatus = 0.0;
679 Bool_t fFlagPhotonicElec = kFALSE;
680 Bool_t fFlagConvinatElec = kFALSE;
682 Int_t clsId = track->GetEMCALcluster();
684 AliESDCaloCluster *clust = fESD->GetCaloCluster(clsId);
685 if(clust && clust->IsEMCAL()){
687 double clustE = clust->E();
688 eop = clustE/fabs(mom);
689 //double clustT = clust->GetTOF();
690 ncells = clust->GetNCells();
691 m02 = clust->GetM02();
692 m20 = clust->GetM20();
693 disp = clust->GetDispersion();
694 double delphi = clust->GetTrackDx();
695 double deleta = clust->GetTrackDz();
696 rmatch = sqrt(pow(delphi,2)+pow(deleta,2));
697 nmatch = clust->GetNTracksMatched();
698 emctof = clust->GetTOF();
699 //cout << "emctof = " << emctof << endl;
701 if(fTPCnSigma>-1.5 && fTPCnSigma<3.0)
703 SelectPhotonicElectron(iTracks,cent,track,fFlagPhotonicElec,fFlagConvinatElec,fTPCnSigma,m20,eop,mcele,mcWeight,iHijing,mcOrgPi0,mcOrgEta);
705 if(fFlagPhotonicElec)oppstatus = 1.0;
706 if(fFlagConvinatElec)oppstatus = 2.0;
707 if(fFlagPhotonicElec && fFlagConvinatElec)oppstatus = 3.0;
710 valdedx[0] = pt; valdedx[1] = nITS; valdedx[2] = phi; valdedx[3] = eta; valdedx[4] = fTPCnSigma;
711 //valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nTPCclF; valdedx[9] = m20; valdedx[10] = mcpT;
712 valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nmatch; valdedx[9] = m20; valdedx[10] = mcpT;
713 valdedx[11] = cent; valdedx[12] = charge; valdedx[13] = oppstatus; valdedx[14] = nTPCcl;
715 if(fqahist==1)fEleInfo->Fill(valdedx);
721 if(nITS<2.5)continue;
722 if(nTPCcl<100)continue;
724 CheckNclust->Fill(nTPCcl);
725 CheckNits->Fill(nITS);
727 fdEdxBef->Fill(mom,fTPCnSigma);
728 fTPCnsigma->Fill(mom,fTPCnSigma);
729 if(fTPCnSigma >= -1.0 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,eop);
733 // check reco eff. with TPC
738 phoval[2] = fTPCnSigma;
742 if((fTPCnSigma >= -1.0 && fTPCnSigma <= 3) && mcele>0 && mcPho && mcOrgPi0)
744 if(iHijing==1)mcWeight = 1.0;
745 fIncpTMCpho_pi0e_TPC->Fill(phoval,mcWeight);
746 if(fFlagPhotonicElec) fPhoElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
747 if(fFlagConvinatElec) fSameElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
751 AliHFEpidObject hfetrack;
752 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
753 hfetrack.SetRecTrack(track);
755 if((0.0< cent) && (cent<5.0)) binct = 0.5;
756 if((5.0< cent) && (cent<10.0)) binct = 1.5;
757 if((10.0< cent) && (cent<20.0)) binct = 2.5;
758 if((20.0< cent) && (cent<30.0)) binct = 3.5;
759 if((30.0< cent) && (cent<40.0)) binct = 4.5;
760 if((40.0< cent) && (cent<50.0)) binct = 5.5;
761 if((50.0< cent) && (cent<60.0)) binct = 6.5;
762 if((60.0< cent) && (cent<70.0)) binct = 7.5;
763 if((70.0< cent) && (cent<80.0)) binct = 8.5;
764 if((80.0< cent) && (cent<90.0)) binct = 9.5;
765 if((90.0< cent) && (cent<100.0)) binct = 10.5;
767 hfetrack.SetCentrality((int)binct); //added
769 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
771 if(pidpassed==0) continue;
773 fTrkEovPAft->Fill(pt,eop);
774 fdEdxAft->Fill(mom,fTPCnSigma);
777 fIncpT->Fill(cent,pt);
778 if(fFlagPhotonicElec) fPhoElecPt->Fill(cent,pt);
779 if(fFlagConvinatElec) fSameElecPt->Fill(cent,pt);
781 if(m20>0.0 && m20<0.3)
783 fIncpTM20->Fill(cent,pt);
784 ftimingEle->Fill(pt,emctof);
785 if(fFlagPhotonicElec) fPhoElecPtM20->Fill(cent,pt);
786 if(fFlagConvinatElec) fSameElecPtM20->Fill(cent,pt);
790 // check label for electron candidiates
793 if(mcLabel==0)idlabel = 0;
794 fLabelCheck->Fill(pt,idlabel);
795 if(mcLabel==0)fgeoFake->Fill(phi,eta);
797 if(mcele>0) // select MC electrons
800 fIncpTMChfeAll->Fill(cent,pt);
801 if(m20>0.0 && m20<0.3)fIncpTMCM20hfeAll->Fill(cent,pt);
803 if(mcBtoE || mcDtoE) // select B->e & D->e
805 fIncpTMChfe->Fill(cent,pt);
806 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfe->Fill(cent,pt);
807 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfeCheck->Fill(cent,mcpT);
808 if(m20>0.0 && m20<0.3)
810 cout << "MC label = " << mcLabel << endl;
811 fIncpTMCM20hfe->Fill(cent,pt);
812 fIncpTMCM20hfeCheck->Fill(cent,mcpT);
813 fIncpTMCM20hfeCheck_weight->Fill(phoval);
817 if(mcPho) // select photonic electrons
820 fIncpTMCpho->Fill(phoval);
821 if(fFlagPhotonicElec) fPhoElecPtMC->Fill(phoval);
822 if(fFlagConvinatElec) fSameElecPtMC->Fill(phoval);
824 if(m20>0.0 && m20<0.3)
826 fIncpTMCM20pho->Fill(phoval);
827 if(fFlagPhotonicElec) fPhoElecPtMCM20->Fill(phoval);
828 if(fFlagConvinatElec) fSameElecPtMCM20->Fill(phoval);
832 if(iHijing==1)mcWeight = 1.0;
835 fIncpTMCM20pho_pi0e->Fill(phoval,mcWeight);
836 if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval,mcWeight);
837 if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval,mcWeight);
838 //fIncpTMCM20pho_pi0e->Fill(phoval); // v5-04-02-AN & v5-04-06-AN
839 //if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval);
840 //if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval);
844 fIncpTMCM20pho_eta->Fill(phoval,mcWeight);
845 if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval,mcWeight);
846 if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval,mcWeight);
847 //fIncpTMCM20pho_eta->Fill(phoval);
848 //if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval);
849 //if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval);
857 PostData(1, fOutputList);
859 //_________________________________________
860 void AliAnalysisTaskHFECal::UserCreateOutputObjects()
864 //Bool_t mcData = kFALSE;
865 if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())
868 printf("+++++ MC Data available");
872 printf("++++++++= MC analysis \n");
876 printf("++++++++ real data analysis \n");
879 printf("+++++++ QA hist %d",fqahist);
882 fGeom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
884 //--------Initialize PID
885 //fPID->SetHasMCData(kFALSE);
886 fPID->SetHasMCData(fmcData);
887 if(!fPID->GetNumberOfPIDdetectors())
889 fPID->AddDetector("TPC", 0);
890 fPID->AddDetector("EMCAL", 1);
894 const char *cutmodel;
896 params[0] = -1.0; //sigma min
897 double maxnSig = 3.0;
900 params[0] = -5.0; //sigma min
904 for(Int_t a=0;a<11;a++)fPID->ConfigureTPCcentralityCut(a,cutmodel,params,maxnSig);
906 fPID->SortDetectors();
907 fPIDqa = new AliHFEpidQAmanager();
908 fPIDqa->Initialize(fPID);
910 //------- fcut --------------
911 fCuts = new AliHFEcuts();
912 fCuts->CreateStandardCuts();
913 //fCuts->SetMinNClustersTPC(100);
914 fCuts->SetMinNClustersTPC(90);
915 fCuts->SetMinRatioTPCclusters(0.6);
916 fCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
917 //fCuts->SetMinNClustersITS(3);
918 fCuts->SetMinNClustersITS(2);
919 fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
920 fCuts->SetCheckITSLayerStatus(kFALSE);
921 fCuts->SetVertexRange(10.);
922 fCuts->SetTOFPIDStep(kFALSE);
923 fCuts->SetPtRange(2, 50);
924 fCuts->SetMaxImpactParam(3.,3.);
926 //--------Initialize correction Framework and Cuts
927 fCFM = new AliCFManager;
928 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
929 fCFM->SetNStepParticle(kNcutSteps);
930 for(Int_t istep = 0; istep < kNcutSteps; istep++)
931 fCFM->SetParticleCutsList(istep, NULL);
934 AliWarning("Cuts not available. Default cuts will be used");
935 fCuts = new AliHFEcuts;
936 fCuts->CreateStandardCuts();
938 fCuts->Initialize(fCFM);
940 //---------Output Tlist
941 fOutputList = new TList();
942 fOutputList->SetOwner();
943 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
945 fNoEvents = new TH1F("fNoEvents","",4,-0.5,3.5) ;
946 fOutputList->Add(fNoEvents);
948 Int_t binsE[5] = {250, 100, 1000, 200, 10};
949 Double_t xminE[5] = {1.0, -1, 0.0, 0, -0.5};
950 Double_t xmaxE[5] = {3.5, 1, 100.0, 100, 9.5};
951 fEMCAccE = new THnSparseD("fEMCAccE","EMC acceptance & E;#eta;#phi;Energy;Centrality;trugCondition;",5,binsE,xminE,xmaxE);
952 if(fqahist==1)fOutputList->Add(fEMCAccE);
954 hEMCAccE = new TH2F("hEMCAccE","Cluster Energy",200,0,100,100,0,20);
955 fOutputList->Add(hEMCAccE);
957 fTrkpt = new TH1F("fTrkpt","track pt",100,0,50);
958 fOutputList->Add(fTrkpt);
960 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",100,0,50);
961 fOutputList->Add(fTrackPtBefTrkCuts);
963 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",100,0,50);
964 fOutputList->Add(fTrackPtAftTrkCuts);
966 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",100,0,50,200,-10,10);
967 fOutputList->Add(fTPCnsigma);
969 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",100,0,50,100,0,2);
970 fOutputList->Add(fTrkEovPBef);
972 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",100,0,50,100,0,2);
973 fOutputList->Add(fTrkEovPAft);
975 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",100,0,50,200,-10,10);
976 fOutputList->Add(fdEdxBef);
978 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",100,0,50,200,-10,10);
979 fOutputList->Add(fdEdxAft);
981 fIncpT = new TH2F("fIncpT","HFE pid electro vs. centrality",200,0,100,100,0,50);
982 fOutputList->Add(fIncpT);
984 fIncpTM20 = new TH2F("fIncpTM20","HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
985 fOutputList->Add(fIncpTM20);
987 Int_t nBinspho[9] = { 200, 100, 500, 12, 50, 4, 200, 8, 100};
988 Double_t minpho[9] = { 0., 0., 0., -2.5, 0, -0.5, 0,-1.5, 0};
989 Double_t maxpho[9] = {100., 50., 0.5, 3.5, 1, 3.5, 2, 6.5, 50};
991 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);
992 if(fqahist==1)fOutputList->Add(fInvmassLS);
994 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);
995 if(fqahist==1)fOutputList->Add(fInvmassULS);
997 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);
998 if(fqahist==1)fOutputList->Add(fInvmassLSmc);
1000 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);
1001 if(fqahist==1)fOutputList->Add(fInvmassULSmc);
1003 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 );
1004 fInvmassLSmc0->Sumw2();
1005 fOutputList->Add(fInvmassLSmc0);
1007 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 );
1008 fInvmassLSmc1->Sumw2();
1009 fOutputList->Add(fInvmassLSmc1);
1011 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 );
1012 fInvmassLSmc2->Sumw2();
1013 fOutputList->Add(fInvmassLSmc2);
1015 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 );
1016 fInvmassLSmc3->Sumw2();
1017 fOutputList->Add(fInvmassLSmc3);
1019 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 );
1020 fInvmassULSmc0->Sumw2();
1021 fOutputList->Add(fInvmassULSmc0);
1023 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 );
1024 fInvmassULSmc1->Sumw2();
1025 fOutputList->Add(fInvmassULSmc1);
1027 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 );
1028 fInvmassULSmc2->Sumw2();
1029 fOutputList->Add(fInvmassULSmc2);
1031 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 );
1032 fInvmassULSmc3->Sumw2();
1033 fOutputList->Add(fInvmassULSmc3);
1035 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1036 fOutputList->Add(fOpeningAngleLS);
1038 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1039 fOutputList->Add(fOpeningAngleULS);
1041 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,50);
1042 fOutputList->Add(fPhotoElecPt);
1044 fPhoElecPt = new TH2F("fPhoElecPt", "Pho-inclusive electron pt",200,0,100,100,0,50);
1045 fOutputList->Add(fPhoElecPt);
1047 fPhoElecPtM20 = new TH2F("fPhoElecPtM20", "Pho-inclusive electron pt with M20",200,0,100,100,0,50);
1048 fOutputList->Add(fPhoElecPtM20);
1050 fSameElecPt = new TH2F("fSameElecPt", "Same-inclusive electron pt",200,0,100,100,0,50);
1051 fOutputList->Add(fSameElecPt);
1053 fSameElecPtM20 = new TH2F("fSameElecPtM20", "Same-inclusive electron pt with M20",200,0,100,100,0,50);
1054 fOutputList->Add(fSameElecPtM20);
1056 fCent = new TH1F("fCent","Centrality",200,0,100) ;
1057 fOutputList->Add(fCent);
1059 // Make common binning
1060 const Double_t kMinP = 0.;
1061 const Double_t kMaxP = 50.;
1062 //const Double_t kTPCSigMim = 40.;
1063 //const Double_t kTPCSigMax = 140.;
1065 // 1st histogram: TPC dEdx with/without EMCAL (p, pT, TPC Signal, phi, eta, Sig, e/p, ,match, cell, M02, M20, Disp, Centrality, select)
1066 Int_t nBins[16] = { 250, 10, 60, 20, 100, 300, 50, 40, 200, 200, 250, 200, 3, 5, 100, 8};
1067 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};
1068 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};
1069 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);
1070 if(fqahist==1)fOutputList->Add(fEleInfo);
1074 fClsEBftTrigCut = new TH1F("fClsEBftTrigCut","cluster E before trigger selection",1000,0,100);
1075 fOutputList->Add(fClsEBftTrigCut);
1077 fClsEAftTrigCut = new TH1F("fClsEAftTrigCut","cluster E if cls has 0 trigcut channel",1000,0,100);
1078 fOutputList->Add(fClsEAftTrigCut);
1080 fClsEAftTrigCut1 = new TH1F("fClsEAftTrigCut1","cluster E if cls with trig channel",1000,0,100);
1081 fOutputList->Add(fClsEAftTrigCut1);
1083 fClsEAftTrigCut2 = new TH1F("fClsEAftTrigCut2","cluster E if cls with trigcut channel",1000,0,100);
1084 fOutputList->Add(fClsEAftTrigCut2);
1086 fClsEAftTrigCut3 = new TH1F("fClsEAftTrigCut3","cluster E if cls with trigcut channel + nCell>Ecorrect",1000,0,100);
1087 fOutputList->Add(fClsEAftTrigCut3);
1089 fClsEAftTrigCut4 = new TH1F("fClsEAftTrigCut4","cluster E if cls with trigcut channel + nCell>Ecorrect + cls time cut",1000,0,100);
1090 fOutputList->Add(fClsEAftTrigCut4);
1092 fClsETime = new TH2F("fClsETime", "Cls time vs E; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1093 fOutputList->Add(fClsETime);
1095 fClsETime1 = new TH2F("fClsETime1", "Cls time vs E if cls contains trigger channel; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1096 fOutputList->Add(fClsETime1);
1098 fTrigTimes = new TH1F("fTrigTimes", "Trigger time; time; N;",25,0,25);
1099 fOutputList->Add(fTrigTimes);
1101 fCellCheck = new TH2F("fCellCheck", "Cell vs E; E GeV; Cell ID",10,6,26,12000,0,12000);
1102 fOutputList->Add(fCellCheck);
1106 fInputHFEMC = new TH2F("fInputHFEMC","Input MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1107 fOutputList->Add(fInputHFEMC);
1109 fInputAlle = new TH2F("fInputAlle","Input MC electro vs. centrality",200,0,100,100,0,50);
1110 fOutputList->Add(fInputAlle);
1112 fIncpTMChfe = new TH2F("fIncpTMChfe","MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1113 fOutputList->Add(fIncpTMChfe);
1115 fIncpTMChfeAll = new TH2F("fIncpTMChfeAll","MC Alle pid electro vs. centrality",200,0,100,100,0,50);
1116 fOutputList->Add(fIncpTMChfeAll);
1118 fIncpTMCM20hfe = new TH2F("fIncpTMCM20hfe","MC HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
1119 fOutputList->Add(fIncpTMCM20hfe);
1121 fIncpTMCM20hfeAll = new TH2F("fIncpTMCM20hfeAll","MC Alle pid electro vs. centrality with M20",200,0,100,100,0,50);
1122 fOutputList->Add(fIncpTMCM20hfeAll);
1124 fIncpTMCM20hfeCheck = new TH2F("fIncpTMCM20hfeCheck","MC HFE pid electro vs. centrality with M20 Check",200,0,100,100,0,50);
1125 fOutputList->Add(fIncpTMCM20hfeCheck);
1127 Int_t nBinspho2[5] = { 200, 100, 7, 3, 700};
1128 Double_t minpho2[5] = { 0., 0., -2.5, -0.5, 0.};
1129 Double_t maxpho2[5] = {100., 50., 4.5, 2.5, 70.};
1131 fInputHFEMC_weight = new THnSparseD("fInputHFEMC_weight", "MC HFE electron pt",5,nBinspho2,minpho2,maxpho2);
1132 fOutputList->Add(fInputHFEMC_weight);
1134 fIncpTMCM20hfeCheck_weight = new THnSparseD("fIncpTMCM20hfeCheck_weight", "HFE electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1135 fOutputList->Add(fIncpTMCM20hfeCheck_weight);
1137 fIncpTMCpho = new THnSparseD("fIncpTMCpho","MC Pho pid electro vs. centrality",5,nBinspho2,minpho2,maxpho2);
1138 fOutputList->Add(fIncpTMCpho);
1140 fIncpTMCM20pho = new THnSparseD("fIncpTMCM20pho","MC Pho pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1141 fOutputList->Add(fIncpTMCM20pho);
1143 fPhoElecPtMC = new THnSparseD("fPhoElecPtMC", "MC Pho-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1144 fOutputList->Add(fPhoElecPtMC);
1146 fPhoElecPtMCM20 = new THnSparseD("fPhoElecPtMCM20", "MC Pho-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1147 fOutputList->Add(fPhoElecPtMCM20);
1149 fSameElecPtMC = new THnSparseD("fSameElecPtMC", "MC Same-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1150 fOutputList->Add(fSameElecPtMC);
1152 fSameElecPtMCM20 = new THnSparseD("fSameElecPtMCM20", "MC Same-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1153 fOutputList->Add(fSameElecPtMCM20);
1155 fIncpTMCM20pho_pi0e = new THnSparseD("fIncpTMCM20pho_pi0e","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1156 fIncpTMCM20pho_pi0e->Sumw2();
1157 fOutputList->Add(fIncpTMCM20pho_pi0e);
1159 fPhoElecPtMCM20_pi0e = new THnSparseD("fPhoElecPtMCM20_pi0e", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1160 fPhoElecPtMCM20_pi0e->Sumw2();
1161 fOutputList->Add(fPhoElecPtMCM20_pi0e);
1163 fSameElecPtMCM20_pi0e = new THnSparseD("fSameElecPtMCM20_pi0e", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1164 fSameElecPtMCM20_pi0e->Sumw2();
1165 fOutputList->Add(fSameElecPtMCM20_pi0e);
1167 fIncpTMCM20pho_eta = new THnSparseD("fIncpTMCM20pho_eta","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1168 fIncpTMCM20pho_eta->Sumw2();
1169 fOutputList->Add(fIncpTMCM20pho_eta);
1171 fPhoElecPtMCM20_eta = new THnSparseD("fPhoElecPtMCM20_eta", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1172 fPhoElecPtMCM20_eta->Sumw2();
1173 fOutputList->Add(fPhoElecPtMCM20_eta);
1175 fSameElecPtMCM20_eta = new THnSparseD("fSameElecPtMCM20_eta", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1176 fSameElecPtMCM20_eta->Sumw2();
1177 fOutputList->Add(fSameElecPtMCM20_eta);
1179 fIncpTMCpho_pi0e_TPC = new THnSparseD("fIncpTMCpho_pi0e_TPC","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1180 fIncpTMCpho_pi0e_TPC->Sumw2();
1181 fOutputList->Add(fIncpTMCpho_pi0e_TPC);
1183 fPhoElecPtMC_pi0e_TPC = new THnSparseD("fPhoElecPtMC_pi0e_TPC", "MC Pho-inclusive electron pt with pi0->e",5,nBinspho2,minpho2,maxpho2);
1184 fPhoElecPtMC_pi0e_TPC->Sumw2();
1185 fOutputList->Add(fPhoElecPtMC_pi0e_TPC);
1187 fSameElecPtMC_pi0e_TPC = new THnSparseD("fSameElecPtMC_pi0e_TPC", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1188 fSameElecPtMC_pi0e_TPC->Sumw2();
1189 fOutputList->Add(fSameElecPtMC_pi0e_TPC);
1192 CheckNclust = new TH1D("CheckNclust","cluster check",200,0,200);
1193 fOutputList->Add(CheckNclust);
1195 CheckNits = new TH1D("CheckNits","ITS cluster check",8,-0.5,7.5);
1196 fOutputList->Add(CheckNits);
1198 Hpi0pTcheck = new TH2D("Hpi0pTcheck","Pi0 pT from Hijing",100,0,50,3,-0.5,2.5);
1199 fOutputList->Add(Hpi0pTcheck);
1201 HETApTcheck = new TH2D("HETApTcheck","Eta pT from Hijing",100,0,50,3,-0.5,2.5);
1202 fOutputList->Add(HETApTcheck);
1205 Int_t nBinspho3[3] = { 200, 100, 3};
1206 Double_t minpho3[3] = { 0., 0., -0.5};
1207 Double_t maxpho3[3] = {100., 50., 2.5};
1209 Hpi0pTcheck = new THnSparseD("Hpi0pTcheck","Pi0 pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1210 fOutputList->Add(Hpi0pTcheck);
1212 HETApTcheck = new THnSparseD("HETApTcheck","Eta pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1213 fOutputList->Add(HETApTcheck);
1215 HphopTcheck = new TH2D("HphopTcheck","Pho pT from Hijing",100,0,50,3,-0.5,2.5);
1216 fOutputList->Add(HphopTcheck);
1218 HDpTcheck = new TH2D("HDpTcheck","D pT from Hijing",100,0,50,3,-0.5,2.5);
1219 fOutputList->Add(HDpTcheck);
1221 HBpTcheck = new TH2D("HBpTcheck","B pT from Hijing",100,0,50,3,-0.5,2.5);
1222 fOutputList->Add(HBpTcheck);
1225 fpTCheck = new TH1D("fpTCheck","pT check",500,0,50);
1226 fOutputList->Add(fpTCheck);
1228 fMomDtoE = new TH2D("fMomDtoE","D->E pT correlations;e p_{T} GeV/c;D p_{T} GeV/c",400,0,40,400,0,40);
1229 fOutputList->Add(fMomDtoE);
1231 fLabelCheck = new TH2D("fLabelCheck","MC label",50,0,50,5,-1.5,3.5);
1232 fOutputList->Add(fLabelCheck);
1234 fgeoFake = new TH2D("fgeoFake","Label==0 eta and phi",628,0,6.28,200,-1,1);
1235 fOutputList->Add(fgeoFake);
1237 ftimingEle = new TH2D("ftimingEle","electron TOF",100,0,20,100,1e-7,1e-6);
1238 fOutputList->Add(ftimingEle);
1240 PostData(1,fOutputList);
1243 //________________________________________________________________________
1244 void AliAnalysisTaskHFECal::Terminate(Option_t *)
1246 // Info("Terminate");
1247 AliAnalysisTaskSE::Terminate();
1250 //________________________________________________________________________
1251 Bool_t AliAnalysisTaskHFECal::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1253 // Check single track cuts for a given cut step
1254 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1255 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1258 //_________________________________________
1259 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec)
1260 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec, Bool_t &fFlagConvinatElec, Double_t nSig)
1261 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)
1263 //Identify non-heavy flavour electrons using Invariant mass method
1265 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
1266 fTrackCuts->SetRequireTPCRefit(kTRUE);
1267 fTrackCuts->SetRequireITSRefit(kTRUE);
1268 fTrackCuts->SetEtaRange(-0.9,0.9);
1269 //fTrackCuts->SetRequireSigmaToVertex(kTRUE);
1270 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
1271 fTrackCuts->SetMinNClustersTPC(90);
1273 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
1275 double ptEle = track->Pt(); //add
1276 if(ibgevent==0 && w > 0.0)
1278 fpTCheck->Fill(ptEle,w);
1281 Bool_t flagPhotonicElec = kFALSE;
1282 Bool_t flagConvinatElec = kFALSE;
1287 Int_t label = TMath::Abs(track->GetLabel());
1288 TParticle* particle = stack->Particle(label);
1289 p1 = particle->GetFirstMother();
1292 //for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1293 for(Int_t jTracks = 0; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1294 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
1296 printf("ERROR: Could not receive track %d\n", jTracks);
1299 if(itrack==jTracks)continue;
1305 Int_t label2 = TMath::Abs(trackAsso->GetLabel());
1306 TParticle* particle2 = stack->Particle(label2);
1307 Bool_t MChijing_ass = fMC->IsFromBGEvent(label2);
1308 if(MChijing_ass)jbgevent =1;
1309 if(particle2->GetFirstMother()>-1)
1310 p2 = particle2->GetFirstMother();
1313 Double_t dEdxAsso = -999., ptPrim=-999., ptAsso=-999., openingAngle = -999.;
1314 Double_t mass=999., width = -999;
1315 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
1317 //ptPrim = track->Pt();
1320 dEdxAsso = trackAsso->GetTPCsignal();
1321 ptAsso = trackAsso->Pt();
1322 Int_t chargeAsso = trackAsso->Charge();
1323 Int_t charge = track->Charge();
1326 if(ptAsso <0.5) continue;
1327 if(!fTrackCuts->AcceptTrack(trackAsso)) continue;
1328 if(dEdxAsso <65 || dEdxAsso>100) continue; //11a pass1
1330 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
1331 if(charge>0) fPDGe1 = -11;
1332 if(chargeAsso>0) fPDGe2 = -11;
1334 //printf("chargeAsso = %d\n",chargeAsso);
1335 //printf("charge = %d\n",charge);
1336 if(charge == chargeAsso) fFlagLS = kTRUE;
1337 if(charge != chargeAsso) fFlagULS = kTRUE;
1339 //printf("fFlagLS = %d\n",fFlagLS);
1340 //printf("fFlagULS = %d\n",fFlagULS);
1343 AliKFParticle ge1(*track, fPDGe1);
1344 AliKFParticle ge2(*trackAsso, fPDGe2);
1345 AliKFParticle recg(ge1, ge2);
1347 if(recg.GetNDF()<1) continue;
1348 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1349 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
1351 // for v5-03-70-AN comment
1352 AliKFVertex primV(*pVtx);
1354 recg.SetProductionVertex(primV);
1356 recg.SetMassConstraint(0,0.0001);
1358 openingAngle = ge1.GetAngle(ge2);
1359 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
1360 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
1363 recg.GetMass(mass,width);
1366 if(shower>0.0 && shower<0.3)ishower = 1;
1370 phoinfo[1] = ptPrim;
1373 phoinfo[4] = openingAngle;
1374 phoinfo[5] = ishower;
1377 phoinfo[8] = ptAsso;
1379 if(fFlagLS) fInvmassLS->Fill(phoinfo);
1380 if(fFlagULS) fInvmassULS->Fill(phoinfo);
1381 if(fFlagLS && ibgevent==0 && jbgevent==0) fInvmassLSmc->Fill(phoinfo,w);
1382 if(fFlagULS && ibgevent==0 && jbgevent==0)
1384 fInvmassULSmc->Fill(phoinfo,w);
1386 //printf("fInvmassCut %f\n",fInvmassCut);
1387 //printf("openingAngle %f\n",fOpeningAngleCut);
1389 if(openingAngle > fOpeningAngleCut) continue;
1392 //printf("mce =%f\n",mce);
1393 if(mce<-0.5) // mce==-1. is real
1395 //printf("Real data\n");
1396 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
1397 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1398 flagPhotonicElec = kTRUE;
1400 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec){
1401 flagConvinatElec = kTRUE;
1407 //printf("MC data\n");
1411 //cout << "tagpi0 = " << tagpi0 << " ; tageta = " << tageta << endl;
1412 if(fFlagLS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassLSmc0->Fill(ptPrim,mass,w);
1413 if(fFlagULS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassULSmc0->Fill(ptPrim,mass,w);
1414 if(fFlagLS && ibgevent==0 && jbgevent==0 && tageta) fInvmassLSmc1->Fill(ptPrim,mass,w);
1415 if(fFlagULS && ibgevent==0 && jbgevent==0 && tageta) fInvmassULSmc1->Fill(ptPrim,mass,w);
1416 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassLSmc2->Fill(ptPrim,mass,w);
1417 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassULSmc2->Fill(ptPrim,mass,w);
1418 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassLSmc3->Fill(ptPrim,mass,w);
1419 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassULSmc3->Fill(ptPrim,mass,w);
1421 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (ibgevent==jbgevent)){
1422 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1423 flagPhotonicElec = kTRUE;
1425 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec && (ibgevent==jbgevent)){
1426 flagConvinatElec = kTRUE;
1431 fFlagPhotonicElec = flagPhotonicElec;
1432 fFlagConvinatElec = flagConvinatElec;
1435 //-------------------------------------------
1437 void AliAnalysisTaskHFECal::FindMother(TParticle* part, int &label, int &pid)
1439 //int label = 99999;
1442 if(part->GetFirstMother()>-1)
1444 label = part->GetFirstMother();
1445 pid = stack->Particle(label)->GetPdgCode();
1447 //cout << "Find Mother : label = " << label << " ; pid" << pid << endl;
1450 double AliAnalysisTaskHFECal::GetMCweight(double mcPi0pT)
1452 double weight = 1.0;
1454 if(mcPi0pT>0.0 && mcPi0pT<5.0)
1456 weight = 0.323*mcPi0pT/(TMath::Exp(-1.6+0.767*mcPi0pT+0.0285*mcPi0pT*mcPi0pT));
1460 weight = 115.0/(0.718*mcPi0pT*TMath::Power(mcPi0pT,3.65));
1465 double AliAnalysisTaskHFECal::GetMCweightEta(double mcEtapT)
1467 double weight = 1.0;
1469 weight = 223.3/TMath::Power((TMath::Exp(-0.17*mcEtapT-0.0322*mcEtapT*mcEtapT)+mcEtapT/1.69),5.65);
1474 //_________________________________________
1475 void AliAnalysisTaskHFECal::FindTriggerClusters()
1477 //cout << "finding trigger patch" << endl;
1479 const int nModuleCols = 2;
1480 const int nModuleRows = 5;
1481 const int nColsFeeModule = 48;
1482 const int nRowsFeeModule = 24;
1483 const int nColsFaltroModule = 24;
1484 const int nRowsFaltroModule = 12;
1485 //const int faltroWidthMax = 20;
1487 // part 1, trigger extraction -------------------------------------
1488 Int_t globCol, globRow;
1489 //Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0, trigInCut=0;
1490 Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0;
1492 //Int_t trigtimes[faltroWidthMax];
1493 Double_t cellTime[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1494 Double_t cellEnergy[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1495 //Double_t fTrigCutLow = 6;
1496 //Double_t fTrigCutHigh = 10;
1497 Double_t fTimeCutLow = 469e-09;
1498 Double_t fTimeCutHigh = 715e-09;
1500 AliESDCaloTrigger * fCaloTrigger = fESD->GetCaloTrigger( "EMCAL" );
1502 // erase trigger maps
1503 for(Int_t i = 0; i < nColsFaltroModule*nModuleCols; i++ )
1505 for(Int_t j = 0; j < nRowsFaltroModule*nModuleRows; j++ )
1507 ftriggersCut[i][j] = 0;
1508 ftriggers[i][j] = 0;
1509 ftriggersTime[i][j] = 0;
1513 Int_t iglobCol=0, iglobRow=0;
1514 // go through triggers
1515 if( fCaloTrigger->GetEntries() > 0 )
1518 fCaloTrigger->Reset();
1519 while( fCaloTrigger->Next() )
1521 fCaloTrigger->GetPosition( globCol, globRow );
1522 fCaloTrigger->GetNL0Times( ntimes );
1525 if( ntimes < 1 ) continue;
1526 // get precise timings
1527 fCaloTrigger->GetL0Times( trigtimes );
1529 for(Int_t i = 0; i < ntimes; i++ )
1531 // save the first trigger time in channel
1532 if( i == 0 || triggersTime[globCol][globRow] > trigtimes[i] )
1533 triggersTime[globCol][globRow] = trigtimes[i];
1534 //printf("trigger times: %d\n",trigtimes[i]);
1536 if(trigtimes[i] > fTrigCutLow && trigtimes[i] < fTrigCutHigh )
1539 fTrigTimes->Fill(trigtimes[i]);
1543 //L1 analysis from AliAnalysisTaskEMCALTriggerQA
1545 fCaloTrigger->GetTriggerBits(bit);
1546 //cout << "bit = " << bit << endl;
1549 fCaloTrigger->GetL1TimeSum(ts);
1550 //cout << "ts = " << ts << endl;
1551 if (ts > 0)ftriggers[globCol][globRow] = 1;
1552 // number of triggered channels in event
1555 if(ts>0 && (bit >> 6 & 0x1))
1560 //cout << "ts cut = " << ts << endl;
1561 //cout << "globCol = " << globCol << endl;
1562 //cout << "globRow = " << globRow << endl;
1563 ftriggersCut[globCol][globRow] = 1;
1566 } // calo trigger entries
1567 } // has calo trigger entries
1569 // part 2 go through the clusters here -----------------------------------
1570 //cout << " part 2 go through the clusters here ----------------------------------- " << endl;
1571 Int_t nCluster=0, nCell=0, iCell=0, gCell=0;
1572 Short_t cellAddr, nSACell;
1574 //Int_t nSACell, iSACell, mclabel;
1576 Double_t cellAmp=0, cellTimeT=0, clusterTime=0, efrac=0;
1577 Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta, gphi, geta, feta, fphi;
1579 TRefArray *fCaloClusters = new TRefArray();
1580 fESD->GetEMCALClusters( fCaloClusters );
1581 nCluster = fCaloClusters->GetEntries();
1584 // save all cells times if there are clusters
1587 for(Int_t i = 0; i < nColsFeeModule*nModuleCols; i++ ){
1588 for(Int_t j = 0; j < nRowsFeeModule*nModuleRows; j++ ){
1589 cellTime[i][j] = 0.;
1590 cellEnergy[i][j] = 0.;
1595 AliESDCaloCells *fCaloCells = fESD->GetEMCALCells();
1596 //AliVCaloCells fCaloCells = fESD->GetEMCALCells();
1597 nSACell = fCaloCells->GetNumberOfCells();
1598 for(iSACell = 0; iSACell < nSACell; iSACell++ ){
1599 // get the cell info *fCal
1600 fCaloCells->GetCell( iSACell, cellAddr, cellAmp, cellTimeT , mclabel, efrac);
1602 // get cell position
1603 fGeom->GetCellIndex( cellAddr, nSupMod, nModule, nIphi, nIeta );
1604 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1606 // convert co global phi eta
1607 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1608 geta = ieta + nColsFeeModule*(nSupMod%2);
1610 // save cell time and energy
1611 cellTime[geta][gphi] = cellTimeT;
1612 cellEnergy[geta][gphi] = cellAmp;
1617 Int_t nClusterTrig, nClusterTrigCut;
1618 UShort_t *cellAddrs;
1619 Double_t clsE=-999, clsEta=-999, clsPhi=-999;
1620 Float_t clsPos[3] = {0.,0.,0.};
1622 for(Int_t icl=0; icl<fESD->GetNumberOfCaloClusters(); icl++)
1624 AliESDCaloCluster *cluster = fESD->GetCaloCluster(icl);
1625 if(!cluster || !cluster->IsEMCAL()) continue;
1627 // get cluster cells
1628 nCell = cluster->GetNCells();
1630 // get cluster energy
1631 clsE = cluster->E();
1633 // get cluster position
1634 cluster->GetPosition(clsPos);
1635 TVector3 clsPosVec(clsPos[0],clsPos[1],clsPos[2]);
1636 clsEta = clsPosVec.Eta();
1637 clsPhi = clsPosVec.Phi();
1639 // get the cell addresses
1640 cellAddrs = cluster->GetCellsAbsId();
1642 // check if the cluster contains cell, that was marked as triggered
1644 nClusterTrigCut = 0;
1646 // loop the cells to check, if cluser in acceptance
1647 // any cluster with a cell outside acceptance is not considered
1648 for( iCell = 0; iCell < nCell; iCell++ )
1651 //if(clsE>6.0)fCellCheck->Fill(clsE,cellAddrs[iCell]);
1653 // get cell position
1654 fGeom->GetCellIndex( cellAddrs[iCell], nSupMod, nModule, nIphi, nIeta );
1655 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1657 // convert co global phi eta
1658 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1659 geta = ieta + nColsFeeModule*(nSupMod%2);
1661 if( cellTime[geta][gphi] > 0. ){
1662 clusterTime += cellTime[geta][gphi];
1666 // get corresponding FALTRO
1670 //cout << "fphi = " << fphi << endl;
1671 //cout << "feta = " << feta << endl;
1673 // try to match with a triggered
1674 if( ftriggers[feta][fphi]==1)
1677 if( ftriggersCut[feta][fphi]==1)
1678 { nClusterTrigCut++;
1681 //cout << "nClusterTrigCut : " << nClusterTrigCut << endl;
1687 clusterTime = clusterTime / (Double_t)gCell;
1688 // fix the reconstriction code time 100ns jumps
1689 if( fESD->GetBunchCrossNumber() % 4 < 2 )
1690 clusterTime -= 0.0000001;
1692 //fClsETime->Fill(clsE,clusterTime);
1693 //fClsEBftTrigCut->Fill(clsE);
1696 //fClsETime1->Fill(clsE,clusterTime);
1700 cluster->SetChi2(1);
1701 //fClsEAftTrigCut1->Fill(clsE);
1704 if(nClusterTrigCut>0){
1705 cluster->SetChi2(2);
1706 //fClsEAftTrigCut2->Fill(clsE);
1709 if(nClusterTrigCut>0 && ( nCell > (1 + clsE / 3)))
1711 cluster->SetChi2(3);
1712 //fClsEAftTrigCut3->Fill(clsE);
1715 if(nClusterTrigCut>0 && (nCell > (1 + clsE / 3) )&&( clusterTime > fTimeCutLow && clusterTime < fTimeCutHigh ))
1717 // cluster->SetChi2(4);
1718 //fClsEAftTrigCut4->Fill(clsE);
1720 if(nClusterTrigCut<1)
1722 cluster->SetChi2(0);
1724 //fClsEAftTrigCut->Fill(clsE);
1731 double AliAnalysisTaskHFECal::NsigCorr(float cent)
1734 if(cent>=20 && cent<30)shift = 0.156;
1735 if(cent>=30 && cent<40)shift = 0.316;
1736 if(cent>=40 && cent<50)shift = 0.336;
1737 if(cent>=50 && cent<70)shift = 0.440;
1738 if(cent>=70 && cent<90)shift = 0.534;