15#include "TDirectory.h"
25#include <boost/assign/list_of.hpp>
30using boost::assign::list_of;
46 const string& outputDir)
49 TFile* oldFile = gFile;
50 TDirectory* oldDir = gDirectory;
53 TFile* fileSE =
new TFile(fileSuperEvent.c_str());
57 TFile* fileEbE =
new TFile(fileEventByEvent.c_str());
82 long nofSEEvents =
fHMSuperEvent->
H1(
"fh_se_event_number")->GetEntries();
83 long nofSEEventsSquared = nofSEEvents * nofSEEvents;
84 cout <<
"Number of SE events = " << nofSEEventsSquared << endl;
88 cout <<
"Number of EE events = " << nofEEEvents << endl;
117 CreateCanvas(
"jpsi_fh_SE_PdgCode_of Others_BG",
"jpsi_fh_SE_PdgCode_of Others_BG", 1000, 1000);
129 CreateCanvas(
"jpsi_se_fh_se_ee_bg_minv_reco",
"jpsi_fh_se_ee_bg_minv_reco", 900, 900);
132 list_of(
"Event-by-Event")(
"SuperEvent"),
kLinear,
kLinear,
true, 0.7, 0.9, 0.99, 0.95);
136 CreateCanvas(
"jpsi_se_fh_se_ee_bg_minv_chi2prim",
"jpsi_fh_se_ee_bg_minv_chi2prim", 900, 900);
139 list_of(
"Event-by-Event")(
"SuperEvent"),
kLinear,
kLinear,
true, 0.7, 0.9, 0.99, 0.95);
143 CreateCanvas(
"jpsi_se_fh_se_ee_bg_minv_elid",
"jpsi_fh_se_ee_bg_minv_elid", 900, 900);
146 list_of(
"Event-by-Event")(
"SuperEvent"),
kLinear,
kLinear,
true, 0.7, 0.9, 0.99, 0.95);
150 CreateCanvas(
"jpsi_se_fh_se_ee_bg_minv_ptcut",
"jpsi_fh_se_ee_bg_minv_ptcut", 900, 900);
153 list_of(
"Event-by-Event")(
"SuperEvent"),
kLinear,
kLinear,
true, 0.7, 0.9, 0.99, 0.95);
159 CreateCanvas(
"jpsi_se_minv_reco",
"jpsi_se_minv_reco", 900, 900);
163 list_of(
"Background SuperEvent")(
"Signal Event-By-Event"),
kLinear,
kLog,
true, 0.7, 0.9, 0.99, 0.95);
166 CreateCanvas(
"jpsi_se_minv_chi2prim",
"jpsi_se_minv_chi2prim", 900, 900);
170 list_of(
"Background SuperEvent")(
"Signal Event-By-Event"),
kLinear,
kLog,
true, 0.7, 0.9, 0.99, 0.95);
173 CreateCanvas(
"jpsi_se_minv_elid",
"jpsi_se_minv_elid", 900, 900);
177 list_of(
"Background SuperEvent")(
"Signal Event-By-Event"),
kLinear,
kLog,
true, 0.7, 0.9, 0.99, 0.95);
180 CreateCanvas(
"jpsi_se_minv_ptcut",
"jpsi_se_minv_ptcut", 900, 900);
184 list_of(
"Background SuperEvent")(
"Signal Event-By-Event"),
kLinear,
kLog,
true, 0.7, 0.9, 0.99, 0.95);
187 CreateCanvas(
"jpsi_se_ee_minv_ptcut",
"jpsi_se_ee_minv_ptcut", 900, 900);
190 TH1D* fhBgSignal = (TH1D*) fhBg->Clone();
191 fhBgSignal->Add(fhSignal);
192 fhBgSignal->SetMinimum(1e-9);
193 DrawH1(list_of(fhBg)(fhSignal)(fhBgSignal),
194 list_of(
"Background SuperEvent")(
"Signal Event-By-Event")(
"Signal and Background"),
kLinear,
kLog,
true, 0.7,
205 TH1D* signalFit_ee = (TH1D*) signal_ee->Clone();
206 signalFit_ee->Fit(
"gaus",
"",
"", 2.9, 3.3);
209 Double_t sigmaSignal = signalFit_ee->GetFunction(
"gaus")->GetParameter(
"Sigma");
210 Double_t meanSignal = signalFit_ee->GetFunction(
"gaus")->GetParameter(
"Mean");
213 int signalMin = signal_ee->FindBin(meanSignal - 2. * sigmaSignal);
214 int signalMax = signal_ee->FindBin(meanSignal + 2. * sigmaSignal);
216 double NOfSignalEntries = 0.;
217 double NOfBgEntries = 0.;
220 for (
int i = signalMin; i <= signalMax; i++) {
221 NOfSignalEntries += signal_ee->GetBinContent(i);
222 NOfBgEntries += bg_se->GetBinContent(i);
226 if (NOfBgEntries <= 0.) {
return 0.; }
228 double sOverBg = NOfSignalEntries / NOfBgEntries;
235 CreateCanvas(
"jpsi_fh_se_SignalOverBg_allAnaSteps",
"jpsi_fh_se_SignalOverBg_allAnaSteps", 600, 600);
236 fHMSuperEvent->
Create1<TH1D>(
"fh_se_SignalOverBg_allAnaSteps",
"fh_se_SignalOverBg_allAnaSteps;AnaSteps;S/Bg", 4, 0,
241 double nstep = i + 0.5;
243 fHMSuperEvent->
H1(
"fh_se_SignalOverBg_allAnaSteps")->Fill(nstep, SOverBg);
247 fHMSuperEvent->
H1(
"fh_se_SignalOverBg_allAnaSteps")->GetXaxis()->SetLabelSize(0.06);
261 CreateCanvas(
"jpsi_fh_bg_pair_source",
"jpsi_fh_bg_pair_source", 800, 800);
267 list_of(
"whole BG")(
"#gamma + #gamma")(
"#gamma + #pi^{0}")(
"#gamma + others")(
"#pi^{0} + #pi^{0}")(
268 "#pi^{0} + others")(
"others + others"),
276 CreateCanvas(
"jpsi_fh_se_bg_Minv_Mismatch_pt",
"jpsi_fh_se_bg_Minv_Mismatch_pt", 800, 800);
278 double trueMatch =
fHMSuperEvent->
H1(
"fh_se_bg_truematch_minv_ptCut")->GetEntries();
279 double trueMatchEl =
fHMSuperEvent->
H1(
"fh_se_bg_truematch_el_minv_ptCut")->GetEntries();
280 double trueMatchNotEl =
fHMSuperEvent->
H1(
"fh_se_bg_truematch_notel_minv_ptCut")->GetEntries();
281 double misMatch =
fHMSuperEvent->
H1(
"fh_se_bg_mismatch_minv_ptCut")->GetEntries();
289 +
"%)")(
"true match (not e^{#pm}) (" +
Cbm::NumberToString(100. * trueMatchNotEl / nofBg, 1)
298 TCanvas* c6 =
CreateCanvas(
"jpsi_se_ee_minv_diff_ptCuts",
"jpsi_se_ee_minv_diff_ptCuts", 1600, 800);
300 for (
int i = 0; i < 8; i++) {
303 TH1D* fhSignalDiffPtCuts =
305 TH1D* fhBgSignalDiffPtCuts = (TH1D*) fhBgDiffPtCuts->Clone();
306 fhBgSignalDiffPtCuts->Add(fhSignalDiffPtCuts);
307 fhBgSignalDiffPtCuts->SetMinimum(1e-9);
312 upperCut = (0.4 * (i + 1));
313 lowerCut = (upperCut - 0.4);
327 TH1D* signalFit_DiffPt_ee = (TH1D*) fhSignalDiffPtCuts->Clone();
328 signalFit_DiffPt_ee->Fit(
"gaus",
"",
"", 2.9, 3.3);
331 Double_t sigmaSignal = signalFit_DiffPt_ee->GetFunction(
"gaus")->GetParameter(
"Sigma");
332 Double_t meanSignal = signalFit_DiffPt_ee->GetFunction(
"gaus")->GetParameter(
"Mean");
335 int signalMin = signalFit_DiffPt_ee->FindBin(meanSignal - 2. * sigmaSignal);
336 int signalMax = signalFit_DiffPt_ee->FindBin(meanSignal + 2. * sigmaSignal);
338 double NOfSignalEntries = 0.;
339 double NOfBgEntries = 0.;
342 for (
int j = signalMin; j <= signalMax; j++) {
343 NOfSignalEntries += signalFit_DiffPt_ee->GetBinContent(j);
344 NOfBgEntries += fhBgDiffPtCuts->GetBinContent(j);
349 if (NOfBgEntries <= 0.) { SOverBg = 0; }
351 SOverBg = NOfSignalEntries / NOfBgEntries;
355 DrawH1(list_of(fhBgDiffPtCuts)(fhSignalDiffPtCuts)(fhBgSignalDiffPtCuts),
356 list_of(
"Background")(
"Signal")(
"Signal and Background"),
kLinear,
kLog,
true, 0.65, 0.8, 0.99, 0.95);
ClassImp(CbmConverterManager)
void DrawTextOnPad(const string &text, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void SetDefaultDrawStyle()
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.).
static const std::vector< std::string > fAnaStepsLatex
static const int fNofAnaSteps
static const std::vector< std::string > fAnaSteps
void DrawMinvDiffPtBins()
virtual void Create()
Inherited from CbmSimulationReport.
double SignalOverBg(int step)
CbmAnaJpsiSuperEventReport()
Constructor.
CbmHistManager * fHMEventByEvent
CbmHistManager * fHMSuperEvent
virtual ~CbmAnaJpsiSuperEventReport()
Destructor.
void SignalOverBgAllSteps()
virtual void Draw()
Inherited from CbmSimulationReport.
void DrawMinvMismatchPt()
void ReadFromFile(TFile *file)
Read histograms from file.
void ScaleByPattern(const std::string &pattern, Double_t scale)
Scale histograms which name matches specified pattern.
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.
virtual std::string Title(int size, const std::string &title) const =0
Return string with title.
virtual std::string DocumentBegin() const =0
Return string with open tags for document.
virtual std::string DocumentEnd() const =0
Return string with close tags of the document.
std::ostream & Out() const
All text output goes to this stream.
void SetOutputDir(const std::string &outputDir)
void SetReportName(const std::string &name)
void PrintCanvases() const
Print images created from canvases in the report.
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
void CreateReports()
Create all available report types.
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases. Canvases created with this function will be automati...
Base class for simulation reports.
vector< string > Split(const string &name, char delimiter)
std::string NumberToString(const T &value, int precision=1)