11 int i=0,j=0, k=0, l=0;
12 gStyle->SetOptFit(1011);
15 TString OutFile=
"out_dummy.root";
18 TString inPidFile = prefix+
"_pid.root";
19 TString inParFile = prefix+
"_par.root";
22 TString pidParFile =
TString(gSystem->Getenv(
"VMCWORKDIR"))+
"/macro/params/all.par";
25 FairLogger::GetLogger()->SetLogToFile(kFALSE);
26 FairRunAna*
fRun =
new FairRunAna();
27 FairRuntimeDb*
rtdb = fRun->GetRuntimeDb();
28 fRun->SetSource(
new FairFileSource(inPidFile));
31 FairParRootFileIo* parIO =
new FairParRootFileIo();
32 parIO->open(inParFile);
33 FairParAsciiFileIo* parIOPid =
new FairParAsciiFileIo();
34 parIOPid->open(pidParFile.Data(),
"in");
36 rtdb->setFirstInput(parIO);
37 rtdb->setSecondInput(parIOPid);
38 rtdb->setOutput(parIO);
40 fRun->SetOutputFile(OutFile);
44 TFile *
out = TFile::Open(prefix+
"_ana_mcmatch.root",
"RECREATE");
47 TH1F *hjpsim_all =
new TH1F(
"hjpsim_all",
"J/#psi mass",200,0,4.5);
48 TH1F *hpsim_all =
new TH1F(
"hpsim_all",
"#psi(2S) mass",200,0,5);
50 TH1F *hjpsim_nm =
new TH1F(
"hjpsim_nm",
"J/#psi mass (no truth match)",200,0,4.5);
51 TH1F *hpsim_nm =
new TH1F(
"hpsim_nm",
"#psi(2S) mass (no truth match)",200,0,5);
53 TH1F *hjpsim_ftm =
new TH1F(
"hjpsim_ftm",
"J/#psi mass (full truth match)",200,0,4.5);
54 TH1F *hpsim_ftm =
new TH1F(
"hpsim_ftm",
"#psi(2S) mass (full truth match)",200,0,5);
56 TH1F *hjpsim_diff =
new TH1F(
"hjpsim_diff",
"J/#psi mass diff to truth",100,-2,2);
57 TH1F *hpsim_diff =
new TH1F(
"hpsim_diff",
"#psi(2S) mass diff to truth",100,-2,2);
66 if (nevts==0) nevts= theAnalysis->
GetEntries();
77 while (theAnalysis->
GetEvent() && i++<nevts)
79 if ((i%100)==0) cout<<
"evt " << i << endl;
82 theAnalysis->
FillList(muplus,
"MuonAllPlus");
83 theAnalysis->
FillList(muminus,
"MuonAllMinus");
84 theAnalysis->
FillList(piplus,
"PionAllPlus");
85 theAnalysis->
FillList(piminus,
"PionAllMinus");
97 hjpsim_all->Fill( jpsi[j]->M() );
101 hjpsim_ftm->Fill( jpsi[j]->M() );
102 hjpsim_diff->Fill( jpsi[j]->GetMcTruth()->M() - jpsi[j]->M() );
105 hjpsim_nm->Fill( jpsi[j]->M() );
112 psi2s.
Combine(jpsi, piplus, piminus);
121 hpsim_all->Fill( psi2s[j]->M() );
125 hpsim_ftm->Fill( psi2s[j]->M() );
126 hpsim_diff->Fill( psi2s[j]->GetMcTruth()->M() - psi2s[j]->M() );
129 hpsim_nm->Fill( psi2s[j]->M() );
142 hjpsim_diff->Write();
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
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)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)
void tut_ana_mcmatch(int nevts=0, TString prefix="signal")