3 #include <RtypesCore.h>
21 const std::string& dir,
22 const std::string& option) {
23 if (dir ==
"")
return;
24 if (option.find(
"eps") != std::string::npos) {
25 string dir2 = dir +
"/eps/";
26 gSystem->mkdir(dir2.c_str(),
29 std::string(dir2 + std::string(c->GetTitle()) +
".eps").c_str());
31 if (option.find(
"png") != std::string::npos) {
32 string dir2 = dir +
"/png/";
33 gSystem->mkdir(dir2.c_str(),
true);
35 std::string(dir2 + std::string(c->GetTitle()) +
".png").c_str());
37 if (option.find(
"gif") != std::string::npos) {
38 string dir2 = dir +
"/gif/";
39 gSystem->mkdir(dir2.c_str(),
true);
41 std::string(dir2 + std::string(c->GetTitle()) +
".gif").c_str());
46 const string& oldSubstr,
47 const string& newSubstr) {
48 string newName = name;
49 Int_t startPos = name.find(oldSubstr);
50 newName.replace(startPos, oldSubstr.size(), newSubstr);
54 vector<string>
Split(
const string& name,
char delimiter) {
55 vector<string> result;
56 std::size_t begin = 0;
57 std::size_t end = name.find_first_of(delimiter);
58 while (end != string::npos) {
59 string str = name.substr(begin, end - begin);
60 if (str[0] == delimiter) str.erase(0, 1);
61 result.push_back(str);
63 end = name.find_first_of(delimiter, end + 1);
65 result.push_back(name.substr(begin + 1));
72 const string& histName,
74 const string& titleYaxis) {
75 int nBins = h1->GetNbinsX();
76 double min = h1->GetXaxis()->GetXmin();
77 double max = h1->GetXaxis()->GetXmax();
78 string hname = string(h1->GetName()) +
"_divide";
79 if (histName !=
"") hname = histName;
81 TH1D* h3 =
new TH1D(histName.c_str(), hname.c_str(), nBins,
min,
max);
82 h3->GetXaxis()->SetTitle(h1->GetXaxis()->GetTitle());
83 h3->GetYaxis()->SetTitle(titleYaxis.c_str());
87 h3->Divide(h1, h2, 1., 1.,
"B");
94 const string& histName,
96 const string& titleZaxis) {
97 int nBinsX = h1->GetNbinsX();
98 double minX = h1->GetXaxis()->GetXmin();
99 double maxX = h1->GetXaxis()->GetXmax();
100 int nBinsY = h1->GetNbinsY();
101 double minY = h1->GetYaxis()->GetXmin();
102 double maxY = h1->GetYaxis()->GetXmax();
103 string hname = string(h1->GetName()) +
"_divide";
104 if (histName !=
"") hname = histName;
107 hname.c_str(), hname.c_str(), nBinsX, minX, maxX, nBinsY, minY, maxY);
108 h3->GetXaxis()->SetTitle(h1->GetXaxis()->GetTitle());
109 h3->GetYaxis()->SetTitle(h1->GetYaxis()->GetTitle());
110 h3->GetZaxis()->SetTitle(titleZaxis.c_str());
114 h3->Divide(h1, h2, 1., 1.,
"B");