28 int i=0,j=0, k=0, l=0;
29 gStyle->SetOptFit(1011);
32 TString OutFile=
"out_dummy.root";
35 TString inPidFile = prefix+
"_fast.root";
38 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
42 FairRunAna*
fRun =
new FairRunAna();
43 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
44 fRun->SetSource(
new FairFileSource(inPidFile));
45 fRun->SetOutputFile(OutFile);
48 FairParRootFileIo* parIO =
new FairParRootFileIo();
50 FairParAsciiFileIo* parIOPid =
new FairParAsciiFileIo();
51 parIOPid->open(pidParFile.Data(),
"in");
53 rtdb->setFirstInput(parIO);
54 rtdb->setSecondInput(parIOPid);
55 rtdb->setOutput(parIO);
57 fRun->SetOutputFile(OutFile);
64 TFile *
out = TFile::Open(prefix+
"_ana_fast.root",
"RECREATE");
67 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
68 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
70 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
71 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
73 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
74 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
76 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
77 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
80 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
81 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
83 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
84 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
86 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
87 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
90 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
91 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
92 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
94 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
95 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
96 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
98 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
99 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
100 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
102 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
111 if (nevts==0) nevts= theAnalysis->
GetEntries();
117 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
121 TLorentzVector ini(0, 0, 6.231552, 7.240065);
123 TString pidalgo =
"PidChargedProbability";
128 while (theAnalysis->
GetEvent() && i++<nevts)
130 if ((i%100)==0) cout<<
"evt " << i << endl;
133 theAnalysis->
FillList(muplus,
"MuonAllPlus" , pidalgo );
134 theAnalysis->
FillList(muminus,
"MuonAllMinus" , pidalgo );
135 theAnalysis->
FillList(piplus,
"PionAllPlus" , pidalgo );
136 theAnalysis->
FillList(piminus,
"PionAllMinus" , pidalgo );
149 hjpsim_all->Fill( jpsi[j]->M() );
153 hjpsim_ftm->Fill( jpsi[j]->M() );
154 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
157 hjpsim_nm->Fill( jpsi[j]->M() );
168 double chi2_vtx = vtxfitter.
GetChi2();
169 double prob_vtx = vtxfitter.
GetProb();
170 hjpsi_chi2_vf->Fill(chi2_vtx);
171 hjpsi_prob_vf->Fill(prob_vtx);
173 if ( prob_vtx > 0.01 )
176 TVector3 jVtx=jfit->
Pos();
178 hjpsim_vf->Fill(jfit->
M());
179 hvpos->Fill(jVtx.X(),jVtx.Y());
187 psi2s.
Combine(jpsi, piplus, piminus);
197 hpsim_all->Fill( psi2s[j]->M() );
201 hpsim_ftm->Fill( psi2s[j]->M() );
202 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
205 hpsim_nm->Fill( psi2s[j]->M() );
218 double chi2_4c = fitter.
GetChi2();
219 double prob_4c = fitter.
GetProb();
220 hpsi_chi2_4c->Fill(chi2_4c);
221 hpsi_prob_4c->Fill(prob_4c);
223 if ( prob_4c > 0.01 )
227 hjpsim_4cf->Fill(jfit->
M());
241 double chi2_m = mfitter.
GetChi2();
242 double prob_m = mfitter.
GetProb();
243 hjpsi_chi2_mf->Fill(chi2_m);
244 hjpsi_prob_mf->Fill(prob_m);
249 hjpsim_mcf->Fill(jfit->
M());
266 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
269 psi2s.
Combine(jpsi, piplus, piminus);
270 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
276 pidalgo =
"MvdPidProbability;SttPidProbability;DrcBarrelProbability";
278 theAnalysis->
FillList(muplus,
"MuonLoosePlus", pidalgo );
279 theAnalysis->
FillList(muminus,
"MuonLooseMinus", pidalgo );
280 theAnalysis->
FillList(piplus,
"PionLoosePlus", pidalgo );
281 theAnalysis->
FillList(piminus,
"PionLooseMinus", pidalgo);
284 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
287 psi2s.
Combine(jpsi, piplus, piminus);
288 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
294 TString pidalgomdt =
"ScMdtPidBarrelProbability;ScMdtPidForwardProbability";
296 theAnalysis->
FillList(muplus,
"MuonTightPlus", pidalgomdt);
297 theAnalysis->
FillList(muminus,
"MuonTightMinus", pidalgomdt);
298 theAnalysis->
FillList(piplus,
"PionLoosePlus", pidalgo);
299 theAnalysis->
FillList(piminus,
"PionLooseMinus", pidalgo);
302 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
305 psi2s.
Combine(jpsi, piplus, piminus);
306 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
315 hjpsim_lpid->Write();
317 hjpsim_tpid->Write();
319 hjpsim_trpid->Write();
320 hpsim_trpid->Write();
328 hjpsim_diff->Write();
334 hjpsi_chi2_vf->Write();
335 hpsi_chi2_4c->Write();
336 hjpsi_chi2_mf->Write();
338 hjpsi_prob_vf->Write();
339 hpsi_prob_4c->Write();
340 hjpsi_prob_mf->Write();
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 tut_ana_fast(int nevts=0, TString prefix="signal")
void Select(RhoParticleSelectorBase *pidmgr)
void SetType(const TParticlePDG *pdt, int start=0)
Int_t Remove(RhoCandidate *)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)