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);
69 TString inPidFile = prefix+
"_pid.root";
70 TString inParFile = prefix+
"_par.root";
73 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
76 FairLogger::GetLogger()->SetLogToFile(kFALSE);
77 FairRunAna*
fRun =
new FairRunAna();
78 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
79 fRun->SetInputFile(inPidFile);
82 FairParRootFileIo* parIO =
new FairParRootFileIo();
83 parIO->open(inParFile);
84 FairParAsciiFileIo* parIOPid =
new FairParAsciiFileIo();
85 parIOPid->open(pidParFile.Data(),
"in");
87 rtdb->setFirstInput(parIO);
88 rtdb->setSecondInput(parIOPid);
89 rtdb->setOutput(parIO);
91 fRun->SetOutputFile(OutFile);
95 TString histofile=prefix+
"_histo.root";
96 TFile *
out = TFile::Open(histofile,
"RECREATE");
99 TH1F *hmomtrk =
new TH1F(
"hmomtrk",
"track momentum (all)",200,0,5);
100 TH1F *hthttrk =
new TH1F(
"hthttrk",
"track theta (all)",200,0,3.1415);
102 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
103 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
105 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
106 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
108 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
109 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
111 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
112 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
115 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
116 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
118 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
119 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
121 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
122 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
125 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
126 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
127 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
129 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
130 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
131 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
133 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
134 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
135 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
137 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
146 if (nevts==0) nevts= theAnalysis->
GetEntries();
152 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
156 TLorentzVector ini(0, 0, 6.231552, 7.240065);
162 int cntdbltrk=0, cntdblmc=0, cntdblboth=0, cnttrk=0, cnt_dbl_jpsi=0, cnt_dbl_psip=0;
164 while (theAnalysis->
GetEvent() && i++<nevts)
166 if ((i%100)==0) cout<<
"evt " << i << endl;
169 theAnalysis->
FillList(chrg,
"Charged");
170 theAnalysis->
FillList(muplus,
"MuonAllPlus");
171 theAnalysis->
FillList(muminus,
"MuonAllMinus");
172 theAnalysis->
FillList(piplus,
"PionAllPlus");
173 theAnalysis->
FillList(piminus,
"PionAllMinus");
178 hmomtrk->Fill(muplus[j]->
P());
179 hthttrk->Fill(muplus[j]->P4().Theta());
183 hmomtrk->Fill(muminus[j]->
P());
184 hthttrk->Fill(muminus[j]->P4().Theta());
208 hjpsim_all->Fill( jpsi[j]->M() );
213 hjpsim_ftm->Fill( jpsi[j]->M() );
214 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
217 hjpsim_nm->Fill( jpsi[j]->M() );
220 if (nm>1) cnt_dbl_jpsi++;
229 double chi2_vtx = vtxfitter.GetChi2();
230 double prob_vtx = vtxfitter.GetProb();
231 hjpsi_chi2_vf->Fill(chi2_vtx);
232 hjpsi_prob_vf->Fill(prob_vtx);
234 if ( prob_vtx > 0.01 )
237 TVector3 jVtx=jfit->
Pos();
239 hjpsim_vf->Fill(jfit->
M());
240 hvpos->Fill(jVtx.X(),jVtx.Y());
248 psi2s.
Combine(jpsi, piplus, piminus);
259 hpsim_all->Fill( psi2s[j]->M() );
264 hpsim_ftm->Fill( psi2s[j]->M() );
265 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
268 hpsim_nm->Fill( psi2s[j]->M() );
270 if (nm>1) cnt_dbl_psip++;
279 fitter.Add4MomConstraint(ini);
282 double chi2_4c = fitter.GetChi2();
283 double prob_4c = fitter.GetProb();
284 hpsi_chi2_4c->Fill(chi2_4c);
285 hpsi_prob_4c->Fill(prob_4c);
287 if ( prob_4c > 0.01 )
291 hjpsim_4cf->Fill(jfit->
M());
302 mfitter.AddMassConstraint(m0_jpsi);
305 double chi2_m = mfitter.GetChi2();
306 double prob_m = mfitter.GetProb();
307 hjpsi_chi2_mf->Fill(chi2_m);
308 hjpsi_prob_mf->Fill(prob_m);
313 hjpsim_mcf->Fill(jfit->
M());
330 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
333 psi2s.
Combine(jpsi, piplus, piminus);
334 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
342 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoMdtHardCuts");
343 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoMdtHardCuts");
344 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
345 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
348 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
351 psi2s.
Combine(jpsi, piplus, piminus);
352 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
360 theAnalysis->
FillList(muplus,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
361 theAnalysis->
FillList(muminus,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
362 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
363 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
366 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
369 psi2s.
Combine(jpsi, piplus, piminus);
370 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
382 hjpsim_lpid->Write();
384 hjpsim_tpid->Write();
386 hjpsim_trpid->Write();
387 hpsim_trpid->Write();
395 hjpsim_diff->Write();
401 hjpsi_chi2_vf->Write();
402 hpsi_chi2_4c->Write();
403 hjpsi_chi2_mf->Write();
405 hjpsi_prob_vf->Write();
406 hpsi_prob_4c->Write();
407 hjpsi_prob_mf->Write();
415 FairSystemInfo sysInfo;
416 Float_t maxMemory=sysInfo.GetMaxMemory();
417 cout <<
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
419 cout <<
"</DartMeasurement>" << endl;
425 Float_t cpuUsage=ctime/
rtime;
426 cout <<
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
428 cout <<
"</DartMeasurement>" << endl;
431 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime
433 cout <<
"CPU usage " << cpuUsage*100. <<
"%" << endl;
434 cout <<
"Max Memory " << maxMemory <<
" MB" << endl;
436 cout <<
"Macro finished successfully." << endl;
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
void Combine(RhoCandList &l1, RhoCandList &l2)
void Select(RhoParticleSelectorBase *pidmgr)
void SetType(const TParticlePDG *pdt, int start=0)
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
void countDoubles(RhoCandList &l, int &n1, int &n2, int &n3)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)