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"
54 fHistEventMultZv(0x0),
55 fHistEventMultZvEvSel(0x0),
56 fHistTrackStatus(0x0),
57 fHistTrackEtaMultZv(0x0),
58 fHistCheckOrigin(0x0),
59 fHistCheckOriginSel(0x0),
60 fHistCheckDecChan(0x0),
61 fHistCheckDecChanAcc(0x0),
63 fPtVsYVsMultGenLargeAcc(0x0),
64 fPtVsYVsMultGenLimAcc(0x0),
65 fPtVsYVsMultGenAcc(0x0),
66 fPtVsYVsMultGenAccEvSel(0x0),
67 fPtVsYVsMultReco(0x0),
70 fMassVsPtVsYLSpp(0x0),
71 fMassVsPtVsYLSmm(0x0),
73 fMassVsPtVsYRefl(0x0),
78 fDeltaMassFullAnalysis(0x0),
80 fMassVsPtVsYMELSpp(0x0),
81 fMassVsPtVsYMELSmm(0x0),
89 fCutCos3PiKPhiRFrame(-1.1),
90 fCutCosPiDsLabFrame(1.1),
100 fMinAngleForRot(5*TMath::Pi()/6),
101 fMaxAngleForRot(7*TMath::Pi()/6),
103 fMinAngleForRot3(2*TMath::Pi()/6),
104 fMaxAngleForRot3(4*TMath::Pi()/6),
108 fPromptFeeddown(kPrompt),
111 fPIDstrategy(knSigma),
116 fBayesThresKaon(0.4),
117 fBayesThresPion(0.4),
119 fNumberOfEventsForMixing(20),
120 fMaxzVertDistForMix(5.),
121 fMaxMultDiffForMix(5.),
123 fNzVertPoolsLimSize(2),
126 fNMultPoolsLimSize(2),
130 fEventInfo(new TObjString(
"")),
133 fMinMultiplicity(-0.5),
134 fMaxMultiplicity(199.5),
146 fHistEventMultZv(0x0),
147 fHistEventMultZvEvSel(0x0),
148 fHistTrackStatus(0x0),
149 fHistTrackEtaMultZv(0x0),
150 fHistCheckOrigin(0x0),
151 fHistCheckOriginSel(0x0),
152 fHistCheckDecChan(0x0),
153 fHistCheckDecChanAcc(0x0),
154 fPtVsYVsMultGen(0x0),
155 fPtVsYVsMultGenLargeAcc(0x0),
156 fPtVsYVsMultGenLimAcc(0x0),
157 fPtVsYVsMultGenAcc(0x0),
158 fPtVsYVsMultGenAccEvSel(0x0),
159 fPtVsYVsMultReco(0x0),
161 fMassVsPtVsYRot(0x0),
162 fMassVsPtVsYLSpp(0x0),
163 fMassVsPtVsYLSmm(0x0),
164 fMassVsPtVsYSig(0x0),
165 fMassVsPtVsYRefl(0x0),
166 fMassVsPtVsYBkg(0x0),
170 fDeltaMassFullAnalysis(0x0),
172 fMassVsPtVsYMELSpp(0x0),
173 fMassVsPtVsYMELSmm(0x0),
175 fMixingsPerPool(0x0),
181 fCutCos3PiKPhiRFrame(-1),
182 fCutCosPiDsLabFrame(1.1),
184 fAnalysisCuts(analysiscuts),
192 fMinAngleForRot(5*TMath::Pi()/6),
193 fMaxAngleForRot(7*TMath::Pi()/6),
195 fMinAngleForRot3(2*TMath::Pi()/6),
196 fMaxAngleForRot3(4*TMath::Pi()/6),
203 fPIDstrategy(knSigma),
208 fBayesThresKaon(0.4),
209 fBayesThresPion(0.4),
211 fNumberOfEventsForMixing(20),
212 fMaxzVertDistForMix(5.),
213 fMaxMultDiffForMix(5.),
215 fNzVertPoolsLimSize(2),
218 fNMultPoolsLimSize(2),
222 fEventInfo(new TObjString(
"")),
225 fMinMultiplicity(-0.5),
226 fMaxMultiplicity(199.5),
232 DefineOutput(1,TList::Class());
233 DefineOutput(2,AliNormalizationCounter::Class());
322 if(fDebug > 1) printf(
"AnalysisTaskCombinHF::UserCreateOutputObjects() \n");
326 fOutput->SetName(
"OutputHistos");
328 fHistNEvents =
new TH1F(
"hNEvents",
"number of events ",9,-0.5,8.5);
330 fHistNEvents->GetXaxis()->SetBinLabel(2,
"n. passing IsEvSelected");
331 fHistNEvents->GetXaxis()->SetBinLabel(3,
"n. rejected due to trigger");
332 fHistNEvents->GetXaxis()->SetBinLabel(4,
"n. rejected due to phys sel");
333 fHistNEvents->GetXaxis()->SetBinLabel(5,
"n. rejected due to not reco vertex");
334 fHistNEvents->GetXaxis()->SetBinLabel(6,
"n. rejected for contr vertex");
335 fHistNEvents->GetXaxis()->SetBinLabel(7,
"n. rejected for vertex out of accept");
336 fHistNEvents->GetXaxis()->SetBinLabel(8,
"n. rejected for pileup events");
337 fHistNEvents->GetXaxis()->SetBinLabel(9,
"no. of out centrality events");
364 fHistTrackEtaMultZv =
new TH3F(
"hTrackEtaMultZv",
"",40,-1.,1.,30,-15.,15.,200,
fMinMultiplicity,
fMaxMultiplicity);
392 fPtVsYVsMultGen=
new TH3F(
"hPtVsYVsMultGen",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
397 fPtVsYVsMultGenLargeAcc=
new TH3F(
"hPtVsYVsMultGenLargeAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
402 fPtVsYVsMultGenLimAcc=
new TH3F(
"hPtVsYVsMultGenLimAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
407 fPtVsYVsMultGenAcc=
new TH3F(
"hPtVsYVsMultGenAcc",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
412 fPtVsYVsMultGenAccEvSel=
new TH3F(
"hPtVsYVsMultGenAccEvSel",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
417 fPtVsYVsMultReco=
new TH3F(
"hPtVsYVsMultReco",
"",nPtBins,0.,maxPt,20,-1.,1.,200,
fMinMultiplicity,
fMaxMultiplicity);
426 fMassVsPtVsY=
new TH3F(
"hMassVsPtVsY",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
431 fMassVsPtVsYRot=
new TH3F(
"hMassVsPtVsYRot",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
436 fMassVsPtVsYLSpp=
new TH3F(
"hMassVsPtVsYLSpp",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
440 fMassVsPtVsYLSmm=
new TH3F(
"hMassVsPtVsYLSmm",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
445 fMassVsPtVsYSig=
new TH3F(
"hMassVsPtVsYSig",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
450 fMassVsPtVsYRefl=
new TH3F(
"hMassVsPtVsYRefl",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
455 fMassVsPtVsYBkg=
new TH3F(
"hMassVsPtVsYBkg",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
460 fNSelected=
new TH1F(
"hNSelected",
"",100,-0.5,99.5);
470 fDeltaMass=
new TH1F(
"hDeltaMass",
"",100,-0.4,0.4);
475 Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
477 Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
478 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);
481 fMassVsPtVsYME=
new TH3F(
"hMassVsPtVsYME",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
486 fMassVsPtVsYMELSpp=
new TH3F(
"hMassVsPtVsYMELSpp",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
491 fMassVsPtVsYMELSmm=
new TH3F(
"hMassVsPtVsYMELSmm",
"",nMassBins,
fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
524 fEventBuffer[i]=
new TTree(Form(
"EventBuffer_%d",i),
"Temporary buffer for event mixing");
541 if(!aod && AODEvent() && IsStandardAOD()) {
547 printf(
"AliAnalysisTaskCombinHF::UserExec: AOD not found!\n");
553 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001)
return;
559 Int_t runnumber = aod->GetRunNumber();
560 if(aod->GetTriggerMask()==0 &&
561 (runnumber>=195344 && runnumber<=195677)){
567 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
568 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
599 Int_t ntracks=aod->GetNumberOfTracks();
600 fVtxZ = aod->GetPrimaryVertex()->GetZ();
603 TClonesArray *arrayMC=0;
604 AliAODMCHeader *mcHeader=0;
606 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
608 printf(
"AliAnalysisTaskCombinHF::UserExec: MC particles branch not found!\n");
613 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
615 printf(
"AliAnalysisTaskCombinHF::UserExec: MC header branch not found!\n");
618 Double_t zMCVertex = mcHeader->GetVtxZ();
636 UChar_t* status =
new UChar_t[ntracks];
637 for(
Int_t iTr=0; iTr<ntracks; iTr++){
639 AliAODTrack* track=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr));
641 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
649 if(
IsKaon(track)) status[iTr]+=2;
650 if(
IsPion(track)) status[iTr]+=4;
657 if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kKaon]) status[iTr] += 2;
658 if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kPion]) status[iTr] += 4;
675 AliAODVertex* v2=
new AliAODVertex(dummypos,999.,-1,2);
676 AliAODVertex* v3=
new AliAODVertex(dummypos,999.,-1,3);
680 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
681 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
683 UInt_t pdgp[3]={321,211,211};
684 UInt_t pdgs[3]={321,211,321};
691 for(
Int_t iTr1=0; iTr1<ntracks; iTr1++){
692 AliAODTrack* trK=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr1));
694 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
697 if((status[iTr1] & 1)==0)
continue;
699 if(status[iTr1] & 2)
fKaonTracks->AddLast(
new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
700 if(status[iTr1] & 4)
fPionTracks->AddLast(
new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
702 if((status[iTr1] & 2)==0)
continue;
703 Int_t chargeK=trK->Charge();
704 trK->GetPxPyPz(tmpp);
708 dgLabels[0]=trK->GetLabel();
709 for(
Int_t iTr2=0; iTr2<ntracks; iTr2++){
710 if((status[iTr2] & 1)==0)
continue;
711 if((status[iTr2] & 4)==0)
continue;
712 if(iTr1==iTr2)
continue;
713 AliAODTrack* trPi1=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr2));
715 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
718 Int_t chargePi1=trPi1->Charge();
719 trPi1->GetPxPyPz(tmpp);
723 dgLabels[1]=trPi1->GetLabel();
725 if(chargePi1==chargeK){
731 v2->AddDaughter(trK);
732 v2->AddDaughter(trPi1);
733 tmpRD2->SetSecondaryVtx(v2);
735 v2->RemoveDaughters();
739 for(
Int_t iTr3=iTr2+1; iTr3<ntracks; iTr3++){
740 if((status[iTr3] & 1)==0)
continue;
742 if(
fMeson==
kDs && (status[iTr3] & 2)==0)
continue;
743 if(iTr1==iTr3)
continue;
744 AliAODTrack* trPi2=
dynamic_cast<AliAODTrack*
>(aod->GetTrack(iTr3));
746 AliWarning(
"Error in casting track to AOD track. Not a standard AOD?");
749 Int_t chargePi2=trPi2->Charge();
750 trPi2->GetPxPyPz(tmpp);
754 dgLabels[2]=trPi2->GetLabel();
757 Double_t deltaMass=massKK-TDatabasePDG::Instance()->GetParticle(333)->Mass();
759 tmpRD3->SetPxPyPzProngs(3,px,py,pz);
761 Double_t kincutPiKPhi=TMath::Abs(cos1*cos1*cos1);
767 if(chargePi1==chargeK && chargePi2==chargeK){
774 if(chargePi1!=chargeK && chargePi2!=chargeK)acceptOS=kTRUE;
776 if(chargePi2!=chargeK && !isThreeLS) acceptOS=kTRUE;
780 v3->AddDaughter(trK);
781 v3->AddDaughter(trPi1);
782 v3->AddDaughter(trPi2);
783 tmpRD3->SetSecondaryVtx(v3);
787 v3->RemoveDaughters();
805 fEventInfo->SetString(Form(
"Ev%d_esd%d_Pi%d_K%d",mgr->GetNcalls(),((AliAODHeader*)aod->GetHeader())->GetEventNumberESDFile(),
fPionTracks->GetEntries(),
fKaonTracks->GetEntries()));
830 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
832 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
846 Int_t totPart=arrayMC->GetEntriesFast();
856 for(
Int_t ip=0; ip<totPart; ip++){
857 AliAODMCParticle *part = (AliAODMCParticle*)arrayMC->At(ip);
858 if(TMath::Abs(part->GetPdgCode())==thePDG){
866 Bool_t isGoodDecay=kFALSE;
867 Int_t labDau[4]={-1,-1,-1,-1};
870 if(part->GetNDaughters()!=2)
continue;
871 if(deca==1) isGoodDecay=kTRUE;
874 if(deca>0) isGoodDecay=kTRUE;
877 if(deca==1) isGoodDecay=kTRUE;
907 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
909 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
918 Int_t signPdg[3]={0,0,0};
919 for(
Int_t iii=0; iii<nProngs; iii++) signPdg[iii]=pdgdau[iii];
920 Int_t labD = tmpRD->MatchToMC(pdgD,arrayMC,nProngs,signPdg);
922 AliAODMCParticle* part =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(TMath::Abs(dgLabels[0])));
927 Int_t pdgCode = TMath::Abs( part->GetPdgCode() );
930 AliAODMCParticle* dmes =
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(labD));
949 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])));
951 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])));
968 px[0]=tmpx*TMath::Cos(phirot)-tmpy*TMath::Sin(phirot);
969 py[0]=tmpx*TMath::Sin(phirot)+tmpy*TMath::Cos(phirot);
971 if(pdgD==411 || pdgD==431){
973 px[2]=tmpx*TMath::Cos(phirot2)-tmpy*TMath::Sin(phirot2);
974 py[2]=tmpx*TMath::Sin(phirot2)+tmpy*TMath::Cos(phirot2);
976 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
978 minv2 = tmpRD->InvMass2(nProngs,pdgdau);
982 massRot=TMath::Sqrt(minv2);
995 if(pdgD==411 || pdgD==431){
1009 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1011 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1026 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1028 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1044 if(track->Charge()==0)
return kFALSE;
1045 if(track->GetID()<0&&!
fKeepNegID)
return kFALSE;
1047 if(!(track->TestFilterMask(
fFilterMask)))
return kFALSE;
1057 if(!
fPidHF)
return kTRUE;
1061 if(isKaon>=1)
return kTRUE;
1062 if(isKaon<=-1)
return kFALSE;
1079 if(nsigma>-2.&& nsigma<3. && mom<0.6)isKaon=1;
1080 else if(nsigma>-1.&& nsigma<3.&& mom<0.8)isKaon=1;
1081 if(isKaon==1)
return kTRUE;
1086 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1098 if(!
fPidHF)
return kTRUE;
1102 if(isPion>=1)
return kTRUE;
1103 if(isPion<=-1)
return kFALSE;
1121 if(nsigma<2.&& nsigma>-3. && mom<0.6)isPion=1;
1122 else if(nsigma<1. && nsigma> -3. && mom<0.8)isPion=1;
1123 if(isPion==1)
return kTRUE;
1128 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1141 if(!cuts)
return kTRUE;
1143 AliESDtrack esdTrack(track);
1145 esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1146 esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1147 esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1148 if(!cuts->IsSelected(&esdTrack))
return kFALSE;
1156 for (
Int_t iProng = 0; iProng<nProng; iProng++){
1157 AliAODMCParticle* mcPartDaughter=
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(labDau[iProng]));
1158 if(!mcPartDaughter)
return kFALSE;
1159 Double_t eta = mcPartDaughter->Eta();
1160 Double_t pt = mcPartDaughter->Pt();
1178 if(poolIndex<0 || poolIndex>=
fNOfPools)
return;
1180 fEventBuffer[poolIndex]=
new TTree(Form(
"EventBuffer_%d",poolIndex),
"Temporary buffer for event mixing");
1201 if(fDebug > 1) printf(
"AnalysisTaskCombinHF::DoMixingWithCuts Start Event Mixing of %d events\n",nEvents);
1206 TObjString* eventInfo=0x0;
1209 fEventBuffer[0]->SetBranchAddress(
"eventInfo",&eventInfo);
1210 fEventBuffer[0]->SetBranchAddress(
"zVertex", &zVertex);
1211 fEventBuffer[0]->SetBranchAddress(
"multiplicity", &mult);
1214 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1215 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1216 UInt_t pdg0[2]={321,211};
1219 Int_t evId1,esdId1,nk1,np1;
1220 Int_t evId2,esdId2,nk2,np2;
1227 Int_t nKaons=karray1->GetEntries();
1228 Int_t nPionsForCheck=parray->GetEntries();
1229 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1230 if(nk1!=nKaons || np1!=nPionsForCheck){
1231 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1236 Int_t iToMix=iEv1+iEv2+1;
1237 if(iEv1>=(nEvents-fNumberOfEventsForMixing)) iToMix=iEv1-iEv2-1;
1238 if(iToMix<0)
continue;
1239 if(iToMix==iEv1)
continue;
1240 if(iToMix<iEv1)
continue;
1244 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1245 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1249 Int_t nPions=parray2->GetEntries();
1250 Int_t nKaonsForCheck=karray->GetEntries();
1251 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1252 if(nk2!=nKaonsForCheck || np2!=nPions){
1253 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1257 if(evId2==evId1 && esdId2==esdId1){
1258 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1262 if(
CanBeMixed(zVertex1,zVertex2,mult1,mult2)){
1263 for(
Int_t iTr1=0; iTr1<nKaons; iTr1++){
1264 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1269 for(
Int_t iTr2=0; iTr2<nPions; iTr2++){
1270 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1272 px[1] = trPi1->Px();
1273 py[1] = trPi1->Py();
1274 pz[1] = trPi1->Pz();
1299 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools Start Event Mixing of %d events\n",nEvents);
1303 TObjString* eventInfo=0x0;
1304 fEventBuffer[poolIndex]->SetBranchAddress(
"karray", &karray);
1305 fEventBuffer[poolIndex]->SetBranchAddress(
"parray", &parray);
1306 fEventBuffer[poolIndex]->SetBranchAddress(
"eventInfo",&eventInfo);
1307 fEventBuffer[poolIndex]->SetBranchAddress(
"zVertex", &zVertex);
1308 fEventBuffer[poolIndex]->SetBranchAddress(
"multiplicity", &mult);
1313 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1314 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1315 UInt_t pdg0[2]={321,211};
1316 UInt_t pdgp[3]={321,211,211};
1317 UInt_t pdgs[3]={321,211,321};
1319 Int_t evId1,esdId1,nk1,np1;
1320 Int_t evId2,esdId2,nk2,np2;
1327 Int_t nKaons=karray1->GetEntries();
1328 Int_t nPionsForCheck=parray->GetEntries();
1329 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1330 if(nk1!=nKaons || np1!=nPionsForCheck){
1331 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1336 if(iEv2==iEv1)
continue;
1340 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1341 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1345 Int_t nPions=parray2->GetEntries();
1346 Int_t nKaonsForCheck=karray->GetEntries();
1347 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1348 if(nk2!=nKaonsForCheck || np2!=nPions){
1349 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1353 if(evId2==evId1 && esdId2==esdId1){
1354 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1362 if(iEv3==iEv1) iEv3=iEv2+2;
1363 if(iEv3>=nEvents) iEv3=iEv2-3;
1364 if(nEvents==2) iEv3=iEv1;
1365 if(iEv3<0) iEv3=iEv2-1;
1368 nPions3=parray3->GetEntries();
1370 for(
Int_t iTr1=0; iTr1<nKaons; iTr1++){
1371 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1376 for(
Int_t iTr2=0; iTr2<nPions; iTr2++){
1377 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1379 px[1] = trPi1->Px();
1380 py[1] = trPi1->Py();
1381 pz[1] = trPi1->Pz();
1382 if(chargePi1*chargeK<0){
1387 for(
Int_t iTr3=iTr2+1; iTr3<nPions3; iTr3++){
1388 TLorentzVector* trPi2=(TLorentzVector*)parray3->At(iTr3);
1390 px[2] = trPi2->Px();
1391 py[2] = trPi2->Py();
1392 pz[2] = trPi2->Pz();
1393 if(chargePi2*chargeK<0){
1400 }
else if(chargePi1*chargeK>0){
1418 printf(
"AliAnalysisTaskCombinHF: FinishTaskOutput\n");
1432 Double_t massK=TDatabasePDG::Instance()->GetParticle(321)->Mass();
1435 Double_t pxtot=tr1->Px()+tr2->Px();
1436 Double_t pytot=tr1->Py()+tr2->Py();
1437 Double_t pztot=tr1->Pz()+tr2->Pz();
1438 Double_t e1=TMath::Sqrt(massK*massK+p1*p1);
1439 Double_t e2=TMath::Sqrt(massK*massK+p2*p2);
1441 Double_t m2=etot*etot-(pxtot*pxtot+pytot*pytot+pztot*pztot);
1442 return TMath::Sqrt(m2);
1449 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF: Terminate() \n");
1452 printf(
"ERROR: fOutput not available\n");
1457 printf(
"Number of analyzed events = %d\n",(
Int_t)
fHistNEvents->GetBinContent(2));
1459 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)
static Int_t CheckD0Decay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
void ResetPool(Int_t poolIndex)
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)
static Int_t CheckDplusDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
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
Double_t fCutCos3PiKPhiRFrame
cut on the KK inv mass for phi selection
virtual ~AliAnalysisTaskCombinHF()
void FillMEHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau)
static Int_t CheckDsDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
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
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)
Functions to check the decay tree.
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
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)
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
Double_t nEvents
plot quality messages
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)
Double_t fCutCosPiDsLabFrame
void SetPidResponse(AliPIDResponse *pidResp)
TH3F * fMassVsPtVsYRot
! hist. of Y vs. Pt vs. Mass (rotations)
TH1F * fHistCheckOrigin
!hist. of origin (c/b) of D meson