9 #include "FairRootManager.h"
10 #include "FairRunAna.h"
11 #include "FairRuntimeDb.h"
13 #include "FairRuntimeDb.h"
16 #include "TClonesArray.h"
17 #include "TLorentzVector.h"
43 FairTask(
"Panda LLbar Analysis Task") {
86 hprob_4c =
new TH1F(
"hprob_4c",
"#Lambda_{0}#Lambda_{0}bar Prob 4C fit",100,0,1);
87 hchi2_4c =
new TH1F(
"hchi2_4c",
"#Lambda_{0}#Lambda_{0}bar #chi^{2} 4C fit",100,0,250);
90 hlam0_M_all =
new TH1F(
"hlam0_M_all",
"#Lambda_{0} mass",100,0,5);
91 hlam0_M_4c =
new TH1F(
"hlam0_M_4c",
"#Lambda_{0} mass, with 4c fit",100,0,5);
94 hlam0bar_M_all =
new TH1F(
"hlam0bar_M_all",
"#Lambda_{0} bar mass",100,0,5);
95 hlam0bar_M_4c =
new TH1F(
"hlam0bar_M_4c",
"#Lambda_{0} bar mass, with 4c fit",100,0,5);
98 hpiplus_tm_P =
new TH1F(
"hpiplus_tm_P",
"tm #pi^{+} P",150,0.,3.);
99 hpiplus_tm_Pt =
new TH1F(
"hpiplus_tm_Pt",
"tm #pi^{+} Pt",150,0.,3.);
100 hpiplus_tm_Theta =
new TH1F(
"hpiplus_tm_Theta",
"tm #pi^{+} #theta",90,0.,180.);
102 hpiplus_tm_cm_cosTheta =
new TH1F(
"hpiplus_tm_cm_cosTheta",
"tm #pi^{+} cos#theta in CM frame",100,-1.,1.);
105 hpiminus_tm_P =
new TH1F(
"hpiminus_tm_P",
"tm #pi^{-} P",150,0.,3.);
106 hpiminus_tm_Pt =
new TH1F(
"hpiminus_tm_Pt",
"tm #pi^{-} Pt",150,0.,3.);
107 hpiminus_tm_Theta =
new TH1F(
"hpiminus_tm_Theta",
"tm #pi^{-} #theta",90,0.,180.);
112 hproton_tm_P =
new TH1F(
"hproton_tm_P",
"tm p P",150,0.,3.);
113 hproton_tm_Pt =
new TH1F(
"hproton_tm_Pt",
"tm p Pt",150,0.,3.);
126 hlam0_tm_M_all =
new TH1F(
"hlam0_tm_M_all",
"tm #Lambda_{0} mass",100,0,5);
128 hlam0_tm_chi2_vtx =
new TH1F(
"hlam0_chi2_vtx",
"#tm Lambda_{0} #chi^{2} vertex fit",100,0,10);
129 hlam0_tm_prob_vtx =
new TH1F(
"hlam0_prob_vtx",
"#tm Lambda_{0} Prob vertex fit",100,0,1);
130 hlam0_tm_M_vtx =
new TH1F(
"hlam0_M_vtx",
"#tm Lambda_{0} mass, with vertex fit",100,0,5);
131 hlam0_tm_R_vtx =
new TH1F(
"hlam0_R_vtx",
"#tm Lambda_{0} R, with vertex fit",75,0,15);
132 hlam0_tm_Z_vtx =
new TH1F(
"hlam0_Z_vtx",
"#tm Lambda_{0} Z, with vertex fit",90,-5,25);
136 hlam0bar_tm_M_all =
new TH1F(
"hlam0bar_tm_M_all",
"tm #Lambda_{0} bar mass",100,0,5);
138 hlam0bar_tm_chi2_vtx =
new TH1F(
"hlam0bar_chi2_vtx",
"#tm Lambda_{0} bar #chi^{2} vertex fit",100,0,10);
139 hlam0bar_tm_prob_vtx =
new TH1F(
"hlam0bar_prob_vtx",
"#tm Lambda_{0} bar Prob vertex fit",100,0,1);
140 hlam0bar_tm_M_vtx =
new TH1F(
"hlam0bar_M_vtx",
"#tm Lambda_{0} bar mass, with vertex fit",100,0,5);
141 hlam0bar_tm_R_vtx =
new TH1F(
"hlam0bar_R_vtx",
"#tm Lambda_{0} bar R, with vertex fit",75,0,15);
142 hlam0bar_tm_Z_vtx =
new TH1F(
"hlam0bar_Z_vtx",
"#tm Lambda_{0} bar Z, with vertex fit",180,-5,55);
150 htruelam0_cm_cosTheta =
new TH1F(
"htruelam0_cm_cosTheta",
"McTruth #Lambda_{0} cos#theta in CM frame",100,-1.,1.);
153 htruelam0bar_cm_cosTheta =
new TH1F(
"htruelam0bar_cm_cosTheta",
"McTruth #Lambda_{0}bar cos#theta in CM frame",100,-1.,1.);
172 hpiplus_tm_PvsTheta =
new TH2F(
"hpiplus_tm_PvsTheta",
"tm #pi^{+} P vs #theta",150,0.,3.,180,0.,180.);
173 hpiplus_tm_PvsDP =
new TH2F(
"hpiplus_tm_PvsDP",
"tm #pi^{+} P vs #Delta P", 150, 0.,3.,100,-1.,1.);
174 hpiplus_tm_ThetavsDTheta =
new TH2F(
"hpiplus_tm_ThetavsDTheta",
"tm #pi^{+} #theta vs #Delta#theta",180,0.,180.,100,-1.,1.);
177 hpiminus_tm_PvsTheta =
new TH2F(
"hpiminus_tm_PvsTheta",
"tm #pi^{-} P vs #theta",150,0.,3.,180,0.,180.);
178 hpiminus_tm_PvsDP =
new TH2F(
"hpiminus_tm_PvsDP",
"tm #pi^{-} P vs #Delta P", 150, 0.,3.,100,-1.,1.);
179 hpiminus_tm_ThetavsDTheta =
new TH2F(
"hpiminus_tm_ThetavsDTheta",
"tm #pi^{-} #theta vs #Delta#theta",180,0.,180.,100,-1.,1.);
182 hproton_tm_PvsTheta =
new TH2F(
"hproton_tm_PvsTheta",
"tm p P vs #theta",150,0.,3.,180,0.,180.);
183 hproton_tm_PvsDP =
new TH2F(
"hproton_tm_PvsDP",
"tm p P vs #Delta P", 150, 0.,3.,100,-1.,1.);
184 hproton_tm_ThetavsDTheta =
new TH2F(
"hproton_tm_ThetavsDTheta",
"tm p #theta vs #Delta#theta",180,0.,180.,100,-1.,1.);
188 hantiproton_tm_PvsDP =
new TH2F(
"hantiproton_tm_PvsDP",
"tm pbar P vs #Delta P", 250, 0.,5.,100,-1.,1.);
199 FairRun*
run = FairRun::Instance();
200 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
210 int i=0,j=0, k=0, l=0;
215 if (!(++
nevts%100)) cout <<
"evt "<<
nevts<<endl;
222 RhoCandList p, pbar,
piplus,
piminus, lam0, lam0bar, truepiplus, truepiminus, truep, truepbar, lam0_tm, lam0bar_tm, ppbarsystem,
mclist;
224 Bool_t pfromlam, pbarfromlam, piplusfromlam, piminusfromlam;
226 double m0_p = 0.938272;
228 pbarfromlam = kFALSE;
229 piplusfromlam = kFALSE;
230 piminusfromlam = kFALSE;
232 TLorentzVector targ(0,0,0,m0_p);
233 TLorentzVector beam(0,0,pbarmom,
sqrt(m0_p*m0_p + pbarmom*pbarmom));
234 TLorentzVector
init=targ+beam;
235 TVector3 cmboost = -init.BoostVector();
260 ppbarsystem.
Combine(lam0,lam0bar);
262 RhoCandidate *mctrlam0, *mctrlam0bar, *mctrpiplus, *mctrpiminus, *mctrproton, *mctrantiproton;
265 mctrlam0 = mclist[2];
266 mctrlam0bar = mclist[1];
267 mctrproton = mclist[2]->Daughter(0);
268 mctrantiproton = mclist[1]->Daughter(0);
269 mctrpiplus = mclist[1]->Daughter(1);
270 mctrpiminus = mclist[2]->Daughter(1);
273 TLorentzVector mctrlam04 = mctrlam0->
P4();
274 TLorentzVector mctrlam0bar4 = mctrlam0bar->
P4();
275 TLorentzVector mctrpiplus4 = mctrpiplus->
P4();
276 TLorentzVector mctrpiminus4 = mctrpiminus->
P4();
277 TLorentzVector mctrproton4 = mctrproton->
P4();
278 TLorentzVector mctrantiproton4 = mctrantiproton->
P4();
281 mctrlam04.Boost(cmboost);
282 mctrlam0bar4.Boost(cmboost);
316 double chi2_4c = fitter.
GetChi2();
317 double prob_4c = fitter.
GetProb();
321 RhoCandidate *lam04cfit = ppbarsystem[j]->Daughter(0)->GetFit();
322 RhoCandidate *lam0bar4cfit = ppbarsystem[j]->Daughter(1)->GetFit();
324 if (chi2_4c<20 && check)
333 lam0bar_tm.
Combine(pbar, piplus);
342 TLorentzVector lam04 = lam0_tm[j]->P4();
343 TLorentzVector lam04_cm = lam04;
344 lam04_cm.
Boost(cmboost);
352 double chi2_vtx = vtxfitter.
GetChi2();
353 double prob_vtx = vtxfitter.
GetProb();
356 TVector3 lam0_tm_XYZ = jfit->
Pos();
358 if ( prob_vtx > 0.01 )
369 TLorentzVector lam0bar4 = lam0bar_tm[j]->P4();
370 TLorentzVector lam0bar4_cm = lam0bar4;
371 lam0bar4_cm.
Boost(cmboost);
379 double chi2_vtx = vtxfitter.
GetChi2();
380 double prob_vtx = vtxfitter.
GetProb();
383 TVector3 lam0bar_tm_XYZ = jfit->
Pos();
385 if ( prob_vtx > 0.01 )
396 if((truepiplus[j]->GetMcTruth()->TheMother()->PdgCode())!=-3122)
continue;
397 piplusfromlam = kTRUE;
400 TLorentzVector piplus4=truepiplus[j]->P4();
401 TLorentzVector mctruthpiplus4=truepiplus[j]->GetMcTruth()->P4();
402 TLorentzVector piplus4cm = piplus4;
403 piplus4cm.
Boost(cmboost);
404 recopiplus=truepiplus[j]->GetRecoCandidate();
415 hpiplus_tm_PvsDP->Fill(piplus4.P(),(piplus4.P()-mctruthpiplus4.P())/mctruthpiplus4.P());
422 if((truepiminus[j]->GetMcTruth()->TheMother()->PdgCode())!=3122)
continue;
423 piminusfromlam = kTRUE;
426 TLorentzVector piminus4=truepiminus[j]->P4();
427 TLorentzVector mctruthpiminus4=truepiminus[j]->GetMcTruth()->P4();
428 TLorentzVector piminus4cm = piminus4;
429 piminus4cm.
Boost(cmboost);
430 recopiminus=truepiminus[j]->GetRecoCandidate();
442 hpiminus_tm_PvsDP->Fill(piminus4.P(),(piminus4.P()-mctruthpiminus4.P())/mctruthpiminus4.P());
449 if((truep[j]->GetMcTruth()->TheMother()->PdgCode())!=3122)
continue;
453 TLorentzVector p4=truep[j]->P4();
454 TLorentzVector mctruthp4=truep[j]->GetMcTruth()->P4();
455 TLorentzVector p4cm = p4;
457 recop=truep[j]->GetRecoCandidate();
476 if((truepbar[j]->GetMcTruth()->TheMother()->PdgCode())!=-3122)
continue;
480 TLorentzVector pbar4=truepbar[j]->P4();
481 TLorentzVector mctruthpbar4=truepbar[j]->GetMcTruth()->P4();
482 TLorentzVector pbar4cm = pbar4;
483 pbar4cm.
Boost(cmboost);
484 recopbar=truepbar[j]->GetRecoCandidate();
TH2F * hantiproton_tm_PvsDP
TH1F * hpiplus_tm_cosTheta
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
TH1F * htrueantiproton_cosTheta
friend F32vec4 sqrt(const F32vec4 &a)
TH1F * htruelam0_cm_cosTheta
Bool_t FitConserveMasses()
TH1F * hlam0_tm_cosTheta_all
void Boost(const TVector3 &)
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
TH2F * hpiminus_tm_ThetavsDTheta
TH1F * hlam0bar_tm_cosTheta_all
TH1F * htruelam0bar_cm_cosTheta
TH2F * hpiminus_tm_PvsTheta
virtual void SetParContainers()
TH1F * hlam0_tm_cm_cosTheta_all
TH2F * hantiproton_tm_PvsTheta
TH1F * hproton_tm_cosTheta
void Combine(RhoCandList &l1, RhoCandList &l2)
TH1F * hantiproton_tm_cosTheta
TH1F * hlam0bar_tm_chi2_vtx
TH1F * hantiproton_tm_Theta
TH1F * htruepiplus_cosTheta
TH2F * hantiproton_tm_ThetavsDTheta
virtual InitStatus Init()
TLorentzVector P4() const
TH1F * hlam0bar_tm_prob_vtx
void SetType(const TParticlePDG *pdt, int start=0)
TH2F * hpiplus_tm_PvsTheta
virtual void Exec(Option_t *opt)
PndAnalysis * theAnalysis
Int_t Remove(RhoCandidate *)
TH1F * hantiproton_tm_cm_cosTheta
TH1F * hproton_tm_cm_cosTheta
TH2F * hproton_tm_PvsTheta
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)
TH1F * htruepiminus_cosTheta
TH1F * hpiplus_tm_cm_cosTheta
TH1F * hpiminus_tm_cosTheta
TH1F * htrueproton_cosTheta
TH2F * hpiplus_tm_ThetavsDTheta
TH1F * hlam0bar_tm_cm_cosTheta_all
TH1F * hpiminus_tm_cm_cosTheta
TH2F * hproton_tm_ThetavsDTheta