30 #include "THnSparse.h"
33 #include "TClonesArray.h"
35 #include "TObjString.h"
39 #include "AliAODMCHeader.h"
40 #include "AliAODMCParticle.h"
41 #include "AliAODEvent.h"
42 #include "AliAODVertex.h"
43 #include "AliESDVertex.h"
44 #include "AliVTrack.h"
45 #include "AliAODTrack.h"
46 #include "AliVertexerTracks.h"
47 #include "AliExternalTrackParam.h"
48 #include "AliNeutralTrackParam.h"
57 , fCheckAcceptance(kTRUE)
58 , fResolveResonances(kTRUE)
67 , fNprongsInAcc((
UInt_t)-1)
68 , fFoundElectron(kFALSE)
70 , fGenerateDecayList(kFALSE)
81 , fCheckAcceptance(kTRUE)
82 , fResolveResonances(kTRUE)
91 , fNprongsInAcc((
UInt_t)-1)
92 , fFoundElectron(kFALSE)
94 , fGenerateDecayList(kFALSE)
107 :
TNamed(c.GetName(),c.GetTitle())
109 , fCheckAcceptance(c.fCheckAcceptance)
110 , fResolveResonances(c.fResolveResonances)
111 , fTHnGenStep(c.fTHnGenStep)
112 , fTHnData(c.fTHnData)
114 , fMCarray(c.fMCarray)
115 , fAODtracks(c.fAODtracks)
116 , fLabCand(c.fLabCand)
118 , fNprongs(c.fNprongs)
119 , fNprongsInAcc(c.fNprongsInAcc)
120 , fFoundElectron(c.fFoundElectron)
121 , fMotherPt(c.fMotherPt)
122 , fGenerateDecayList(c.fGenerateDecayList)
123 , fDecayProngs(c.fDecayProngs)
124 , fDecayStrList(c.fDecayStrList)
125 , fQAhists(c.fQAhists)
137 AliDebug(3,
"TODO: implement me!");
142 Int_t dimAxes[8]={500 ,96 ,200 ,100 , 200,100 , 100 ,100 };
143 Double_t min[8]={ 1.7, 0., 0., 0.99, 0., 0.99, 0. , 0. };
144 Double_t max[8]={ 2.2,24.,100., 1. ,100., 1. , 1.0, 1.0};
145 fTHnData=
new THnSparseF(
"fCutsDataFD",
"fCutsDataFD",8,dimAxes,min,max);
146 fTHnData->GetAxis(0)->SetName(
"mass");
147 fTHnData->GetAxis(0)->SetTitle(
"Mass (K,#pi) (GeV/#it{c^{2}})");
148 fTHnData->GetAxis(1)->SetName(
"pt");
149 fTHnData->GetAxis(1)->SetTitle(
"#it{p}_{T} (GeV/#it{c})");
150 fTHnData->GetAxis(2)->SetName(
"NormDecLengthXY");
151 fTHnData->GetAxis(2)->SetTitle(
"Normalized XY decay length");
152 fTHnData->GetAxis(3)->SetName(
"CosPointXY");
153 fTHnData->GetAxis(3)->SetTitle(
"Cos#theta_{point}^{XY}");
154 fTHnData->GetAxis(4)->SetName(
"NormDecLength");
155 fTHnData->GetAxis(4)->SetTitle(
"Normalized decay length");
156 fTHnData->GetAxis(5)->SetName(
"CosPoint");
157 fTHnData->GetAxis(5)->SetTitle(
"Cos#theta_{point}");
158 fTHnData->GetAxis(6)->SetName(
"DecLengthXY");
159 fTHnData->GetAxis(6)->SetTitle(
"XY decay length (cm)");
160 fTHnData->GetAxis(7)->SetName(
"DecLength");
161 fTHnData->GetAxis(7)->SetTitle(
"Decay length (cm)");
164 Int_t dimAxesMC[10]={96 ,200 ,100 ,20 ,24 ,200 ,100 ,100 ,100 ,2 };
165 Double_t minMC[10]={ 0., 0., 0.99, 0., 0., 0., 0.99, 0. , 0. ,0.};
166 Double_t maxMC[10]={24.,100., 1. ,20.,24.,100., 1. , 1.0, 1.0,2.};
167 fTHnMC=
new THnSparseF(
"fCutsMCFD",
"fCutsMCFD",10,dimAxesMC,minMC,maxMC);
168 fTHnMC->GetAxis(0)->SetName(
"pt");
169 fTHnMC->GetAxis(0)->SetTitle(
"#it{p}_{T} (GeV/#it{c})");
170 fTHnMC->GetAxis(1)->SetName(
"NormDecLengthXY");
171 fTHnMC->GetAxis(1)->SetTitle(
"Normalized XY decay length");
172 fTHnMC->GetAxis(2)->SetName(
"CosPointXY");
173 fTHnMC->GetAxis(2)->SetTitle(
"Cos#theta_{point}^{XY}");
174 fTHnMC->GetAxis(3)->SetName(
"nProngs");
175 fTHnMC->GetAxis(3)->SetTitle(
"Number of Decay Prongs");
176 fTHnMC->GetAxis(4)->SetName(
"Mother_pt");
177 fTHnMC->GetAxis(4)->SetTitle(
"Mother #it{p}_{T} (GeV/#it{c})");
178 fTHnMC->GetAxis(5)->SetName(
"NormDecLength");
179 fTHnMC->GetAxis(5)->SetTitle(
"Normalized decay length");
180 fTHnMC->GetAxis(6)->SetName(
"CosPoint");
181 fTHnMC->GetAxis(6)->SetTitle(
"Cos#theta_{point}");
182 fTHnMC->GetAxis(7)->SetName(
"DecLengthXY");
183 fTHnMC->GetAxis(7)->SetTitle(
"XY decay length (cm)");
184 fTHnMC->GetAxis(8)->SetName(
"DecLength");
185 fTHnMC->GetAxis(8)->SetTitle(
"Decay length (cm)");
186 fTHnMC->GetAxis(9)->SetName(
"ContainsElectron");
187 fTHnMC->GetAxis(9)->SetTitle(
"ContainsElectron");
189 Int_t dimAxesGen[6]={96 ,20 ,24 ,100 ,100 ,2 };
190 Double_t minGen[6]={ 0., 0., 0., 0., 0.,0.};
191 Double_t maxGen[6]={24.,20.,24., 1., 1.,2.};
192 fTHnGenStep=
new THnSparseF(
"fPtMCGenStep",
"fPtMCGenStep",6,dimAxesGen,minGen,maxGen);
194 fTHnGenStep->GetAxis(0)->SetTitle(
"#it{p}_{T} (GeV/#it{c})");
196 fTHnGenStep->GetAxis(1)->SetTitle(
"Number of Decay Prongs");
198 fTHnGenStep->GetAxis(2)->SetTitle(
"Mother #it{p}_{T} (GeV/#it{c})");
200 fTHnGenStep->GetAxis(3)->SetTitle(
"XY decay length (cm)");
202 fTHnGenStep->GetAxis(4)->SetTitle(
"Decay length (cm)");
203 fTHnGenStep->GetAxis(5)->SetName(
"ContainsElectron");
204 fTHnGenStep->GetAxis(5)->SetTitle(
"ContainsElectron");
206 fQAhists->Add(
new TH1F(
"hRapidityDist" ,
"All Particles;y;Counts (a.u.)" ,800,-4., 4. ));
207 fQAhists->Add(
new TH1F(
"hRapidityDistStable" ,
"All Stable Particles;y;Counts (a.u.)" ,800,-4., 4. ));
208 fQAhists->Add(
new TH2F(
"hDecayLengthB" ,
";D meson #it{p}_{T};Decay Length B Meson (cm);counts (a.u.)" , 24, 0.,24. , 200,0.,2.0 ));
209 fQAhists->Add(
new TH2F(
"hDecayLengthBxy" ,
";D meson #it{p}_{T};Decay Length B Meson in XY direction (cm);counts (a.u.)" , 24, 0.,24. , 200,0.,2.0 ));
210 fQAhists->Add(
new TH3F(
"hDCABhypothesis" ,
"All Particles;D meson #it{p}_{T};Distance of Closest Approach (cm);Impact parameter of D0 x track (cm^{2})" , 24, 0.,24. , 100,0.,1.0 ,100,0.,0.001));
211 fQAhists->Add(
new TH3F(
"hDCABprongs" ,
"Only Real B Decay Prongs;D meson #it{p}_{T};Distance of Closest Approach (cm);Impact parameter of D0 x track (cm^{2})" , 24, 0.,24. , 100,0.,1.0 ,100,0.,0.001));
212 fQAhists->Add(
new TH3F(
"hVtxDistBprongs" ,
"Only Real B Decay Prongs;D meson #it{p}_{T};Distance to Primary Vertex (cm);Error Distance to Primary Vertex (cm)" , 24, 0.,24. , 100,0.,1.0 ,100,0.,1.0 ));
213 fQAhists->Add(
new TH3F(
"hVtxDistXYBprongs" ,
"Only Real B Decay Prongs;D meson #it{p}_{T};Distance to Primary Vertex in XY (cm);Error Distance to Primary Vertex in XY (cm)", 24, 0.,24. , 100,0.,1.0 ,100,0.,1.0 ));
214 fQAhists->Add(
new TH3F(
"hVtxDistBhypothesis" ,
"All Particles;D meson #it{p}_{T};Distance to Primary Vertex (cm);Error Distance to Primary Vertex (cm)" , 24, 0.,24. , 100,0.,1.0 ,100,0.,1.0 ));
215 fQAhists->Add(
new TH3F(
"hVtxDistXYBhypthesis" ,
"All Particles;D meson #it{p}_{T};Distance to Primary Vertex in XY (cm);Error Distance to Primary Vertex in XY (cm)" , 24, 0.,24. , 100,0.,1.0 ,100,0.,1.0 ));
216 fQAhists->Add(
new TH2F(
"hNormVtxDistBprongs" ,
"Only Real B Decay Prongs;D meson #it{p}_{T};Distance to Primary Vertex (cm);counts (a.u.)" , 24, 0.,24. , 100,0.,1.0 ));
217 fQAhists->Add(
new TH2F(
"hNormVtxDistXYBprongs" ,
"Only Real B Decay Prongs;D meson #it{p}_{T};Distance to Primary Vertex in XY (cm);counts (a.u.)" , 24, 0.,24. , 100,0.,1.0 ));
218 fQAhists->Add(
new TH2F(
"hNormVtxDistBhypothesis" ,
"All Particles;D meson #it{p}_{T};Distance to Primary Vertex (cm);counts (a.u.)" , 24, 0.,24. , 100,0.,1.0 ));
219 fQAhists->Add(
new TH2F(
"hNormVtxDistXYBhypthesis",
"All Particles;D meson #it{p}_{T};Distance to Primary Vertex in XY (cm);counts (a.u.)" , 24, 0.,24. , 100,0.,1.0 ));
220 fQAhists->Add(
new TH2F(
"hVtxPrecision" ,
";#it{d}_{z}^{Vertex} (cm);#it{d}_{xyz}^{Vertex} (cm);counts (a.u.)" ,100, 0., 0.05,1000,0.,0.05 ));
221 fQAhists->Add(
new TH2F(
"hDecayLengthPrecision" ,
";D meson #it{p}_{T};Decay Length Residual (cm);counts (a.u.)" , 24, 0.,24. ,1000,0.,0.05 ));
222 fQAhists->Add(
new TH2F(
"hDecayLengthXYPrecision" ,
";D meson #it{p}_{T};XY decay Length Residual(cm);counts (a.u.)" , 24, 0.,24. ,1000,0.,0.05 ));
241 Double_t vtxDist[] = { mcHeader->GetVtxX()-((AliAODMCParticle*)mcArray->At(dzeropart->GetFirstDaughter()))->Xv(),
242 mcHeader->GetVtxY()-((AliAODMCParticle*)mcArray->At(dzeropart->GetFirstDaughter()))->Yv(),
243 mcHeader->GetVtxZ()-((AliAODMCParticle*)mcArray->At(dzeropart->GetFirstDaughter()))->Zv() };
244 Double_t decayLength = TMath::Sqrt(vtxDist[0]*vtxDist[0]+vtxDist[1]*vtxDist[1]+vtxDist[2]*vtxDist[2]);
245 Double_t decayLengthXY = TMath::Sqrt(vtxDist[0]*vtxDist[0]+vtxDist[1]*vtxDist[1]);
247 AliDebug(3,
"Error during the decay type determination!");
259 Double_t entry[] = {pt,0.,-1., 0., 0.};
270 fBkG =aodEvent->GetMagneticField();
271 fPriVtx =aodEvent->GetPrimaryVertex();
273 if(isSelected<=0||isSelected>3){
274 Printf(
"isSelected = %d", isSelected);
279 Printf(
"mass D0 =%f, massD0bar = %f ", massD0, massD0bar);
291 Double_t pointData[]={massD0,pt,normalDecayLengXY,cptangXY,normalDecayLeng,cptang,decayLengXY,decayLeng};
293 if(isSelected==1||isSelected==3){
296 if(isSelected==2||isSelected==3){
297 pointData[0]=massD0bar;
310 AliDebug(3,
"Error during the decay type determination!");
314 fTHnMC->Fill(pointMC, weight);
318 fPriVtx->GetY()-mcHeader->GetVtxY(),
319 fPriVtx->GetZ()-mcHeader->GetVtxZ() };
320 Int_t labDau0=((AliAODTrack*)
fD0Cand->GetDaughter(0))->GetLabel();
323 AliDebug(1,
"Negative Daughter label");
325 Double_t decLengMC3D[] = { mcHeader->GetVtxX()-((AliAODMCParticle*)mcArray->At(labDau0))->Xv(),
326 mcHeader->GetVtxY()-((AliAODMCParticle*)mcArray->At(labDau0))->Yv(),
327 mcHeader->GetVtxZ()-((AliAODMCParticle*)mcArray->At(labDau0))->Zv() };
328 Double_t decayLengMC = TMath::Sqrt(decLengMC3D[0]*decLengMC3D[0]+decLengMC3D[1]*decLengMC3D[1]+decLengMC3D[2]*decLengMC3D[2]);
329 Double_t decayLengXYMC = TMath::Sqrt(decLengMC3D[0]*decLengMC3D[0]+decLengMC3D[1]*decLengMC3D[1]);
332 ((
TH2F*)
fQAhists->At(14))->Fill(TMath::Sqrt(dist[2]*dist[2]),
333 TMath::Sqrt(dist[0]*dist[0]+dist[1]*dist[1]+dist[2]*dist[2]));
334 ((
TH2F*)
fQAhists->At(15))->Fill(pt, decayLengMC-decayLeng);
335 ((
TH2F*)
fQAhists->At(16))->Fill(pt, decayLengXYMC-decayLengXY);
347 Int_t labDau0=((AliAODTrack*)
fD0Cand->GetDaughter(0))->GetLabel();
350 AliDebug(1,
"Negative Daughter label");
352 AliAODMCParticle* firstDau=(AliAODMCParticle*)
fMCarray->UncheckedAt(labDau0);
357 AliDebug(3,
"Could not obtain the label of the candidate");
367 Int_t pdgMother = mother->GetPdgCode();
368 if (pdgMother<0) pdgMother*=-1;
369 if (pdgMother==4 || pdgMother==2212 || pdgMother==2112) {
374 if ((pdgMother%1000)/100==4 || (pdgMother%10000)/1000==4) {
380 if ((pdgMother%1000)/100!=5 && (pdgMother%10000)/1000!=5) {
381 AliDebug(3,
"Found strange decay, expected the mother to be a beauty hadron!");
388 if (generateString) {
396 TObjString* str =
new TObjString(decayStr);
405 if(!mother->XvYvZv(originB)) AliDebug(3,
"Couldn't determine MC origin of the beauty hadron");
407 if(!cand->XvYvZv(originD)) AliDebug(3,
"Couldn't determine MC origin of the charmed hadron");
408 decayLengthBxy = TMath::Sqrt((originB[0]-originD[0])*(originB[0]-originD[0])+
409 (originB[1]-originD[1])*(originB[1]-originD[1]));
410 decayLengthB = TMath::Sqrt(decayLengthBxy*decayLengthBxy+(originB[2]-originD[2])*(originB[2]-originD[2]));
415 for (
Int_t iAODtrack=0; iAODtrack<
fAODtracks->GetEntriesFast(); ++iAODtrack) {
426 for (
Int_t iMCParticle=0; iMCParticle<
fMCarray->GetEntriesFast(); ++iMCParticle) {
427 if (iMCParticle!=labCurrExcl) {
428 if (((AliAODMCParticle*)
fMCarray->UncheckedAt(iMCParticle))->GetMother()==labCurrMother) {
430 if (generateString)
fDecayProngs.push_back(((AliAODMCParticle*)
fMCarray->UncheckedAt(iMCParticle))->GetPdgCode());
433 for (
Int_t iAODtrack=0; iAODtrack<
fAODtracks->GetEntriesFast(); ++iAODtrack) {
434 AliAODTrack* aodTrack=(AliAODTrack*)
fAODtracks->UncheckedAt(iAODtrack);
442 else CountProngs(iMCParticle, -1, generateString, mcOnly);
448 if (generateString)
fDecayProngs.push_back(((AliAODMCParticle*)
fMCarray->UncheckedAt(iMCParticle))->GetPdgCode());
454 const Int_t stablePartPdgs[] = { 11, 13, 211, 321, 2212, 12, 14, 22, 111, 130 };
455 const Int_t nStablePartPdgs =
sizeof(stablePartPdgs)/
sizeof(
Int_t);
456 AliAODMCParticle* prong = (AliAODMCParticle*)
fMCarray->UncheckedAt(labProng);
457 Int_t pdgProng = prong->GetPdgCode();
458 if (pdgProng<0) pdgProng*=-1;
459 for (
Int_t iPdg=0; iPdg<nStablePartPdgs; ++iPdg) {
461 if (stablePartPdgs[iPdg] == pdgProng)
return kTRUE;
467 AliDebug(1,
"AliHFsubtractBFDcuts::IsInAcceptance(...) hasn't been implemented yet, prong");
471 if ((pt>0.15) && (eta>-0.9) && (eta<0.9) && (charge!=0))
return kTRUE;
476 AliExternalTrackParam* t =
new AliExternalTrackParam();
477 t->CopyFromVTrack((AliVTrack*)
fAODtracks->UncheckedAt(iAODtrack));
483 AliAODVertex* bVtx =
RecBvtx(tracks);
485 AliDebug(3,
"Couldn't reconstruct B meson vertex!");
499 t->PropagateToDCA(bVtx,
fBkG,maxD,dz,cov);
505 Double_t d0TrackErr=TMath::Sqrt(cov[0]);
508 Double_t d0D0CandErr=TMath::Sqrt(cov[0]);
528 delete tracks; tracks=0x0;
529 delete bVtx ; bVtx =0x0;
535 AliESDVertex* vtxESD=0x0;
536 AliVertexerTracks* vertexer =
new AliVertexerTracks(
fBkG);
537 vertexer->SetVtxStart((AliESDVertex*)
fPriVtx);
538 vtxESD = (AliESDVertex*)vertexer->VertexForSelectedESDTracks(tracks);
539 delete vertexer; vertexer=0x0;
540 if(!vtxESD || vtxESD->GetNContributors()!=tracks->GetEntriesFast()) {
541 AliDebug(3,
"Couldn't reconstruct B Meson vertex");
542 delete vtxESD; vtxESD=0x0;
545 Double_t rVtxSq=vtxESD->GetX()*vtxESD->GetX()+vtxESD->GetY()*vtxESD->GetY();
548 delete vtxESD; vtxESD=0x0;
554 vtxESD->GetCovMatrix(cov);
555 chi2perNDF=vtxESD->GetChi2toNDF();
556 delete vtxESD; vtxESD=0x0;
557 return new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,0);
Double_t NormalizedDecayLengthXY() const
Double_t NormalizedDecayLength() const
Bool_t AnalyseDecay(Bool_t generateString, Bool_t mcOnly)
Bool_t fIsMC
Method to check Whether the current D0 candidate and the track originate from a B decay...
THnSparseF * fTHnMC
! THnSparse for cut variables (MC at PID level, w/o mass axis)y
AliAODVertex * RecBvtx(TObjArray *tracks) const
Is that prong within the fiducial acceptance.
THnSparseF * fTHnGenStep
flag resolve resonances in during the prong determination
Double_t fPtCand
Label of the candidate D0 (charmed hadron in case of a chained decay)
Class for storing and handling D0 meson candidates properties // for estimating the feed-down fractio...
std::vector< Int_t > fDecayProngs
Generate the list containig strings with all PDG codes of the decay prongs.
Double_t CosPointingAngleXY() const
AliAODRecoDecayHF2Prong * fD0Cand
Magnetic field (z-direction) in units of kG.
Double_t InvMassD0() const
AliNeutralTrackParam * fD0CandParam
Pointer to the D0 candidate from reconstruction.
Int_t fLabMother
pT of the candidate (from MC track, not following decay chain)
Bool_t fCheckAcceptance
flag for MC/Data
TClonesArray * fAODtracks
! TClonesArray holding the AliAODTracks of the event to be processed
AliAODVertex * fPriVtx
! Primary AOD vertex
Bool_t fGenerateDecayList
TList * fQAhists
! List with QA histograms
TList * fDecayStrList
PDG codes of the daughters separated.
Bool_t fFoundElectron
Number of prongs, counting only the particles within acceptance.
TClonesArray * fMCarray
Event specific variables.
UInt_t fNprongsInAcc
Number of prongs, counting the first charmed hadron as one particle (simulation cuts can lead to loss...
UInt_t fNprongs
Label of the mother of the candidate D0 (or charmed hadron)
void CountProngs(Int_t labCurrMother, Int_t labCurrExcl, Bool_t generateString, Bool_t mConly)
check in which decay process a particle was created
Double_t fMotherPt
Chained decay of charmed hadrons.
Double_t DecayLengthXY() const
Bool_t fResolveResonances
flag for checking whether the decay prongs are within acceptance
Bool_t IsStable(Int_t labProng)
counting the prongs of labCurrMother, labCurrExcl is assumed to be a stable particle ...
Bool_t fDecayChain
Does the B meson decay contain an electron?
Bool_t IsInAcceptance(Int_t labProng) const
Is that prong a stable particle?
void FillSparses(AliAODRecoDecayHF2Prong *dzeroPart, Int_t isSelected, Double_t pt=-1, Double_t massD0=-1, Double_t massD0bar=-1, Double_t weight=1., TClonesArray *mcArray=0x0, AliAODEvent *aodEvent=0x0, AliAODMCHeader *mcHeader=0x0)
AliHFsubtractBFDcuts operator=(const AliHFsubtractBFDcuts &c)
void FillGenStep(AliAODMCParticle *dzeroMC, Double_t pt=-1, Double_t weight=1., TClonesArray *mcArray=0x0, AliAODMCHeader *mcHeader=0x0)
Bool_t GetCandidateLabel()
Int_t fLabCand
Pointer to an AliNeutralTrackParam of the D0 candidata for DCA calculation.
Double_t CosPointingAngle() const
Double_t DecayLength() const
THnSparseF * fTHnData
! THnSparse for cut variables (data, with inv mass axis), first axis is always mass ...
Bool_t CheckBhypothesis(Int_t iAODtrack, Bool_t Bprong)
Reconstruct a secondary vertex with the supplied tracks.