15#include <RtypesCore.h>
16#include <TDirectory.h>
36 assert(histManager !=
nullptr);
44 assert(
fHM ==
nullptr);
45 fHM =
new CbmHistManager();
47 TFile* oldFile = gFile;
48 TDirectory* oldDir = gDirectory;
50 TFile* file =
new TFile(fileName.c_str());
51 fHM->ReadFromFile(file);
65 vector<TH1*> histos =
HM()->
H1Vector(histNamePattern);
66 UInt_t nofHistos = histos.size();
67 if (nofHistos < 1)
return;
68 for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
69 TH1* hist = histos[iHist];
72 CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
80 vector<TH1*> histos =
HM()->
H1Vector(histNamePattern);
81 UInt_t nofHistos = histos.size();
82 if (nofHistos < 1)
return;
85 CreateCanvas(canvasName.c_str(), canvasName.c_str(), 600, 500);
87 vector<string> labels(nofHistos);
88 for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
89 string name = histos[iHist]->GetName();
90 labels[iHist] = labelFormatter(name,
HM());
97 const string& drawOpt)
100 UInt_t nofHistos = histos.size();
101 if (nofHistos < 1)
return;
102 for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
103 TH2* hist = histos[iHist];
106 CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 500);
107 DrawH2(hist, logx, logy, logz, drawOpt);
ClassImp(CbmConverterManager)
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.
HistScale
Define linear or logarithmic scale for drawing.
Base class for simulation reports.
std::vector< TH1 * > H1Vector(const std::vector< std::string > &names) const
Return vector of pointers to TH1 histogram.
std::vector< TH2 * > H2Vector(const std::vector< std::string > &names) const
Return vector of pointers to TH2 histogram.
void SetOutputDir(const std::string &outputDir)
const std::string & GetReportName() const
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.
CbmSimulationReport()
Constructor.
virtual void Create()=0
Inherited from CbmReport. Pure abstract function which is called from public Create() function.
virtual ~CbmSimulationReport()
Destructor.
void DrawH1ByPattern(const std::string &histNamePattern)
Select by pattern TH1 histograms and draw each histogram on separate canvas.
CbmHistManager * HM() const
Return pointer to Histogram manager.
void DrawH2ByPattern(const std::string &histNamePattern, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const std::string &drawOpt="")
Select by pattern TH2 histograms and draw each histogram on separate canvas.