CMS 3D CMS Logo

Tools.h
Go to the documentation of this file.
1 //
2 //
3 // TOOLS declarations
4 //
5 //
6 
7 #ifndef Tools_H
8 #define Tools_H
9 
10 #include "TH1F.h"
11 #include "TH2F.h"
12 #include "TArrayF.h"
13 #include "TObjArray.h"
14 #include "TCanvas.h"
15 #include "TFile.h"
16 class TStyle;
17 
18 #include <iostream>
19 #include <string>
20 #include <sstream>
21 
22 namespace RecoBTag {
23  double HistoBinWidth(const TH1F* theHisto, const int& iBin);
24 
25  double IntegrateHistogram(const TH1F* theHisto);
26 
27  void HistoToNormalizedArrays(const TH1F* theHisto,
28  TArrayF& theNormalizedArray,
29  TArrayF& theLeftOfBinArray,
30  TArrayF& theBinWidthArray);
31 
32  double IntegrateArray(const TArrayF& theArray, const TArrayF& theBinWidth);
33 
34  void PrintHistos(const std::string& psFile, const std::string& epsFile, const std::string& gifFile);
35 
36  void PrintCanvasHistos(TCanvas* canvas,
37  const std::string& psFile,
38  const std::string& epsFile,
39  const std::string& gifFile);
40 
41  TObjArray getHistArray(TFile* histoFile, const std::string& baseName);
42 
43  std::string flavour(const int& flav);
44 
45  bool flavourIsD(const int& flav);
46  bool flavourIsU(const int& flav);
47  bool flavourIsS(const int& flav);
48  bool flavourIsC(const int& flav);
49  bool flavourIsB(const int& flav);
50  bool flavourIsG(const int& flav);
51  bool flavourIsDUS(const int& flav);
52  bool flavourIsDUSG(const int& flav);
53  bool flavourIsNI(const int& flav);
54 
56 
57  int findBinClosestYValue(const TH1F*, const float& yVal, const float& yLow, const float& yHigh);
58 
59  std::vector<int> findBinClosestYValueAtFixedZ(const TH2F*,
60  const float& yVal,
61  const float& yLow,
62  const float& yHigh,
63  const TH2F*,
64  const std::vector<double>& zVal);
65 
66  TStyle* setTDRStyle();
67 
68  void tdrGrid(const bool& gridOn);
69 
70  void fixOverlay();
71 
72  std::string itos(const int& i); // convert int to string
73 
74 } // namespace RecoBTag
75 #endif
void PrintCanvasHistos(TCanvas *canvas, const std::string &psFile, const std::string &epsFile, const std::string &gifFile)
Definition: Tools.cc:100
bool flavourIsG(const int &flav)
Definition: Tools.cc:187
bool flavourIsNI(const int &flav)
Definition: Tools.cc:192
double IntegrateHistogram(const TH1F *theHisto)
Definition: Tools.cc:35
TStyle * setTDRStyle()
Definition: Tools.cc:343
bool flavourIsD(const int &flav)
Definition: Tools.cc:182
int findBinClosestYValue(const TH1F *, const float &yVal, const float &yLow, const float &yHigh)
Definition: Tools.cc:225
bool flavourIsC(const int &flav)
Definition: Tools.cc:185
bool flavourIsU(const int &flav)
Definition: Tools.cc:183
int checkCreateDirectory(const std::string &)
Definition: Tools.cc:199
TObjArray getHistArray(TFile *histoFile, const std::string &baseName)
Definition: Tools.cc:141
void tdrGrid(const bool &gridOn)
Definition: Tools.cc:490
double IntegrateArray(const TArrayF &theArray, const TArrayF &theBinWidth)
Definition: Tools.cc:87
double HistoBinWidth(const TH1F *theHisto, const int &iBin)
Definition: Tools.cc:18
void fixOverlay()
Definition: Tools.cc:499
std::string flavour(const int &flav)
Definition: Tools.cc:161
bool flavourIsB(const int &flav)
Definition: Tools.cc:186
bool flavourIsDUSG(const int &flav)
Definition: Tools.cc:190
Definition: Tools.h:22
void HistoToNormalizedArrays(const TH1F *theHisto, TArrayF &theNormalizedArray, TArrayF &theLeftOfBinArray, TArrayF &theBinWidthArray)
Definition: Tools.cc:55
bool flavourIsS(const int &flav)
Definition: Tools.cc:184
bool flavourIsDUS(const int &flav)
Definition: Tools.cc:189
std::string itos(const int &i)
Definition: Tools.cc:501
def canvas(sub, attr)
Definition: svgfig.py:482
std::vector< int > findBinClosestYValueAtFixedZ(const TH2F *, const float &yVal, const float &yLow, const float &yHigh, const TH2F *, const std::vector< double > &zVal)
Definition: Tools.cc:278
void PrintHistos(const std::string &psFile, const std::string &epsFile, const std::string &gifFile)