Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//
//
// TOOLS declarations
//
//

#ifndef Tools_H
#define Tools_H

#include "TH1F.h"
#include "TH2F.h"
#include "TArrayF.h"
#include "TObjArray.h"
#include "TCanvas.h"
#include "TFile.h"
class TStyle;

#include <iostream>
#include <string>
#include <sstream>

namespace RecoBTag {
  double HistoBinWidth(const TH1F* theHisto, const int& iBin);

  double IntegrateHistogram(const TH1F* theHisto);

  void HistoToNormalizedArrays(const TH1F* theHisto,
                               TArrayF& theNormalizedArray,
                               TArrayF& theLeftOfBinArray,
                               TArrayF& theBinWidthArray);

  double IntegrateArray(const TArrayF& theArray, const TArrayF& theBinWidth);

  void PrintHistos(const std::string& psFile, const std::string& epsFile, const std::string& gifFile);

  void PrintCanvasHistos(TCanvas* canvas,
                         const std::string& psFile,
                         const std::string& epsFile,
                         const std::string& gifFile);

  TObjArray getHistArray(TFile* histoFile, const std::string& baseName);

  std::string flavour(const int& flav);

  bool flavourIsD(const int& flav);
  bool flavourIsU(const int& flav);
  bool flavourIsS(const int& flav);
  bool flavourIsC(const int& flav);
  bool flavourIsB(const int& flav);
  bool flavourIsG(const int& flav);
  bool flavourIsDUS(const int& flav);
  bool flavourIsDUSG(const int& flav);
  bool flavourIsNI(const int& flav);

  int checkCreateDirectory(const std::string&);

  int findBinClosestYValue(const TH1F*, const float& yVal, const float& yLow, const float& yHigh);

  std::vector<int> findBinClosestYValueAtFixedZ(const TH2F*,
                                                const float& yVal,
                                                const float& yLow,
                                                const float& yHigh,
                                                const TH2F*,
                                                const std::vector<double>& zVal);

  TStyle* setTDRStyle();

  void tdrGrid(const bool& gridOn);

  void fixOverlay();

  std::string itos(const int& i);  // convert int to string

}  // namespace RecoBTag
#endif