BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnReport.h
Go to the documentation of this file.
1
#ifndef BMNREPORT_H_
2
#define BMNREPORT_H_
3
4
#include <iostream>
5
#include <map>
6
#include <string>
7
#include <vector>
8
// ROOT
9
#include <
TCanvas.h
>
10
#include <
TFile.h
>
11
#include <
THttpServer.h
>
12
#include <
TObject.h
>
13
14
using
std::map;
15
using
std::ostream;
16
using
std::string;
17
using
std::vector;
18
19
class
BmnReportElement
;
20
21
/**
22
* \class BmnReport
23
* \brief Base class for reports.
24
* \author Andrey Lebedev <andrey.lebedev@gsi.de>
25
* \author Ilnur Gabdrakhmanov <ilnur@jinr.ru> - unificiation for online/offline mode
26
* \date 2011 - 2025
27
*/
28
class
BmnReport
:
public
TObject
29
{
30
public
:
31
/**
32
* \brief Constructor.
33
*/
34
BmnReport
();
35
36
/**
37
* \brief Destructor.
38
*/
39
virtual
~BmnReport
();
40
41
/**
42
* \brief Accessor to BmnReportElement object.
43
* User has to write the report using available tags from BmnReportElement class.
44
*/
45
const
BmnReportElement
*
R
()
const
{
return
fR
; }
46
47
/**
48
* \brief All text output goes to this stream.
49
*/
50
ostream&
Out
()
const
{
return
*
fOut
; }
51
52
void
Register
(
string
path);
53
void
CallDraw
() {
Draw
(); }
54
55
/* Setters */
56
void
SetReportName
(
TString
name) {
fReportName
= name.
Data
(); }
57
void
SetReportTitle
(
const
string
& title) {
fReportTitle
= title; }
58
void
SetOutputDir
(
const
string
& outputDir) {
fOutputDir
= outputDir; }
59
60
/* void SetObjDir(TFile* outFile = nullptr)
61
{
62
TDirectory* fDir = nullptr;
63
if (outFile)
64
fDir = outFile->mkdir((fReportName + "_hists").data());
65
//for (auto el : fCanvases)
66
// el->SetDirectory(fDir);
67
} */
68
69
void
SetMonitorMode
(
const
Bool_t
mm) {
fMonitorMode
= mm; }
70
void
SetObjServer
(
THttpServer
* s) {
fServer
= s; }
71
72
/* Accessors */
73
const
string
&
GetReportName
()
const
{
return
fReportName
; }
74
const
string
&
GetReportTitle
()
const
{
return
fReportTitle
; }
75
const
string
&
GetOutputDir
()
const
{
return
fOutputDir
; }
76
Bool_t
GetMonitorMode
()
const
{
return
fMonitorMode
; }
77
THttpServer
*
GetObjServer
()
const
{
return
fServer
; }
78
79
protected
:
80
/**
81
* \brief Pure abstract function which is called from public Create() function.
82
* This function has to write report using Out() for output stream and
83
* R() for report elements. This function is called for each report type.
84
*/
85
virtual
void
Create
() = 0;
86
87
/**
88
* \brief Pure abstract function which is called from public Create() function.
89
* This function has to draw all necessary histograms and graphs.
90
* It is called only once before report creation.
91
*/
92
virtual
void
Draw
() = 0;
93
94
/**
95
* \brief Create all available report types.
96
*/
97
void
CreateReports
();
98
99
/**
100
* \brief Create canvas and put it to vector of TCanvases.
101
* Canvases created with this function will be automatically saved to image and
102
* printed in the report.
103
*/
104
TCanvas
*
CreateCanvas
(
const
char
* name,
const
char
* title,
Int_t
ww,
Int_t
wh);
105
106
/**
107
* \brief Save all canvases to images.
108
*/
109
void
SaveCanvasesAsImages
()
const
;
110
111
/**
112
* \brief Write canvases to file.
113
*/
114
void
WriteCanvases
()
const
;
115
116
/**
117
* \brief Print images created from canvases in the report.
118
*/
119
void
PrintCanvases
()
const
;
120
121
THttpServer
*
fServer
;
122
Bool_t
fMonitorMode
;
123
Bool_t
fInitCanvasesDone
;
124
125
private
:
126
/**
127
* \brief Create concrete BmnReportElement instance based on the report type.
128
*/
129
void
CreateReportElement
();
130
131
/**
132
* \brief Delete report element. Normally should be called at the end of Create function.
133
*/
134
void
DeleteReportElement
();
135
136
string
fReportName
;
// Name of report
137
string
fReportTitle
;
// Title of report
138
string
fOutputDir
;
// Output directory for the report files
139
BmnReportElement
*
fR
;
// Report element tool
140
mutable
ostream*
fOut
;
// Output stream
141
142
// Storage for TCanvas. All Canvases in this vector will be automatically saved
143
// to image and printed in the report.
144
// User can use CreateCanvas function which automatically push created canvas in this vector.
145
vector<TCanvas*>
fCanvases
;
146
map<string, TCanvas*>
fCanvasMap
;
147
148
// private:
149
150
BmnReport
(
const
BmnReport
&) =
delete
;
151
BmnReport
&
operator=
(
const
BmnReport
&) =
delete
;
152
153
ClassDef
(
BmnReport
, 1)
154
};
155
156
#endif
/* BmnREPORT_H_ */
Bool_t
bool Bool_t
Int_t
int Int_t
ClassDef
#define ClassDef(name, id)
TCanvas.h
TFile.h
THttpServer.h
TObject.h
BmnReportElement
Abstract class for basic report elements (headers, tables, images etc.).
Definition
BmnReportElement.h:34
BmnReport::GetReportTitle
const string & GetReportTitle() const
Definition
BmnReport.h:74
BmnReport::SetMonitorMode
void SetMonitorMode(const Bool_t mm)
Definition
BmnReport.h:69
BmnReport::SetReportTitle
void SetReportTitle(const string &title)
Definition
BmnReport.h:57
BmnReport::GetOutputDir
const string & GetOutputDir() const
Definition
BmnReport.h:75
BmnReport::Draw
virtual void Draw()=0
Pure abstract function which is called from public Create() function.
BmnReport::SetReportName
void SetReportName(TString name)
Definition
BmnReport.h:56
BmnReport::PrintCanvases
void PrintCanvases() const
Print images created from canvases in the report.
Definition
BmnReport.cxx:113
BmnReport::fR
BmnReportElement * fR
Definition
BmnReport.h:139
BmnReport::BmnReport
BmnReport(const BmnReport &)=delete
BmnReport::CallDraw
void CallDraw()
Definition
BmnReport.h:53
BmnReport::R
const BmnReportElement * R() const
Accessor to BmnReportElement object.
Definition
BmnReport.h:45
BmnReport::BmnReport
BmnReport()
Constructor.
Definition
BmnReport.cxx:17
BmnReport::SetOutputDir
void SetOutputDir(const string &outputDir)
Definition
BmnReport.h:58
BmnReport::CreateCanvas
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases.
Definition
BmnReport.cxx:75
BmnReport::fCanvases
vector< TCanvas * > fCanvases
Definition
BmnReport.h:145
BmnReport::CreateReports
void CreateReports()
Create all available report types.
Definition
BmnReport.cxx:54
BmnReport::Out
ostream & Out() const
All text output goes to this stream.
Definition
BmnReport.h:50
BmnReport::fInitCanvasesDone
Bool_t fInitCanvasesDone
Definition
BmnReport.h:123
BmnReport::SetObjServer
void SetObjServer(THttpServer *s)
Definition
BmnReport.h:70
BmnReport::fOutputDir
string fOutputDir
Definition
BmnReport.h:138
BmnReport::fReportTitle
string fReportTitle
Definition
BmnReport.h:137
BmnReport::GetObjServer
THttpServer * GetObjServer() const
Definition
BmnReport.h:77
BmnReport::WriteCanvases
void WriteCanvases() const
Write canvases to file.
Definition
BmnReport.cxx:103
BmnReport::operator=
BmnReport & operator=(const BmnReport &)=delete
BmnReport::DeleteReportElement
void DeleteReportElement()
Delete report element.
Definition
BmnReport.cxx:46
BmnReport::fOut
ostream * fOut
Definition
BmnReport.h:140
BmnReport::Register
void Register(string path)
Definition
BmnReport.cxx:122
BmnReport::fReportName
string fReportName
Definition
BmnReport.h:136
BmnReport::Create
virtual void Create()=0
Pure abstract function which is called from public Create() function.
BmnReport::GetReportName
const string & GetReportName() const
Definition
BmnReport.h:73
BmnReport::fMonitorMode
Bool_t fMonitorMode
Definition
BmnReport.h:122
BmnReport::SaveCanvasesAsImages
void SaveCanvasesAsImages() const
Save all canvases to images.
Definition
BmnReport.cxx:89
BmnReport::fServer
THttpServer * fServer
Definition
BmnReport.h:121
BmnReport::~BmnReport
virtual ~BmnReport()
Destructor.
Definition
BmnReport.cxx:28
BmnReport::CreateReportElement
void CreateReportElement()
Create concrete BmnReportElement instance based on the report type.
Definition
BmnReport.cxx:36
BmnReport::fCanvasMap
map< string, TCanvas * > fCanvasMap
Definition
BmnReport.h:146
BmnReport::GetMonitorMode
Bool_t GetMonitorMode() const
Definition
BmnReport.h:76
TCanvas
THttpServer
TObject::TObject
TObject()
TString
TString::Data
const char * Data() const
install
include
BmnReport.h
Generated on
for BmnRoot by
1.17.0