59 TDatabasePDG::Instance()->AddParticle(
"pbarpSystem",
"pbarpSystem",1.9,kFALSE,0.1,0,
"",88888);
62 int i=0,j=0, k=0, l=0;
63 gStyle->SetOptFit(1011);
66 TString OutFile=
"outputmult.root";
69 TString inPidFile =
"psi2s_jpsi2pi_jpsi_mumu_pidmult.root";
73 TString inParFile =
"psi2s_jpsi2pi_jpsi_mumu_par.root";
76 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
79 FairLogger::GetLogger()->SetLogToFile(kFALSE);
80 FairRunAna*
fRun =
new FairRunAna();
81 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
82 fRun->SetInputFile(inPidFile);
88 FairParRootFileIo* parIO =
new FairParRootFileIo();
89 parIO->open(inParFile);
90 FairParAsciiFileIo* parIOPid =
new FairParAsciiFileIo();
91 parIOPid->open(pidParFile.Data(),
"in");
93 rtdb->setFirstInput(parIO);
94 rtdb->setSecondInput(parIOPid);
95 rtdb->setOutput(parIO);
97 fRun->SetOutputFile(OutFile);
101 TFile *
out = TFile::Open(
"output_anamulti.root",
"RECREATE");
104 TH1F *hmomtrk =
new TH1F(
"hmomtrk",
"track momentum (all)",200,0,5);
105 TH1F *hthttrk =
new TH1F(
"hthttrk",
"track theta (all)",200,0,3.1415);
107 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
108 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
110 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
111 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
113 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
114 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
116 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
117 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
119 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
120 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
122 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
123 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
125 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
126 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
128 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
129 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
130 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
132 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
133 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
134 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
136 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
137 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
138 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
140 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
149 if (nevts==0) nevts= theAnalysis->
GetEntries();
153 RhoCandList muplusloose, muminusloose, piplusloose, piminusloose, jpsiloose, psi2sloose;
154 RhoCandList muplustight, muminustight, piplustight, piminustight, jpsitight, psi2stight;
157 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
161 TLorentzVector ini(0, 0, 6.231552, 7.240065);
167 int cntdbltrk=0, cntdblmc=0, cntdblboth=0, cnttrk=0, cnt_dbl_jpsi=0, cnt_dbl_psip=0;
169 while (theAnalysis->
GetEvent() && i++<nevts)
171 if ((i%100)==0) cout<<
"evt " << i << endl;
174 theAnalysis->
FillList(chrg,
"Charged");
175 theAnalysis->
FillList(muplus,
"MuonAllPlus");
176 theAnalysis->
FillList(muminus,
"MuonAllMinus");
177 theAnalysis->
FillList(piplus,
"PionAllPlus");
178 theAnalysis->
FillList(piminus,
"PionAllMinus");
183 hmomtrk->Fill(muplus[j]->
P());
184 hthttrk->Fill(muplus[j]->P4().Theta());
188 hmomtrk->Fill(muminus[j]->
P());
189 hthttrk->Fill(muminus[j]->P4().Theta());
220 hjpsim_all->Fill( jpsi[j]->M() );
225 hjpsim_ftm->Fill( jpsi[j]->M() );
226 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
229 hjpsim_nm->Fill( jpsi[j]->M() );
232 if (nm>1) cnt_dbl_jpsi++;
241 double chi2_vtx = vtxfitter.GetChi2();
242 double prob_vtx = vtxfitter.GetProb();
243 hjpsi_chi2_vf->Fill(chi2_vtx);
244 hjpsi_prob_vf->Fill(prob_vtx);
246 if ( prob_vtx > 0.01 )
249 TVector3 jVtx=jfit->
Pos();
251 hjpsim_vf->Fill(jfit->
M());
252 hvpos->Fill(jVtx.X(),jVtx.Y());
260 psi2s.
Combine(jpsi, piplus, piminus);
270 hpsim_all->Fill( psi2s[j]->M() );
274 hpsim_ftm->Fill( psi2s[j]->M() );
275 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
278 hpsim_nm->Fill( psi2s[j]->M() );
280 if (nm>1) cnt_dbl_psip++;
289 fitter.Add4MomConstraint(ini);
292 double chi2_4c = fitter.GetChi2();
293 double prob_4c = fitter.GetProb();
294 hpsi_chi2_4c->Fill(chi2_4c);
295 hpsi_prob_4c->Fill(prob_4c);
297 if ( prob_4c > 0.01 )
301 hjpsim_4cf->Fill(jfit->
M());
312 mfitter.AddMassConstraint(m0_jpsi);
315 double chi2_m = mfitter.GetChi2();
316 double prob_m = mfitter.GetProb();
317 hjpsi_chi2_mf->Fill(chi2_m);
318 hjpsi_prob_mf->Fill(prob_m);
323 hjpsim_mcf->Fill(jfit->
M());
340 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
343 psi2s.
Combine(jpsi, piplus, piminus);
344 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
351 theAnalysis->
FillList(muplusloose,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
352 theAnalysis->
FillList(muminusloose,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
353 theAnalysis->
FillList(piplusloose,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
354 theAnalysis->
FillList(piminusloose,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
356 jpsiloose.
Combine(muplusloose, muminusloose);
357 for (j=0;j<jpsiloose.
GetLength();++j) hjpsim_lpid->Fill( jpsiloose[j]->M() );
364 jpsiloose.
Select(jpsiMassSel);
366 psi2sloose.
Combine(jpsiloose, piplusloose, piminusloose);
367 for (j=0;j<psi2sloose.
GetLength();++j) hpsim_lpid->Fill( psi2sloose[j]->M() );
374 theAnalysis->
FillList(muplustight,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
375 theAnalysis->
FillList(muminustight,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
376 theAnalysis->
FillList(piplustight,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
377 theAnalysis->
FillList(piminustight,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
379 jpsitight.
Combine(muplustight, muminustight);
380 for (j=0;j<jpsitight.
GetLength();++j) hjpsim_tpid->Fill( jpsitight[j]->M() );
387 jpsitight.
Select(jpsiMassSel);
389 psi2stight.
Combine(jpsitight, piplustight, piminustight);
390 for (j=0;j<psi2stight.
GetLength();++j) hpsim_tpid->Fill( psi2stight[j]->M() );
395 cout<<
"Write histograms to file "<<out->GetName()<<endl;
403 hjpsim_lpid->Write();
405 hjpsim_tpid->Write();
407 hjpsim_trpid->Write();
408 hpsim_trpid->Write();
416 hjpsim_diff->Write();
422 hjpsi_chi2_vf->Write();
423 hpsi_chi2_4c->Write();
424 hjpsi_chi2_mf->Write();
426 hjpsi_prob_vf->Write();
427 hpsi_prob_4c->Write();
428 hjpsi_prob_mf->Write();
433 cout<<
"Write histograms to file "<<out->GetName()<<
" done."<<endl;
437 FairSystemInfo sysInfo;
438 Float_t maxMemory=sysInfo.GetMaxMemory();
439 cout <<
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
441 cout <<
"</DartMeasurement>" << endl;
447 Float_t cpuUsage=ctime/
rtime;
448 cout <<
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
450 cout <<
"</DartMeasurement>" << endl;
453 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime
455 cout <<
"CPU usage " << cpuUsage*100. <<
"%" << endl;
456 cout <<
"Max Memory " << maxMemory <<
" MB" << endl;
458 cout <<
"Macro finished successfully." << endl;
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
void countDoubles(RhoCandList &l, int &n1, int &n2, int &n3)
void Combine(RhoCandList &l1, RhoCandList &l2)
void Select(RhoParticleSelectorBase *pidmgr)
void SetType(const TParticlePDG *pdt, int start=0)
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)