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"
61 AliAnalysisTaskSE(
"HFMCChecks"),
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 fSearchUpToQuark(kFALSE),
106 for(Int_t i=0; i<5; i++){
114 for(Int_t i=0; i<2; i++){
121 DefineInput(0, TChain::Class());
122 DefineOutput(1, TList::Class());
129 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode())
return;
144 fOutput->SetName(
"OutputHistos");
146 fHistoNEvents =
new TH1F(
"hNEvents",
"Number of processed events",3,-0.5,2.5);
160 fHistoTracks =
new TH1F(
"hTracks",
"",100,-0.5,maxMult*2-0.5);
198 Double_t maxncn=nBinscb-0.5;
199 fHistoNcharmed =
new TH2F(
"hncharmed",
"",100,-0.5,maxMult-0.5,nBinscb,-0.5,maxncn);
201 fHistoNbVsNc =
new TH2F(
"hnbvsnc",
"",nBinscb,-0.5,maxncn,nBinscb,-0.5,maxncn);
204 fHistYPtPrompt[0] =
new TH2F(
"hyptD0prompt",
"D0 - Prompt",40,0.,40.,20,-2.,2.);
205 fHistYPtPrompt[1] =
new TH2F(
"hyptDplusprompt",
"Dplus - Prompt",40,0.,40.,20,-2.,2.);
206 fHistYPtPrompt[2] =
new TH2F(
"hyptDstarprompt",
"Dstar - Prompt",40,0.,40.,20,-2.,2.);
207 fHistYPtPrompt[3] =
new TH2F(
"hyptDsprompt",
"Ds - Prompt",40,0.,40.,20,-2.,2.);
208 fHistYPtPrompt[4] =
new TH2F(
"hyptLcprompt",
"Lc - Prompt",40,0.,40.,20,-2.,2.);
210 fHistBYPtAllDecay[0] =
new TH2F(
"hyptB0AllDecay",
"B0 - All",40,0.,40.,40,-2.,2.);
211 fHistBYPtAllDecay[1] =
new TH2F(
"hyptBplusAllDecay",
"Bplus - All",40,0.,40.,40,-2.,2.);
212 fHistBYPtAllDecay[2] =
new TH2F(
"hyptBstarAllDecay",
"Bstar - All",40,0.,40.,40,-2.,2.);
213 fHistBYPtAllDecay[3] =
new TH2F(
"hyptBsAllDecay",
"Bs - All",40,0.,40.,40,-2.,2.);
214 fHistBYPtAllDecay[4] =
new TH2F(
"hyptLbAllDecay",
"LB - All",40,0.,40.,40,-2.,2.);
216 fHistYPtAllDecay[0] =
new TH2F(
"hyptD0AllDecay",
"D0 - All",40,0.,40.,40,-2.,2.);
217 fHistYPtAllDecay[1] =
new TH2F(
"hyptDplusAllDecay",
"Dplus - All",40,0.,40.,40,-2.,2.);
218 fHistYPtAllDecay[2] =
new TH2F(
"hyptDstarAllDecay",
"Dstar - All",40,0.,40.,40,-2.,2.);
219 fHistYPtAllDecay[3] =
new TH2F(
"hyptDsAllDecay",
"Ds - All",40,0.,40.,40,-2.,2.);
220 fHistYPtAllDecay[4] =
new TH2F(
"hyptLcAllDecay",
"Lc - All",40,0.,40.,40,-2.,2.);
235 fHistYPtFeeddown[0] =
new TH2F(
"hyptD0feeddown",
"D0 - Feeddown",40,0.,40.,20,-2.,2.);
236 fHistYPtFeeddown[1] =
new TH2F(
"hyptDplusfeeddown",
"Dplus - Feeddown",40,0.,40.,20,-2.,2.);
237 fHistYPtFeeddown[2] =
new TH2F(
"hyptDstarfeedown",
"Dstar - Feeddown",40,0.,40.,20,-2.,2.);
238 fHistYPtFeeddown[3] =
new TH2F(
"hyptDsfeedown",
"Ds - Feeddown",40,0.,40.,20,-2.,2.);
239 fHistYPtFeeddown[4] =
new TH2F(
"hyptLcfeedown",
"Lc - Feeddown",40,0.,40.,20,-2.,2.);
241 for(Int_t ih=0; ih<5; ih++){
264 for(Int_t ih=0; ih<2; ih++){
320 fHistLcDecayChan->GetXaxis()->SetBinLabel(9,
"#pi#Lambda#rightarrowp#pi#pi");
329 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};
330 const Int_t nBinsPhi=40;
331 Double_t binsphi[nBinsPhi+1];
332 for(Int_t ib=0; ib<=nBinsPhi; ib++) binsphi[ib]=ib*TMath::Pi()/20.;
333 const Int_t nBinsPt=24;
334 Double_t binspt[nBinsPt+1]={0.,0.10,0.15,0.2,0.25,
340 fHistEtaPhiPtGenEle=
new TH3F(
"hEtaPhiPtGenEle",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
342 fHistEtaPhiPtGenPi=
new TH3F(
"hEtaPhiPtGenPi",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
344 fHistEtaPhiPtGenK=
new TH3F(
"hEtaPhiPtGenK",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
346 fHistEtaPhiPtGenPro=
new TH3F(
"hEtaPhiPtGenPro",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
350 fHistEtaPhiPtRecEle=
new TH3F(
"hEtaPhiPtRecEle",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
352 fHistEtaPhiPtRecPi=
new TH3F(
"hEtaPhiPtRecPi",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
354 fHistEtaPhiPtRecK=
new TH3F(
"hEtaPhiPtRecK",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
356 fHistEtaPhiPtRecPro=
new TH3F(
"hEtaPhiPtRecPro",
"",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
369 AliESDEvent *esd = (AliESDEvent*) (InputEvent());
373 printf(
"AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
381 if(esd->GetRunNumber()<=139517) year=2010;
382 if(year==2010)
fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);
383 else fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
387 fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
388 AliESDtrackCuts::kAny);
391 Int_t nTracks=esd->GetNumberOfTracks();
394 for(Int_t it=0; it<nTracks; it++){
395 AliESDtrack* tr=esd->GetTrack(it);
396 UInt_t status=tr->GetStatus();
397 if(!(status&AliESDtrack::kITSrefit))
continue;
398 if(!(status&AliESDtrack::kTPCin))
continue;
403 const AliMultiplicity* mult=esd->GetMultiplicity();
404 Int_t nTracklets=mult->GetNumberOfTracklets();
406 for(Int_t it=0; it<nTracklets; it++){
407 Double_t eta=TMath::Abs(mult->GetEta(it));
408 if(eta<1) nTracklets1++;
413 const AliESDVertex *spdv=esd->GetVertex();
414 if(spdv && spdv->IsFromVertexer3D()){
419 if(spdv && spdv->IsFromVertexerZ()){
424 const AliESDVertex *trkv=esd->GetPrimaryVertex();
425 if(trkv && trkv->GetNContributors()>1){
434 AliMCEventHandler* eventHandler =
dynamic_cast<AliMCEventHandler*
> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
436 Printf(
"ERROR: Could not retrieve MC event handler");
439 AliMCEvent* mcEvent = eventHandler->MCEvent();
441 Printf(
"ERROR: Could not retrieve MC event");
444 stack = mcEvent->Stack();
446 Printf(
"ERROR: stack not available");
449 const AliVVertex* mcVert=mcEvent->GetPrimaryVertex();
451 Printf(
"ERROR: generated vertex not available");
454 if(TMath::Abs(mcVert->GetZ())>10)
return;
458 TString genname=mcEvent->GenEventHeader()->ClassName();
460 Double_t imppar=-999.;
464 if(genname.Contains(
"CocktailEventHeader")){
465 AliGenCocktailEventHeader *cockhead=(AliGenCocktailEventHeader*)mcEvent->GenEventHeader();
466 lgen=cockhead->GetHeaders();
467 for(Int_t ig=0; ig<lgen->GetEntries(); ig++){
468 AliGenerator* gen=(AliGenerator*)lgen->At(ig);
469 TString
title=gen->GetName();
470 if(title.Contains(
"bchadr")){
473 }
else if(title.Contains(
"chadr")) {
476 }
else if(title.Contains(
"bele")){
479 }
else if(title.Contains(
"cele")){
482 }
else if(title.Contains(
"pythiaHF")){
484 }
else if(title.Contains(
"hijing")){
485 AliGenHijingEventHeader* hijh=(AliGenHijingEventHeader*)lgen->At(ig);
486 imppar=hijh->ImpactParameter();
489 nColl=lgen->GetEntries();
493 TString genTitle=mcEvent->GenEventHeader()->GetTitle();
494 if(genTitle.Contains(
"bchadr")) typeHF=1;
495 else if(genTitle.Contains(
"chadr")) typeHF=0;
496 else if(genTitle.Contains(
"bele")) typeHF=3;
497 else if(genTitle.Contains(
"cele")) typeHF=2;
500 Int_t nParticles=stack->GetNtrack();
501 Double_t dNchdy = 0.;
506 for (Int_t i=0;i<nParticles;i++){
507 TParticle* part = (TParticle*)stack->Particle(i);
508 Int_t absPdg=TMath::Abs(part->GetPdgCode());
509 Int_t
pdg=part->GetPdgCode();
512 if(stack->IsPhysicalPrimary(i)){
513 Double_t eta=part->Eta();
520 if(TMath::Abs(eta)<0.5){
524 if(TMath::Abs(eta)<0.9){
526 if(absPdg==211 || absPdg==321 || absPdg==2212){
532 if (part->Energy() != TMath::Abs(part->Pz())){
533 rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz()));
544 else if(absPdg==411){
549 if(iTypeKKpi>0) iType=3;
553 else if(absPdg==413){
558 else if(absPdg==431){
561 if(iType==1 || iType==2) iPart=3;
563 else if(absPdg==4122){
568 if(iTypeV0==1) iType=5;
569 if(iTypeV0==2) iType=6;
572 if(iType>=0) iPart=4;
594 if(iSpecies<0)
continue;
607 Double_t distx=part->Vx()-mcVert->GetX();
608 Double_t disty=part->Vy()-mcVert->GetY();
609 Double_t distz=part->Vz()-mcVert->GetZ();
610 Double_t distToVert=TMath::Sqrt(distx*distx+disty*disty+distz*distz);
622 if(iPart<0)
continue;
623 if(iType<0)
continue;
625 if(iPart==0 && iType>0 && iType<=2){
627 }
else if(iPart==1 && iType>0 && iType<=3){
629 }
else if(iPart==3 && iType>0 && iType<=2){
633 if(iFromB==4 && iPart>=0 && iPart<5)
fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid);
634 else if(iFromB==5 && iPart>=0 && iPart<5)
fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid);
637 for(Int_t i=0; i<nTracks; i++){
638 AliESDtrack* track=esd->GetTrack(i);
640 Int_t label=TMath::Abs(track->GetLabel());
641 if(stack->IsPhysicalPrimary(label)){
642 TParticle* part = (TParticle*)stack->Particle(label);
643 Int_t absPdg=TMath::Abs(part->GetPdgCode());
644 Double_t eta=part->Eta();
666 fOutput =
dynamic_cast<TList*
> (GetOutputData(1));
668 printf(
"ERROR: fOutput not available\n");
680 if(labLc<0)
return -1;
681 TParticle* dp = (TParticle*)stack->Particle(labLc);
682 Int_t pdgdp=dp->GetPdgCode();
683 Int_t nDau=dp->GetNDaughters();
689 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
690 if(iDau<0)
return -1;
691 TParticle* dau=(TParticle*)stack->Particle(iDau);
692 Int_t pdgdau=dau->GetPdgCode();
693 if(TMath::Abs(pdgdau)==321){
694 if(pdgdp>0 && pdgdau>0)
return -1;
695 if(pdgdp<0 && pdgdau<0)
return -1;
697 }
else if(TMath::Abs(pdgdau)==211){
698 if(pdgdp<0 && pdgdau>0)
return -1;
699 if(pdgdp>0 && pdgdau<0)
return -1;
701 }
else if(TMath::Abs(pdgdau)==2212){
702 if(pdgdp<0 && pdgdau>0)
return -1;
703 if(pdgdp>0 && pdgdau<0)
return -1;
709 if(nPions!=1)
return -1;
710 if(nKaons!=1)
return -1;
711 if(nProtons!=1)
return -1;
712 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
713 if(iDau<0)
return -1;
722 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
723 if(iDau<0)
return -1;
724 TParticle* dau=(TParticle*)stack->Particle(iDau);
725 Int_t pdgdau=dau->GetPdgCode();
726 if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224
727 || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){
728 Int_t nDauRes=dau->GetNDaughters();
729 if(nDauRes!=2)
return -1;
730 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
731 if(resDau<0)
return -1;
732 TParticle* resdau=(TParticle*)stack->Particle(resDau);
733 Int_t pdgresdau=resdau->GetPdgCode();
734 if(TMath::Abs(pdgresdau)==321){
735 if(pdgdp>0 && pdgresdau>0)
return -1;
736 if(pdgdp<0 && pdgresdau<0)
return -1;
739 if(TMath::Abs(pdgresdau)==211){
740 if(pdgdp<0 && pdgresdau>0)
return -1;
741 if(pdgdp>0 && pdgresdau<0)
return -1;
744 if(TMath::Abs(pdgresdau)==2212){
745 if(pdgdp<0 && pdgresdau>0)
return -1;
746 if(pdgdp>0 && pdgresdau<0)
return -1;
750 }
else if(TMath::Abs(pdgdau)==321){
751 if(pdgdp>0 && pdgdau>0)
return -1;
752 if(pdgdp<0 && pdgdau<0)
return -1;
754 }
else if(TMath::Abs(pdgdau)==211){
755 if(pdgdp<0 && pdgdau>0)
return -1;
756 if(pdgdp>0 && pdgdau<0)
return -1;
758 }
else if(TMath::Abs(pdgdau)==2212){
759 if(pdgdp<0 && pdgdau>0)
return -1;
760 if(pdgdp>0 && pdgdau<0)
return -1;
766 if(nPions!=1)
return -1;
767 if(nKaons!=1)
return -1;
768 if(nProtons!=1)
return -1;
769 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
770 if(iDau<0)
return -1;
TH3F * fHistEtaPhiPtRecK
! histo of generated kaons
AliESDtrackCuts * fESDtrackCuts
0=pp, 1=PbPb, 2=pPb
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)
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 * 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
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
Int_t CheckLcDecay(Int_t labLc, AliStack *stack) const
Bool_t fReadMC
track selection
virtual void Terminate(Option_t *option)