28 int i=0,j=0, k=0, l=0;
29 gStyle->SetOptFit(1011);
32 TString OutFile=
"out_dummy.root";
35 TString inPidFile = prefix+
"_pid.root";
36 TString inParFile = prefix+
"_par.root";
39 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
43 FairRunAna*
fRun =
new FairRunAna();
44 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
45 fRun->SetSource(
new FairFileSource(inPidFile));
48 FairParRootFileIo* parIO =
new FairParRootFileIo();
49 parIO->open(inParFile);
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);
61 TFile *
out = TFile::Open(prefix+
"_ana.root",
"RECREATE");
64 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
65 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
67 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
68 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
70 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
71 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
73 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
74 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
77 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
78 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
80 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
81 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
83 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
84 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
87 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
88 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
89 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
91 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
92 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
93 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
95 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
96 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
97 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
99 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
108 if (nevts==0) nevts= theAnalysis->
GetEntries();
114 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
118 TLorentzVector ini(0, 0, 6.231552, 7.240065);
123 while (theAnalysis->
GetEvent() && i++<nevts)
125 if ((i%100)==0) cout<<
"evt " << i << endl;
128 theAnalysis->
FillList(muplus,
"MuonAllPlus");
129 theAnalysis->
FillList(muminus,
"MuonAllMinus");
130 theAnalysis->
FillList(piplus,
"PionAllPlus");
131 theAnalysis->
FillList(piminus,
"PionAllMinus");
144 hjpsim_all->Fill( jpsi[j]->M() );
148 hjpsim_ftm->Fill( jpsi[j]->M() );
149 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
152 hjpsim_nm->Fill( jpsi[j]->M() );
163 double chi2_vtx = vtxfitter.
GetChi2();
164 double prob_vtx = vtxfitter.
GetProb();
165 hjpsi_chi2_vf->Fill(chi2_vtx);
166 hjpsi_prob_vf->Fill(prob_vtx);
168 if ( prob_vtx > 0.01 )
171 TVector3 jVtx=jfit->
Pos();
173 hjpsim_vf->Fill(jfit->
M());
174 hvpos->Fill(jVtx.X(),jVtx.Y());
182 psi2s.
Combine(jpsi, piplus, piminus);
192 hpsim_all->Fill( psi2s[j]->M() );
196 hpsim_ftm->Fill( psi2s[j]->M() );
197 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
200 hpsim_nm->Fill( psi2s[j]->M() );
213 double chi2_4c = fitter.
GetChi2();
214 double prob_4c = fitter.
GetProb();
215 hpsi_chi2_4c->Fill(chi2_4c);
216 hpsi_prob_4c->Fill(prob_4c);
218 if ( prob_4c > 0.01 )
222 hjpsim_4cf->Fill(jfit->
M());
236 double chi2_m = mfitter.
GetChi2();
237 double prob_m = mfitter.
GetProb();
238 hjpsi_chi2_mf->Fill(chi2_m);
239 hjpsi_prob_mf->Fill(prob_m);
244 hjpsim_mcf->Fill(jfit->
M());
261 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
264 psi2s.
Combine(jpsi, piplus, piminus);
265 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
273 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
274 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
275 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
276 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
279 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
282 psi2s.
Combine(jpsi, piplus, piminus);
283 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
291 theAnalysis->
FillList(muplus,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
292 theAnalysis->
FillList(muminus,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
293 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
294 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
297 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
300 psi2s.
Combine(jpsi, piplus, piminus);
301 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
310 hjpsim_lpid->Write();
312 hjpsim_tpid->Write();
314 hjpsim_trpid->Write();
315 hpsim_trpid->Write();
323 hjpsim_diff->Write();
329 hjpsi_chi2_vf->Write();
330 hpsi_chi2_4c->Write();
331 hjpsi_chi2_mf->Write();
333 hjpsi_prob_vf->Write();
334 hpsi_prob_4c->Write();
335 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 tut_ana(TString pref="pid_complete.root", int min=-1, int max=1, int nevts=0)
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)
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)