1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // Class for heavy-flavour electron with EMCal triggered events
17 // Author: Shingo Sakai
26 #include "THnSparse.h"
27 #include "TLorentzVector.h"
31 #include "AliAnalysisTask.h"
32 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliESDHandler.h"
36 #include "AliAODEvent.h"
37 #include "AliAODHandler.h"
39 #include "AliMCEventHandler.h"
40 #include "AliMCEvent.h"
41 #include "AliMCParticle.h"
43 #include "AliAnalysisTaskHFECal.h"
44 #include "TGeoGlobalMagField.h"
46 #include "AliAnalysisTaskSE.h"
47 #include "TRefArray.h"
49 #include "AliESDInputHandler.h"
50 #include "AliESDpid.h"
51 #include "AliESDtrackCuts.h"
52 #include "AliPhysicsSelection.h"
53 #include "AliESDCaloCluster.h"
54 #include "AliAODCaloCluster.h"
55 #include "AliEMCALRecoUtils.h"
56 #include "AliEMCALGeometry.h"
57 #include "AliGeomManager.h"
59 #include "TGeoManager.h"
63 #include "AliEMCALTrack.h"
66 #include "AliKFParticle.h"
67 #include "AliKFVertex.h"
70 #include "AliPIDResponse.h"
71 #include "AliHFEcontainer.h"
72 #include "AliHFEcuts.h"
73 #include "AliHFEpid.h"
74 #include "AliHFEpidBase.h"
75 #include "AliHFEpidQAmanager.h"
76 #include "AliHFEtools.h"
77 #include "AliCFContainer.h"
78 #include "AliCFManager.h"
82 #include "AliCentrality.h"
84 ClassImp(AliAnalysisTaskHFECal)
85 //________________________________________________________________________
86 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal(const char *name)
87 : AliAnalysisTaskSE(name)
96 ,fIdentifiedAsOutInz(kFALSE)
97 ,fPassTheEventCut(kFALSE)
98 ,fRejectKinkMother(kFALSE)
104 ,fOpeningAngleCut(0.1)
135 ,fTrackPtBefTrkCuts(0)
136 ,fTrackPtAftTrkCuts(0)
157 ,fIncpTMCM20hfeAll(0)
158 ,fIncpTMCM20hfeCheck(0)
159 ,fInputHFEMC_weight(0)
160 ,fIncpTMCM20hfeCheck_weight(0)
167 ,fIncpTMCM20pho_pi0e(0)
168 ,fPhoElecPtMCM20_pi0e(0)
169 ,fSameElecPtMCM20_pi0e(0)
170 ,fIncpTMCM20pho_eta(0)
171 ,fPhoElecPtMCM20_eta(0)
172 ,fSameElecPtMCM20_eta(0)
173 ,fIncpTMCpho_pi0e_TPC(0)
174 ,fPhoElecPtMC_pi0e_TPC(0)
175 ,fSameElecPtMC_pi0e_TPC(0)
191 fPID = new AliHFEpid("hfePid");
192 fTrackCuts = new AliESDtrackCuts();
194 // Define input and output slots here
195 // Input slot #0 works with a TChain
196 DefineInput(0, TChain::Class());
197 // Output slot #0 id reserved by the base class for AOD
198 // Output slot #1 writes into a TH1 container
199 // DefineOutput(1, TH1I::Class());
200 DefineOutput(1, TList::Class());
201 // DefineOutput(3, TTree::Class());
204 //________________________________________________________________________
205 AliAnalysisTaskHFECal::AliAnalysisTaskHFECal()
206 : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskHFECal")
215 ,fIdentifiedAsOutInz(kFALSE)
216 ,fPassTheEventCut(kFALSE)
217 ,fRejectKinkMother(kFALSE)
223 ,fOpeningAngleCut(0.1)
254 ,fTrackPtBefTrkCuts(0)
255 ,fTrackPtAftTrkCuts(0)
276 ,fIncpTMCM20hfeAll(0)
277 ,fIncpTMCM20hfeCheck(0)
278 ,fInputHFEMC_weight(0)
279 ,fIncpTMCM20hfeCheck_weight(0)
286 ,fIncpTMCM20pho_pi0e(0)
287 ,fPhoElecPtMCM20_pi0e(0)
288 ,fSameElecPtMCM20_pi0e(0)
289 ,fIncpTMCM20pho_eta(0)
290 ,fPhoElecPtMCM20_eta(0)
291 ,fSameElecPtMCM20_eta(0)
292 ,fIncpTMCpho_pi0e_TPC(0)
293 ,fPhoElecPtMC_pi0e_TPC(0)
294 ,fSameElecPtMC_pi0e_TPC(0)
308 //Default constructor
309 fPID = new AliHFEpid("hfePid");
311 fTrackCuts = new AliESDtrackCuts();
314 // Define input and output slots here
315 // Input slot #0 works with a TChain
316 DefineInput(0, TChain::Class());
317 // Output slot #0 id reserved by the base class for AOD
318 // Output slot #1 writes into a TH1 container
319 // DefineOutput(1, TH1I::Class());
320 DefineOutput(1, TList::Class());
321 //DefineOutput(3, TTree::Class());
323 //_________________________________________
325 AliAnalysisTaskHFECal::~AliAnalysisTaskHFECal()
337 //_________________________________________
339 void AliAnalysisTaskHFECal::UserExec(Option_t*)
342 //Called for each event
344 // create pointer to event
345 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
347 printf("ERROR: fESD not available\n");
352 AliError("HFE cuts not available");
356 if(!fPID->IsInitialized()){
357 // Initialize PID with the given run number
358 AliWarning("PID not initialised, get from Run no");
359 fPID->InitializePID(fESD->GetRunNumber());
362 if(fmcData)fMC = MCEvent();
363 //AliStack* stack = NULL;
364 if(fmcData && fMC)stack = fMC->Stack();
367 AliCentrality *centrality = fESD->GetCentrality();
368 cent = centrality->GetCentralityPercentile("V0M");
370 //---- fill MC track info
373 Int_t nParticles = stack->GetNtrack();
374 for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
375 TParticle* particle = stack->Particle(iParticle);
376 int fPDG = particle->GetPdgCode();
377 double mcZvertex = fMC->GetPrimaryVertex()->GetZ();
378 double pTMC = particle->Pt();
379 double proR = particle->R();
380 double etaMC = particle->Eta();
381 if(fabs(etaMC)>0.6)continue;
382 Bool_t mcInDtoE= kFALSE;
383 Bool_t mcInBtoE= kFALSE;
385 Bool_t MChijing = fMC->IsFromBGEvent(iParticle);
386 //if(!MChijing)printf("not MC hijing");
388 if(!MChijing)iHijing = 0;
392 mcphoinfo[2] = iHijing;
393 //if(fPDG==111)Hpi0pTcheck->Fill(pTMC,iHijing);
394 //if(fPDG==221)HETApTcheck->Fill(pTMC,iHijing);
395 if(fPDG==111)Hpi0pTcheck->Fill(mcphoinfo);
396 if(fPDG==221)HETApTcheck->Fill(mcphoinfo);
397 if(fabs(fPDG)==411 || fabs(fPDG)==413 || fabs(fPDG)==421 || fabs(fPDG)==423 || fabs(fPDG)==431)HDpTcheck->Fill(pTMC,iHijing);
398 if(fabs(fPDG)==511 || fabs(fPDG)==513 || fabs(fPDG)==521 || fabs(fPDG)==523 || fabs(fPDG)==531)HBpTcheck->Fill(pTMC,iHijing);
400 if(particle->GetFirstMother()>-1 && fPDG==22)
402 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
403 if(parentPID==111 || parentPID==221)HphopTcheck->Fill(pTMC,iHijing); // pi0->g & eta->g
406 if(particle->GetFirstMother()>-1 && fabs(fPDG)==11)
408 int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
409 double pTMCparent = stack->Particle(particle->GetFirstMother())->Pt();
410 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(fPDG)==11)mcInDtoE = kTRUE;
411 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(fPDG)==11)mcInBtoE = kTRUE;
412 if((mcInBtoE || mcInDtoE) && fabs(mcZvertex)<10.0)
414 fInputHFEMC->Fill(cent,pTMC);
420 mcinfo[4] = pTMCparent;
421 fInputHFEMC_weight->Fill(mcinfo);
426 if(proR<7.0 && fabs(fPDG)==11)fInputAlle->Fill(cent,pTMC);
433 Int_t fNOtrks = fESD->GetNumberOfTracks();
434 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
436 Double_t pVtxZ = -999;
437 pVtxZ = pVtx->GetZ();
439 if(TMath::Abs(pVtxZ)>10) return;
442 if(fNOtrks<1) return;
445 AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse();
447 AliDebug(1, "Using default PID Response");
448 pidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
451 fPID->SetPIDResponse(pidResponse);
453 fCFM->SetRecEventInfo(fESD);
455 //Float_t cent = -1.;
456 //AliCentrality *centrality = fESD->GetCentrality();
457 //cent = centrality->GetCentralityPercentile("V0M");
460 //if(cent>90.) return;
464 FindTriggerClusters();
467 for(Int_t iCluster=0; iCluster<fESD->GetNumberOfCaloClusters(); iCluster++)
469 AliESDCaloCluster *clust = fESD->GetCaloCluster(iCluster);
470 if(clust && clust->IsEMCAL())
472 double clustE = clust->E();
473 float emcx[3]; // cluster pos
474 clust->GetPosition(emcx);
475 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
476 double emcphi = clustpos.Phi();
477 double emceta = clustpos.Eta();
479 calInfo[0] = emcphi; calInfo[1] = emceta; calInfo[2] = clustE; calInfo[3] = cent; calInfo[4] = clust->Chi2();
480 //fEMCAccE->Fill(calInfo);
481 //if(clustE>3.0)fEMCAccE->Fill(calInfo);
482 //if(fqahist==1 && clustE>1.5)fEMCAccE->Fill(calInfo);
483 hEMCAccE->Fill(cent,clustE);
488 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
489 AliESDtrack* track = fESD->GetTrack(iTracks);
491 printf("ERROR: Could not receive track %d\n", iTracks);
495 int parentlabel = 99999;
496 int parentPID = 99999;
497 int grand_parentlabel = 99999;
498 int grand_parentPID = 99999;
499 Bool_t mcPho = kFALSE;
500 Bool_t mcDtoE= kFALSE;
501 Bool_t mcBtoE= kFALSE;
502 Bool_t mcOrgPi0 = kFALSE;
503 Bool_t mcOrgEta = kFALSE;
506 double mcMompT = 0.0;
507 //double mcGrandMompT = 0.0;
508 double mcWeight = -10.0;
513 if(fmcData && fMC && stack)
515 Int_t label = TMath::Abs(track->GetLabel());
516 mcLabel = track->GetLabel();
521 Bool_t MChijing = fMC->IsFromBGEvent(label);
522 if(!MChijing)iHijing = 0;
524 TParticle* particle = stack->Particle(label);
525 int mcpid = particle->GetPdgCode();
526 mcpT = particle->Pt();
527 //printf("MCpid = %d",mcpid);
528 if(particle->GetFirstMother()>-1)
530 //int parentlabel = particle->GetFirstMother();
531 //int parentPID = stack->Particle(particle->GetFirstMother())->GetPdgCode();
532 //mcMompT = stack->Particle(particle->GetFirstMother())->Pt();
533 FindMother(particle, parentlabel, parentPID);
534 mcMompT = stack->Particle(parentlabel)->Pt();
535 if((parentPID==22 || parentPID==111 || parentPID==221)&& fabs(mcpid)==11)mcPho = kTRUE;
536 if((fabs(parentPID)==411 || fabs(parentPID)==413 || fabs(parentPID)==421 || fabs(parentPID)==423 || fabs(parentPID)==431)&& fabs(mcpid)==11)mcDtoE = kTRUE;
537 if((fabs(parentPID)==511 || fabs(parentPID)==513 || fabs(parentPID)==521 || fabs(parentPID)==523 || fabs(parentPID)==531)&& fabs(mcpid)==11)mcBtoE = kTRUE;
539 // make D->e pT correlation
540 if(mcDtoE)fMomDtoE->Fill(mcpT,mcMompT);
542 //cout << "check PID = " << parentPID << endl;
543 //cout << "check pho = " << mcPho << endl;
544 //cout << "check D or B = " << mcDtoE << endl;
546 if(parentPID==111 && fabs(mcpid)==11 && mcMompT>0.0)
548 //cout << "find pi0->e " << endl;
550 mcWeight = GetMCweight(mcMompT);
553 if(parentPID==221 && fabs(mcpid)==11 && mcMompT>0.0)
555 //cout << "find Eta->e " << endl;
557 mcWeight = GetMCweightEta(mcMompT);
560 // access grand parent
561 TParticle* particle_parent = stack->Particle(parentlabel); // get parent pointer
562 //if(particle_parent->GetFirstMother()>-1 && parentPID==22 && fabs(mcpid)==11) // get grand parent g->e
563 if(particle_parent->GetFirstMother()>-1 && (parentPID==22 || parentPID==111) && fabs(mcpid)==11) // get grand parent g->e
565 //int grand_parentPID = stack->Particle(particle_parent->GetFirstMother())->GetPdgCode();
566 //double pTtmp = stack->Particle(particle_parent->GetFirstMother())->Pt();
567 FindMother(particle_parent, grand_parentlabel, grand_parentPID);
568 double mcGrandpT = stack->Particle(grand_parentlabel)->Pt();
569 if(grand_parentPID==111 && mcGrandpT>0.0)
571 // check eta->pi0 decay !
572 int grand2_parentlabel = 99999; int grand2_parentPID = 99999;
573 TParticle* particle_grand = stack->Particle(grand_parentlabel); // get parent pointer
574 FindMother(particle_grand, grand2_parentlabel, grand2_parentPID);
575 if(grand2_parentPID==221)
577 //cout << "find Eta->e " << endl;
578 double mcGrandpT2 = stack->Particle(grand2_parentlabel)->Pt();
580 mcWeight = GetMCweight(mcGrandpT2);
581 mcMompT = mcGrandpT2;
585 //cout << "find pi0->e " << endl;
587 mcWeight = GetMCweight(mcGrandpT);
592 if(grand_parentPID==221 && mcGrandpT>0.0)
594 //cout << "find Eta->e " << endl;
597 mcWeight = GetMCweightEta(mcGrandpT);
603 //cout << "===================="<<endl;
604 //cout << "mcDtoE : " << mcDtoE << endl;
605 //cout << "mcBtoE : " << mcBtoE << endl;
606 //cout << "mcPho : " << mcPho << endl;
608 if(fabs(mcpid)==11)mcele= 0.;
609 //cout << "check e: " << mcele << endl;
610 if(fabs(mcpid)==11 && mcDtoE)mcele= 1.;
611 //cout << "check D->e: " << mcele << endl;
612 if(fabs(mcpid)==11 && mcBtoE)mcele= 2.;
613 //cout << "check B->e: " << mcele << endl;
614 if(fabs(mcpid)==11 && mcPho)mcele= 3.;
615 //cout << "check Pho->e: " << mcele << endl;
617 } // end of mcLabel>-1
621 //cout << "Pi0 = " << mcOrgPi0 << " ; Eta = " << mcOrgEta << endl;
622 //printf("weight = %f\n",mcWeight);
624 if(TMath::Abs(track->Eta())>0.6) continue;
625 if(TMath::Abs(track->Pt()<2.0)) continue;
627 fTrackPtBefTrkCuts->Fill(track->Pt());
628 // RecKine: ITSTPC cuts
629 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
632 if(fRejectKinkMother) { // Quick and dirty fix to reject both kink mothers and daughters
633 if(track->GetKinkIndex(0) != 0) continue;
637 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
639 // HFEcuts: ITS layers cuts
640 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
642 // HFE cuts: TPC PID cleanup
643 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
645 int nTPCcl = track->GetTPCNcls();
646 //int nTPCclF = track->GetTPCNclsF(); // warnings
647 int nITS = track->GetNcls(0);
649 fTrackPtAftTrkCuts->Fill(track->Pt());
651 Double_t mom = -999., eop=-999., pt = -999., dEdx=-999., fTPCnSigma=-10, phi=-999., eta=-999.;
655 // Track extrapolation
657 Int_t charge = track->Charge();
662 dEdx = track->GetTPCsignal();
663 fTPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
665 double ncells = -1.0;
669 double rmatch = -1.0;
670 double nmatch = -1.0;
671 double oppstatus = 0.0;
674 Bool_t fFlagPhotonicElec = kFALSE;
675 Bool_t fFlagConvinatElec = kFALSE;
677 Int_t clsId = track->GetEMCALcluster();
679 AliESDCaloCluster *clust = fESD->GetCaloCluster(clsId);
680 if(clust && clust->IsEMCAL()){
682 double clustE = clust->E();
683 eop = clustE/fabs(mom);
684 cout << "eop org = "<< eop << endl;
687 double mceopcorr = MCEopMeanCorrection(pt,cent);
690 cout << "eop corr = " << eop << endl;
692 //double clustT = clust->GetTOF();
693 ncells = clust->GetNCells();
694 m02 = clust->GetM02();
695 m20 = clust->GetM20();
696 disp = clust->GetDispersion();
697 double delphi = clust->GetTrackDx();
698 double deleta = clust->GetTrackDz();
699 rmatch = sqrt(pow(delphi,2)+pow(deleta,2));
700 nmatch = clust->GetNTracksMatched();
701 emctof = clust->GetTOF();
702 //cout << "emctof = " << emctof << endl;
704 if(fTPCnSigma>-1.5 && fTPCnSigma<3.0)
706 SelectPhotonicElectron(iTracks,cent,track,fFlagPhotonicElec,fFlagConvinatElec,fTPCnSigma,m20,eop,mcele,mcWeight,iHijing,mcOrgPi0,mcOrgEta);
708 if(fFlagPhotonicElec)oppstatus = 1.0;
709 if(fFlagConvinatElec)oppstatus = 2.0;
710 if(fFlagPhotonicElec && fFlagConvinatElec)oppstatus = 3.0;
713 valdedx[0] = pt; valdedx[1] = nITS; valdedx[2] = phi; valdedx[3] = eta; valdedx[4] = fTPCnSigma;
714 //valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nTPCclF; valdedx[9] = m20; valdedx[10] = mcpT;
715 valdedx[5] = eop; valdedx[6] = rmatch; valdedx[7] = ncells, valdedx[8] = nmatch; valdedx[9] = m20; valdedx[10] = mcpT;
716 valdedx[11] = cent; valdedx[12] = charge; valdedx[13] = oppstatus; valdedx[14] = nTPCcl;
718 if(fqahist==1)fEleInfo->Fill(valdedx);
724 if(nITS<2.5)continue;
725 if(nTPCcl<100)continue;
727 CheckNclust->Fill(nTPCcl);
728 CheckNits->Fill(nITS);
730 fdEdxBef->Fill(mom,fTPCnSigma);
731 fTPCnsigma->Fill(mom,fTPCnSigma);
732 if(fTPCnSigma >= -1.0 && fTPCnSigma <= 3)fTrkEovPBef->Fill(pt,eop);
736 // check reco eff. with TPC
741 phoval[2] = fTPCnSigma;
745 if((fTPCnSigma >= -1.0 && fTPCnSigma <= 3) && mcele>0 && mcPho && mcOrgPi0)
747 if(iHijing==1)mcWeight = 1.0;
748 fIncpTMCpho_pi0e_TPC->Fill(phoval,mcWeight);
749 if(fFlagPhotonicElec) fPhoElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
750 if(fFlagConvinatElec) fSameElecPtMC_pi0e_TPC->Fill(phoval,mcWeight);
754 AliHFEpidObject hfetrack;
755 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
756 hfetrack.SetRecTrack(track);
758 if((0.0< cent) && (cent<5.0)) binct = 0.5;
759 if((5.0< cent) && (cent<10.0)) binct = 1.5;
760 if((10.0< cent) && (cent<20.0)) binct = 2.5;
761 if((20.0< cent) && (cent<30.0)) binct = 3.5;
762 if((30.0< cent) && (cent<40.0)) binct = 4.5;
763 if((40.0< cent) && (cent<50.0)) binct = 5.5;
764 if((50.0< cent) && (cent<60.0)) binct = 6.5;
765 if((60.0< cent) && (cent<70.0)) binct = 7.5;
766 if((70.0< cent) && (cent<80.0)) binct = 8.5;
767 if((80.0< cent) && (cent<90.0)) binct = 9.5;
768 if((90.0< cent) && (cent<100.0)) binct = 10.5;
770 hfetrack.SetCentrality((int)binct); //added
772 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
774 if(pidpassed==0) continue;
776 fTrkEovPAft->Fill(pt,eop);
777 fdEdxAft->Fill(mom,fTPCnSigma);
780 fIncpT->Fill(cent,pt);
781 if(fFlagPhotonicElec) fPhoElecPt->Fill(cent,pt);
782 if(fFlagConvinatElec) fSameElecPt->Fill(cent,pt);
784 if(m20>0.0 && m20<0.3)
786 fIncpTM20->Fill(cent,pt);
787 ftimingEle->Fill(pt,emctof);
788 if(fFlagPhotonicElec) fPhoElecPtM20->Fill(cent,pt);
789 if(fFlagConvinatElec) fSameElecPtM20->Fill(cent,pt);
793 // check label for electron candidiates
796 if(mcLabel==0)idlabel = 0;
797 fLabelCheck->Fill(pt,idlabel);
798 if(mcLabel==0)fgeoFake->Fill(phi,eta);
800 if(mcele>0) // select MC electrons
803 fIncpTMChfeAll->Fill(cent,pt);
804 if(m20>0.0 && m20<0.3)fIncpTMCM20hfeAll->Fill(cent,pt);
806 if(mcBtoE || mcDtoE) // select B->e & D->e
808 fIncpTMChfe->Fill(cent,pt);
809 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfe->Fill(cent,pt);
810 //if(m20>0.0 && m20<0.3)fIncpTMCM20hfeCheck->Fill(cent,mcpT);
811 if(m20>0.0 && m20<0.3)
813 cout << "MC label = " << mcLabel << endl;
814 fIncpTMCM20hfe->Fill(cent,pt);
815 fIncpTMCM20hfeCheck->Fill(cent,mcpT);
816 fIncpTMCM20hfeCheck_weight->Fill(phoval);
820 if(mcPho) // select photonic electrons
823 fIncpTMCpho->Fill(phoval);
824 if(fFlagPhotonicElec) fPhoElecPtMC->Fill(phoval);
825 if(fFlagConvinatElec) fSameElecPtMC->Fill(phoval);
827 if(m20>0.0 && m20<0.3)
829 fIncpTMCM20pho->Fill(phoval);
830 if(fFlagPhotonicElec) fPhoElecPtMCM20->Fill(phoval);
831 if(fFlagConvinatElec) fSameElecPtMCM20->Fill(phoval);
835 if(iHijing==1)mcWeight = 1.0;
838 fIncpTMCM20pho_pi0e->Fill(phoval,mcWeight);
839 if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval,mcWeight);
840 if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval,mcWeight);
841 //fIncpTMCM20pho_pi0e->Fill(phoval); // v5-04-02-AN & v5-04-06-AN
842 //if(fFlagPhotonicElec) fPhoElecPtMCM20_pi0e->Fill(phoval);
843 //if(fFlagConvinatElec) fSameElecPtMCM20_pi0e->Fill(phoval);
847 fIncpTMCM20pho_eta->Fill(phoval,mcWeight);
848 if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval,mcWeight);
849 if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval,mcWeight);
850 //fIncpTMCM20pho_eta->Fill(phoval);
851 //if(fFlagPhotonicElec) fPhoElecPtMCM20_eta->Fill(phoval);
852 //if(fFlagConvinatElec) fSameElecPtMCM20_eta->Fill(phoval);
860 PostData(1, fOutputList);
862 //_________________________________________
863 void AliAnalysisTaskHFECal::UserCreateOutputObjects()
867 //Bool_t mcData = kFALSE;
868 if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())
871 printf("+++++ MC Data available");
875 printf("++++++++= MC analysis \n");
879 printf("++++++++ real data analysis \n");
882 printf("+++++++ QA hist %d",fqahist);
885 fGeom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
887 //--------Initialize PID
888 //fPID->SetHasMCData(kFALSE);
889 fPID->SetHasMCData(fmcData);
890 if(!fPID->GetNumberOfPIDdetectors())
892 fPID->AddDetector("TPC", 0);
893 fPID->AddDetector("EMCAL", 1);
897 const char *cutmodel;
899 params[0] = -1.0; //sigma min
900 double maxnSig = 3.0;
903 params[0] = -5.0; //sigma min
907 for(Int_t a=0;a<11;a++)fPID->ConfigureTPCcentralityCut(a,cutmodel,params,maxnSig);
909 fPID->SortDetectors();
910 fPIDqa = new AliHFEpidQAmanager();
911 fPIDqa->Initialize(fPID);
913 //------- fcut --------------
914 fCuts = new AliHFEcuts();
915 fCuts->CreateStandardCuts();
916 //fCuts->SetMinNClustersTPC(100);
917 fCuts->SetMinNClustersTPC(90);
918 fCuts->SetMinRatioTPCclusters(0.6);
919 fCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
920 //fCuts->SetMinNClustersITS(3);
921 fCuts->SetMinNClustersITS(2);
922 fCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
923 fCuts->SetCheckITSLayerStatus(kFALSE);
924 fCuts->SetVertexRange(10.);
925 fCuts->SetTOFPIDStep(kFALSE);
926 fCuts->SetPtRange(2, 50);
927 fCuts->SetMaxImpactParam(3.,3.);
929 //--------Initialize correction Framework and Cuts
930 fCFM = new AliCFManager;
931 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
932 fCFM->SetNStepParticle(kNcutSteps);
933 for(Int_t istep = 0; istep < kNcutSteps; istep++)
934 fCFM->SetParticleCutsList(istep, NULL);
937 AliWarning("Cuts not available. Default cuts will be used");
938 fCuts = new AliHFEcuts;
939 fCuts->CreateStandardCuts();
941 fCuts->Initialize(fCFM);
943 //---------Output Tlist
944 fOutputList = new TList();
945 fOutputList->SetOwner();
946 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
948 fNoEvents = new TH1F("fNoEvents","",4,-0.5,3.5) ;
949 fOutputList->Add(fNoEvents);
951 Int_t binsE[5] = {250, 100, 1000, 200, 10};
952 Double_t xminE[5] = {1.0, -1, 0.0, 0, -0.5};
953 Double_t xmaxE[5] = {3.5, 1, 100.0, 100, 9.5};
954 fEMCAccE = new THnSparseD("fEMCAccE","EMC acceptance & E;#eta;#phi;Energy;Centrality;trugCondition;",5,binsE,xminE,xmaxE);
955 if(fqahist==1)fOutputList->Add(fEMCAccE);
957 hEMCAccE = new TH2F("hEMCAccE","Cluster Energy",200,0,100,100,0,20);
958 fOutputList->Add(hEMCAccE);
960 fTrkpt = new TH1F("fTrkpt","track pt",100,0,50);
961 fOutputList->Add(fTrkpt);
963 fTrackPtBefTrkCuts = new TH1F("fTrackPtBefTrkCuts","track pt before track cuts",100,0,50);
964 fOutputList->Add(fTrackPtBefTrkCuts);
966 fTrackPtAftTrkCuts = new TH1F("fTrackPtAftTrkCuts","track pt after track cuts",100,0,50);
967 fOutputList->Add(fTrackPtAftTrkCuts);
969 fTPCnsigma = new TH2F("fTPCnsigma", "TPC - n sigma",100,0,50,200,-10,10);
970 fOutputList->Add(fTPCnsigma);
972 fTrkEovPBef = new TH2F("fTrkEovPBef","track E/p before HFE pid",100,0,50,100,0,2);
973 fOutputList->Add(fTrkEovPBef);
975 fTrkEovPAft = new TH2F("fTrkEovPAft","track E/p after HFE pid",100,0,50,100,0,2);
976 fOutputList->Add(fTrkEovPAft);
978 fdEdxBef = new TH2F("fdEdxBef","track dEdx vs p before HFE pid",100,0,50,200,-10,10);
979 fOutputList->Add(fdEdxBef);
981 fdEdxAft = new TH2F("fdEdxAft","track dEdx vs p after HFE pid",100,0,50,200,-10,10);
982 fOutputList->Add(fdEdxAft);
984 fIncpT = new TH2F("fIncpT","HFE pid electro vs. centrality",200,0,100,100,0,50);
985 fOutputList->Add(fIncpT);
987 fIncpTM20 = new TH2F("fIncpTM20","HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
988 fOutputList->Add(fIncpTM20);
990 Int_t nBinspho[9] = { 200, 100, 500, 12, 50, 4, 200, 8, 100};
991 Double_t minpho[9] = { 0., 0., 0., -2.5, 0, -0.5, 0,-1.5, 0};
992 Double_t maxpho[9] = {100., 50., 0.5, 3.5, 1, 3.5, 2, 6.5, 50};
994 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);
995 if(fqahist==1)fOutputList->Add(fInvmassLS);
997 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);
998 if(fqahist==1)fOutputList->Add(fInvmassULS);
1000 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);
1001 if(fqahist==1)fOutputList->Add(fInvmassLSmc);
1003 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);
1004 if(fqahist==1)fOutputList->Add(fInvmassULSmc);
1006 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 );
1007 fInvmassLSmc0->Sumw2();
1008 fOutputList->Add(fInvmassLSmc0);
1010 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 );
1011 fInvmassLSmc1->Sumw2();
1012 fOutputList->Add(fInvmassLSmc1);
1014 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 );
1015 fInvmassLSmc2->Sumw2();
1016 fOutputList->Add(fInvmassLSmc2);
1018 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 );
1019 fInvmassLSmc3->Sumw2();
1020 fOutputList->Add(fInvmassLSmc3);
1022 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 );
1023 fInvmassULSmc0->Sumw2();
1024 fOutputList->Add(fInvmassULSmc0);
1026 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 );
1027 fInvmassULSmc1->Sumw2();
1028 fOutputList->Add(fInvmassULSmc1);
1030 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 );
1031 fInvmassULSmc2->Sumw2();
1032 fOutputList->Add(fInvmassULSmc2);
1034 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 );
1035 fInvmassULSmc3->Sumw2();
1036 fOutputList->Add(fInvmassULSmc3);
1038 fOpeningAngleLS = new TH1F("fOpeningAngleLS","Opening angle for LS pairs",100,0,1);
1039 fOutputList->Add(fOpeningAngleLS);
1041 fOpeningAngleULS = new TH1F("fOpeningAngleULS","Opening angle for ULS pairs",100,0,1);
1042 fOutputList->Add(fOpeningAngleULS);
1044 fPhotoElecPt = new TH1F("fPhotoElecPt", "photonic electron pt",100,0,50);
1045 fOutputList->Add(fPhotoElecPt);
1047 fPhoElecPt = new TH2F("fPhoElecPt", "Pho-inclusive electron pt",200,0,100,100,0,50);
1048 fOutputList->Add(fPhoElecPt);
1050 fPhoElecPtM20 = new TH2F("fPhoElecPtM20", "Pho-inclusive electron pt with M20",200,0,100,100,0,50);
1051 fOutputList->Add(fPhoElecPtM20);
1053 fSameElecPt = new TH2F("fSameElecPt", "Same-inclusive electron pt",200,0,100,100,0,50);
1054 fOutputList->Add(fSameElecPt);
1056 fSameElecPtM20 = new TH2F("fSameElecPtM20", "Same-inclusive electron pt with M20",200,0,100,100,0,50);
1057 fOutputList->Add(fSameElecPtM20);
1059 fCent = new TH1F("fCent","Centrality",200,0,100) ;
1060 fOutputList->Add(fCent);
1062 // Make common binning
1063 const Double_t kMinP = 0.;
1064 const Double_t kMaxP = 50.;
1065 //const Double_t kTPCSigMim = 40.;
1066 //const Double_t kTPCSigMax = 140.;
1068 // 1st histogram: TPC dEdx with/without EMCAL (p, pT, TPC Signal, phi, eta, Sig, e/p, ,match, cell, M02, M20, Disp, Centrality, select)
1069 Int_t nBins[16] = { 250, 10, 60, 20, 100, 300, 50, 40, 200, 200, 250, 200, 3, 5, 100, 8};
1070 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};
1071 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};
1072 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);
1073 if(fqahist==1)fOutputList->Add(fEleInfo);
1077 fClsEBftTrigCut = new TH1F("fClsEBftTrigCut","cluster E before trigger selection",1000,0,100);
1078 fOutputList->Add(fClsEBftTrigCut);
1080 fClsEAftTrigCut = new TH1F("fClsEAftTrigCut","cluster E if cls has 0 trigcut channel",1000,0,100);
1081 fOutputList->Add(fClsEAftTrigCut);
1083 fClsEAftTrigCut1 = new TH1F("fClsEAftTrigCut1","cluster E if cls with trig channel",1000,0,100);
1084 fOutputList->Add(fClsEAftTrigCut1);
1086 fClsEAftTrigCut2 = new TH1F("fClsEAftTrigCut2","cluster E if cls with trigcut channel",1000,0,100);
1087 fOutputList->Add(fClsEAftTrigCut2);
1089 fClsEAftTrigCut3 = new TH1F("fClsEAftTrigCut3","cluster E if cls with trigcut channel + nCell>Ecorrect",1000,0,100);
1090 fOutputList->Add(fClsEAftTrigCut3);
1092 fClsEAftTrigCut4 = new TH1F("fClsEAftTrigCut4","cluster E if cls with trigcut channel + nCell>Ecorrect + cls time cut",1000,0,100);
1093 fOutputList->Add(fClsEAftTrigCut4);
1095 fClsETime = new TH2F("fClsETime", "Cls time vs E; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1096 fOutputList->Add(fClsETime);
1098 fClsETime1 = new TH2F("fClsETime1", "Cls time vs E if cls contains trigger channel; E; time;",1000,0,100,1000,-0.0000002,0.0000009);
1099 fOutputList->Add(fClsETime1);
1101 fTrigTimes = new TH1F("fTrigTimes", "Trigger time; time; N;",25,0,25);
1102 fOutputList->Add(fTrigTimes);
1104 fCellCheck = new TH2F("fCellCheck", "Cell vs E; E GeV; Cell ID",10,6,26,12000,0,12000);
1105 fOutputList->Add(fCellCheck);
1109 fInputHFEMC = new TH2F("fInputHFEMC","Input MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1110 fOutputList->Add(fInputHFEMC);
1112 fInputAlle = new TH2F("fInputAlle","Input MC electro vs. centrality",200,0,100,100,0,50);
1113 fOutputList->Add(fInputAlle);
1115 fIncpTMChfe = new TH2F("fIncpTMChfe","MC HFE pid electro vs. centrality",200,0,100,100,0,50);
1116 fOutputList->Add(fIncpTMChfe);
1118 fIncpTMChfeAll = new TH2F("fIncpTMChfeAll","MC Alle pid electro vs. centrality",200,0,100,100,0,50);
1119 fOutputList->Add(fIncpTMChfeAll);
1121 fIncpTMCM20hfe = new TH2F("fIncpTMCM20hfe","MC HFE pid electro vs. centrality with M20",200,0,100,100,0,50);
1122 fOutputList->Add(fIncpTMCM20hfe);
1124 fIncpTMCM20hfeAll = new TH2F("fIncpTMCM20hfeAll","MC Alle pid electro vs. centrality with M20",200,0,100,100,0,50);
1125 fOutputList->Add(fIncpTMCM20hfeAll);
1127 fIncpTMCM20hfeCheck = new TH2F("fIncpTMCM20hfeCheck","MC HFE pid electro vs. centrality with M20 Check",200,0,100,100,0,50);
1128 fOutputList->Add(fIncpTMCM20hfeCheck);
1130 Int_t nBinspho2[5] = { 200, 100, 7, 3, 700};
1131 Double_t minpho2[5] = { 0., 0., -2.5, -0.5, 0.};
1132 Double_t maxpho2[5] = {100., 50., 4.5, 2.5, 70.};
1134 fInputHFEMC_weight = new THnSparseD("fInputHFEMC_weight", "MC HFE electron pt",5,nBinspho2,minpho2,maxpho2);
1135 fOutputList->Add(fInputHFEMC_weight);
1137 fIncpTMCM20hfeCheck_weight = new THnSparseD("fIncpTMCM20hfeCheck_weight", "HFE electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1138 fOutputList->Add(fIncpTMCM20hfeCheck_weight);
1140 fIncpTMCpho = new THnSparseD("fIncpTMCpho","MC Pho pid electro vs. centrality",5,nBinspho2,minpho2,maxpho2);
1141 fOutputList->Add(fIncpTMCpho);
1143 fIncpTMCM20pho = new THnSparseD("fIncpTMCM20pho","MC Pho pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1144 fOutputList->Add(fIncpTMCM20pho);
1146 fPhoElecPtMC = new THnSparseD("fPhoElecPtMC", "MC Pho-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1147 fOutputList->Add(fPhoElecPtMC);
1149 fPhoElecPtMCM20 = new THnSparseD("fPhoElecPtMCM20", "MC Pho-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1150 fOutputList->Add(fPhoElecPtMCM20);
1152 fSameElecPtMC = new THnSparseD("fSameElecPtMC", "MC Same-inclusive electron pt",5,nBinspho2,minpho2,maxpho2);
1153 fOutputList->Add(fSameElecPtMC);
1155 fSameElecPtMCM20 = new THnSparseD("fSameElecPtMCM20", "MC Same-inclusive electron pt with M20",5,nBinspho2,minpho2,maxpho2);
1156 fOutputList->Add(fSameElecPtMCM20);
1158 fIncpTMCM20pho_pi0e = new THnSparseD("fIncpTMCM20pho_pi0e","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1159 fIncpTMCM20pho_pi0e->Sumw2();
1160 fOutputList->Add(fIncpTMCM20pho_pi0e);
1162 fPhoElecPtMCM20_pi0e = new THnSparseD("fPhoElecPtMCM20_pi0e", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1163 fPhoElecPtMCM20_pi0e->Sumw2();
1164 fOutputList->Add(fPhoElecPtMCM20_pi0e);
1166 fSameElecPtMCM20_pi0e = new THnSparseD("fSameElecPtMCM20_pi0e", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1167 fSameElecPtMCM20_pi0e->Sumw2();
1168 fOutputList->Add(fSameElecPtMCM20_pi0e);
1170 fIncpTMCM20pho_eta = new THnSparseD("fIncpTMCM20pho_eta","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1171 fIncpTMCM20pho_eta->Sumw2();
1172 fOutputList->Add(fIncpTMCM20pho_eta);
1174 fPhoElecPtMCM20_eta = new THnSparseD("fPhoElecPtMCM20_eta", "MC Pho-inclusive electron pt with M20 pi0->e",5,nBinspho2,minpho2,maxpho2);
1175 fPhoElecPtMCM20_eta->Sumw2();
1176 fOutputList->Add(fPhoElecPtMCM20_eta);
1178 fSameElecPtMCM20_eta = new THnSparseD("fSameElecPtMCM20_eta", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1179 fSameElecPtMCM20_eta->Sumw2();
1180 fOutputList->Add(fSameElecPtMCM20_eta);
1182 fIncpTMCpho_pi0e_TPC = new THnSparseD("fIncpTMCpho_pi0e_TPC","MC Pho pi0->e pid electro vs. centrality with M20",5,nBinspho2,minpho2,maxpho2);
1183 fIncpTMCpho_pi0e_TPC->Sumw2();
1184 fOutputList->Add(fIncpTMCpho_pi0e_TPC);
1186 fPhoElecPtMC_pi0e_TPC = new THnSparseD("fPhoElecPtMC_pi0e_TPC", "MC Pho-inclusive electron pt with pi0->e",5,nBinspho2,minpho2,maxpho2);
1187 fPhoElecPtMC_pi0e_TPC->Sumw2();
1188 fOutputList->Add(fPhoElecPtMC_pi0e_TPC);
1190 fSameElecPtMC_pi0e_TPC = new THnSparseD("fSameElecPtMC_pi0e_TPC", "MC Same-inclusive electron pt pi0->e",5,nBinspho2,minpho2,maxpho2);
1191 fSameElecPtMC_pi0e_TPC->Sumw2();
1192 fOutputList->Add(fSameElecPtMC_pi0e_TPC);
1195 CheckNclust = new TH1D("CheckNclust","cluster check",200,0,200);
1196 fOutputList->Add(CheckNclust);
1198 CheckNits = new TH1D("CheckNits","ITS cluster check",8,-0.5,7.5);
1199 fOutputList->Add(CheckNits);
1201 Hpi0pTcheck = new TH2D("Hpi0pTcheck","Pi0 pT from Hijing",100,0,50,3,-0.5,2.5);
1202 fOutputList->Add(Hpi0pTcheck);
1204 HETApTcheck = new TH2D("HETApTcheck","Eta pT from Hijing",100,0,50,3,-0.5,2.5);
1205 fOutputList->Add(HETApTcheck);
1208 Int_t nBinspho3[3] = { 200, 100, 3};
1209 Double_t minpho3[3] = { 0., 0., -0.5};
1210 Double_t maxpho3[3] = {100., 50., 2.5};
1212 Hpi0pTcheck = new THnSparseD("Hpi0pTcheck","Pi0 pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1213 fOutputList->Add(Hpi0pTcheck);
1215 HETApTcheck = new THnSparseD("HETApTcheck","Eta pT from Hijing",3,nBinspho3,minpho3,maxpho3);
1216 fOutputList->Add(HETApTcheck);
1218 HphopTcheck = new TH2D("HphopTcheck","Pho pT from Hijing",100,0,50,3,-0.5,2.5);
1219 fOutputList->Add(HphopTcheck);
1221 HDpTcheck = new TH2D("HDpTcheck","D pT from Hijing",100,0,50,3,-0.5,2.5);
1222 fOutputList->Add(HDpTcheck);
1224 HBpTcheck = new TH2D("HBpTcheck","B pT from Hijing",100,0,50,3,-0.5,2.5);
1225 fOutputList->Add(HBpTcheck);
1228 fpTCheck = new TH1D("fpTCheck","pT check",500,0,50);
1229 fOutputList->Add(fpTCheck);
1231 fMomDtoE = new TH2D("fMomDtoE","D->E pT correlations;e p_{T} GeV/c;D p_{T} GeV/c",400,0,40,400,0,40);
1232 fOutputList->Add(fMomDtoE);
1234 fLabelCheck = new TH2D("fLabelCheck","MC label",50,0,50,5,-1.5,3.5);
1235 fOutputList->Add(fLabelCheck);
1237 fgeoFake = new TH2D("fgeoFake","Label==0 eta and phi",628,0,6.28,200,-1,1);
1238 fOutputList->Add(fgeoFake);
1240 ftimingEle = new TH2D("ftimingEle","electron TOF",100,0,20,100,1e-7,1e-6);
1241 fOutputList->Add(ftimingEle);
1243 PostData(1,fOutputList);
1246 //________________________________________________________________________
1247 void AliAnalysisTaskHFECal::Terminate(Option_t *)
1249 // Info("Terminate");
1250 AliAnalysisTaskSE::Terminate();
1253 //________________________________________________________________________
1254 Bool_t AliAnalysisTaskHFECal::ProcessCutStep(Int_t cutStep, AliVParticle *track)
1256 // Check single track cuts for a given cut step
1257 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
1258 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
1261 //_________________________________________
1262 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec)
1263 //void AliAnalysisTaskHFECal::SelectPhotonicElectron(Int_t itrack, Double_t cent, AliESDtrack *track, Bool_t &fFlagPhotonicElec, Bool_t &fFlagConvinatElec, Double_t nSig)
1264 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)
1266 //Identify non-heavy flavour electrons using Invariant mass method
1268 fTrackCuts->SetAcceptKinkDaughters(kFALSE);
1269 fTrackCuts->SetRequireTPCRefit(kTRUE);
1270 fTrackCuts->SetRequireITSRefit(kTRUE);
1271 fTrackCuts->SetEtaRange(-0.9,0.9);
1272 //fTrackCuts->SetRequireSigmaToVertex(kTRUE);
1273 fTrackCuts->SetMaxChi2PerClusterTPC(3.5);
1274 fTrackCuts->SetMinNClustersTPC(90);
1276 const AliESDVertex *pVtx = fESD->GetPrimaryVertex();
1278 double ptEle = track->Pt(); //add
1279 if(ibgevent==0 && w > 0.0)
1281 fpTCheck->Fill(ptEle,w);
1284 Bool_t flagPhotonicElec = kFALSE;
1285 Bool_t flagConvinatElec = kFALSE;
1290 Int_t label = TMath::Abs(track->GetLabel());
1291 TParticle* particle = stack->Particle(label);
1292 p1 = particle->GetFirstMother();
1295 //for(Int_t jTracks = itrack+1; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1296 for(Int_t jTracks = 0; jTracks<fESD->GetNumberOfTracks(); jTracks++){
1297 AliESDtrack* trackAsso = fESD->GetTrack(jTracks);
1299 printf("ERROR: Could not receive track %d\n", jTracks);
1302 if(itrack==jTracks)continue;
1308 Int_t label2 = TMath::Abs(trackAsso->GetLabel());
1309 TParticle* particle2 = stack->Particle(label2);
1310 Bool_t MChijing_ass = fMC->IsFromBGEvent(label2);
1311 if(MChijing_ass)jbgevent =1;
1312 if(particle2->GetFirstMother()>-1)
1313 p2 = particle2->GetFirstMother();
1316 Double_t dEdxAsso = -999., ptPrim=-999., ptAsso=-999., openingAngle = -999.;
1317 Double_t mass=999., width = -999;
1318 Bool_t fFlagLS=kFALSE, fFlagULS=kFALSE;
1320 //ptPrim = track->Pt();
1323 dEdxAsso = trackAsso->GetTPCsignal();
1324 ptAsso = trackAsso->Pt();
1325 Int_t chargeAsso = trackAsso->Charge();
1326 Int_t charge = track->Charge();
1329 if(ptAsso <0.5) continue;
1330 if(!fTrackCuts->AcceptTrack(trackAsso)) continue;
1331 if(dEdxAsso <65 || dEdxAsso>100) continue; //11a pass1
1333 Int_t fPDGe1 = 11; Int_t fPDGe2 = 11;
1334 if(charge>0) fPDGe1 = -11;
1335 if(chargeAsso>0) fPDGe2 = -11;
1337 //printf("chargeAsso = %d\n",chargeAsso);
1338 //printf("charge = %d\n",charge);
1339 if(charge == chargeAsso) fFlagLS = kTRUE;
1340 if(charge != chargeAsso) fFlagULS = kTRUE;
1342 //printf("fFlagLS = %d\n",fFlagLS);
1343 //printf("fFlagULS = %d\n",fFlagULS);
1346 AliKFParticle ge1(*track, fPDGe1);
1347 AliKFParticle ge2(*trackAsso, fPDGe2);
1348 AliKFParticle recg(ge1, ge2);
1350 if(recg.GetNDF()<1) continue;
1351 Double_t chi2recg = recg.GetChi2()/recg.GetNDF();
1352 if(TMath::Sqrt(TMath::Abs(chi2recg))>3.) continue;
1354 // for v5-03-70-AN comment
1355 AliKFVertex primV(*pVtx);
1357 recg.SetProductionVertex(primV);
1359 recg.SetMassConstraint(0,0.0001);
1361 openingAngle = ge1.GetAngle(ge2);
1362 if(fFlagLS) fOpeningAngleLS->Fill(openingAngle);
1363 if(fFlagULS) fOpeningAngleULS->Fill(openingAngle);
1366 recg.GetMass(mass,width);
1369 if(shower>0.0 && shower<0.3)ishower = 1;
1373 phoinfo[1] = ptPrim;
1376 phoinfo[4] = openingAngle;
1377 phoinfo[5] = ishower;
1380 phoinfo[8] = ptAsso;
1382 if(fFlagLS) fInvmassLS->Fill(phoinfo);
1383 if(fFlagULS) fInvmassULS->Fill(phoinfo);
1384 if(fFlagLS && ibgevent==0 && jbgevent==0) fInvmassLSmc->Fill(phoinfo,w);
1385 if(fFlagULS && ibgevent==0 && jbgevent==0)
1387 fInvmassULSmc->Fill(phoinfo,w);
1389 //printf("fInvmassCut %f\n",fInvmassCut);
1390 //printf("openingAngle %f\n",fOpeningAngleCut);
1392 if(openingAngle > fOpeningAngleCut) continue;
1395 //printf("mce =%f\n",mce);
1396 if(mce<-0.5) // mce==-1. is real
1398 //printf("Real data\n");
1399 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec){
1400 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1401 flagPhotonicElec = kTRUE;
1403 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec){
1404 flagConvinatElec = kTRUE;
1410 //printf("MC data\n");
1414 //cout << "tagpi0 = " << tagpi0 << " ; tageta = " << tageta << endl;
1415 if(fFlagLS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassLSmc0->Fill(ptPrim,mass,w);
1416 if(fFlagULS && ibgevent==0 && jbgevent==0 && tagpi0) fInvmassULSmc0->Fill(ptPrim,mass,w);
1417 if(fFlagLS && ibgevent==0 && jbgevent==0 && tageta) fInvmassLSmc1->Fill(ptPrim,mass,w);
1418 if(fFlagULS && ibgevent==0 && jbgevent==0 && tageta) fInvmassULSmc1->Fill(ptPrim,mass,w);
1419 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassLSmc2->Fill(ptPrim,mass,w);
1420 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tagpi0) fInvmassULSmc2->Fill(ptPrim,mass,w);
1421 if(fFlagLS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassLSmc3->Fill(ptPrim,mass,w);
1422 if(fFlagULS && ibgevent==0 && jbgevent==0 && (p1==p2) && tageta) fInvmassULSmc3->Fill(ptPrim,mass,w);
1424 if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (ibgevent==jbgevent)){
1425 //if(mass<fInvmassCut && fFlagULS && !flagPhotonicElec && (p1==p2)){ <--- only MC train (55,56) v5-03-68-AN & 69 for check
1426 flagPhotonicElec = kTRUE;
1428 if(mass<fInvmassCut && fFlagLS && !flagConvinatElec && (ibgevent==jbgevent)){
1429 flagConvinatElec = kTRUE;
1434 fFlagPhotonicElec = flagPhotonicElec;
1435 fFlagConvinatElec = flagConvinatElec;
1438 //-------------------------------------------
1440 void AliAnalysisTaskHFECal::FindMother(TParticle* part, int &label, int &pid)
1442 //int label = 99999;
1445 if(part->GetFirstMother()>-1)
1447 label = part->GetFirstMother();
1448 pid = stack->Particle(label)->GetPdgCode();
1450 //cout << "Find Mother : label = " << label << " ; pid" << pid << endl;
1453 double AliAnalysisTaskHFECal::GetMCweight(double mcPi0pT)
1455 double weight = 1.0;
1457 if(mcPi0pT>0.0 && mcPi0pT<5.0)
1459 weight = 0.323*mcPi0pT/(TMath::Exp(-1.6+0.767*mcPi0pT+0.0285*mcPi0pT*mcPi0pT));
1463 weight = 115.0/(0.718*mcPi0pT*TMath::Power(mcPi0pT,3.65));
1468 double AliAnalysisTaskHFECal::GetMCweightEta(double mcEtapT)
1470 double weight = 1.0;
1472 weight = 223.3/TMath::Power((TMath::Exp(-0.17*mcEtapT-0.0322*mcEtapT*mcEtapT)+mcEtapT/1.69),5.65);
1477 //_________________________________________
1478 void AliAnalysisTaskHFECal::FindTriggerClusters()
1480 //cout << "finding trigger patch" << endl;
1482 const int nModuleCols = 2;
1483 const int nModuleRows = 5;
1484 const int nColsFeeModule = 48;
1485 const int nRowsFeeModule = 24;
1486 const int nColsFaltroModule = 24;
1487 const int nRowsFaltroModule = 12;
1488 //const int faltroWidthMax = 20;
1490 // part 1, trigger extraction -------------------------------------
1491 Int_t globCol, globRow;
1492 //Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0, trigInCut=0;
1493 Int_t ntimes=0, nTrigChannel=0, nTrigChannelCut=0;
1495 //Int_t trigtimes[faltroWidthMax];
1496 Double_t cellTime[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1497 Double_t cellEnergy[nColsFeeModule*nModuleCols][nRowsFeeModule*nModuleRows];
1498 //Double_t fTrigCutLow = 6;
1499 //Double_t fTrigCutHigh = 10;
1500 Double_t fTimeCutLow = 469e-09;
1501 Double_t fTimeCutHigh = 715e-09;
1503 AliESDCaloTrigger * fCaloTrigger = fESD->GetCaloTrigger( "EMCAL" );
1505 // erase trigger maps
1506 for(Int_t i = 0; i < nColsFaltroModule*nModuleCols; i++ )
1508 for(Int_t j = 0; j < nRowsFaltroModule*nModuleRows; j++ )
1510 ftriggersCut[i][j] = 0;
1511 ftriggers[i][j] = 0;
1512 ftriggersTime[i][j] = 0;
1516 Int_t iglobCol=0, iglobRow=0;
1517 // go through triggers
1518 if( fCaloTrigger->GetEntries() > 0 )
1521 fCaloTrigger->Reset();
1522 while( fCaloTrigger->Next() )
1524 fCaloTrigger->GetPosition( globCol, globRow );
1525 fCaloTrigger->GetNL0Times( ntimes );
1528 if( ntimes < 1 ) continue;
1529 // get precise timings
1530 fCaloTrigger->GetL0Times( trigtimes );
1532 for(Int_t i = 0; i < ntimes; i++ )
1534 // save the first trigger time in channel
1535 if( i == 0 || triggersTime[globCol][globRow] > trigtimes[i] )
1536 triggersTime[globCol][globRow] = trigtimes[i];
1537 //printf("trigger times: %d\n",trigtimes[i]);
1539 if(trigtimes[i] > fTrigCutLow && trigtimes[i] < fTrigCutHigh )
1542 fTrigTimes->Fill(trigtimes[i]);
1546 //L1 analysis from AliAnalysisTaskEMCALTriggerQA
1548 fCaloTrigger->GetTriggerBits(bit);
1549 //cout << "bit = " << bit << endl;
1552 fCaloTrigger->GetL1TimeSum(ts);
1553 //cout << "ts = " << ts << endl;
1554 if (ts > 0)ftriggers[globCol][globRow] = 1;
1555 // number of triggered channels in event
1558 if(ts>0 && (bit >> 6 & 0x1))
1563 //cout << "ts cut = " << ts << endl;
1564 //cout << "globCol = " << globCol << endl;
1565 //cout << "globRow = " << globRow << endl;
1566 ftriggersCut[globCol][globRow] = 1;
1569 } // calo trigger entries
1570 } // has calo trigger entries
1572 // part 2 go through the clusters here -----------------------------------
1573 //cout << " part 2 go through the clusters here ----------------------------------- " << endl;
1574 Int_t nCluster=0, nCell=0, iCell=0, gCell=0;
1575 Short_t cellAddr, nSACell;
1577 //Int_t nSACell, iSACell, mclabel;
1579 Double_t cellAmp=0, cellTimeT=0, clusterTime=0, efrac=0;
1580 Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta, gphi, geta, feta, fphi;
1582 TRefArray *fCaloClusters = new TRefArray();
1583 fESD->GetEMCALClusters( fCaloClusters );
1584 nCluster = fCaloClusters->GetEntries();
1587 // save all cells times if there are clusters
1590 for(Int_t i = 0; i < nColsFeeModule*nModuleCols; i++ ){
1591 for(Int_t j = 0; j < nRowsFeeModule*nModuleRows; j++ ){
1592 cellTime[i][j] = 0.;
1593 cellEnergy[i][j] = 0.;
1598 AliESDCaloCells *fCaloCells = fESD->GetEMCALCells();
1599 //AliVCaloCells fCaloCells = fESD->GetEMCALCells();
1600 nSACell = fCaloCells->GetNumberOfCells();
1601 for(iSACell = 0; iSACell < nSACell; iSACell++ ){
1602 // get the cell info *fCal
1603 fCaloCells->GetCell( iSACell, cellAddr, cellAmp, cellTimeT , mclabel, efrac);
1605 // get cell position
1606 fGeom->GetCellIndex( cellAddr, nSupMod, nModule, nIphi, nIeta );
1607 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1609 // convert co global phi eta
1610 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1611 geta = ieta + nColsFeeModule*(nSupMod%2);
1613 // save cell time and energy
1614 cellTime[geta][gphi] = cellTimeT;
1615 cellEnergy[geta][gphi] = cellAmp;
1620 Int_t nClusterTrig, nClusterTrigCut;
1621 UShort_t *cellAddrs;
1622 Double_t clsE=-999, clsEta=-999, clsPhi=-999;
1623 Float_t clsPos[3] = {0.,0.,0.};
1625 for(Int_t icl=0; icl<fESD->GetNumberOfCaloClusters(); icl++)
1627 AliESDCaloCluster *cluster = fESD->GetCaloCluster(icl);
1628 if(!cluster || !cluster->IsEMCAL()) continue;
1630 // get cluster cells
1631 nCell = cluster->GetNCells();
1633 // get cluster energy
1634 clsE = cluster->E();
1636 // get cluster position
1637 cluster->GetPosition(clsPos);
1638 TVector3 clsPosVec(clsPos[0],clsPos[1],clsPos[2]);
1639 clsEta = clsPosVec.Eta();
1640 clsPhi = clsPosVec.Phi();
1642 // get the cell addresses
1643 cellAddrs = cluster->GetCellsAbsId();
1645 // check if the cluster contains cell, that was marked as triggered
1647 nClusterTrigCut = 0;
1649 // loop the cells to check, if cluser in acceptance
1650 // any cluster with a cell outside acceptance is not considered
1651 for( iCell = 0; iCell < nCell; iCell++ )
1654 //if(clsE>6.0)fCellCheck->Fill(clsE,cellAddrs[iCell]);
1656 // get cell position
1657 fGeom->GetCellIndex( cellAddrs[iCell], nSupMod, nModule, nIphi, nIeta );
1658 fGeom->GetCellPhiEtaIndexInSModule( nSupMod,nModule, nIphi, nIeta, iphi, ieta);
1660 // convert co global phi eta
1661 gphi = iphi + nRowsFeeModule*(nSupMod/2);
1662 geta = ieta + nColsFeeModule*(nSupMod%2);
1664 if( cellTime[geta][gphi] > 0. ){
1665 clusterTime += cellTime[geta][gphi];
1669 // get corresponding FALTRO
1673 //cout << "fphi = " << fphi << endl;
1674 //cout << "feta = " << feta << endl;
1676 // try to match with a triggered
1677 if( ftriggers[feta][fphi]==1)
1680 if( ftriggersCut[feta][fphi]==1)
1681 { nClusterTrigCut++;
1684 //cout << "nClusterTrigCut : " << nClusterTrigCut << endl;
1690 clusterTime = clusterTime / (Double_t)gCell;
1691 // fix the reconstriction code time 100ns jumps
1692 if( fESD->GetBunchCrossNumber() % 4 < 2 )
1693 clusterTime -= 0.0000001;
1695 //fClsETime->Fill(clsE,clusterTime);
1696 //fClsEBftTrigCut->Fill(clsE);
1699 //fClsETime1->Fill(clsE,clusterTime);
1703 cluster->SetChi2(1);
1704 //fClsEAftTrigCut1->Fill(clsE);
1707 if(nClusterTrigCut>0){
1708 cluster->SetChi2(2);
1709 //fClsEAftTrigCut2->Fill(clsE);
1712 if(nClusterTrigCut>0 && ( nCell > (1 + clsE / 3)))
1714 cluster->SetChi2(3);
1715 //fClsEAftTrigCut3->Fill(clsE);
1718 if(nClusterTrigCut>0 && (nCell > (1 + clsE / 3) )&&( clusterTime > fTimeCutLow && clusterTime < fTimeCutHigh ))
1720 // cluster->SetChi2(4);
1721 //fClsEAftTrigCut4->Fill(clsE);
1723 if(nClusterTrigCut<1)
1725 cluster->SetChi2(0);
1727 //fClsEAftTrigCut->Fill(clsE);
1734 double AliAnalysisTaskHFECal::MCEopMeanCorrection(double pTmc, float central)
1736 TF1 *fcorr0 = new TF1("fcorr0","[0]*tanh([1]+[2]*x)");
1737 TF1 *fcorr1 = new TF1("fcorr1","[0]*tanh([1]+[2]*x)");
1741 if(central>0 && central<=10)
1743 fcorr0->SetParameters(1.045,1.288,3.18e-01); //
1744 fcorr1->SetParameters(9.91e-01,3.466,2.344);
1747 if(central>10 && central<=20)
1749 fcorr0->SetParameters(1.029,8.254e-01,4.07e-01);
1750 fcorr1->SetParameters(0.975,2.276,1.501e-01);
1752 else if(central>20 && central<=30)
1754 fcorr0->SetParameters(1.01,8.795e-01,3.904e-01);
1755 fcorr1->SetParameters(9.675e-01,1.654,2.583e-01);
1757 else if(central>30 && central<=40)
1759 fcorr0->SetParameters(1.00,1.466,2.305e-1);
1760 fcorr1->SetParameters(9.637e-01,1.473,2.754e-01);
1762 else if(central>40 && central<=50)
1764 fcorr0->SetParameters(1.00,1.422,1.518);
1765 fcorr1->SetParameters(9.59e-01,1.421,2.931e-01);
1768 else if(central>50 && central<=70)
1770 fcorr0->SetParameters(0.989,2.495,2.167);
1771 fcorr1->SetParameters(0.961e-1,1.734,1.438e-01);
1773 else if(central>70 && central<=100)
1775 fcorr0->SetParameters(0.981,-3.373,3.93327);
1776 fcorr1->SetParameters(9.574e-01,1.698,1.58-01);
1780 shift = fcorr0->Eval(pTmc)-fcorr1->Eval(pTmc);