16#include "TDirectory.h"
25#include <boost/assign/list_of.hpp>
30using boost::assign::list_of;
58 int nofEvents =
H1(
"fh_event_number")->GetEntries();
59 cout <<
"Number of events = " << nofEvents << endl;
101 TCanvas* c =
CreateCanvas(
"jpsi_fh_vertex_el_gamma",
"jpsi_fh_vertex_el_gamma", 1000, 1000);
104 DrawH2(
H2(
"fh_vertex_el_gamma_xz"));
106 DrawH2(
H2(
"fh_vertex_el_gamma_yz"));
108 DrawH2(
H2(
"fh_vertex_el_gamma_xy"));
110 DrawH2(
H2(
"fh_vertex_el_gamma_rz"));
114 TCanvas* c =
CreateCanvas(
"jpsi_fh_nof_tracks",
"jpsi_fh_nof_tracks", 1000, 500);
123 H1(
"fh_nof_el_tracks")->SetMinimum(0.0);
128 TCanvas* c =
CreateCanvas(
"jpsi_fh_nof_mismatches",
"jpsi_fh_nof_mismatches", 1000, 1000);
135 DrawH1(
H1(
"fh_nof_mismatches_rich"));
139 DrawH1(
H1(
"fh_nof_mismatches_trd"));
143 DrawH1(
H1(
"fh_nof_mismatches_tof"));
148 DrawBgSource2D(
"fh_source_tracks", list_of(
"#gamma")(
"#pi^{0}")(
"#pi^{#pm}")(
"p")(
"K")(
"e^{#pm}_{sec}")(
"oth."),
159 TCanvas* c =
CreateCanvas(
"jpsi_fh_PdgCode_of Others_BG",
"jpsi_fh_PdgCode_of Others_BG", 1000, 1000);
171 TCanvas* c =
CreateCanvas((
"jpsi_" + hName).c_str(), (
"jpsi_" + hName).c_str(), 1200, 800);
186 CreateCanvas((
"jpsi_" + hName).c_str(), (
"jpsi_" + hName).c_str(), 600, 600);
191 h.push_back(
H1(fullName));
192 h[i]->SetLineWidth(2);
194 if (doScale)
h[i]->Scale(1. /
h[i]->Integral());
197 h[i]->SetMinimum(
min);
198 h[i]->SetMaximum(
max);
210 h.push_back(
H1(fullName));
211 h[i]->SetLineWidth(2);
214 Double_t integral =
h[i]->Integral();
215 if (integral != 0.0) {
h[i]->Scale(1. /
h[i]->Integral()); }
224 CreateCanvas((
"jpsi_" + hName).c_str(), (
"jpsi_" + hName).c_str(), 600, 600);
226 if (cutValue != -999999.) {
227 TLine* cutLine =
new TLine(cutValue, 0.0, cutValue, 1.);
228 cutLine->SetLineWidth(2);
235 TCanvas* c =
CreateCanvas((
"jpsi_" + hist).c_str(), (
"jpsi_" + hist).c_str(), 900, 900);
249 DrawCutH1(
"fh_track_mom", -999999.,
false);
250 DrawCutH1(
"fh_track_chi2sts", -999999.,
false);
251 DrawCutH1(
"fh_track_rapidity", -999999.,
false);
262 const string hName =
"fh_signal_minv";
264 CreateCanvas((
"jpsi_" + hName).c_str(), (
"jpsi_" + hName).c_str(), 600, 600);
269 h.push_back((TH1*)
H1(fullName)->Clone());
270 cout << i <<
" Integral " <<
h[i]->Integral() << endl;
271 cout << i <<
" Entries " <<
h[i]->GetEntries() << endl;
272 h[i]->SetAxisRange(2., 4.,
"X");
273 h[i]->SetLineWidth(2);
277 h[i]->SetMinimum(
min);
278 h[i]->SetMaximum(
max);
298 +
"%)")(
"true match (not e^{#pm}) (" +
Cbm::NumberToString(100. * trueMatchNotEl / nofBg, 1)
308 TCanvas* c =
CreateCanvas(
"jpsi_fh_minv_mismatches",
"jpsi_fh_minv_mismatches", 1000, 1000);
315 CreateCanvas(
"jpsi_fh_minv_mismatches_ptcut",
"jpsi_fh_minv_mismatches_ptcut", 600, 600);
322 Double_t nofMCEntries =
H2(McHistName)->GetEntries();
323 if (nofMCEntries != 0) {
342 TCanvas* c =
CreateCanvas(
"jpsi_fh_pty_efficiency",
"jpsi_fh_pty_efficiency", 1200, 800);
352 h->GetXaxis()->SetLabelSize(0.06);
366 TH1D* signalFit = (TH1D*) signal->Clone();
367 signalFit->Fit(
"gaus");
370 Double_t sigmaSignal = signalFit->GetFunction(
"gaus")->GetParameter(
"Sigma");
371 Double_t meanSignal = signalFit->GetFunction(
"gaus")->GetParameter(
"Mean");
374 int signalMin = signal->FindBin(meanSignal - 2. * sigmaSignal);
375 int signalMax = signal->FindBin(meanSignal + 2. * sigmaSignal);
377 double NOfSignalEntries = 0.;
378 double NOfBgEntries = 0.;
381 for (
int i = signalMin; i <= signalMax; i++) {
382 NOfSignalEntries += signal->GetBinContent(i);
383 NOfBgEntries += bg->GetBinContent(i);
387 if (NOfBgEntries <= 0.) {
return 0.; }
389 double sOverBg = NOfSignalEntries / NOfBgEntries;
396 CreateCanvas(
"jpsi_fh_SignalOverBg_allAnaSteps",
"jpsi_fh_SignalOverBg_allAnaSteps", 600, 600);
397 HM()->
Create1<TH1D>(
"fh_SignalOverBg_allAnaSteps",
"fh_SignalOverBg_allAnaSteps;AnaSteps;S/Bg", 6, 0, 6);
400 double nstep = i + 0.5;
402 HM()->
H1(
"fh_SignalOverBg_allAnaSteps")->Fill(nstep, SOverBg);
407 DrawH1(
H1(
"fh_SignalOverBg_allAnaSteps"));
416 TH1D* s = (TH1D*) signal->Clone();
417 TH1D* bg = (TH1D*) background->Clone();
418 TH1D* sbg = (TH1D*) background->Clone();
423 sbg->SetMinimum(1e-12);
425 DrawH1(list_of(sbg)(bg)(s), list_of(
"")(
"")(
""),
kLinear,
kLog,
false, 0, 0, 0, 0);
427 s->SetFillColor(kRed);
428 s->SetLineColor(kBlack);
431 bg->SetFillColor(kYellow - 10);
432 bg->SetLineColor(kBlack);
435 sbg->SetFillColor(kBlue);
436 sbg->SetLineColor(kBlack);
437 sbg->SetLineWidth(1);
439 s->SetMarkerStyle(1);
440 bg->SetMarkerStyle(1);
441 sbg->SetMarkerStyle(1);
449 TCanvas* c1 =
CreateCanvas(
"jpsi_fh_Minv_Signal_and_Bg",
"jpsi_fh_Minv_Signal_and_Bg", 1200, 800);
458 CreateCanvas(
"jpsi_fh_Minv_Signal_and_Bg_ptCut",
"jpsi_fh_Minv_Signal_and_Bg_ptCut", 600, 600);
467 McEff->SetMinimum(0.);
468 McEff->SetMaximum(115.);
474 (TH1D*)
Mc->Clone());
480 CreateCanvas(
"jpsi_fh_Momentum_Efficiency_AllSteps",
"jpsi_fh_Momentum_Efficiency_AllSteps", 800, 800);
482 DrawH1(list_of(McEff)(AccEff)(RecEff)(Chi2PrimEff)(ElIdEff)(PtEff),
490 gPad->SetLogy(
false);
495 CreateCanvas(
"jpsi_fh_Momentum_Mc_Reco",
"jpsi_fh_Momentum_Mc_Reco", 800, 800);
496 DrawH2(
H2(
"fh_track_el_mom_mc_rec"));
513 list_of(
"#gamma + #gamma")(
"whole BG")(
"#gamma + #pi^{0}")(
"#gamma + others")
514 (
"#pi^{0} + #pi^{0}")(
"#pi^{0} + others")
521 TCanvas* c =
CreateCanvas(
"jpsi_fh_bg_pair_source",
"jpsi_fh_bg_pair_source", 1200, 800);
532 gStyle->SetPaintTextFormat(
"4.2f");
533 CreateCanvas(
string(
"jpsi_" + histName +
"_abs").c_str(),
string(
"jpsi_" + histName +
"_abs").c_str(), 900, 600);
534 TH2D* habs = (TH2D*)
H2(histName)->Clone();
535 habs->SetStats(
false);
536 habs->GetZaxis()->SetTitle(zTitle.c_str());
538 habs->SetMarkerSize(1.8);
541 CreateCanvas(
string(
"jpsi_" + histName +
"_percent").c_str(),
string(
"jpsi_" + histName +
"_percent").c_str(), 900,
543 TH2D* hperc = (TH2D*)
H2(histName)->Clone();
544 hperc->SetStats(
false);
545 Int_t nBinsX = hperc->GetNbinsX();
546 Int_t nBinsY = hperc->GetNbinsY();
547 for (
Int_t x = 1;
x <= nBinsX;
x++) {
550 for (
Int_t y = 1;
y <= nBinsY;
y++) {
551 nbg += habs->GetBinContent(
x,
y);
553 Double_t sc = 100. / (nbg);
554 for (
Int_t y = 1;
y <= nBinsY;
y++) {
555 Double_t val = sc * hperc->GetBinContent(
x,
y);
556 hperc->SetBinContent(
x,
y, val);
559 hperc->GetZaxis()->SetTitle(
"[%]");
560 hperc->GetXaxis()->SetLabelSize(0.06);
561 hperc->GetYaxis()->SetLabelSize(0.06);
562 hperc->SetMarkerColor(kBlack);
563 hperc->SetMarkerSize(1.8);
567 for (UInt_t
y = 1;
y <= yLabels.size();
y++) {
568 hperc->GetYaxis()->SetBinLabel(
y, yLabels[
y - 1].c_str());
569 habs->GetYaxis()->SetBinLabel(
y, yLabels[
y - 1].c_str());
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)
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Helper functions for drawing 1D and 2D histograms and graphs.
Abstract class for basic report elements (headers, tables, images etc.).
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
static const std::vector< std::string > fAnaStepsLatex
static const std::vector< std::string > fSourceTypes
static const std::vector< int > fAnaStepsColor
static const std::vector< std::string > fSourceTypesLatex
static const int fNofAnaSteps
static const std::vector< std::string > fAnaSteps
static const int fNofSourceTypes
static const std::vector< int > fSourceTypesColor
void DrawMinvSAndBgAllSteps()
void DrawBgSource2D(const std::string &histName, const std::vector< std::string > &yLabels, const std::string &zTitle)
CbmAnaJpsiReport()
Constructor.
void DrawMinvSAndBg(int step)
virtual void Create()
Inherited from CbmSimulationReport.
void DrawCutDistributions()
void DrawMinvMismatches(int step)
void DrawAnalysisStepsH2(const std::string &hName, bool DoDrawEfficiency)
void DrawCutH1(const std::string &hName, double cutValue, bool doScale=false)
void DrawMinvMismatchesAll()
void SetAnalysisStepLabels(TH1 *h)
virtual void Draw()
Inherited from CbmSimulationReport.
void DrawAnalysisStepsH1(const std::string &hName, bool doScale, double min=-1., double max=-1.)
void SignalOverBgAllSteps()
void DrawSourceTypesH1(const std::string &hName, bool doScale=false)
void Draw2DCut(const std::string &hist)
void DrawMomEffAllSteps()
void DrawPtYEfficiencyAll()
virtual ~CbmAnaJpsiReport()
Destructor.
double SignalOverBg(int step)
void DrawPairSourceAnaSteps(int step)
void DrawEfficiency(const std::string &h, const std::string &hMC)
void DrawPtYEfficiency(int step)
static Int_t MarkerStyle(Int_t markerIndex)
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.
static CbmLitGlobalElectronId & GetInstance()
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 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...
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...
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
CbmSimulationReport()
Constructor.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
CbmHistManager * HM() const
Return pointer to Histogram manager.
Data class with information on a STS local track.
TH1D * DivideH1(TH1 *h1, TH1 *h2, const string &histName, double scale, const string &titleYaxis)
vector< string > Split(const string &name, char delimiter)
TH2D * DivideH2(TH2 *h1, TH2 *h2, const string &histName, double scale, const string &titleZaxis)
std::string NumberToString(const T &value, int precision=1)