EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CbmReport.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file CbmReport.cxx
1
7
#include "
CbmReport.h
"
8
#include "
CbmLatexReportElement.h
"
9
#include "
CbmHtmlReportElement.h
"
10
#include "
CbmTextReportElement.h
"
11
#include "TCanvas.h"
12
13
#include <fstream>
14
#include <string>
15
using
std::ofstream;
16
using
std::string;
17
18
CbmReport::CbmReport
():
19
fReportName(
"qa_report"
),
20
fReportTitle(
"QA report"
),
21
fOutputDir(
"./"
),
22
fR(NULL),
23
fOut(NULL),
24
fReportType(
kCoutReport
),
25
fCanvases()
26
{
27
}
28
29
CbmReport::~CbmReport
()
30
{
31
}
32
33
void
CbmReport::CreateReportElement
(
34
ReportType
reportType)
35
{
36
fReportType
= reportType;
37
if
(NULL !=
fR
)
delete
fR
;
38
if
(NULL !=
fOut
&&
fReportType
!=
kCoutReport
)
delete
fOut
;
39
if
(reportType ==
kLatexReport
) {
40
fR
=
new
CbmLatexReportElement
();
41
fOut
=
new
ofstream(
string
(
GetOutputDir
() +
fReportName
+
".tex"
).c_str());
42
}
else
if
(reportType ==
kHtmlReport
) {
43
fR
=
new
CbmHtmlReportElement
();
44
fOut
=
new
ofstream(
string
(
GetOutputDir
() +
fReportName
+
".html"
).c_str());
45
}
else
if
(reportType ==
kTextReport
) {
46
fR
=
new
CbmTextReportElement
();
47
fOut
=
new
ofstream(
string
(
GetOutputDir
() +
fReportName
+
".txt"
).c_str());
48
}
else
if
(reportType ==
kCoutReport
) {
49
fR
=
new
CbmTextReportElement
();
50
fOut
= &std::cout;
51
}
52
}
53
54
void
CbmReport::DeleteReportElement
()
55
{
56
// if (NULL != fR) delete fR;
57
// if (NULL != fOut && fReportType != kCoutReport) delete fOut;
58
}
59
60
void
CbmReport::CreateReports
()
61
{
62
Draw
();
// User has to implement this function!
63
SaveCanvasesAsImages
();
64
// WriteCanvases();
65
66
CreateReportElement
(
kHtmlReport
);
67
Create
();
// User has to implement this function!
68
DeleteReportElement
();
69
70
CreateReportElement
(
kLatexReport
);
71
Create
();
// User has to implement this function!
72
DeleteReportElement
();
73
74
CreateReportElement
(
kTextReport
);
75
Create
();
// User has to implement this function!
76
DeleteReportElement
();
77
78
CreateReportElement
(
kCoutReport
);
79
Create
();
// User has to implement this function!
80
DeleteReportElement
();
81
}
82
83
TCanvas*
CbmReport::CreateCanvas
(
84
const
char
*
name
,
85
const
char
*
title
,
86
Int_t ww,
87
Int_t wh)
88
{
89
TCanvas* canvas =
new
TCanvas(name, title, ww, wh);
90
fCanvases
.push_back(canvas);
91
return
canvas;
92
}
93
94
void
CbmReport::SaveCanvasesAsImages
()
const
95
{
96
if
(
GetOutputDir
() ==
""
)
return
;
97
Int_t nofCanvases =
fCanvases
.size();
98
for
(Int_t i = 0; i < nofCanvases; i++) {
99
TCanvas* canvas =
fCanvases
[i];
100
//canvas->SaveAs(string(GetOutputDir() + string(canvas->GetTitle()) + ".eps").c_str());
101
canvas->SaveAs(
string
(
GetOutputDir
() +
string
(canvas->GetTitle()) +
".png"
).c_str());
102
canvas->SaveAs(
string
(
GetOutputDir
() +
string
(canvas->GetTitle()) +
".gif"
).c_str());
103
}
104
}
105
106
void
CbmReport::WriteCanvases
()
const
107
{
108
if
(
GetOutputDir
() ==
""
)
return
;
109
Int_t nofCanvases =
fCanvases
.size();
110
for
(Int_t i = 0; i < nofCanvases; i++) {
111
fCanvases
[i]->Write();
112
}
113
}
114
115
void
CbmReport::PrintCanvases
()
const
116
{
117
Int_t nofCanvases =
fCanvases
.size();
118
for
(Int_t i = 0; i < nofCanvases; i++) {
119
TCanvas* canvas =
fCanvases
[i];
120
Out
() <<
R
()->
Image
(canvas->GetName(), canvas->GetName());
121
}
122
}
123
124
ClassImp
(
CbmReport
)
EicRoot
blob
master
cbmbase
report
CbmReport.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:33
using
1.8.2 with
EIC GitHub integration