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),
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());
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);
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};
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.);
519 fEventBuffer[i]=
new TTree(Form(
"EventBuffer_%d",i),
"Temporary buffer for event mixing");
536 if(!aod && AODEvent() && IsStandardAOD()) {
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)){
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;
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;
670 AliAODVertex* v2=
new AliAODVertex(dummypos,999.,-1,2);
671 AliAODVertex* v3=
new AliAODVertex(dummypos,999.,-1,3);
675 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
676 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
678 UInt_t pdgp[3]={321,211,211};
679 UInt_t pdgs[3]={321,211,321};
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);
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();
756 if(chargePi1==chargeK && chargePi2==chargeK){
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);
821 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
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;
896 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
898 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
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));
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])));
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);
971 massRot=TMath::Sqrt(minv2);
984 if(pdgD==411 || pdgD==431){
998 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1000 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1015 tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1017 Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1033 if(track->Charge()==0)
return kFALSE;
1034 if(track->GetID()<0&&!
fKeepNegID)
return kFALSE;
1036 if(!(track->TestFilterMask(
fFilterMask)))
return kFALSE;
1046 if(!
fPidHF)
return kTRUE;
1050 if(isKaon>=1)
return kTRUE;
1051 if(isKaon<=-1)
return kFALSE;
1068 if(nsigma>-2.&& nsigma<3. && mom<0.6)isKaon=1;
1069 else if(nsigma>-1.&& nsigma<3.&& mom<0.8)isKaon=1;
1070 if(isKaon==1)
return kTRUE;
1075 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1087 if(!
fPidHF)
return kTRUE;
1091 if(isPion>=1)
return kTRUE;
1092 if(isPion<=-1)
return kFALSE;
1110 if(nsigma<2.&& nsigma>-3. && mom<0.6)isPion=1;
1111 else if(nsigma<1. && nsigma> -3. && mom<0.8)isPion=1;
1112 if(isPion==1)
return kTRUE;
1117 AliWarning(Form(
"WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",
fPIDselCaseZero));
1130 if(!cuts)
return kTRUE;
1132 AliESDtrack esdTrack(track);
1134 esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1135 esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1136 esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1137 if(!cuts->IsSelected(&esdTrack))
return kFALSE;
1145 for (
Int_t iProng = 0; iProng<nProng; iProng++){
1146 AliAODMCParticle* mcPartDaughter=
dynamic_cast<AliAODMCParticle*
>(arrayMC->At(labDau[iProng]));
1147 if(!mcPartDaughter)
return kFALSE;
1148 Double_t eta = mcPartDaughter->Eta();
1149 Double_t pt = mcPartDaughter->Pt();
1167 if(poolIndex<0 || poolIndex>=
fNOfPools)
return;
1169 fEventBuffer[poolIndex]=
new TTree(Form(
"EventBuffer_%d",poolIndex),
"Temporary buffer for event mixing");
1190 if(fDebug > 1) printf(
"AnalysisTaskCombinHF::DoMixingWithCuts Start Event Mixing of %d events\n",nEvents);
1195 TObjString* eventInfo=0x0;
1198 fEventBuffer[0]->SetBranchAddress(
"eventInfo",&eventInfo);
1199 fEventBuffer[0]->SetBranchAddress(
"zVertex", &zVertex);
1200 fEventBuffer[0]->SetBranchAddress(
"multiplicity", &mult);
1203 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1204 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1205 UInt_t pdg0[2]={321,211};
1208 Int_t evId1,esdId1,nk1,np1;
1209 Int_t evId2,esdId2,nk2,np2;
1216 Int_t nKaons=karray1->GetEntries();
1217 Int_t nPionsForCheck=parray->GetEntries();
1218 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1219 if(nk1!=nKaons || np1!=nPionsForCheck){
1220 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1225 Int_t iToMix=iEv1+iEv2+1;
1226 if(iEv1>=(nEvents-fNumberOfEventsForMixing)) iToMix=iEv1-iEv2-1;
1227 if(iToMix<0)
continue;
1228 if(iToMix==iEv1)
continue;
1229 if(iToMix<iEv1)
continue;
1233 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1234 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1238 Int_t nPions=parray2->GetEntries();
1239 Int_t nKaonsForCheck=karray->GetEntries();
1240 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1241 if(nk2!=nKaonsForCheck || np2!=nPions){
1242 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1246 if(evId2==evId1 && esdId2==esdId1){
1247 printf(
"AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1251 if(
CanBeMixed(zVertex1,zVertex2,mult1,mult2)){
1252 for(
Int_t iTr1=0; iTr1<nKaons; iTr1++){
1253 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1258 for(
Int_t iTr2=0; iTr2<nPions; iTr2++){
1259 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1261 px[1] = trPi1->Px();
1262 py[1] = trPi1->Py();
1263 pz[1] = trPi1->Pz();
1288 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools Start Event Mixing of %d events\n",nEvents);
1292 TObjString* eventInfo=0x0;
1293 fEventBuffer[poolIndex]->SetBranchAddress(
"karray", &karray);
1294 fEventBuffer[poolIndex]->SetBranchAddress(
"parray", &parray);
1295 fEventBuffer[poolIndex]->SetBranchAddress(
"eventInfo",&eventInfo);
1296 fEventBuffer[poolIndex]->SetBranchAddress(
"zVertex", &zVertex);
1297 fEventBuffer[poolIndex]->SetBranchAddress(
"multiplicity", &mult);
1302 AliAODRecoDecay* tmpRD2 =
new AliAODRecoDecay(0x0,2,0,d02);
1303 AliAODRecoDecay* tmpRD3 =
new AliAODRecoDecay(0x0,3,1,d03);
1304 UInt_t pdg0[2]={321,211};
1305 UInt_t pdgp[3]={321,211,211};
1306 UInt_t pdgs[3]={321,211,321};
1308 Int_t evId1,esdId1,nk1,np1;
1309 Int_t evId2,esdId2,nk2,np2;
1316 Int_t nKaons=karray1->GetEntries();
1317 Int_t nPionsForCheck=parray->GetEntries();
1318 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1319 if(nk1!=nKaons || np1!=nPionsForCheck){
1320 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1325 if(iEv2==iEv1)
continue;
1329 if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1330 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1334 Int_t nPions=parray2->GetEntries();
1335 Int_t nKaonsForCheck=karray->GetEntries();
1336 sscanf((eventInfo->String()).
Data(),
"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1337 if(nk2!=nKaonsForCheck || np2!=nPions){
1338 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1342 if(evId2==evId1 && esdId2==esdId1){
1343 printf(
"AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1351 if(iEv3==iEv1) iEv3=iEv2+2;
1352 if(iEv3>=nEvents) iEv3=iEv2-3;
1353 if(nEvents==2) iEv3=iEv1;
1354 if(iEv3<0) iEv3=iEv2-1;
1357 nPions3=parray3->GetEntries();
1359 for(
Int_t iTr1=0; iTr1<nKaons; iTr1++){
1360 TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1365 for(
Int_t iTr2=0; iTr2<nPions; iTr2++){
1366 TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1368 px[1] = trPi1->Px();
1369 py[1] = trPi1->Py();
1370 pz[1] = trPi1->Pz();
1371 if(chargePi1*chargeK<0){
1376 for(
Int_t iTr3=iTr2+1; iTr3<nPions3; iTr3++){
1377 TLorentzVector* trPi2=(TLorentzVector*)parray3->At(iTr3);
1379 px[2] = trPi2->Px();
1380 py[2] = trPi2->Py();
1381 pz[2] = trPi2->Pz();
1382 if(chargePi2*chargeK<0){
1389 }
else if(chargePi1*chargeK>0){
1407 printf(
"AliAnalysisTaskCombinHF: FinishTaskOutput\n");
1421 Double_t massK=TDatabasePDG::Instance()->GetParticle(321)->Mass();
1424 Double_t pxtot=tr1->Px()+tr2->Px();
1425 Double_t pytot=tr1->Py()+tr2->Py();
1426 Double_t pztot=tr1->Pz()+tr2->Pz();
1427 Double_t e1=TMath::Sqrt(massK*massK+p1*p1);
1428 Double_t e2=TMath::Sqrt(massK*massK+p2*p2);
1430 Double_t m2=etot*etot-(pxtot*pxtot+pytot*pytot+pztot*pztot);
1431 return TMath::Sqrt(m2);
1438 if(fDebug > 1) printf(
"AliAnalysisTaskCombinHF: Terminate() \n");
1441 printf(
"ERROR: fOutput not available\n");
1446 printf(
"Number of analyzed events = %d\n",(
Int_t)
fHistNEvents->GetBinContent(2));
1448 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)
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
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
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