38 int i=0,j=0, k=0, l=0;
39 gStyle->SetOptFit(1011);
42 TString OutFile=
"out_dummy.root";
47 TFile *
out = TFile::Open(prefix+
"_ana.root",
"RECREATE");
50 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass (all)",200,0,4.5);
51 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass (all)",200,0,5);
53 TH1F *hjpsim_lpid =
new TH1F(
"hjpsim_lpid",
"J/#psi mass (loose pid)",200,0,4.5);
54 TH1F *hpsim_lpid =
new TH1F(
"hpsim_lpid",
"#psi(2S) mass (loose pid)",200,0,5);
56 TH1F *hjpsim_tpid =
new TH1F(
"hjpsim_tpid",
"J/#psi mass (tight pid)",200,0,4.5);
57 TH1F *hpsim_tpid =
new TH1F(
"hpsim_tpid",
"#psi(2S) mass (tight pid)",200,0,5);
59 TH1F *hjpsim_trpid =
new TH1F(
"hjpsim_trpid",
"J/#psi mass (true pid)",200,0,4.5);
60 TH1F *hpsim_trpid =
new TH1F(
"hpsim_trpid",
"#psi(2S) mass (true pid)",200,0,5);
63 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
64 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
66 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
67 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
69 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
70 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
73 TH1F *hjpsim_vf =
new TH1F(
"hjpsim_vf",
"J/#psi mass (vertex fit)",200,0,4.5);
74 TH1F *hjpsim_4cf =
new TH1F(
"hjpsim_4cf",
"J/#psi mass (4C fit)",200,0,4.5);
75 TH1F *hjpsim_mcf =
new TH1F(
"hjpsim_mcf",
"J/#psi mass (mass constraint fit)",200,0,4.5);
77 TH1F *hjpsi_chi2_vf =
new TH1F(
"hjpsi_chi2_vf",
"J/#psi: #chi^{2} vertex fit",100,0,10);
78 TH1F *hpsi_chi2_4c =
new TH1F(
"hpsi_chi2_4c",
"#psi(2S): #chi^{2} 4C fit",100,0,250);
79 TH1F *hjpsi_chi2_mf =
new TH1F(
"hjpsi_chi2_mf",
"J/#psi: #chi^{2} mass fit",100,0,10);
81 TH1F *hjpsi_prob_vf =
new TH1F(
"hjpsi_prob_vf",
"J/#psi: Prob vertex fit",100,0,1);
82 TH1F *hpsi_prob_4c =
new TH1F(
"hpsi_prob_4c",
"#psi(2S): Prob 4C fit",100,0,1);
83 TH1F *hjpsi_prob_mf =
new TH1F(
"hjpsi_prob_mf",
"J/#psi: Prob mass fit",100,0,1);
85 TH2F *
hvpos =
new TH2F(
"hvpos",
"(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
94 if (nevts==0) nevts= theAnalysis->
GetEntries();
100 double m0_jpsi = TDatabasePDG::Instance()->GetParticle(
"J/psi")->Mass();
104 TLorentzVector ini(0, 0, 6.231552, 7.240065);
109 while (theAnalysis->
GetEvent() && i++<nevts)
111 if ((i%100)==0) cout<<
"evt " << i << endl;
114 theAnalysis->
FillList(muplus,
"MuonAllPlus");
115 theAnalysis->
FillList(muminus,
"MuonAllMinus");
116 theAnalysis->
FillList(piplus,
"PionAllPlus");
117 theAnalysis->
FillList(piminus,
"PionAllMinus");
130 hjpsim_all->Fill( jpsi[j]->M() );
134 hjpsim_ftm->Fill( jpsi[j]->M() );
135 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
138 hjpsim_nm->Fill( jpsi[j]->M() );
149 double chi2_vtx = vtxfitter.GetChi2();
150 double prob_vtx = vtxfitter.GetProb();
151 hjpsi_chi2_vf->Fill(chi2_vtx);
152 hjpsi_prob_vf->Fill(prob_vtx);
154 if ( prob_vtx > 0.01 )
157 TVector3 jVtx=jfit->
Pos();
159 hjpsim_vf->Fill(jfit->
M());
160 hvpos->Fill(jVtx.X(),jVtx.Y());
168 psi2s.
Combine(jpsi, piplus, piminus);
178 hpsim_all->Fill( psi2s[j]->M() );
182 hpsim_ftm->Fill( psi2s[j]->M() );
183 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
186 hpsim_nm->Fill( psi2s[j]->M() );
196 fitter.Add4MomConstraint(ini);
199 double chi2_4c = fitter.GetChi2();
200 double prob_4c = fitter.GetProb();
201 hpsi_chi2_4c->Fill(chi2_4c);
202 hpsi_prob_4c->Fill(prob_4c);
204 if ( prob_4c > 0.01 )
208 hjpsim_4cf->Fill(jfit->
M());
219 mfitter.AddMassConstraint(m0_jpsi);
222 double chi2_m = mfitter.GetChi2();
223 double prob_m = mfitter.GetProb();
224 hjpsi_chi2_mf->Fill(chi2_m);
225 hjpsi_prob_mf->Fill(prob_m);
230 hjpsim_mcf->Fill(jfit->
M());
247 fillM(jpsi, hjpsim_trpid);
250 psi2s.
Combine(jpsi, piplus, piminus);
251 fillM(psi2s, hpsim_trpid);
259 theAnalysis->
FillList(muplus,
"MuonLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
260 theAnalysis->
FillList(muminus,
"MuonLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
261 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
262 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
265 fillM(jpsi, hjpsim_lpid);
268 psi2s.
Combine(jpsi, piplus, piminus);
269 fillM(psi2s, hpsim_lpid);
277 theAnalysis->
FillList(muplus,
"MuonTightPlus",
"PidAlgoMdtHardCuts");
278 theAnalysis->
FillList(muminus,
"MuonTightMinus",
"PidAlgoMdtHardCuts");
279 theAnalysis->
FillList(piplus,
"PionLoosePlus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
280 theAnalysis->
FillList(piminus,
"PionLooseMinus",
"PidAlgoMvd;PidAlgoStt;PidAlgoDrc");
283 fillM(jpsi, hjpsim_tpid);
286 psi2s.
Combine(jpsi, piplus, piminus);
287 fillM(psi2s, hpsim_tpid);
298 cout<<
"Writing "<<nhist<<
" histograms to file"<<endl;
FairRunAna * initrun(TString prefix, TString outfile, int min=-1, int max=-1)
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)
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)
int fillM(RhoCandList &l, TH1 *h)
int writemyhistos(int maxy=800, double asp=1.1)
void plotmyhistos(std::vector< TH1 * > h, int maxy=700, double asp=1.1)