38 int i=0,j=0, k=0, l=0;
39 gStyle->SetOptFit(1011);
42 TString OutFile=
"out_dummy.root";
45 TString inPidFile = prefix+
"_fast.root";
48 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
51 FairRunAna*
fRun =
new FairRunAna();
52 fRun->SetSource(
new FairFileSource(inPidFile));
53 fRun->SetOutputFile(OutFile);
61 TFile *
out = TFile::Open(prefix+
"_ana_fast.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);
120 TString pidalgo =
"PidChargedProbability";
125 while (theAnalysis->
GetEvent() && i++<nevts)
127 if ((i%100)==0) cout<<
"evt " << i << endl;
130 theAnalysis->
FillList(muplus,
"MuonAllPlus" , pidalgo );
131 theAnalysis->
FillList(muminus,
"MuonAllMinus" , pidalgo );
132 theAnalysis->
FillList(piplus,
"PionAllPlus" , pidalgo );
133 theAnalysis->
FillList(piminus,
"PionAllMinus" , pidalgo );
146 hjpsim_all->Fill( jpsi[j]->M() );
150 hjpsim_ftm->Fill( jpsi[j]->M() );
151 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
154 hjpsim_nm->Fill( jpsi[j]->M() );
165 double chi2_vtx = vtxfitter.GetChi2();
166 double prob_vtx = vtxfitter.GetProb();
167 hjpsi_chi2_vf->Fill(chi2_vtx);
168 hjpsi_prob_vf->Fill(prob_vtx);
170 if ( prob_vtx > 0.01 )
173 TVector3 jVtx=jfit->
Pos();
175 hjpsim_vf->Fill(jfit->
M());
176 hvpos->Fill(jVtx.X(),jVtx.Y());
184 psi2s.
Combine(jpsi, piplus, piminus);
194 hpsim_all->Fill( psi2s[j]->M() );
198 hpsim_ftm->Fill( psi2s[j]->M() );
199 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
202 hpsim_nm->Fill( psi2s[j]->M() );
212 fitter.Add4MomConstraint(ini);
215 double chi2_4c = fitter.GetChi2();
216 double prob_4c = fitter.GetProb();
217 hpsi_chi2_4c->Fill(chi2_4c);
218 hpsi_prob_4c->Fill(prob_4c);
220 if ( prob_4c > 0.01 )
224 hjpsim_4cf->Fill(jfit->
M());
235 mfitter.AddMassConstraint(m0_jpsi);
238 double chi2_m = mfitter.GetChi2();
239 double prob_m = mfitter.GetProb();
240 hjpsi_chi2_mf->Fill(chi2_m);
241 hjpsi_prob_mf->Fill(prob_m);
246 hjpsim_mcf->Fill(jfit->
M());
263 for (j=0;j<jpsi.
GetLength();++j) hjpsim_trpid->Fill( jpsi[j]->M() );
266 psi2s.
Combine(jpsi, piplus, piminus);
267 for (j=0;j<psi2s.
GetLength();++j) hpsim_trpid->Fill( psi2s[j]->M() );
273 pidalgo =
"MvdPidProbability;SttPidProbability;DrcBarrelProbability";
275 theAnalysis->
FillList(muplus,
"MuonLoosePlus", pidalgo );
276 theAnalysis->
FillList(muminus,
"MuonLooseMinus", pidalgo );
277 theAnalysis->
FillList(piplus,
"PionLoosePlus", pidalgo );
278 theAnalysis->
FillList(piminus,
"PionLooseMinus", pidalgo);
281 for (j=0;j<jpsi.
GetLength();++j) hjpsim_lpid->Fill( jpsi[j]->M() );
284 psi2s.
Combine(jpsi, piplus, piminus);
285 for (j=0;j<psi2s.
GetLength();++j) hpsim_lpid->Fill( psi2s[j]->M() );
291 TString pidalgomdt =
"ScMdtPidBarrelProbability;ScMdtPidForwardProbability";
293 theAnalysis->
FillList(muplus,
"MuonTightPlus", pidalgomdt);
294 theAnalysis->
FillList(muminus,
"MuonTightMinus", pidalgomdt);
295 theAnalysis->
FillList(piplus,
"PionLoosePlus", pidalgo);
296 theAnalysis->
FillList(piminus,
"PionLooseMinus", pidalgo);
299 for (j=0;j<jpsi.
GetLength();++j) hjpsim_tpid->Fill( jpsi[j]->M() );
302 psi2s.
Combine(jpsi, piplus, piminus);
303 for (j=0;j<psi2s.
GetLength();++j) hpsim_tpid->Fill( psi2s[j]->M() );
315 cout<<
"Writing "<<nhist<<
" histograms to file"<<endl;
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
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)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)
int writemyhistos(int maxy=800, double asp=1.1)
void plotmyhistos(std::vector< TH1 * > h, int maxy=700, double asp=1.1)