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 
23 namespace RecoBTag {
24  double HistoBinWidth ( const TH1F * theHisto , const int& iBin ) ;
25 
26  double IntegrateHistogram ( const TH1F * theHisto ) ;
27 
28  void HistoToNormalizedArrays ( const TH1F * theHisto , TArrayF & theNormalizedArray , TArrayF & theLeftOfBinArray , TArrayF & theBinWidthArray ) ;
29 
30  double IntegrateArray ( const TArrayF & theArray , const TArrayF & theBinWidth ) ;
31 
32  void PrintHistos ( const std::string& psFile , const std::string& epsFile , const std::string& gifFile ) ;
33 
34  void PrintCanvasHistos ( TCanvas * canvas , const std::string& psFile , const std::string& epsFile , const std::string& gifFile ) ;
35 
36  TObjArray getHistArray ( TFile * histoFile , const std::string& baseName ) ;
37 
38  std::string flavour ( const int& flav ) ;
39 
40  bool flavourIsD ( const int & flav ) ;
41  bool flavourIsU ( const int & flav ) ;
42  bool flavourIsS ( const int & flav ) ;
43  bool flavourIsC ( const int & flav ) ;
44  bool flavourIsB ( const int & flav ) ;
45  bool flavourIsG ( const int & flav ) ;
46  bool flavourIsDUS ( const int & flav ) ;
47  bool flavourIsDUSG ( const int & flav ) ;
48  bool flavourIsNI ( const int & flav ) ;
49 
50  int checkCreateDirectory ( const std::string& ) ;
51 
52  int findBinClosestYValue ( const TH1F * , const float& yVal , const float& yLow , const float& yHigh ) ;
53 
54  std::vector<int> findBinClosestYValueAtFixedZ ( const TH2F * , const float& yVal , const float& yLow , const float& yHigh, const TH2F *, const std::vector<double>& zVal) ;
55 
56  TStyle* setTDRStyle();
57 
58  void tdrGrid(const bool& gridOn);
59 
60  void fixOverlay();
61 
62  std::string itos(const int& i); // convert int to string
63 
64 }
65 #endif
TFile * histoFile
Definition: hcalCalib.cc:43
void PrintCanvasHistos(TCanvas *canvas, const std::string &psFile, const std::string &epsFile, const std::string &gifFile)
Definition: Tools.cc:109
bool flavourIsG(const int &flav)
Definition: Tools.cc:195
bool flavourIsNI(const int &flav)
Definition: Tools.cc:200
double IntegrateHistogram(const TH1F *theHisto)
Definition: Tools.cc:34
TStyle * setTDRStyle()
Definition: Tools.cc:346
bool flavourIsD(const int &flav)
Definition: Tools.cc:190
int findBinClosestYValue(const TH1F *, const float &yVal, const float &yLow, const float &yHigh)
Definition: Tools.cc:233
bool flavourIsC(const int &flav)
Definition: Tools.cc:193
bool flavourIsU(const int &flav)
Definition: Tools.cc:191
int checkCreateDirectory(const std::string &)
Definition: Tools.cc:205
TObjArray getHistArray(TFile *histoFile, const std::string &baseName)
Definition: Tools.cc:147
void tdrGrid(const bool &gridOn)
Definition: Tools.cc:493
double IntegrateArray(const TArrayF &theArray, const TArrayF &theBinWidth)
Definition: Tools.cc:93
double HistoBinWidth(const TH1F *theHisto, const int &iBin)
Definition: Tools.cc:19
void fixOverlay()
Definition: Tools.cc:502
std::string flavour(const int &flav)
Definition: Tools.cc:168
bool flavourIsB(const int &flav)
Definition: Tools.cc:194
bool flavourIsDUSG(const int &flav)
Definition: Tools.cc:198
Definition: Tools.h:23
void HistoToNormalizedArrays(const TH1F *theHisto, TArrayF &theNormalizedArray, TArrayF &theLeftOfBinArray, TArrayF &theBinWidthArray)
Definition: Tools.cc:57
bool flavourIsS(const int &flav)
Definition: Tools.cc:192
bool flavourIsDUS(const int &flav)
Definition: Tools.cc:197
std::string itos(const int &i)
Definition: Tools.cc:507
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:286
void PrintHistos(const std::string &psFile, const std::string &epsFile, const std::string &gifFile)