26 TLorentzVector lv=c->
P4();
28 cout <<c->
PdgCode()<<
" ("<<lv.X()<<
"/"<<lv.Y()<<
"/"<<lv.Z()<<
"/"<<lv.E()<<
")"<<endl;
42 TLorentzVector dl = l[
i]->P4() - l[j]->P4();
44 bool chkmc = (l[
i]->GetMcTruth()==l[j]->GetMcTruth());
45 bool chktrk = (
fabs(dl.X())<d) && (
fabs(dl.Y())<d) && (
fabs(dl.Z())<d) && (
fabs(dl.E())<d);
48 if (chktrk && chkmc) n_both++;
58 TDatabasePDG::Instance()->AddParticle(
"pbarpSystem",
"pbarpSystem",1.9,kFALSE,0.1,0,
"",88888);
61 int i=0,j=0, k=0, l=0;
62 gStyle->SetOptFit(1011);
68 TString inPidFile =
"pid_complete.root";
69 TString inParFile =
"simparams.root";
72 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
75 FairLogger::GetLogger()->SetLogToFile(kFALSE);
76 FairRunAna*
fRun =
new FairRunAna();
77 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
78 fRun->SetInputFile(inPidFile);
81 FairParRootFileIo* parIO =
new FairParRootFileIo();
82 parIO->open(inParFile);
83 FairParAsciiFileIo* parIOPid =
new FairParAsciiFileIo();
84 parIOPid->open(pidParFile.Data(),
"in");
86 rtdb->setFirstInput(parIO);
87 rtdb->setSecondInput(parIOPid);
88 rtdb->setOutput(parIO);
90 fRun->SetOutputFile(OutFile);
94 TFile *
out = TFile::Open(
"output_ana.root",
"RECREATE");
97 TH1F *hmomtrk =
new TH1F(
"hmomtrk",
"track momentum (all)",200,0,5);
98 TH1F *hthttrk =
new TH1F(
"hthttrk",
"track theta (all)",200,0,3.1415);
100 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
101 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
103 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
104 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
106 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
107 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
109 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
110 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
113 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
114 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
116 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
117 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
119 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
120 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
123 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
124 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
125 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
127 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
128 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
129 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
131 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
132 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
133 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
135 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
144 if (nevts==0) nevts= theAnalysis->
GetEntries();
150 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
154 TLorentzVector ini(0, 0, 6.231552, 7.240065);
160 int cntdbltrk=0, cntdblmc=0, cntdblboth=0, cnttrk=0, cnt_dbl_jpsi=0, cnt_dbl_psip=0;
162 while (theAnalysis->
GetEvent() && i++<nevts)
164 if ((i%100)==0) cout<<
"evt " << i << endl;
167 theAnalysis->
FillList(chrg,
"Charged");
168 theAnalysis->
FillList(muplus,
"MuonAllPlus");
169 theAnalysis->
FillList(muminus,
"MuonAllMinus");
170 theAnalysis->
FillList(piplus,
"PionAllPlus");
171 theAnalysis->
FillList(piminus,
"PionAllMinus");
176 hmomtrk->Fill(muplus[j]->
P());
177 hthttrk->Fill(muplus[j]->P4().Theta());
181 hmomtrk->Fill(muminus[j]->
P());
182 hthttrk->Fill(muminus[j]->P4().Theta());
206 hjpsim_all->Fill( jpsi[j]->M() );
211 hjpsim_ftm->Fill( jpsi[j]->M() );
212 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
215 hjpsim_nm->Fill( jpsi[j]->M() );
218 if (nm>1) cnt_dbl_jpsi++;
227 double chi2_vtx = vtxfitter.
GetChi2();
228 double prob_vtx = vtxfitter.
GetProb();
229 hjpsi_chi2_vf->Fill(chi2_vtx);
230 hjpsi_prob_vf->Fill(prob_vtx);
232 if ( prob_vtx > 0.01 )
235 TVector3 jVtx=jfit->
Pos();
237 hjpsim_vf->Fill(jfit->
M());
238 hvpos->Fill(jVtx.X(),jVtx.Y());
246 psi2s.
Combine(jpsi, piplus, piminus);
257 hpsim_all->Fill( psi2s[j]->M() );
262 hpsim_ftm->Fill( psi2s[j]->M() );
263 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
266 hpsim_nm->Fill( psi2s[j]->M() );
268 if (nm>1) cnt_dbl_psip++;
280 double chi2_4c = fitter.
GetChi2();
281 double prob_4c = fitter.
GetProb();
282 hpsi_chi2_4c->Fill(chi2_4c);
283 hpsi_prob_4c->Fill(prob_4c);
285 if ( prob_4c > 0.01 )
289 hjpsim_4cf->Fill(jfit->
M());
303 double chi2_m = mfitter.
GetChi2();
304 double prob_m = mfitter.
GetProb();
305 hjpsi_chi2_mf->Fill(chi2_m);
306 hjpsi_prob_mf->Fill(prob_m);
311 hjpsim_mcf->Fill(jfit->
M());
328 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
331 psi2s.
Combine(jpsi, piplus, piminus);
332 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
340 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
341 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc;PidAlgoMdtHardCuts");
342 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
343 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc;PidAlgoDisc");
346 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
349 psi2s.
Combine(jpsi, piplus, piminus);
350 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
358 theAnalysis->
FillList(muplus,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
359 theAnalysis->
FillList(muminus,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
360 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
361 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
364 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
367 psi2s.
Combine(jpsi, piplus, piminus);
368 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
380 hjpsim_lpid->Write();
382 hjpsim_tpid->Write();
384 hjpsim_trpid->Write();
385 hpsim_trpid->Write();
393 hjpsim_diff->Write();
399 hjpsi_chi2_vf->Write();
400 hpsi_chi2_4c->Write();
401 hjpsi_chi2_mf->Write();
403 hjpsi_prob_vf->Write();
404 hpsi_prob_4c->Write();
405 hjpsi_prob_mf->Write();
414 cout << endl << endl;
415 cout <<
"Macro finished successfully." << endl;
416 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
419 cout <<
" Test passed" << endl;
420 cout <<
" All ok " << endl;
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
void AddMassConstraint(double mass)
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
void Add4MomConstraint(TLorentzVector lv)
void Combine(RhoCandList &l1, RhoCandList &l2)
PndAnalysis(TString tname1="", TString tname2="", TString algnamec="PidAlgoIdealCharged", TString algnamen="PidAlgoIdealNeutral")
void Select(RhoParticleSelectorBase *pidmgr)
TLorentzVector P4() const
void SetType(const TParticlePDG *pdt, int start=0)
friend F32vec4 fabs(const F32vec4 &a)
Int_t Remove(RhoCandidate *)
void countDoubles(RhoCandList &l, int &n1, int &n2, int &n3)
void printCand(TLorentzVector l, TVector3 p)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)
int ana_complete(int nevts=0, TString prefix="evtcomplete")