19 const int&
nBins = theHisto->GetSize();
21 if (iBin < 0 || iBin >=
nBins)
25 return theHisto->GetBinWidth(1);
27 if (iBin ==
nBins - 1)
28 return theHisto->GetBinWidth(
nBins - 2);
30 return theHisto->GetBinWidth(iBin);
39 double histoIntegral = 0.0;
40 const int&
nBins = theHisto->GetSize();
45 for (
int iBin = 0; iBin !=
nBins; ++iBin) {
47 histoIntegral += (*theHisto)[iBin] * binWidth;
56 TArrayF& theNormalizedArray,
57 TArrayF& theLeftOfBinArray,
58 TArrayF& theBinWidthArray) {
59 const int&
nBins = theHisto->GetSize();
62 if (
nBins == theNormalizedArray.GetSize() &&
nBins == theLeftOfBinArray.GetSize() &&
63 nBins == theBinWidthArray.GetSize()) {
66 for (
int iBin = 0; iBin !=
nBins; ++iBin) {
67 theNormalizedArray[iBin] = (*theHisto)[iBin] / histoIntegral;
68 theLeftOfBinArray[iBin] = theHisto->GetBinLowEdge(iBin);
73 cout <<
"============>>>>>>>>>>>>>>>>" << endl
74 <<
"============>>>>>>>>>>>>>>>>" << endl
75 <<
"============>>>>>>>>>>>>>>>>" << endl
76 <<
"============>>>>>>>>>>>>>>>>" << endl
77 <<
"============>>>>>>>>>>>>>>>> HistoToNormalizedArrays failed: not equal sizes of all arrays!!" << endl
78 <<
"============>>>>>>>>>>>>>>>>" << endl
79 <<
"============>>>>>>>>>>>>>>>>" << endl
80 <<
"============>>>>>>>>>>>>>>>>" << endl
81 <<
"============>>>>>>>>>>>>>>>>" << endl;
88 double arrayIntegral = 0.0;
89 const int&
nBins = theArray.GetSize();
91 for (
int iBin = 0; iBin !=
nBins; ++iBin) {
92 arrayIntegral += theArray[iBin] * theBinWidth[iBin];
114 canvas->Print(psFile.c_str());
115 if (!epsFile.empty())
116 canvas->Print(epsFile.c_str(),
"eps");
118 const std::string& rootVersion(gROOT->GetVersion());
119 const bool& rootCanGif = rootVersion.find(
'4') == 0 || rootVersion.find(
'5') == 0;
120 if (!gifFile.empty()) {
121 if (!(gROOT->IsBatch()) || rootCanGif) {
122 cout <<
"--> Print directly gif!" << endl;
123 canvas->Print(gifFile.c_str(),
"gif");
125 if (!epsFile.empty()) {
126 cout <<
"--> Print gif via scripts!" << endl;
127 const std::string& executeString1 =
"pstopnm -ppm -xborder 0 -yborder 0 -portrait " + epsFile;
128 gSystem->Exec(executeString1.c_str());
130 const std::string& executeString2 =
"ppmtogif " + ppmFile +
" > " + gifFile;
131 gSystem->Exec(executeString2.c_str());
132 const std::string& executeString3 =
"rm " + ppmFile;
133 gSystem->Exec(executeString3.c_str());
152 histos.Add((TH1F*)histoFile->Get(nameB.c_str()));
154 histos.Add((TH1F*)histoFile->Get(nameDUSG.c_str()));
200 cout <<
"====>>>> ToolsC:checkCreateDirectory() : " << endl;
201 int exists = gSystem->Exec((
"ls -d " +
directory).c_str());
204 cout <<
"====>>>> ToolsC:checkCreateDirectory() : The directory does not exist : " <<
directory << endl;
205 cout <<
"====>>>> ToolsC:checkCreateDirectory() : I'll try to create it" << endl;
208 cout <<
"====>>>> ToolsC:checkCreateDirectory() : Creation of directory failed : " <<
directory << endl
209 <<
"====>>>> ToolsC:checkCreateDirectory() : Please check your write permissions!" << endl;
211 cout <<
"====>>>> ToolsC:checkCreateDirectory() : Creation of directory successful!" << endl;
213 cout <<
"====>>>> ToolsC:checkCreateDirectory() : " << endl;
214 exists = gSystem->Exec((
"ls -d " +
directory).c_str());
216 cout <<
"ToolsC:checkCreateDirectory() : However, it still doesn't exist!?" << endl;
255 for (
int iBin = 1; iBin <=
nBins; ++iBin) {
256 const float&
yBin =
histo->GetBinContent(iBin);
264 if (yClosest < yLow || yClosest > yHigh) {
270 cout <<
"====>>>> ToolsC=>findBinClosestYValue() : WARNING: returned bin is the initialization bin!!" << endl;
283 const vector<double>& zVal) {
294 const int& nBinsX = histoY->GetNbinsX() - 2;
295 const int& nBinsY = histoY->GetNbinsY() - 2;
300 const float&
maxInHisto = histoY->GetMaximum();
301 const float&
minInHisto = histoY->GetMinimum();
317 for (
int iBinX = 1; iBinX <= nBinsX; ++iBinX) {
318 for (
int iBinY = 1; iBinY <= nBinsY; ++iBinY) {
319 const float&
yBin = histoY->GetBinContent(iBinX, iBinY);
320 for (
unsigned int i = 0;
i < zVal.size();
i++) {
322 const float& zLow = zVal[
i] - (yVal - yLow);
323 const float& zHigh = zVal[
i] + (yHigh - yVal);
324 const float&
zBin = histoZ->GetBinContent(iBinX, iBinY);
325 if (zBin < zLow || zBin > zHigh)
334 for (
unsigned int i = 0;
i <
yClosest.size();
i++) {
344 TStyle*
tdrStyle =
new TStyle(
"tdrStyle",
"Style for P-TDR");
442 tdrStyle->SetTitleSize(0.06,
"XYZ");
453 tdrStyle->SetLabelOffset(0.007,
"XYZ");
454 tdrStyle->SetLabelSize(0.05,
"XYZ");
460 tdrStyle->SetTickLength(0.03,
"XYZ");
461 tdrStyle->SetNdivisions(510,
"XYZ");
void PrintCanvasHistos(TCanvas *canvas, const std::string &psFile, const std::string &epsFile, const std::string &gifFile)
bool flavourIsG(const int &flav)
def create(alignables, pedeDump, additionalData, outputFile, config)
bool flavourIsNI(const int &flav)
double IntegrateHistogram(const TH1F *theHisto)
bool flavourIsD(const int &flav)
int findBinClosestYValue(const TH1F *, const float &yVal, const float &yLow, const float &yHigh)
bool flavourIsC(const int &flav)
bool flavourIsU(const int &flav)
int checkCreateDirectory(const std::string &)
TObjArray getHistArray(TFile *histoFile, const std::string &baseName)
void tdrGrid(const bool &gridOn)
double IntegrateArray(const TArrayF &theArray, const TArrayF &theBinWidth)
double HistoBinWidth(const TH1F *theHisto, const int &iBin)
std::string flavour(const int &flav)
bool flavourIsB(const int &flav)
bool flavourIsDUSG(const int &flav)
void HistoToNormalizedArrays(const TH1F *theHisto, TArrayF &theNormalizedArray, TArrayF &theLeftOfBinArray, TArrayF &theBinWidthArray)
bool flavourIsS(const int &flav)
bool flavourIsDUS(const int &flav)
std::string itos(const int &i)
std::vector< int > findBinClosestYValueAtFixedZ(const TH2F *, const float &yVal, const float &yLow, const float &yHigh, const TH2F *, const std::vector< double > &zVal)