BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnUtils.cxx
Go to the documentation of this file.
1
#include "
BmnUtils.h
"
2
3
#include "
TCanvas.h
"
4
#include "
TSystem.h
"
5
6
namespace
lit
7
{
8
9
void
SaveCanvasAsImage
(
TCanvas
* c,
const
std::string& dir)
10
{
11
if
(dir ==
""
)
12
return
;
13
gSystem
->mkdir(dir.c_str(),
true
);
// create directory if it does not exist
14
c->
SaveAs
(std::string(dir + std::string(c->
GetTitle
()) +
".eps"
).c_str());
15
c->
SaveAs
(std::string(dir + std::string(c->
GetTitle
()) +
".png"
).c_str());
16
c->
SaveAs
(std::string(dir + std::string(c->
GetTitle
()) +
".gif"
).c_str());
17
}
18
19
string
FindAndReplace
(
const
string
& name,
const
string
& oldSubstr,
const
string
& newSubstr)
20
{
21
string
newName = name;
22
Int_t
startPos = name.find(oldSubstr);
23
newName.replace(startPos, oldSubstr.size(), newSubstr);
24
return
newName;
25
}
26
27
vector<string>
Split
(
const
string
& name,
char
delimiter)
28
{
29
vector<string> result;
30
size_t
begin = 0;
31
size_t
end = name.find_first_of(delimiter);
32
while
(end != string::npos) {
33
string
str = name.substr(begin, end - begin);
34
if
(str[0] == delimiter)
35
str.erase(0, 1);
36
result.push_back(str);
37
begin = end;
38
end = name.find_first_of(delimiter, end + 1);
39
}
40
result.push_back(name.substr(begin + 1));
41
return
result;
42
}
43
44
}
// namespace lit
BmnUtils.h
Int_t
int Int_t
TCanvas.h
TSystem.h
gSystem
R__EXTERN TSystem * gSystem
TCanvas
TPad::GetTitle
const char * GetTitle() const override
TPad::SaveAs
void SaveAs(const char *filename="", Option_t *option="") const override
lit
Definition
BmnMath.cxx:27
lit::FindAndReplace
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
Definition
BmnUtils.cxx:19
lit::SaveCanvasAsImage
void SaveCanvasAsImage(TCanvas *c, const std::string &dir)
Definition
BmnUtils.cxx:9
lit::Split
vector< string > Split(const string &name, char delimiter)
Definition
BmnUtils.cxx:27
QA
BmnUtils.cxx
Generated on
for BmnRoot by
1.17.0