32 "mvd1cut",
"mvd2cut",
"stcut",
"rtcut",
"ttcut",
"ptcut"};
34 "MC",
"REC",
"ACC",
"#chi^{2}_{prim}",
"ID",
"m_{#gamma}",
"mvd1",
"mvd2",
"ST",
"RT",
"TT",
"P_{t}"};
40 kGreen, kOrange - 3, kViolet + 10, kGreen - 3, kMagenta, kYellow + 1};
49 "#gamma-#pi^{0}",
"#gamma-o.",
"#pi^{0}-o."};
53 "el+_sec",
"el+_prim",
"el-_sec",
"el-_prim",
"pion+_sec",
"pion+_prim",
"pion-_sec",
"pion-_prim",
54 "proton_sec",
"proton_prim",
"kaon+_sec",
"kaon+_prim",
"kaon-_sec",
"kaon-_prim",
"other"};
56 "e^{+}_{sec}",
"e^{+}_{prim}",
"e^{-}_{sec}",
"e^{-}_{prim}",
"#pi^{+}_{sec}",
57 "#pi^{+}_{prim}",
"#pi^{-}_{sec}",
"#pi^{-}_{prim}",
"p_{sec}",
"p_{prim}",
58 "K^{+}_{sec}",
"K^{+}_{prim}",
"K^{-}_{sec}",
"K^{-}_{prim}",
"other"};
61 "pion-",
"proton",
"kaon+",
"kaon-",
"other"};
74 "pion",
"proton",
"kaon",
"other"};
76 "pion",
"proton",
"kaon",
"other"};
83 for (
const auto& subName : subNames) {
84 result.push_back(name +
"_" + subName);
92 vector<string> result;
93 for (
const auto& subName1 : subNames1) {
94 for (
const auto& subName2 : subNames2) {
95 result.push_back(name +
"_" + subName1 +
"_" + subName2);
101void LmvmHist::CreateH1(
const string& name,
const string& axisX,
const string& axisY,
double nBins,
double min,
104 string title = name +
";" + axisX +
";" + axisY;
105 fHM.Create1<TH1D>(name, title, nBins,
min,
max);
108void LmvmHist::CreateH1(
const string& name,
const string& axisX,
const string& axisY,
double nBins,
double min,
109 double max,
bool doSumw2)
111 string title = name +
";" + axisX +
";" + axisY;
112 fHM.Create1<TH1D>(name, title, nBins,
min,
max);
113 if (doSumw2)
fHM.H1(name)->Sumw2();
117 double nBins,
double min,
double max)
120 for (
const auto& curName : names) {
121 string title = curName +
";" + axisX +
";" + axisY;
122 fHM.Create1<TH1D>(curName, title, nBins,
min,
max);
127 double nBins,
double min,
double max,
bool doSumw2)
130 for (
const auto& curName : names) {
131 string title = curName +
";" + axisX +
";" + axisY;
132 fHM.Create1<TH1D>(curName, title, nBins,
min,
max);
133 if (doSumw2)
fHM.H1(curName)->Sumw2();
138 const string& axisX,
const string& axisY,
double nBins,
double min,
double max)
140 vector<string> names =
CombineNames(name, subNames1, subNames2);
141 for (
const auto& curName : names) {
142 string title = curName +
";" + axisX +
";" + axisY;
143 fHM.Create1<TH1D>(curName, title, nBins,
min,
max);
148 const string& axisX,
const string& axisY,
double nBins,
double min,
double max,
bool doSumw2)
150 vector<string> names =
CombineNames(name, subNames1, subNames2);
151 for (
const auto& curName : names) {
152 string title = curName +
";" + axisX +
";" + axisY;
153 fHM.Create1<TH1D>(curName, title, nBins,
min,
max);
154 if (doSumw2)
fHM.H1(curName)->Sumw2();
158void LmvmHist::CreateH2(
const string& name,
const string& axisX,
const string& axisY,
const string& axisZ,
159 double nBinsX,
double minX,
double maxX,
double nBinsY,
double minY,
double maxY)
161 string title = name +
";" + axisX +
";" + axisY +
";" + axisZ;
162 fHM.Create2<TH2D>(name, title, nBinsX, minX, maxX, nBinsY, minY, maxY);
166 const string& axisZ,
double nBinsX,
double minX,
double maxX,
double nBinsY,
double minY,
170 for (
const auto& curName : names) {
171 string title = curName +
";" + axisX +
";" + axisY +
";" + axisZ;
172 fHM.Create2<TH2D>(curName, title, nBinsX, minX, maxX, nBinsY, minY, maxY);
177 const string& axisX,
const string& axisY,
const string& axisZ,
double nBinsX,
double minX,
178 double maxX,
double nBinsY,
double minY,
double maxY)
180 vector<string> names =
CombineNames(name, subNames1, subNames2);
181 for (
const auto& curName : names) {
182 string title = curName +
";" + axisX +
";" + axisY +
";" + axisZ;
183 fHM.Create2<TH2D>(curName, title, nBinsX, minX, maxX, nBinsY, minY, maxY);
196 H1(name, src)->Fill(
x, wSignal);
204 H2(name, src)->Fill(
x,
y, wSignal);
211 H2(name, step)->Fill(
x,
y, w);
234 LOG(error) <<
"LmvmHist::GetName step == ELmvmAnaStep::Undefined";
243 LOG(error) <<
"LmvmHist::GetName src == ELmvmSrc::Undefined";
246 return name +
"_" +
fSrcNames[
static_cast<int>(src)];
257 hist->GetXaxis()->SetTitle(xAxisTitle);
258 hist->GetYaxis()->SetTitle(yAxisTitle);
259 hist->GetXaxis()->SetTitleSize(0.05);
260 hist->GetYaxis()->SetTitleSize(0.05);
261 hist->GetXaxis()->SetTitleFont(42);
262 hist->GetYaxis()->SetTitleFont(42);
263 hist->GetXaxis()->SetNdivisions(Ndevision);
264 hist->GetYaxis()->SetTitleOffset(1.4);
265 hist->GetXaxis()->SetTitleOffset(1.);
268 hist->GetXaxis()->SetLabelFont(42);
269 hist->GetYaxis()->SetLabelFont(42);
270 hist->GetXaxis()->SetLabelSize(0.04);
271 hist->GetYaxis()->SetLabelSize(0.04);
272 if (opt ==
"marker") {
273 hist->SetMarkerStyle(style);
274 hist->SetMarkerSize(
size);
275 hist->SetMarkerColor(color);
276 hist->SetLineColor(color);
277 hist->SetLineWidth(2);
282 hist->GetXaxis()->SetLabelColor(1);
283 hist->GetYaxis()->SetLabelColor(1);
284 hist->GetXaxis()->SetTitleColor(1);
285 hist->GetYaxis()->SetTitleColor(1);
286 hist->SetFillColor(1);
288 else if (opt ==
"line") {
289 hist->SetLineStyle(style);
290 hist->SetLineColor(color);
292 hist->SetLineWidth(
size);
295 LOG(error) <<
"Option '" << opt <<
"' undefined. Choose 'marker' or 'line'." << std::endl;
300 gStyle->SetOptStat(0);
301 gStyle->SetEndErrorSize(5);
303 gStyle->SetLineStyleString(22,
"80 18 12 18 12 12");
304 gStyle->SetEndErrorSize(5);
305 gStyle->SetCanvasColor(10);
306 gStyle->SetPadColor(10);
307 canvas->SetLeftMargin(0.15);
308 canvas->SetRightMargin(0.04);
309 canvas->SetTopMargin(0.05);
310 canvas->SetBottomMargin(0.12);
311 canvas->ToggleEventStatus();
312 canvas->Range(-200, -10, 1000, -2);
313 canvas->SetFillColor(0);
314 canvas->SetBorderMode(0);
315 canvas->SetBorderSize(0);
319 canvas->SetFrameLineWidth(2);
320 canvas->SetFrameBorderMode(0);
321 canvas->SetFrameBorderSize(0);
327 auto leg =
new TLegend(x1, y1, x2, y2);
328 leg->SetLineColor(10);
329 leg->SetLineStyle(1);
330 leg->SetLineWidth(1);
331 leg->SetFillColor(10);
332 leg->SetTextSize(textsize);
333 leg->SetTextFont(42);
335 leg->SetBorderSize(0);
336 for (
size_t i = 0; i < legendV.size(); i++) {
337 const auto& l = legendV[i];
338 leg->AddEntry(l.fH, l.fName, l.fOpt);
347 TLatex* tex =
new TLatex(xPos, yPos,
"#splitline{CBM Simulations}{Au+Au #sqrt{#it{s}_{NN}}=4.1 GeV, #it{b}=0 fm}");
348 tex->SetTextColor(1);
349 tex->SetTextFont(42);
350 tex->SetTextSize(textSize);
358 h->GetXaxis()->SetLabelSize(0.05);
361 h->GetXaxis()->SetBinLabel(
x,
fAnaStepLatex[
static_cast<int>(step)].c_str());
371 for (
const auto& curName : names) {
372 fHM.Rebin(curName, nGroup);
378 vector<string> names =
CombineNames(name, subNames1, subNames2);
379 for (
const auto& curName : names) {
380 fHM.Rebin(curName, nGroup);
386 int nBins = s->GetNbinsX();
387 TH1D* hsig =
new TH1D(name.c_str(), name.c_str(), nBins, s->GetXaxis()->GetXmin(), s->GetXaxis()->GetXmax());
388 hsig->GetXaxis()->SetTitle(s->GetXaxis()->GetTitle());
391 if (option ==
"right") {
392 for (
int i = 1; i <= nBins; i++) {
393 double sumSignal = s->Integral(1, i,
"width");
394 double sumBg = bg->Integral(1, i,
"width");
395 double sign = (sumSignal + sumBg != 0.) ? sumSignal / std::sqrt(sumSignal + sumBg) : 0.;
396 hsig->SetBinContent(i, sign);
397 hsig->GetYaxis()->SetTitle(
"Significance");
401 else if (option ==
"left") {
402 for (
int i = nBins; i >= 1; i--) {
403 double sumSignal = s->Integral(i, nBins,
"width");
404 double sumBg = bg->Integral(i, nBins,
"width");
405 double sign = (sumSignal + sumBg != 0.) ? sumSignal / std::sqrt(sumSignal + sumBg) : 0.;
406 hsig->SetBinContent(i, sign);
407 hsig->GetYaxis()->SetTitle(
"Significance");
420 int nStepsX = (int) ((xmax - xmin) / delta);
421 int nStepsY = (int) ((ymax - ymin) / delta);
423 TH2D* hsig =
new TH2D(name.c_str(), title.c_str(), nStepsX, xmin, xmax, nStepsY, ymin, ymax);
426 for (
double xcut = xmin; xcut <= xmax; xcut += delta, binX++) {
428 for (
double ycut = ymin; ycut <= ymax; ycut += delta, binY++) {
429 double sumSignal = 0;
431 for (
int ix = 1; ix <= signal->GetNbinsX(); ix++) {
432 for (
int iy = 1; iy <= signal->GetNbinsY(); iy++) {
433 double xc = signal->GetXaxis()->GetBinCenter(ix);
434 double yc = signal->GetYaxis()->GetBinCenter(iy);
435 double val = -1 * (ycut / xcut) * xc + ycut;
437 if (!(xc < xcut && yc < val)) {
438 sumSignal += signal->GetBinContent(ix, iy);
439 sumBg += bg->GetBinContent(ix, iy);
443 double sign = (sumSignal + sumBg != 0.) ? sumSignal / std::sqrt(sumSignal + sumBg) : 0.;
444 hsig->SetBinContent(binX, binY, sign);
453 TCanvas* c =
fHM.CreateCanvas(cName, cName, 2400, 2400);
458 string hFullname = hName +
"_" + ptcl;
466 TCanvas* c =
fHM.CreateCanvas(cName, cName, 2400, 1800);
471 string hFullname = hName +
"_" + ptcl;
480 TCanvas* c =
fHM.CreateCanvas(cName +
"Steps/" +
fAnaStepNames[
static_cast<int>(step)],
481 cName +
"Steps/" +
fAnaStepNames[
static_cast<int>(step)], 2400, 1800);
486 string hFullname =
GetName(hName +
"_" + ptcl, step);
492 TCanvas* c =
fHM.CreateCanvas(cName +
"Candidates/" + ptcl, cName +
"Candidates/" + ptcl, 2400, 1800);
497 string hFullname =
GetName(hName +
"_" + ptcl, step);
509 TH1D*
h =
H1Clone(hFullname.c_str());
510 h->GetYaxis()->SetRangeUser(
min,
max);
515 if (xLabel.size() > 1) {
516 for (
size_t iL = 0; iL < xLabel.size(); iL++) {
517 h->GetXaxis()->SetBinLabel(iL + 1, xLabel[iL].c_str());
522 TH2D*
h =
H2Clone(hFullname.c_str());
523 h->GetZaxis()->SetRangeUser(
min,
max);
525 if (logX ==
false && logY ==
false)
527 else if (logX ==
false && logY ==
true)
529 else if (logX ==
true && logY ==
false)
531 else if (logX ==
true && logY ==
true)
534 if (xLabel.size() > 1) {
535 for (
size_t iL = 0; iL < xLabel.size(); iL++) {
536 h->GetXaxis()->SetBinLabel(iL + 1, xLabel[iL].c_str());
539 if (yLabel.size() > 1) {
540 for (
size_t iL = 0; iL < yLabel.size(); iL++) {
541 h->GetYaxis()->SetBinLabel(iL + 1, yLabel[iL].c_str());
546 LOG(error) <<
"LmvmHist::DrawAll: Choose dimension 1 or 2!";
558 for (
size_t iC = 5; iC <
fCandNames.size(); iC++) {
562 ratio->GetZaxis()->SetTitle(
"Others/Electrons");
569 TCanvas* c =
fHM.CreateCanvas(cName +
"Ratio", cName +
"Ratio", 2400, 1800);
574 ratio->GetYaxis()->SetTitle(
"Value");
575 ratio->GetZaxis()->SetTitle(
"Ratio Electrons/Others");
576 ratio->GetZaxis()->SetRangeUser(1e-7, 100.);
589 TText* t =
new TText(xPos, yPos, effTxt.c_str());
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)
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Helper functions for drawing 1D and 2D histograms and graphs.
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
static constexpr size_t size()
void Rebin(const std::string &histName, Int_t ngroup)
Rebin histogram.
Data class with information on a STS local track.
void CreateH1(const std::string &name, const std::string &axisX, const std::string &axisY, double nBins, double min, double max)
static const std::vector< int > fAnaStepColors
static const std::vector< ELmvmSrc > fSrcs
static const std::vector< std::string > fCandNames
static const std::vector< std::string > fAnaStepLatex
void DrawEfficiency(TH1 *h1, TH1 *h2, double xPos, double yPos)
void DrawSimDataLabel(double xPos, double yPos)
TH1D * CreateSignificanceH1(TH1D *s, TH1D *bg, const std::string &name, const std::string &option)
void FillH1(const std::string &name, double x, double w=1.)
TH2D * GetRatioElectronsOthers(const std::string &hName, ELmvmAnaStep step)
TH2D * H2Clone(const std::string &name)
TH2D * H2(const std::string &name)
void SetOptH1(TH1D *hist, TString xAxisTitle, TString yAxisTitle, Int_t Ndevision, Int_t style, Float_t size, Int_t color, std::string opt="")
static const std::vector< int > fSrcColors
static const std::vector< std::string > fBgPairSrcNames
static const std::vector< ELmvmSignal > fSignals
std::vector< std::string > CombineNames(const std::string &name, const std::vector< std::string > &subNames)
static const std::vector< std::string > fFSCandLatex
void SetOptCanvas(TCanvas *canvas)
void CreateH2(const std::string &name, const std::string &axisX, const std::string &axisY, const std::string &axisZ, double nBinsX, double minX, double maxX, double nBinsY, double minY, double maxY)
static const std::vector< std::string > fSrcNames
static const std::vector< std::string > fCandLatex
static const std::vector< ELmvmAnaStep > fAnaStepsFS
std::string GetName(const std::string &name, ELmvmAnaStep step)
void FillH2(const std::string &name, double x, double y, double w=1.)
void DrawAll(int dim, const std::string &hFullname, const std::string &padText, std::vector< std::string > xLabel, std::vector< std::string > yLabel, bool logX, bool logY, double min, double max)
static const std::vector< std::string > fGTrackNames
void DrawAllCandsAndSteps(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, bool logX, bool logY, double min, double max)
static const std::vector< std::string > fSrcLatex
void Rebin(const std::string &name, int nGroup)
TH2D * CreateSignificanceH2(TH2D *signal, TH2D *bg, const std::string &name, const std::string &title)
static const std::vector< std::string > fGTrackLatex
static const std::vector< ELmvmAnaStep > fAnaSteps
void DrawAllGTracks(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, bool logX, bool logY, double min, double max)
static const std::vector< std::string > fSignalNames
void DrawAllCands(int dim, const std::string &cName, const std::string &hName, std::vector< std::string > xLabel, std::vector< std::string > yLabel, bool logX, bool logY, double min, double max)
static const std::vector< std::string > fFSCandNames
static const int fNofAnaSteps
void SetAnalysisStepAxis(TH1 *hist)
TH1D * H1Clone(const std::string &name)
TH1D * H1(const std::string &name)
void DrawRatioElectronsOthers(const std::string &cName, const std::string &hName)
static const std::vector< std::string > fBgPairSrcLatex
static const std::vector< std::string > fAnaStepNames
void SetLegend(std::vector< LmvmLegend >, double textsize, double x1, double y1, double x2, double y2)
static void DrawAnaStepOnPad(ELmvmAnaStep step)
std::string NumberToString(const T &value, int precision=1)