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 =
"ftf_pid.root";
70 TString inParFile =
"ftf_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 TFile *
out = TFile::Open(
"output_ana.root",
"RECREATE");
98 TH1F *hmomtrk =
new TH1F(
"hmomtrk",
"track momentum (all)",200,0,5);
99 TH1F *hthttrk =
new TH1F(
"hthttrk",
"track theta (all)",200,0,3.1415);
101 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
102 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
104 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
105 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
107 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
108 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
110 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
111 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
114 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
115 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
117 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
118 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
120 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
121 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
124 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
125 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
126 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
128 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
129 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
130 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
132 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
133 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
134 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
136 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
145 if (nevts==0) nevts= theAnalysis->
GetEntries();
151 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
155 TLorentzVector ini(0, 0, 6.231552, 7.240065);
161 int cntdbltrk=0, cntdblmc=0, cntdblboth=0, cnttrk=0, cnt_dbl_jpsi=0, cnt_dbl_psip=0;
163 while (theAnalysis->
GetEvent() && i++<nevts)
165 if ((i%100)==0) cout<<
"evt " << i << endl;
168 theAnalysis->
FillList(chrg,
"Charged");
169 theAnalysis->
FillList(muplus,
"MuonAllPlus");
170 theAnalysis->
FillList(muminus,
"MuonAllMinus");
171 theAnalysis->
FillList(piplus,
"PionAllPlus");
172 theAnalysis->
FillList(piminus,
"PionAllMinus");
177 hmomtrk->Fill(muplus[j]->
P());
178 hthttrk->Fill(muplus[j]->P4().Theta());
182 hmomtrk->Fill(muminus[j]->
P());
183 hthttrk->Fill(muminus[j]->P4().Theta());
207 hjpsim_all->Fill( jpsi[j]->M() );
212 hjpsim_ftm->Fill( jpsi[j]->M() );
213 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
216 hjpsim_nm->Fill( jpsi[j]->M() );
219 if (nm>1) cnt_dbl_jpsi++;
228 double chi2_vtx = vtxfitter.GetChi2();
229 double prob_vtx = vtxfitter.GetProb();
230 hjpsi_chi2_vf->Fill(chi2_vtx);
231 hjpsi_prob_vf->Fill(prob_vtx);
233 if ( prob_vtx > 0.01 )
236 TVector3 jVtx=jfit->
Pos();
238 hjpsim_vf->Fill(jfit->
M());
239 hvpos->Fill(jVtx.X(),jVtx.Y());
247 psi2s.
Combine(jpsi, piplus, piminus);
258 hpsim_all->Fill( psi2s[j]->M() );
263 hpsim_ftm->Fill( psi2s[j]->M() );
264 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
267 hpsim_nm->Fill( psi2s[j]->M() );
269 if (nm>1) cnt_dbl_psip++;
278 fitter.Add4MomConstraint(ini);
281 double chi2_4c = fitter.GetChi2();
282 double prob_4c = fitter.GetProb();
283 hpsi_chi2_4c->Fill(chi2_4c);
284 hpsi_prob_4c->Fill(prob_4c);
286 if ( prob_4c > 0.01 )
290 hjpsim_4cf->Fill(jfit->
M());
301 mfitter.AddMassConstraint(m0_jpsi);
304 double chi2_m = mfitter.GetChi2();
305 double prob_m = mfitter.GetProb();
306 hjpsi_chi2_mf->Fill(chi2_m);
307 hjpsi_prob_mf->Fill(prob_m);
312 hjpsim_mcf->Fill(jfit->
M());
329 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
332 psi2s.
Combine(jpsi, piplus, piminus);
333 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
341 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
342 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
343 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
344 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
347 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
350 psi2s.
Combine(jpsi, piplus, piminus);
351 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
359 theAnalysis->
FillList(muplus,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
360 theAnalysis->
FillList(muminus,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
361 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
362 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
365 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
368 psi2s.
Combine(jpsi, piplus, piminus);
369 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
381 hjpsim_lpid->Write();
383 hjpsim_tpid->Write();
385 hjpsim_trpid->Write();
386 hpsim_trpid->Write();
394 hjpsim_diff->Write();
400 hjpsi_chi2_vf->Write();
401 hpsi_chi2_4c->Write();
402 hjpsi_chi2_mf->Write();
404 hjpsi_prob_vf->Write();
405 hpsi_prob_4c->Write();
406 hjpsi_prob_mf->Write();
414 FairSystemInfo sysInfo;
415 Float_t maxMemory=sysInfo.GetMaxMemory();
416 cout <<
"<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
418 cout <<
"</DartMeasurement>" << endl;
424 Float_t cpuUsage=ctime/
rtime;
425 cout <<
"<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
427 cout <<
"</DartMeasurement>" << endl;
430 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime
432 cout <<
"CPU usage " << cpuUsage*100. <<
"%" << endl;
433 cout <<
"Max Memory " << maxMemory <<
" MB" << endl;
435 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)