1 #include "AliAnalysisTaskSE.h"
2 #include "AliAnalysisManager.h"
3 #include "AliAnalysisDataContainer.h"
4 #include "AliESDEvent.h"
5 #include "AliESDtrackCuts.h"
7 #include "AliCentrality.h"
8 #include "AliMCEventHandler.h"
9 #include "AliMCEvent.h"
10 #include "AliHeader.h"
11 #include "AliGenCocktailEventHeader.h"
12 #include "AliGenHijingEventHeader.h"
13 #include "AliGenEventHeader.h"
14 #include "AliCollisionGeometry.h"
15 #include "AliGenerator.h"
17 #include "AliMultiplicity.h"
18 #include <TParticle.h>
26 #include "AliESDInputHandlerRP.h"
65 fHistoPhysPrimPiKPi09(0),
66 fHistoPhysPrimPiKPi09vsb(0),
70 fHistoTrackletsEta1(0),
85 fHistOriginFeeddown(0),
92 fHistEtaPhiPtGenEle(0),
93 fHistEtaPhiPtGenPi(0),
95 fHistEtaPhiPtGenPro(0),
96 fHistEtaPhiPtRecEle(0),
97 fHistEtaPhiPtRecPi(0),
99 fHistEtaPhiPtRecPro(0),
100 fHistPtRecVsPtGen(0),
101 fHistPhiRecVsPhiGen(0),
102 fHistEtaRecVsEtaGen(0),
105 fSearchUpToQuark(kFALSE),
111 for(
Int_t i=0; i<5; i++){
119 for(
Int_t i=0; i<2; i++){
126 DefineInput(0, TChain::Class());
127 DefineOutput(1, TList::Class());
134 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode())
return;
149 fOutput->SetName(
"OutputHistos");
151 fHistoNEvents =
new TH1F(
"hNEvents",
"Number of processed events",3,-0.5,2.5);
165 fHistoTracks =
new TH1F(
"hTracks",
"",100,-0.5,maxMult*2-0.5);
206 fHistoNbVsNc =
new TH2F(
"hnbvsnc",
"",nBinscb,-0.5,maxncn,nBinscb,-0.5,maxncn);
246 for(
Int_t ih=0; ih<5; ih++){
269 for(
Int_t ih=0; ih<2; ih++){
325 fHistLcDecayChan->GetXaxis()->SetBinLabel(9,
"#pi#Lambda#rightarrowp#pi#pi");
334 Double_t binseta[11]={-1.0,-0.8,-0.6,-0.4,-0.2,0.,0.2,0.4,0.6,0.8,1.0};
335 const Int_t nBinsPhi=40;
337 for(
Int_t ib=0; ib<=nBinsPhi; ib++) binsphi[ib]=ib*TMath::Pi()/20.;
338 const Int_t nBinsPt=24;
339 Double_t binspt[nBinsPt+1]={0.,0.10,0.15,0.2,0.25,
364 fHistPtRecVsPtGen=
new TH2F(
"hPtRecVsPtGen",
" ; particle p_{T} (GeV/c); track p_{T} (GeV/c)",100,0.,10.,100,0.,10.);
366 fHistPhiRecVsPhiGen=
new TH2F(
"hPhiRecVsPhiGen",
" ; particle #varphi ; track #varphi",100,0.,2.*TMath::Pi(),100,0.,2.*TMath::Pi());
368 fHistEtaRecVsEtaGen=
new TH2F(
"hEtaRecVsEtaGen",
" ; particle #eta ; track #eta",100,0.,2.*TMath::Pi(),100,0.,2.*TMath::Pi());
371 fHistPtRecGood=
new TH1F(
"hPtRecGood",
" ; track p_{T} (GeV/c)",100,0.,10.);
373 fHistPtRecFake=
new TH1F(
"hPtRecFake",
" ; track p_{T} (GeV/c)",100,0.,10.);
388 printf(
"AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
396 if(esd->GetRunNumber()<=139517) year=2010;
397 if(year==2010)
fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);
398 else fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
402 fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
403 AliESDtrackCuts::kAny);
406 Int_t nTracks=esd->GetNumberOfTracks();
409 for(
Int_t it=0; it<nTracks; it++){
410 AliESDtrack* tr=esd->GetTrack(it);
411 UInt_t status=tr->GetStatus();
412 if(!(status&AliESDtrack::kITSrefit))
continue;
413 if(!(status&AliESDtrack::kTPCin))
continue;
418 const AliMultiplicity* mult=esd->GetMultiplicity();
419 Int_t nTracklets=mult->GetNumberOfTracklets();
421 for(
Int_t it=0; it<nTracklets; it++){
422 Double_t eta=TMath::Abs(mult->GetEta(it));
423 if(eta<1) nTracklets1++;
428 const AliESDVertex *spdv=esd->GetVertex();
429 if(spdv && spdv->IsFromVertexer3D()){
434 if(spdv && spdv->IsFromVertexerZ()){
439 const AliESDVertex *trkv=esd->GetPrimaryVertex();
440 if(trkv && trkv->GetNContributors()>1){
449 AliMCEventHandler* eventHandler =
dynamic_cast<AliMCEventHandler*
> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
451 Printf(
"ERROR: Could not retrieve MC event handler");
454 AliMCEvent* mcEvent = eventHandler->MCEvent();
456 Printf(
"ERROR: Could not retrieve MC event");
459 stack = mcEvent->Stack();
461 Printf(
"ERROR: stack not available");
464 const AliVVertex* mcVert=mcEvent->GetPrimaryVertex();
466 Printf(
"ERROR: generated vertex not available");
469 if(TMath::Abs(mcVert->GetZ())>10)
return;
473 TString genname=mcEvent->GenEventHeader()->ClassName();
479 if(genname.Contains(
"CocktailEventHeader")){
480 AliGenCocktailEventHeader *cockhead=(AliGenCocktailEventHeader*)mcEvent->GenEventHeader();
481 lgen=cockhead->GetHeaders();
482 for(
Int_t ig=0; ig<lgen->GetEntries(); ig++){
483 AliGenerator* gen=(AliGenerator*)lgen->At(ig);
485 if(title.Contains(
"bchadr")){
488 }
else if(title.Contains(
"chadr")) {
491 }
else if(title.Contains(
"bele")){
494 }
else if(title.Contains(
"cele")){
497 }
else if(title.Contains(
"pythiaHF")){
499 }
else if(title.Contains(
"hijing") || title.Contains(
"Hijing")){
500 AliGenHijingEventHeader* hijh=(AliGenHijingEventHeader*)lgen->At(ig);
501 imppar=hijh->ImpactParameter();
504 nColl=lgen->GetEntries();
507 }
else if(genname.Contains(
"HijingEventHeader")){
508 AliGenHijingEventHeader* hijh=(AliGenHijingEventHeader*)mcEvent->GenEventHeader();
509 imppar=hijh->ImpactParameter();
511 TString genTitle=mcEvent->GenEventHeader()->GetTitle();
512 if(genTitle.Contains(
"bchadr")) typeHF=1;
513 else if(genTitle.Contains(
"chadr")) typeHF=0;
514 else if(genTitle.Contains(
"bele")) typeHF=3;
515 else if(genTitle.Contains(
"cele")) typeHF=2;
518 Int_t nParticles=stack->GetNtrack();
524 for (
Int_t i=0;i<nParticles;i++){
525 TParticle* part = (TParticle*)stack->Particle(i);
526 Int_t absPdg=TMath::Abs(part->GetPdgCode());
530 if(stack->IsPhysicalPrimary(i)){
538 if(TMath::Abs(eta)<0.5){
542 if(TMath::Abs(eta)<0.9){
544 if(absPdg==211 || absPdg==321 || absPdg==2212){
550 if (part->Energy() != TMath::Abs(part->Pz())){
551 rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz()));
562 else if(absPdg==411){
567 if(iTypeKKpi>0) iType=3;
571 else if(absPdg==413){
576 else if(absPdg==431){
579 if(iType==1 || iType==2) iPart=3;
581 else if(absPdg==4122){
586 if(iTypeV0==1) iType=5;
587 if(iTypeV0==2) iType=6;
590 if(iType>=0) iPart=4;
612 if(iSpecies<0)
continue;
625 Double_t distx=part->Vx()-mcVert->GetX();
626 Double_t disty=part->Vy()-mcVert->GetY();
627 Double_t distz=part->Vz()-mcVert->GetZ();
628 Double_t distToVert=TMath::Sqrt(distx*distx+disty*disty+distz*distz);
640 if(iPart<0)
continue;
641 if(iType<0)
continue;
643 if(iPart==0 && iType>0 && iType<=2){
645 }
else if(iPart==1 && iType>0 && iType<=3){
647 }
else if(iPart==3 && iType>0 && iType<=2){
651 if(iFromB==4 && iPart>=0 && iPart<5)
fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid);
652 else if(iFromB==5 && iPart>=0 && iPart<5)
fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid);
655 for(
Int_t i=0; i<nTracks; i++){
656 AliESDtrack* track=esd->GetTrack(i);
660 Int_t label=TMath::Abs(track->GetLabel());
662 if(stack->IsPhysicalPrimary(label)){
663 TParticle* part = (TParticle*)stack->Particle(label);
664 Int_t absPdg=TMath::Abs(part->GetPdgCode());
667 else if(absPdg==321)
fHistEtaPhiPtRecK->Fill(part->Eta(),part->Phi(),part->Pt());
691 printf(
"ERROR: fOutput not available\n");
703 if(labLc<0)
return -1;
704 TParticle* dp = (TParticle*)stack->Particle(labLc);
705 Int_t pdgdp=dp->GetPdgCode();
706 Int_t nDau=dp->GetNDaughters();
712 for(
Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
713 if(iDau<0)
return -1;
714 TParticle* dau=(TParticle*)stack->Particle(iDau);
715 Int_t pdgdau=dau->GetPdgCode();
716 if(TMath::Abs(pdgdau)==321){
717 if(pdgdp>0 && pdgdau>0)
return -1;
718 if(pdgdp<0 && pdgdau<0)
return -1;
720 }
else if(TMath::Abs(pdgdau)==211){
721 if(pdgdp<0 && pdgdau>0)
return -1;
722 if(pdgdp>0 && pdgdau<0)
return -1;
724 }
else if(TMath::Abs(pdgdau)==2212){
725 if(pdgdp<0 && pdgdau>0)
return -1;
726 if(pdgdp>0 && pdgdau<0)
return -1;
732 if(nPions!=1)
return -1;
733 if(nKaons!=1)
return -1;
734 if(nProtons!=1)
return -1;
735 for(
Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
736 if(iDau<0)
return -1;
745 for(
Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
746 if(iDau<0)
return -1;
747 TParticle* dau=(TParticle*)stack->Particle(iDau);
748 Int_t pdgdau=dau->GetPdgCode();
749 if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224
750 || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){
751 Int_t nDauRes=dau->GetNDaughters();
752 if(nDauRes!=2)
return -1;
753 for(
Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
754 if(resDau<0)
return -1;
755 TParticle* resdau=(TParticle*)stack->Particle(resDau);
756 Int_t pdgresdau=resdau->GetPdgCode();
757 if(TMath::Abs(pdgresdau)==321){
758 if(pdgdp>0 && pdgresdau>0)
return -1;
759 if(pdgdp<0 && pdgresdau<0)
return -1;
762 if(TMath::Abs(pdgresdau)==211){
763 if(pdgdp<0 && pdgresdau>0)
return -1;
764 if(pdgdp>0 && pdgresdau<0)
return -1;
767 if(TMath::Abs(pdgresdau)==2212){
768 if(pdgdp<0 && pdgresdau>0)
return -1;
769 if(pdgdp>0 && pdgresdau<0)
return -1;
773 }
else if(TMath::Abs(pdgdau)==321){
774 if(pdgdp>0 && pdgdau>0)
return -1;
775 if(pdgdp<0 && pdgdau<0)
return -1;
777 }
else if(TMath::Abs(pdgdau)==211){
778 if(pdgdp<0 && pdgdau>0)
return -1;
779 if(pdgdp>0 && pdgdau<0)
return -1;
781 }
else if(TMath::Abs(pdgdau)==2212){
782 if(pdgdp<0 && pdgdau>0)
return -1;
783 if(pdgdp>0 && pdgdau<0)
return -1;
789 if(nPions!=1)
return -1;
790 if(nKaons!=1)
return -1;
791 if(nProtons!=1)
return -1;
792 for(
Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
793 if(iDau<0)
return -1;
TH3F * fHistEtaPhiPtRecK
! histo of generated kaons
AliESDtrackCuts * fESDtrackCuts
0=pp, 1=PbPb, 2=pPb
TH1F * fHistPtRecGood
! pt distribution of "good" tracks
static Int_t CheckDplusDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistBSpecies
! histo of B hadron species
TH1F * fHistoSPDZVtxY
! histo with distr. of y coord. of SPDZ vertex
TH2F * fHistYPtPrompt[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc
Int_t fSystem
c/b separation using quarks
TH3F * fHistEtaPhiPtGenEle
! histo of generated electrons
TH1F * fHistoSPDZVtxX
! histo with distr. of x coord. of SPDZ vertex
TH2F * fHistYPtDplusbyDecChannel[3]
! histo of y vs. pt for D+->Kpipi and D+->K0*pi
TH1F * fHistMotherID
! histo of mother ID
TH3F * fHistEtaPhiPtGenK
! histo of generated kaons
TH2F * fHistBYPtAllDecay[5]
! histo of y vs. pt from prompt B0, B+, B*, Bs, Lb
static Int_t CheckDstarDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistOriginFeeddown
! histo of D production point (feeddown)
virtual ~AliAnalysisTaskCheckHFMCProd()
TH1F * fHistoPhysPrimPiKPi09
! histo of n. of primary pi, K, p
static Int_t CheckDsDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH2F * fHistEtaRecVsEtaGen
! correlation between rec and gen pt
static Int_t CheckLcpKpiDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoTracklets
! histo with number of SPD tracklets
virtual void UserCreateOutputObjects()
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
virtual void UserExec(Option_t *option)
TH2F * fHistYPtDsbyDecChannel[2]
! histo of y vs. pt for Ds->phipi and Ds->K0*K
TH1F * fHistoSPD3DVtxX
! histo with distr. of x coord. of SPD3D vertex
TH2F * fHistoNbVsNc
! histo of n. b quarks vs. n c. quarks
TH1F * fHistoTRKVtxX
! histo with distr. of x coord. of TRK vertex
TH2F * fHistNcollHFtype
! histo of number of injected events vs. type
TH2F * fHistYPtFeeddown[5]
! histo of y vs. pt from feeddown D0, D+, D*, Ds, Lc
TH3F * fHistEtaPhiPtRecPro
! histo of generated protons
TH1F * fHistoSelTracks
! histo with number of TPC+ITS refit ESD tracks
static Int_t CheckLcV0bachelorDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoPhysPrim
! histo of n. of physical primaries in |eta|<0.5
TH1F * fHistoNEvents
! histo with N of events
TH3F * fHistEtaPhiPtGenPi
! histo of generated pions
TH3F * fHistEtaPhiPtGenPro
! histo of generated protons
TH1F * fHistPtRecFake
! pt distribution of fake tracks
TH1F * fHistOriginPrompt
! histo of D production point (prompt)
static Int_t CheckD0Decay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH2F * fHistYPtPromptAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TH2F * fHistoNcharmed
! histo of D mesons vs. dN/dy
TH2F * fHistoPhysPrimPiKPi09vsb
! histo of n. of primary pi, K, p vs. b
TH2F * fHistPhiRecVsPhiGen
! correlation between rec and gen pt
static Int_t CheckDplusKKpiDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoTRKVtxZ
! histo with distr. of z coord. of TRK vertex
TH1F * fHistDSpecies
! histo of D hadron species
AliAnalysisTaskCheckHFMCProd()
TH2F * fHistYPtAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TH1F * fHistoEtaPhysPrim
! histo of eta distribution of physical primaries
TH1F * fHistoSPD3DVtxY
! histo with distr. of y coord. of SPD3D vertex
TH1F * fHistoTrackletsEta1
! histo with number of SPD tracklets in |eta|<1
TH2F * fHistYPtD0byDecChannel[2]
! histo of y vs. pt for D0->Kpi and D0->Kpipipi
TH1F * fHistoTracks
! histo with number of ESD tracks
TH1F * fHistoPtPhysPrim
! histo of pt distribution of phys primaries
TH1F * fHistoSPDZVtxZ
! histo with distr. of z coord. of SPDZ vertex
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH1F * fHistoTRKVtxY
! histo with distr. of y coord. of TRK vertex
TH3F * fHistEtaPhiPtRecEle
! histo of generated electrons
TH2F * fHistYPtFeeddownAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TList * fOutput
! list of output histos
TH1F * fHistLcDecayChan
! histo of Lc decay modes
TH2F * fHistNinjectedvsb
! histo of number of injected events vs. b
TH1F * fHistoSPD3DVtxZ
! histo with distr. of z coord. of SPD3D vertex
TH3F * fHistEtaPhiPtRecPi
! histo of generated pions
TH2F * fHistPtRecVsPtGen
! correlation between rec and gen pt
Int_t CheckLcDecay(Int_t labLc, AliStack *stack) const
Bool_t fReadMC
track selection
virtual void Terminate(Option_t *option)