27 #include <TDatabasePDG.h>
30 #include <THnSparse.h>
32 #include "AliAnalysisManager.h"
33 #include "AliInputEventHandler.h"
34 #include "AliPIDResponse.h"
35 #include "AliAODHandler.h"
36 #include "AliAODEvent.h"
37 #include "AliAODMCParticle.h"
38 #include "AliAODMCHeader.h"
39 #include "AliAODVertex.h"
40 #include "AliAODTrack.h"
53 fHistEventMultZv(0x0),
54 fHistEventMultZvEvSel(0x0),
55 fHistTrackStatus(0x0),
56 fHistTrackEtaMultZv(0x0),
57 fHistCheckOrigin(0x0),
58 fHistCheckOriginSel(0x0),
59 fHistCheckDecChan(0x0),
60 fHistCheckDecChanAcc(0x0),
62 fPtVsYVsMultGenLargeAcc(0x0),
63 fPtVsYVsMultGenLimAcc(0x0),
64 fPtVsYVsMultGenAcc(0x0),
65 fPtVsYVsMultGenAccEvSel(0x0),
66 fPtVsYVsMultReco(0x0),
69 fMassVsPtVsYLSpp(0x0),
70 fMassVsPtVsYLSmm(0x0),
72 fMassVsPtVsYRefl(0x0),
77 fDeltaMassFullAnalysis(0x0),
79 fMassVsPtVsYMELSpp(0x0),
80 fMassVsPtVsYMELSmm(0x0),
97 fMinAngleForRot(5*TMath::Pi()/6),
98 fMaxAngleForRot(7*TMath::Pi()/6),
100 fMinAngleForRot3(2*TMath::Pi()/6),
101 fMaxAngleForRot3(4*TMath::Pi()/6),
105 fPromptFeeddown(kPrompt),
108 fPIDstrategy(knSigma),
113 fBayesThresKaon(0.4),
114 fBayesThresPion(0.4),
116 fNumberOfEventsForMixing(20),
117 fMaxzVertDistForMix(5.),
118 fMaxMultDiffForMix(5.),
120 fNzVertPoolsLimSize(2),
123 fNMultPoolsLimSize(2),
127 fEventInfo(new TObjString(
"")),
130 fMinMultiplicity(-0.5),
131 fMaxMultiplicity(199.5),
140 AliAnalysisTaskSE(
"DmesonCombin"),
143 fHistEventMultZv(0x0),
144 fHistEventMultZvEvSel(0x0),
145 fHistTrackStatus(0x0),
146 fHistTrackEtaMultZv(0x0),
147 fHistCheckOrigin(0x0),
148 fHistCheckOriginSel(0x0),
149 fHistCheckDecChan(0x0),
150 fHistCheckDecChanAcc(0x0),
151 fPtVsYVsMultGen(0x0),
152 fPtVsYVsMultGenLargeAcc(0x0),
153 fPtVsYVsMultGenLimAcc(0x0),
154 fPtVsYVsMultGenAcc(0x0),
155 fPtVsYVsMultGenAccEvSel(0x0),
156 fPtVsYVsMultReco(0x0),
158 fMassVsPtVsYRot(0x0),
159 fMassVsPtVsYLSpp(0x0),
160 fMassVsPtVsYLSmm(0x0),
161 fMassVsPtVsYSig(0x0),
162 fMassVsPtVsYRefl(0x0),
163 fMassVsPtVsYBkg(0x0),
167 fDeltaMassFullAnalysis(0x0),
169 fMassVsPtVsYMELSpp(0x0),
170 fMassVsPtVsYMELSmm(0x0),
172 fMixingsPerPool(0x0),
179 fAnalysisCuts(analysiscuts),
187 fMinAngleForRot(5*TMath::Pi()/6),
188 fMaxAngleForRot(7*TMath::Pi()/6),
190 fMinAngleForRot3(2*TMath::Pi()/6),
191 fMaxAngleForRot3(4*TMath::Pi()/6),
198 fPIDstrategy(knSigma),
203 fBayesThresKaon(0.4),
204 fBayesThresPion(0.4),
206 fNumberOfEventsForMixing(20),
207 fMaxzVertDistForMix(5.),
208 fMaxMultDiffForMix(5.),
210 fNzVertPoolsLimSize(2),
213 fNMultPoolsLimSize(2),
217 fEventInfo(new TObjString(
"")),
220 fMinMultiplicity(-0.5),
221 fMaxMultiplicity(199.5),
227 DefineOutput(1,TList::Class());
228 DefineOutput(2,AliNormalizationCounter::Class());
309 for(Int_t ib=0; ib<nPools+1; ib++)
fMultPoolLims[ib]=multLimits[ib];
317 if(fDebug > 1) printf(
"AnalysisTaskCombinHF::UserCreateOutputObjects() \n");
321 fOutput->SetName(
"OutputHistos");
323 fHistNEvents =
new TH1F(
"hNEvents",
"number of events ",9,-0.5,8.5);
325 fHistNEvents->GetXaxis()->SetBinLabel(2,
"n. passing IsEvSelected");
326 fHistNEvents->GetXaxis()->SetBinLabel(3,
"n. rejected due to trigger");
327 fHistNEvents->GetXaxis()->SetBinLabel(4,
"n. rejected due to phys sel");
328 fHistNEvents->GetXaxis()->SetBinLabel(5,
"n. rejected due to not reco vertex");
329 fHistNEvents->GetXaxis()->SetBinLabel(6,
"n. rejected for contr vertex");
330 fHistNEvents->GetXaxis()->SetBinLabel(7,
"n. rejected for vertex out of accept");
331 fHistNEvents->GetXaxis()->SetBinLabel(8,
"n. rejected for pileup events");
332 fHistNEvents->GetXaxis()->SetBinLabel(9,
"no. of out centrality events");
359 fHistTrackEtaMultZv =
new TH3F(
"hTrackEtaMultZv",
"",40,-1.,1.,30,-15.,15.,200,
fMinMultiplicity,
fMaxMultiplicity);
387 fPtVsYVsMultGen=
new TH3F(
"hPtVsYVsMultGen",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
392 fPtVsYVsMultGenLargeAcc=
new TH3F(
"hPtVsYVsMultGenLargeAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
397 fPtVsYVsMultGenLimAcc=
new TH3F(
"hPtVsYVsMultGenLimAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
402 fPtVsYVsMultGenAcc=
new TH3F(
"hPtVsYVsMultGenAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
407 fPtVsYVsMultGenAccEvSel=
new TH3F(
"hPtVsYVsMultGenAccEvSel",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
412 fPtVsYVsMultReco=
new TH3F(
"hPtVsYVsMultReco",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
420 Double_t maxm=
fMinMass+nMassBins*0.001;
421 fMassVsPtVsY=
new TH3F(
"hMassVsPtVsY",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
426 fMassVsPtVsYRot=
new TH3F(
"hMassVsPtVsYRot",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
431 fMassVsPtVsYLSpp=
new TH3F(
"hMassVsPtVsYLSpp",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
435 fMassVsPtVsYLSmm=
new TH3F(
"hMassVsPtVsYLSmm",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
440 fMassVsPtVsYSig=
new TH3F(
"hMassVsPtVsYSig",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
445 fMassVsPtVsYRefl=
new TH3F(
"hMassVsPtVsYRefl",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
450 fMassVsPtVsYBkg=
new TH3F(
"hMassVsPtVsYBkg",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
455 fNSelected=
new TH1F(
"hNSelected",
"",100,-0.5,99.5);
465 fDeltaMass=
new TH1F(
"hDeltaMass",
"",100,-0.4,0.4);
470 Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
471 Double_t edgeLowSparseDMassRot[5]={
fMinMass,-0.4,0.,-4.,0};
472 Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
473 fDeltaMassFullAnalysis=
new THnSparseF(
"fDeltaMassFullAnalysis",
"fDeltaMassFullAnalysis;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{D} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
476 fMassVsPtVsYME=
new TH3F(
"hMassVsPtVsYME",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
481 fMassVsPtVsYMELSpp=
new TH3F(
"hMassVsPtVsYMELSpp",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
486 fMassVsPtVsYMELSmm=
new TH3F(
"hMassVsPtVsYMELSmm",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
498 fEventsPerPool=
new TH2F(
"hEventsPerPool",
"hEventsPerPool",1,-10.,10.,1,-0.5,2000.5);
499 fMixingsPerPool=
new TH2F(
"hMixingsPerPool",
"hMixingsPerPool",1,-10.,10.,1,-0.5,2000.5);
519 fEventBuffer[i]=
new TTree(Form(
"EventBuffer_%d",i),
"Temporary buffer for event mixing");
535 AliAODEvent *aod =
dynamic_cast<AliAODEvent*
> (InputEvent());
536 if(!aod && AODEvent() && IsStandardAOD()) {
539 aod =
dynamic_cast<AliAODEvent*
> (AODEvent());
542 printf(
"AliAnalysisTaskCombinHF::UserExec: AOD not found!\n");
548 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001)
return;
554 Int_t runnumber = aod->GetRunNumber();
555 if(aod->GetTriggerMask()==0 &&
556 (runnumber>=195344 && runnumber<=195677)){
561 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
562 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
563 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
594 Int_t ntracks=aod->GetNumberOfTracks();
595 fVtxZ = aod->GetPrimaryVertex()->GetZ();
598 TClonesArray *arrayMC=0;
599 AliAODMCHeader *mcHeader=0;
601 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
603 printf(
"AliAnalysisTaskCombinHF::UserExec: MC particles branch not found!\n");
608 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
610 printf(
"AliAnalysisTaskCombinHF::UserExec: MC header branch not found!\n");
613 Double_t zMCVertex = mcHeader->GetVtxZ();
631 UChar_t* status =
new UChar_t[ntracks];
632 for(Int_t iTr=0; iTr<ntracks; iTr++){
634 AliAODTrack* track=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr));
636 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
644 if(
IsKaon(track)) status[iTr]+=2;
645 if(
IsPion(track)) status[iTr]+=4;
649 Double_t *weights =
new Double_t[AliPID::kSPECIES];
652 if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kKaon]) status[iTr] += 2;
653 if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kPion]) status[iTr] += 4;
669 Double_t dummypos[3]={0.,0.,0.};
670 AliAODVertex* v2=
new AliAODVertex(dummypos,999.,-1,2);
671 AliAODVertex* v3=
new AliAODVertex(dummypos,999.,-1,3);
673 Double_t d02[2]={0.,0.};
674 Double_t d03[3]={0.,0.,0.};
675 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
676 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
677 UInt_t pdg0[2]={321,211};
678 UInt_t pdgp[3]={321,211,211};
679 UInt_t pdgs[3]={321,211,321};
681 Double_t px[3],py[3],pz[3];
686 for(Int_t iTr1=0; iTr1<ntracks; iTr1++){
687 AliAODTrack* trK=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr1));
689 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
692 if((status[iTr1] & 1)==0)
continue;
694 if(status[iTr1] & 2)
fKaonTracks->AddLast(
new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
695 if(status[iTr1] & 4)
fPionTracks->AddLast(
new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
697 if((status[iTr1] & 2)==0)
continue;
698 Int_t chargeK=trK->Charge();
699 trK->GetPxPyPz(tmpp);
703 dgLabels[0]=trK->GetLabel();
704 for(Int_t iTr2=0; iTr2<ntracks; iTr2++){
705 if((status[iTr2] & 1)==0)
continue;
706 if((status[iTr2] & 4)==0)
continue;
707 if(iTr1==iTr2)
continue;
708 AliAODTrack* trPi1=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr2));
710 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
713 Int_t chargePi1=trPi1->Charge();
714 trPi1->GetPxPyPz(tmpp);
718 dgLabels[1]=trPi1->GetLabel();
720 if(chargePi1==chargeK){
726 v2->AddDaughter(trK);
727 v2->AddDaughter(trPi1);
728 tmpRD2->SetSecondaryVtx(v2);
729 Bool_t ok=
FillHistos(421,2,tmpRD2,px,py,pz,pdg0,arrayMC,dgLabels);
730 v2->RemoveDaughters();
734 for(Int_t iTr3=iTr2+1; iTr3<ntracks; iTr3++){
735 if((status[iTr3] & 1)==0)
continue;
737 if(
fMeson==
kDs && (status[iTr3] & 2)==0)
continue;
738 if(iTr1==iTr3)
continue;
739 AliAODTrack* trPi2=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr3));
741 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
744 Int_t chargePi2=trPi2->Charge();
745 trPi2->GetPxPyPz(tmpp);
749 dgLabels[2]=trPi2->GetLabel();
752 Double_t deltaMass=massKK-TDatabasePDG::Instance()->GetParticle(333)->Mass();
755 Bool_t isThreeLS=kFALSE;
756 if(chargePi1==chargeK && chargePi2==chargeK){
761 Bool_t acceptOS=kFALSE;
763 if(chargePi1!=chargeK && chargePi2!=chargeK)acceptOS=kTRUE;
765 if(chargePi2!=chargeK && !isThreeLS) acceptOS=kTRUE;
769 v3->AddDaughter(trK);
770 v3->AddDaughter(trPi1);
771 v3->AddDaughter(trPi2);
772 tmpRD3->SetSecondaryVtx(v3);
776 v3->RemoveDaughters();
794 fEventInfo->SetString(Form(
"Ev%d_esd%d_Pi%d_K%d",mgr->GetNcalls(),((AliAODHeader*)aod->GetHeader())->GetEventNumberESDFile(),
fPionTracks->GetEntries(),
fKaonTracks->GetEntries()));
819 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
820 Double_t pt = tmpRD->Pt();
821 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
823 Double_t rapid = tmpRD->Y(pdgD);
835 Int_t totPart=arrayMC->GetEntriesFast();
845 for(Int_t ip=0; ip<totPart; ip++){
846 AliAODMCParticle *part = (AliAODMCParticle*)arrayMC->At(ip);
847 if(TMath::Abs(part->GetPdgCode())==thePDG){
855 Bool_t isGoodDecay=kFALSE;
856 Int_t labDau[4]={-1,-1,-1,-1};
859 if(part->GetNDaughters()!=2)
continue;
860 if(deca==1) isGoodDecay=kTRUE;
863 if(deca>0) isGoodDecay=kTRUE;
866 if(deca==1) isGoodDecay=kTRUE;
876 Double_t ptgen=part->Pt();
877 Double_t ygen=part->Y();
891 Bool_t
AliAnalysisTaskCombinHF::FillHistos(Int_t pdgD,Int_t nProngs, AliAODRecoDecay* tmpRD, Double_t* px, Double_t* py, Double_t* pz, UInt_t *pdgdau, TClonesArray *arrayMC, Int_t* dgLabels){
894 Bool_t accept=kFALSE;
896 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
897 Double_t pt = tmpRD->Pt();
898 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
899 Double_t
mass=TMath::Sqrt(minv2);
902 Double_t rapid = tmpRD->Y(pdgD);
907 Int_t signPdg[3]={0,0,0};
908 for(Int_t iii=0; iii<nProngs; iii++) signPdg[iii]=pdgdau[iii];
909 Int_t labD = tmpRD->MatchToMC(pdgD,arrayMC,nProngs,signPdg);
911 AliAODMCParticle* part =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(TMath::Abs(dgLabels[0])));
916 Int_t pdgCode = TMath::Abs( part->GetPdgCode() );
919 AliAODMCParticle* dmes =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(labD));
937 Double_t angleProngXY;
938 if(TMath::Abs(pdgD)==421)angleProngXY=TMath::ACos((px[0]*px[1]+py[0]*py[1])/TMath::Sqrt((px[0]*px[0]+py[0]*py[0])*(px[1]*px[1]+py[1]*py[1])));
940 angleProngXY=TMath::ACos(((px[0]+px[1])*px[2]+(py[0]+py[1])*py[2])/TMath::Sqrt(((px[0]+px[1])*(px[0]+px[1])+(py[0]+py[1])*(py[0]+py[1]))*(px[2]*px[2]+py[2]*py[2])));
948 Double_t rotStep3=0.;
955 Double_t tmpx2=px[2];
956 Double_t tmpy2=py[2];
957 px[0]=tmpx*TMath::Cos(phirot)-tmpy*TMath::Sin(phirot);
958 py[0]=tmpx*TMath::Sin(phirot)+tmpy*TMath::Cos(phirot);
960 if(pdgD==411 || pdgD==431){
962 px[2]=tmpx*TMath::Cos(phirot2)-tmpy*TMath::Sin(phirot2);
963 py[2]=tmpx*TMath::Sin(phirot2)+tmpy*TMath::Cos(phirot2);
965 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
967 minv2 = tmpRD->InvMass2(nProngs,pdgdau);
969 Double_t rapid = tmpRD->Y(pdgD);
971 massRot=TMath::Sqrt(minv2);
976 Double_t pointRot[5]={
mass,massRot-
mass,ptOrig,pt-ptOrig,angleProngXY};
984 if(pdgD==411 || pdgD==431){
998 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
999 Double_t pt = tmpRD->Pt();
1000 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1001 Double_t
mass=TMath::Sqrt(minv2);
1004 Double_t rapid = tmpRD->Y(pdgD);
1015 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1016 Double_t pt = tmpRD->Pt();
1017 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1018 Double_t
mass=TMath::Sqrt(minv2);
1021 Double_t rapid = tmpRD->Y(pdgD);
1033 if(track->Charge()==0)
return kFALSE;
1034 if(track->GetID()<0&&!
fKeepNegID)
return kFALSE;
1035 if(!(track->TestFilterMask(
fFilterMask)))
return kFALSE;
1044 if(!
fPidHF)
return kTRUE;
1046 Double_t mom=track->P();
1048 if(isKaon>=1)
return kTRUE;
1049 if(isKaon<=-1)
return kFALSE;
1065 Double_t
nsigma=pidResp->NumberOfSigmasTPC(track,AliPID::kKaon);
1066 if(nsigma>-2.&& nsigma<3. && mom<0.6)isKaon=1;
1067 else if(nsigma>-1.&& nsigma<3.&& mom<0.8)isKaon=1;
1068 if(isKaon==1)
return kTRUE;
1073 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1085 if(!
fPidHF)
return kTRUE;
1087 Double_t mom=track->P();
1089 if(isPion>=1)
return kTRUE;
1090 if(isPion<=-1)
return kFALSE;
1107 Double_t
nsigma=pidResp->NumberOfSigmasTPC(track,AliPID::kPion);
1108 if(nsigma<2.&& nsigma>-3. && mom<0.6)isPion=1;
1109 else if(nsigma<1. && nsigma> -3. && mom<0.8)isPion=1;
1110 if(isPion==1)
return kTRUE;
1115 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1128 if(!cuts)
return kTRUE;
1130 AliESDtrack esdTrack(track);
1132 esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1133 esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1134 esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1135 if(!cuts->IsSelected(&esdTrack))
return kFALSE;
1143 for (Int_t iProng = 0; iProng<nProng; iProng++){
1144 AliAODMCParticle* mcPartDaughter=
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(labDau[iProng]));
1145 if(!mcPartDaughter)
return kFALSE;
1146 Double_t eta = mcPartDaughter->Eta();
1147 Double_t pt = mcPartDaughter->Pt();
1165 if(poolIndex<0 || poolIndex>=
fNOfPools)
return;
1167 fEventBuffer[poolIndex]=
new TTree(Form(
"EventBuffer_%d",poolIndex),
"Temporary buffer for event mixing");
1188 if(fDebug > 1) printf(
"AnalysisTaskCombinHF::DoMixingWithCuts Start Event Mixing of %d events\n",nEvents);
1190 TObjArray* karray=0x0;
1191 TObjArray* parray=0x0;
1192 Double_t zVertex,mult;
1193 TObjString* eventInfo=0x0;
1196 fEventBuffer[0]->SetBranchAddress(
"eventInfo",&eventInfo);
1197 fEventBuffer[0]->SetBranchAddress(
"zVertex", &zVertex);
1198 fEventBuffer[0]->SetBranchAddress(
"multiplicity", &mult);
1199 Double_t d02[2]={0.,0.};
1200 Double_t d03[3]={0.,0.,0.};
1201 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1202 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1203 UInt_t pdg0[2]={321,211};
1205 Double_t px[3],py[3],pz[3];
1206 Int_t evId1,esdId1,nk1,np1;
1207 Int_t evId2,esdId2,nk2,np2;
1209 for(Int_t iEv1=0; iEv1<
nEvents; iEv1++){
1211 TObjArray* karray1=(TObjArray*)karray->Clone();
1212 Double_t zVertex1=zVertex;
1213 Double_t mult1=mult;
1214 Int_t nKaons=karray1->GetEntries();
1215 Int_t nPionsForCheck=parray->GetEntries();
1216 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1217 if(nk1!=nKaons || np1!=nPionsForCheck){
1218 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1223 Int_t iToMix=iEv1+iEv2+1;
1224 if(iEv1>=(nEvents-fNumberOfEventsForMixing)) iToMix=iEv1-iEv2-1;
1225 if(iToMix<0)
continue;
1226 if(iToMix==iEv1)
continue;
1227 if(iToMix<iEv1)
continue;
1229 Double_t zVertex2=zVertex;
1230 Double_t mult2=mult;
1231 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1232 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1235 TObjArray* parray2=(TObjArray*)parray->Clone();
1236 Int_t nPions=parray2->GetEntries();
1237 Int_t nKaonsForCheck=karray->GetEntries();
1238 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1239 if(nk2!=nKaonsForCheck || np2!=nPions){
1240 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1244 if(evId2==evId1 && esdId2==esdId1){
1245 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1249 if(
CanBeMixed(zVertex1,zVertex2,mult1,mult2)){
1250 for(Int_t iTr1=0; iTr1<nKaons; iTr1++){
1251 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1252 Double_t chargeK=trK->T();
1256 for(Int_t iTr2=0; iTr2<nPions; iTr2++){
1257 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1258 Double_t chargePi1=trPi1->T();
1259 px[1] = trPi1->Px();
1260 py[1] = trPi1->Py();
1261 pz[1] = trPi1->Pz();
1286 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools Start Event Mixing of %d events\n",nEvents);
1287 TObjArray* karray=0x0;
1288 TObjArray* parray=0x0;
1289 Double_t zVertex,mult;
1290 TObjString* eventInfo=0x0;
1291 fEventBuffer[poolIndex]->SetBranchAddress(
"karray", &karray);
1292 fEventBuffer[poolIndex]->SetBranchAddress(
"parray", &parray);
1293 fEventBuffer[poolIndex]->SetBranchAddress(
"eventInfo",&eventInfo);
1294 fEventBuffer[poolIndex]->SetBranchAddress(
"zVertex", &zVertex);
1295 fEventBuffer[poolIndex]->SetBranchAddress(
"multiplicity", &mult);
1298 Double_t d02[2]={0.,0.};
1299 Double_t d03[3]={0.,0.,0.};
1300 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1301 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1302 UInt_t pdg0[2]={321,211};
1303 UInt_t pdgp[3]={321,211,211};
1304 UInt_t pdgs[3]={321,211,321};
1305 Double_t px[3],py[3],pz[3];
1306 Int_t evId1,esdId1,nk1,np1;
1307 Int_t evId2,esdId2,nk2,np2;
1309 for(Int_t iEv1=0; iEv1<
nEvents; iEv1++){
1311 TObjArray* karray1=(TObjArray*)karray->Clone();
1312 Double_t zVertex1=zVertex;
1313 Double_t mult1=mult;
1314 Int_t nKaons=karray1->GetEntries();
1315 Int_t nPionsForCheck=parray->GetEntries();
1316 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1317 if(nk1!=nKaons || np1!=nPionsForCheck){
1318 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1322 for(Int_t iEv2=0; iEv2<
nEvents; iEv2++){
1323 if(iEv2==iEv1)
continue;
1325 Double_t zVertex2=zVertex;
1326 Double_t mult2=mult;
1327 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1328 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1331 TObjArray* parray2=(TObjArray*)parray->Clone();
1332 Int_t nPions=parray2->GetEntries();
1333 Int_t nKaonsForCheck=karray->GetEntries();
1334 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1335 if(nk2!=nKaonsForCheck || np2!=nPions){
1336 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1340 if(evId2==evId1 && esdId2==esdId1){
1341 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1345 TObjArray* parray3=0x0;
1349 if(iEv3==iEv1) iEv3=iEv2+2;
1350 if(iEv3>=nEvents) iEv3=iEv2-3;
1351 if(nEvents==2) iEv3=iEv1;
1352 if(iEv3<0) iEv3=iEv2-1;
1354 parray3=(TObjArray*)parray->Clone();
1355 nPions3=parray3->GetEntries();
1357 for(Int_t iTr1=0; iTr1<nKaons; iTr1++){
1358 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1359 Double_t chargeK=trK->T();
1363 for(Int_t iTr2=0; iTr2<nPions; iTr2++){
1364 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1365 Double_t chargePi1=trPi1->T();
1366 px[1] = trPi1->Px();
1367 py[1] = trPi1->Py();
1368 pz[1] = trPi1->Pz();
1369 if(chargePi1*chargeK<0){
1374 for(Int_t iTr3=iTr2+1; iTr3<nPions3; iTr3++){
1375 TLorentzVector* trPi2=(TLorentzVector*)parray3->At(iTr3);
1376 Double_t chargePi2=trPi2->T();
1377 px[2] = trPi2->Px();
1378 py[2] = trPi2->Py();
1379 pz[2] = trPi2->Pz();
1380 if(chargePi2*chargeK<0){
1387 }
else if(chargePi1*chargeK>0){
1405 printf(
"AliAnalysisTaskCombinHF: FinishTaskOutput\n");
1419 Double_t massK=TDatabasePDG::Instance()->GetParticle(321)->Mass();
1420 Double_t p1=tr1->P();
1421 Double_t p2=tr2->P();
1422 Double_t pxtot=tr1->Px()+tr2->Px();
1423 Double_t pytot=tr1->Py()+tr2->Py();
1424 Double_t pztot=tr1->Pz()+tr2->Pz();
1425 Double_t e1=TMath::Sqrt(massK*massK+p1*p1);
1426 Double_t e2=TMath::Sqrt(massK*massK+p2*p2);
1427 Double_t etot=e1+e2;
1428 Double_t m2=etot*etot-(pxtot*pxtot+pytot*pytot+pztot*pztot);
1429 return TMath::Sqrt(m2);
1436 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF: Terminate() \n");
1437 fOutput =
dynamic_cast<TList*
> (GetOutputData(1));
1439 printf(
"ERROR: fOutput not available\n");
1444 printf(
"Number of analyzed events = %d\n",(Int_t)
fHistNEvents->GetBinContent(2));
1446 printf(
"ERROR: fHistNEvents not available\n");
Bool_t IsEventRejectedDueToCentrality() const
Double_t fEtaAccCut
width of pt bin (GeV/c)
Bool_t FillHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, TClonesArray *arrayMC, Int_t *dgLabels)
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
Bool_t IsTrackSelected(AliAODTrack *track)
void ResetPool(Int_t poolIndex)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
static Int_t CheckDplusDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
Bool_t IsEventRejectedDueToNotRecoVertex() const
Double_t fMaxzVertDistForMix
maximum number of events to be used in event mixing
void FillMEHistosLS(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, Int_t charge)
Int_t fNzVertPoolsLimSize
number of pools in z vertex for event mixing
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
TH3F * fMassVsPtVsYMELSpp
! hist. of Y vs. Pt vs. Mass (mixedevents)
Bool_t IsKaon(AliAODTrack *track)
Bool_t CheckAcceptance(TClonesArray *arrayMC, Int_t nProng, Int_t *labDau)
TH1F * fHistTrackStatus
!hist. of status of tracks
AliNormalizationCounter * fCounter
maximum angle for track rotation (3rd prong)
TH3F * fPtVsYVsMultGenAccEvSel
! hist. of Y vs. Pt vs. Mult generated (D in acc, sel ev.)
Bool_t IsPion(AliAODTrack *track)
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Int_t fNMultPoolsLimSize
number of pools in multiplicity for event mixing
virtual ~AliAnalysisTaskCombinHF()
void FillMEHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau)
void ConfigureMultiplicityPools(Int_t nPools, Double_t *multLimits)
Double_t fMaxMultiplicity
lower limit for multiplcities in MC histos
TH1F * fNSelected
! hist. of n. of selected D+
TList * fOutput
! list send on output slot 0
Bool_t fReadMC
mesonSpecies (see enum)
TH3F * fMassVsPtVsY
! hist. of Y vs. Pt vs. Mass (all cand)
TH2F * fHistEventMultZvEvSel
!hist. of evnt Mult vs. Zv for selected ev
Double_t fMinAngleForRot
number of rotations
Double_t fPtAccCut
eta limits for acceptance step
Bool_t IsEventRejectedDueToVertexContributors() const
static Int_t CheckDsDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH3F * fPtVsYVsMultGen
! hist. of Y vs. Pt vs. Mult generated (all D)
Double_t fPtBinWidth
maximum pT value for inv. mass histograms
void ConfigureZVertPools(Int_t nPools, Double_t *zVertLimits)
Bool_t fKeepNegID
flag for upper p limit for id band for kaon
TTree ** fEventBuffer
number of pools
Double_t fBayesThresPion
threshold for kaon identification via Bayesian PID
Double_t fMaxPt
maximum value of invariant mass
TH3F * fPtVsYVsMultReco
! hist. of Y vs. Pt vs. Mult generated (Reco D)
Int_t fNRotations3
maximum angle for track rotation
TH3F * fHistTrackEtaMultZv
void FillGenHistos(TClonesArray *arrayMC, Bool_t isEvSel)
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Double_t GetMaxVtxZ() const
TH2F * fHistEventMultZv
!hist. of evnt Mult vs. Zv for all events
TH3F * fPtVsYVsMultGenLimAcc
! hist. of Y vs. Pt vs. Mult generated (|y|<0.5)
Bool_t CanBeMixed(Double_t zv1, Double_t zv2, Double_t mult1, Double_t mult2)
Double_t fPhiMassCut
kaon track selection
AliAODPidHF * fPidHF
cut on the KK inv mass for phi selection
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
Int_t fPIDselCaseZero
flag to keep also track with negative ID (default kFALSE, change it only if you know what you are doi...
TH1F * fHistNEvents
!hist. for No. of events
TH1F * fNormRotated
! hist. rotated/selected D+
TH3F * fMassVsPtVsYLSmm
! hist. of Y vs. Pt vs. Mass (like sign –)
AliAnalysisTaskCombinHF()
AliPIDCombined * GetPidCombined() const
Double_t fMaxAngleForRot
minimum angle for track rotation
virtual void UserCreateOutputObjects()
Int_t GetPoolIndex(Double_t zvert, Double_t mult)
Double_t fMinAngleForRot3
number of rotations (3rd prong)
static Int_t CheckD0Decay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
AliESDtrackCuts * fTrackCutsAll
FilterMask.
AliRDHFCuts * fAnalysisCuts
PID configuration.
AliESDtrackCuts * fTrackCutsPion
THnSparse * fDeltaMassFullAnalysis
! hist. mass difference after rotations with more details
Int_t fNzVertPools
cut on multiplicity difference for event mixing with cuts
TH3F * fMassVsPtVsYSig
! hist. of Y vs. Pt vs. Mass (signal)
Int_t fFullAnalysis
flag for definition of c,b origin
Double_t * fzVertPoolLims
number of pools in z vertex for event mixing +1
Bool_t IsEventRejectedDueToPileup() const
void FillLSHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, Int_t charge)
virtual void UserExec(Option_t *option)
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
virtual void Terminate(Option_t *option)
Double_t ComputeInvMassKK(AliAODTrack *tr1, AliAODTrack *tr2) const
Double_t fMinMultiplicity
multiplicity
virtual void FinishTaskOutput()
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Bool_t IsEventRejectedDuePhysicsSelection() const
Double_t fMinMass
Cuts for candidates.
Int_t fPIDstrategy
flag to set analysis level (0 is the fastest)
Double_t fVtxZ
unique event Id for event mixing checks
AliESDtrackCuts * fTrackCutsKaon
pion track selection
Bool_t fGoUpToQuark
flag to select prompt (1), feeddown (2) or all (3)
Bool_t SelectAODTrack(AliAODTrack *track, AliESDtrackCuts *cuts)
Bool_t IsEventSelected(AliVEvent *event)
TH1F * fHistCheckDecChanAcc
!hist. of decay channel of D meson in acc.
Int_t fDoEventMixing
threshold for pion identification via Bayesian PID
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH3F * fPtVsYVsMultGenAcc
! hist. of Y vs. Pt vs. Mult generated (D in acc)
Double_t fMultiplicity
zVertex
TH3F * fMassVsPtVsYME
! hist. of Y vs. Pt vs. Mass (mixedevents)
TH3F * fPtVsYVsMultGenLargeAcc
! hist. of Y vs. Pt vs. Mult generated (|y|<0.9)
Double_t fmaxPforIDKaon
flag for upper p limit for id band for pion
TH2F * fEventsPerPool
! hist with number of events per pool
TH3F * fMassVsPtVsYBkg
! hist. of Y vs. Pt vs. Mass (background)
TH2F * fMixingsPerPool
! hist with number of mixings per pool
TH3F * fMassVsPtVsYLSpp
! hist. of Y vs. Pt vs. Mass (like sign ++)
Int_t fNumberOfEventsForMixing
flag for event mixing
TObjArray * fPionTracks
array of kaon-compatible tracks (TLorentzVectors)
void DoMixingWithPools(Int_t poolIndex)
Int_t fNRotations
pt limits for acceptance step
TH1F * fHistCheckOriginSel
!hist. of origin (c/b) of D meson
Double_t fBayesThresKaon
flag to change PID strategy
Bool_t IsEventRejectedDueToTrigger() const
TH1F * fDeltaMass
! hist. mass difference after rotations
TObjArray * fKaonTracks
upper limit for multiplcities in MC histos
Int_t fPromptFeeddown
flag for access to MC
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Int_t GetUseCentrality() const
Double_t fMaxMultDiffForMix
cut on zvertex distance for event mixing with cuts
Double_t fMaxMass
minimum value of invariant mass
TH3F * fMassVsPtVsYMELSmm
! hist. of Y vs. Pt vs. Mass (mixedevents)
TH1F * fHistCheckDecChan
!hist. of decay channel of D meson
Double_t fmaxPforIDPion
knSigma, kBayesianMaxProb, kBayesianThres
TH3F * fMassVsPtVsYRefl
! hist. of Y vs. Pt vs. Mass (reflections)
Double_t * fMultPoolLims
number of pools in multiplicity for event mixing +1
Double_t fMaxAngleForRot3
minimum angle for track rotation (3rd prong)
void SetPidResponse(AliPIDResponse *pidResp)
TH3F * fMassVsPtVsYRot
! hist. of Y vs. Pt vs. Mass (rotations)
TH1F * fHistCheckOrigin
!hist. of origin (c/b) of D meson