BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnSimulationReport.h
Go to the documentation of this file.
1/**
2 * \file BmnSimulationReport.h
3 * \brief Base class for simulation reports.
4 * \author Semen Lebedev <s.lebedev@gsi.de>
5 * \date 2011
6 */
7#ifndef BMNSIMULATIONREPORT_H_
8#define BMNSIMULATIONREPORT_H_
9
10#include "BmnDetectorList.h"
11#include "BmnDrawHist.h"
12#include "BmnReport.h"
13#include "TF1.h"
14#include "TPaveStats.h"
15
16#include <string>
17
18using std::ostream;
19using std::string;
20
21class BmnHistManager;
22
23// basic height and wigth of pad
24const Int_t baseW = 700;
25const Int_t baseH = 500;
26
27/**
28 * \class BmnSimulationReport
29 * \brief Base class for simulation reports.
30 * \author Semen Lebedev <s.lebedev@gsi.de>
31 * \date 2011
32 */
34{
35 public:
36 /**
37 * \brief Constructor.
38 */
40
41 /**
42 * \brief Destructor.
43 */
44 virtual ~BmnSimulationReport();
45
46 /**
47 * \brief Main function which creates report data.
48 *
49 * Non virtual interface pattern is used here.
50 * User always creates simulation report using this public non virtual method.
51 * In order to configure concrete report generation class
52 * user has to implement protected Create() method.
53 *
54 * \param[in] histManager Pointer to histogram manager for which report is created.
55 * \param[in] outputDir Path to directory for output results.
56 */
57 void Create(BmnHistManager* histManager, const string& outputDir);
58 void Create(const string& outputDir);
59 void Create();
60
61 /**
62 * \brief Main function which creates report data.
63 *
64 * Same pattern is used here.
65 *
66 * \param[in] fileName Name of the file with histograms.
67 * \param[in] outputDir Path to directory for output results.
68 */
69 void Create(const string& fileName, const string& outputDir);
70
71 void SetHM(BmnHistManager* hm) { fHM = hm; }
72
73 /**
74 * \brief Return pointer to Histogram manager.
75 */
76 BmnHistManager* HM() const { return fHM; }
77
78 /**
79 * \brief Select by pattern TH1 histograms and draw each histogram on separate canvas.
80 * \param[in] histNamePattern Name pattern for histogram.
81 */
82 void DrawH1ByPattern(const string& histNamePattern);
83
84 /**
85 * \brief Select by pattern TH1 histograms and draw all histograms on the same canvas.
86 * \param[in] histNamePattern Name pattern for histogram.
87 */
88 void DrawH1ByPattern(const string& histNamePattern, string (*labelFormatter)(const string&, const BmnHistManager*));
89
90 /**
91 * \brief Select by pattern TH2 histograms and draw each histogram on separate canvas.
92 * \param[in] histNamePattern Name pattern for histogram.
93 * \param[in] logx Specify logarithmic or linear scale for X axis.
94 * \param[in] logy Specify logarithmic or linear scale for Y axis.
95 * \param[in] logz Specify logarithmic or linear scale for Z axis.
96 * \param[in] drawOpt Other drawing options (see ROOT documentation for details).
97 */
98 void DrawH2ByPattern(const string& histNamePattern,
99 HistScale logx = kLinear,
100 HistScale logy = kLinear,
101 HistScale logz = kLinear,
102 const string& drawOpt = "");
103
104 void SetOnlyPrimes(const Bool_t prime) { fPrimes = prime; }
105
106 Bool_t GetOnlyPrimes() const { return fPrimes; }
107
108 void AddStationSet(DetectorId id, void* ss) { fDetStationSets.insert(std::make_pair(id, ss)); }
109
110 void DrawHits2D();
111
113 static char* HistNameHits(string detName, Short_t iSt) { return Form("%s_st%d_x_vs_y", detName.data(), iSt); }
114 static char* HistNameHits(TString& detName, Short_t iSt) { return Form("%s_st%d_x_vs_y", detName.Data(), iSt); }
115 static char* HistNameStripDigit(TString& detName, Short_t iSt, Short_t iMod, Short_t iLayer)
116 {
117 return Form("%s_Station_%d_module_%d_layer_%d", detName.Data(), iSt, iMod, iLayer);
118 }
119
120 protected:
121 void DrawMuSigma(TVirtualPad* pad, TH1* h);
122 void DrawOneH1(const TString canvasName,
123 const TString name1,
124 const TString drawOpt,
125 Int_t histW = baseW,
126 Int_t histH = baseH);
127 void DrawOneH1Log(const TString canvasName,
128 const TString name1,
129 const TString drawOpt,
130 Int_t histW = baseW,
131 Int_t histH = baseH);
132 void DrawTwoH1(const TString canvasName,
133 const TString name1,
134 const TString name2,
135 const TString drawOpt,
136 Bool_t doFit = kFALSE,
137 Int_t histW = baseW,
138 Int_t histH = baseH);
139 void DrawOneH2(const TString canvasName, const TString name1, Int_t histW = baseW, Int_t histH = baseH);
140 void DrawTwoH2(const TString canvasName,
141 const TString name1,
142 const TString name2,
143 Int_t histW = baseW,
144 Int_t histH = baseH);
145 void DrawThreeH1(const TString canvasName,
146 const TString name1,
147 const TString name2,
148 const TString name3,
149 Int_t histW = baseW,
150 Int_t histH = baseH);
151 void DrawThreeH2(const TString canvasName,
152 const TString name1,
153 const TString name2,
154 const TString name3,
155 Int_t histW = baseW,
156 Int_t histH = baseH);
157 void DrawFourH2(const TString canvasName,
158 const TString name1,
159 const TString name2,
160 const TString name3,
161 const TString name4,
162 Int_t histW = baseW,
163 Int_t histH = baseH);
164 void DrawNH2(const string canvasName,
165 const vector<string>& names,
166 Int_t histW = baseW,
167 Int_t histH = baseH,
168 Int_t ncols = 2);
170
171 private:
172 BmnHistManager* fHM; // Histogram manager
174
175 map<DetectorId, void*> fDetStationSets;
176
179
181};
182
183#endif /* BmnSIMULATIONREPORT_H_ */
const Int_t baseH
const Int_t baseW
bool Bool_t
int Int_t
short Short_t
constexpr Bool_t kFALSE
#define ClassDef(name, id)
char * Form(const char *fmt,...)
DetectorId
BM@N DetectorID enumerator.
Histogram manager.
BmnReport()
Constructor.
Definition BmnReport.cxx:17
BmnHistManager * HM() const
Return pointer to Histogram manager.
BmnSimulationReport()
Constructor.
static char * HistNameHits(string detName, Short_t iSt)
void DrawNH2(const string canvasName, const vector< string > &names, Int_t histW=baseW, Int_t histH=baseH, Int_t ncols=2)
void DrawTwoH2(const TString canvasName, const TString name1, const TString name2, Int_t histW=baseW, Int_t histH=baseH)
void DrawH1ByPattern(const string &histNamePattern)
Select by pattern TH1 histograms and draw each histogram on separate canvas.
void DrawThreeH2(const TString canvasName, const TString name1, const TString name2, const TString name3, Int_t histW=baseW, Int_t histH=baseH)
map< DetectorId, void * > fDetStationSets
virtual ~BmnSimulationReport()
Destructor.
BmnSimulationReport(const BmnSimulationReport &)=delete
void DrawOneH1Log(const TString canvasName, const TString name1, const TString drawOpt, Int_t histW=baseW, Int_t histH=baseH)
void DrawH2ByPattern(const string &histNamePattern, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const string &drawOpt="")
Select by pattern TH2 histograms and draw each histogram on separate canvas.
static TClass * GetStationSetClass(DetectorId det)
void SetHM(BmnHistManager *hm)
static char * HistNameStripDigit(TString &detName, Short_t iSt, Short_t iMod, Short_t iLayer)
BmnSimulationReport & operator=(const BmnSimulationReport &)=delete
void DrawTwoH1(const TString canvasName, const TString name1, const TString name2, const TString drawOpt, Bool_t doFit=kFALSE, Int_t histW=baseW, Int_t histH=baseH)
void Create()
Pure abstract function which is called from public Create() function.
void DrawFourH2(const TString canvasName, const TString name1, const TString name2, const TString name3, const TString name4, Int_t histW=baseW, Int_t histH=baseH)
static char * HistNameHits(TString &detName, Short_t iSt)
void SetOnlyPrimes(const Bool_t prime)
void DrawOneH2(const TString canvasName, const TString name1, Int_t histW=baseW, Int_t histH=baseH)
void DrawMuSigma(TVirtualPad *pad, TH1 *h)
void DrawThreeH1(const TString canvasName, const TString name1, const TString name2, const TString name3, Int_t histW=baseW, Int_t histH=baseH)
void DrawOneH1(const TString canvasName, const TString name1, const TString drawOpt, Int_t histW=baseW, Int_t histH=baseH)
void AddStationSet(DetectorId id, void *ss)
const char * Data() const
Defines unique identifiers (enum) for all BM@N detector systems.
Helper functions for drawing 1D and 2D histograms and graphs.
HistScale
Define linear or logarithmic scale for drawing.
Definition BmnDrawHist.h:64
@ kLinear
Definition BmnDrawHist.h:66
const Int_t baseH
const Int_t baseW