22#include "TClonesArray.h"
23#include "TDirectory.h"
32#include <boost/assign/list_of.hpp>
38using boost::assign::list_of;
53 , fRunAfterPtCut(kTRUE)
54 , fRunAfterIdCut(kTRUE)
62 cout <<
"-I- Run" << endl;
73 TFile* oldFile = gFile;
74 TDirectory* oldDir = gDirectory;
76 TFile* file =
new TFile(
fOutputFile.c_str(),
"RECREATE");
91 fHM->
Create1<TH1D>(
"fh_se_bg_minv_reco",
"fh_se_bg_minv_reco;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
92 fHM->
Create1<TH1D>(
"fh_se_bg_minv_chi2prim",
"fh_se_bg_minv_chi2prim;M_{ee} [GeV/c^{2}];particles/event", 4000, 0,
94 fHM->
Create1<TH1D>(
"fh_se_bg_minv_elid",
"fh_se_bg_minv_elid;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
95 fHM->
Create1<TH1D>(
"fh_se_bg_minv_ptcut",
"fh_se_bg_minv_ptcut;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
97 fHM->
Create1<TH1D>(
"fh_se_event_number",
"fh_se_event_number;a.u.;Number of events", 1, 0, 1.);
99 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_gg",
100 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
101 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_gp",
102 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
103 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_go",
104 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
105 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_pg",
106 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
107 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_pp",
108 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
109 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_po",
110 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
111 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_og",
112 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
113 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_op",
114 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
115 fHM->
Create1<TH1D>(
"fh_se_bg_participants_minv_oo",
116 "fh_se_bg_participants_minv_gg;M_{ee} [GeV/c^{2}];particles/event", 4000, 0, 4.);
118 fHM->
Create1<TH1D>(
"fh_SE_PdgCode_of Others_BG",
"fh_SE_PdgCode_of Others_BG;PDGCode;Tracks per Event", 500, -0.5,
121 fHM->
Create1<TH1D>(
"fh_se_bg_mismatch_minv_ptCut",
"fh_se_bg_mismatch_minv_ptCut;M_{ee} [GeV/c^{2}];particles/event",
123 fHM->
Create1<TH1D>(
"fh_se_bg_truematch_minv_ptCut",
124 "fh_se_bg_truematch_minv_ptCut;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
125 fHM->
Create1<TH1D>(
"fh_se_bg_truematch_el_minv_ptCut",
126 "fh_se_bg_truematch_el_minv_ptCut;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
127 fHM->
Create1<TH1D>(
"fh_se_bg_truematch_notel_minv_ptCut",
128 "fh_se_bg_truematch_notel_minv_ptCut;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
130 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_0",
"fh_se_bg_minv_diff_ptcuts_0;M_{ee} [GeV/c^{2}];particles/event",
132 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_1",
"fh_se_bg_minv_diff_ptcuts_1;M_{ee} [GeV/c^{2}];particles/event",
134 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_2",
"fh_se_bg_minv_diff_ptcuts_2;M_{ee} [GeV/c^{2}];particles/event",
136 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_3",
"fh_se_bg_minv_diff_ptcuts_3;M_{ee} [GeV/c^{2}];particles/event",
138 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_4",
"fh_se_bg_minv_diff_ptcuts_4;M_{ee} [GeV/c^{2}];particles/event",
140 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_5",
"fh_se_bg_minv_diff_ptcuts_5;M_{ee} [GeV/c^{2}];particles/event",
142 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_6",
"fh_se_bg_minv_diff_ptcuts_6;M_{ee} [GeV/c^{2}];particles/event",
144 fHM->
Create1<TH1D>(
"fh_se_bg_minv_diff_ptcuts_7",
"fh_se_bg_minv_diff_ptcuts_7;M_{ee} [GeV/c^{2}];particles/event",
153 cout <<
"-I- ReadCandidates" << endl;
154 cout <<
"-I- fFileNames.size:" <<
fFileNames.size() << endl;
157 TFile* oldFile = gFile;
158 TDirectory* oldDir = gDirectory;
160 for (UInt_t iFile = 0; iFile <
fFileNames.size(); iFile++) {
161 cout <<
"-I- Reading file No " << iFile <<
" path:" <<
fFileNames[iFile] << endl;
162 TFile* f =
new TFile(
fFileNames[iFile].c_str(),
"R");
163 LOG_IF(fatal, !f) <<
"Could not open file " <<
fFileNames[iFile].c_str();
164 TTree* t = f->Get<TTree>(
"cbmsim");
165 TFolder* fd = f->Get<TFolder>(
"cbmout");
166 if (fd == NULL)
continue;
167 TClonesArray* candidates = (TClonesArray*) fd->FindObjectAny(
"JpsiCandidates");
168 t->SetBranchAddress(candidates->GetName(), &candidates);
169 Int_t nofEvents = t->GetEntriesFast();
170 cout <<
"-I- Number of events in file: " << nofEvents << endl;
171 for (Int_t iEv = 0; iEv < nofEvents; iEv++) {
172 fHM->
H1(
"fh_se_event_number")->Fill(0.5);
174 Int_t nofCandidates = candidates->GetEntriesFast();
176 for (Int_t iCand = 0; iCand < nofCandidates; iCand++) {
208 cout <<
"-I- number of events:" <<
fHM->
H1(
"fh_se_event_number")->GetEntries() << endl;
213 cout <<
"-I- DoSuperEvent" << endl;
217 for (Int_t iM = 0; iM < nofMinus; iM++) {
218 if (iM % 1000 == 0) cout << 100. * iM / nofMinus <<
"% done" << endl;
220 for (Int_t iP = 0; iP < nofPlus; iP++) {
234 fHM->
H1(
"fh_se_bg_minv_reco")->Fill(pRec.
fMinv);
235 if (isChi2Primary)
fHM->
H1(
"fh_se_bg_minv_chi2prim")->Fill(pRec.
fMinv);
236 if (isChi2Primary && isEl)
fHM->
H1(
"fh_se_bg_minv_elid")->Fill(pRec.
fMinv);
237 if (isChi2Primary && isEl && isPtCut) {
238 fHM->
H1(
"fh_se_bg_minv_ptcut")->Fill(pRec.
fMinv);
242 fHM->
H1(
"fh_se_bg_participants_minv_gg")->Fill(pRec.
fMinv);
245 fHM->
H1(
"fh_se_bg_participants_minv_gp")->Fill(pRec.
fMinv);
248 fHM->
H1(
"fh_se_bg_participants_minv_go")->Fill(pRec.
fMinv);
249 fHM->
H1(
"fh_SE_PdgCode_of Others_BG")->Fill((
double) candP->
fMcPdg - 0.5);
254 fHM->
H1(
"fh_se_bg_participants_minv_gp")->Fill(pRec.
fMinv);
257 fHM->
H1(
"fh_se_bg_participants_minv_pp")->Fill(pRec.
fMinv);
260 fHM->
H1(
"fh_se_bg_participants_minv_po")->Fill(pRec.
fMinv);
261 fHM->
H1(
"fh_SE_PdgCode_of Others_BG")->Fill((
double) candP->
fMcPdg - 0.5);
265 fHM->
H1(
"fh_SE_PdgCode_of Others_BG")->Fill((
double) candM->
fMcPdg - 0.5);
267 fHM->
H1(
"fh_se_bg_participants_minv_go")->Fill(pRec.
fMinv);
270 fHM->
H1(
"fh_se_bg_participants_minv_po")->Fill(pRec.
fMinv);
273 fHM->
H1(
"fh_se_bg_participants_minv_oo")->Fill(pRec.
fMinv);
274 fHM->
H1(
"fh_SE_PdgCode_of Others_BG")->Fill((
double) candP->
fMcPdg - 0.5);
279 if (isBG && isMismatch)
fHM->
H1(
"fh_se_bg_mismatch_minv_ptCut")->Fill(pRec.
fMinv);
280 if (isBG && !isMismatch) {
281 fHM->
H1(
"fh_se_bg_truematch_minv_ptCut")->Fill(pRec.
fMinv);
282 if (candP->
fMcPdg == 11 && candM->
fMcPdg == 11)
fHM->
H1(
"fh_se_bg_truematch_el_minv_ptCut")->Fill(pRec.
fMinv);
284 fHM->
H1(
"fh_se_bg_truematch_notel_minv_ptCut")->Fill(pRec.
fMinv);
288 if (isChi2Primary && isEl && pRec.
fPt < 0.4) {
fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_0")->Fill(pRec.
fMinv); }
289 if (isChi2Primary && isEl && pRec.
fPt >= 0.4 && pRec.
fPt < 0.8) {
290 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_1")->Fill(pRec.
fMinv);
292 if (isChi2Primary && isEl && pRec.
fPt >= 0.8 && pRec.
fPt < 1.2) {
293 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_2")->Fill(pRec.
fMinv);
295 if (isChi2Primary && isEl && pRec.
fPt >= 1.2 && pRec.
fPt < 1.6) {
296 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_3")->Fill(pRec.
fMinv);
298 if (isChi2Primary && isEl && pRec.
fPt >= 1.6 && pRec.
fPt < 2.0) {
299 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_4")->Fill(pRec.
fMinv);
301 if (isChi2Primary && isEl && pRec.
fPt >= 2.0 && pRec.
fPt < 2.4) {
302 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_5")->Fill(pRec.
fMinv);
304 if (isChi2Primary && isEl && pRec.
fPt >= 2.4 && pRec.
fPt < 3.0) {
305 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_6")->Fill(pRec.
fMinv);
307 if (isChi2Primary && isEl && pRec.
fPt >= 3.0 && pRec.
fPt < 6.0) {
308 fHM->
H1(
"fh_se_bg_minv_diff_ptcuts_7")->Fill(pRec.
fMinv);
316 TCanvas* c =
new TCanvas(
"jpsi_se_bg_minv",
"jpsi_se_bg_minv", 1200, 1200);
332 fHM->
H1(
"fh_se_bg_minv_ptcut")->SetMinimum(1e-11);
ClassImp(CbmConverterManager)
void DrawTextOnPad(const string &text, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
Helper functions for drawing 1D and 2D histograms and graphs.
Abstract class for basic report elements (headers, tables, images etc.).
Bool_t fIsMcGammaElectron
Bool_t fIsMcSignalElectron
static const std::vector< std::string > fAnaStepsLatex
static CbmAnaJpsiKinematicParams KinematicParamsWithCandidates(const CbmAnaJpsiCandidate *candP, const CbmAnaJpsiCandidate *candM)
virtual ~CbmAnaJpsiSuperEvent()
std::vector< CbmAnaJpsiCandidate > fMinusCandidates
std::vector< CbmAnaJpsiCandidate > fPlusCandidates
std::vector< std::string > fFileNames
void ScaleByPattern(const std::string &pattern, Double_t scale)
Scale histograms which name matches specified pattern.
void WriteToFile()
Write all objects to current opened file.
void RebinByPattern(const std::string &pattern, Int_t ngroup)
Rebin histograms which name matches specified pattern.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
vector< string > Split(const string &name, char delimiter)
std::string NumberToString(const T &value, int precision=1)