20 int i=0,j=0, k=0, l=0;
21 gStyle->SetOptFit(1011);
24 TString OutFile=
"out_dummy.root";
29 TFile *
out = TFile::Open(prefix+
"_ana_mcmatch.root",
"RECREATE");
32 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass",200,0,4.5);
33 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass",200,0,5);
35 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
36 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
38 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
39 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
41 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
42 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
51 if (nevts==0) nevts= theAnalysis->
GetEntries();
62 while (theAnalysis->
GetEvent() && i++<nevts)
64 if ((i%100)==0) cout<<
"evt " << i << endl;
67 theAnalysis->
FillList(muplus,
"MuonAllPlus");
68 theAnalysis->
FillList(muminus,
"MuonAllMinus");
69 theAnalysis->
FillList(piplus,
"PionAllPlus");
70 theAnalysis->
FillList(piminus,
"PionAllMinus");
82 hjpsim_all->Fill( jpsi[j]->M() );
86 hjpsim_ftm->Fill( jpsi[j]->M() );
87 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
90 hjpsim_nm->Fill( jpsi[j]->M() );
97 psi2s.
Combine(jpsi, piplus, piminus);
106 hpsim_all->Fill( psi2s[j]->M() );
110 hpsim_ftm->Fill( psi2s[j]->M() );
111 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
114 hpsim_nm->Fill( psi2s[j]->M() );
126 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)
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)