CombineHarvester
AutoRebin.h
Go to the documentation of this file.
1 #ifndef CombineTools_AutoRebin_h
2 #define CombineTools_AutoRebin_h
3 #include <string>
5 
6 namespace ch {
19 class AutoRebin {
20  public:
21  AutoRebin();
22 
34  void Rebin(CombineHarvester &src, CombineHarvester &dest);
58  void FindNewBinning(TH1F &total_bkg, std::vector<double> &new_bins,
59  double bin_condition, double bin_uncert_fraction, int mode);
60 
64  int GetMaximumFracUncertBin(TH1F &total_bkg);
65 
69  inline AutoRebin& SetVerbosity(unsigned verbosity) {
70  v_ = verbosity;
71  return *this;
72  }
73 
78  inline AutoRebin& SetBinThreshold(double val) {
79  bin_threshold_ = val;
80  return *this;
81  }
82 
87  inline AutoRebin& SetBinUncertFraction(double val) {
88  bin_uncert_fraction_ = val;
89  return *this;
90  }
91 
95  inline AutoRebin& SetRebinMode(int val) {
96  rebin_mode_ = val;
97  return *this;
98  }
99 
103  inline AutoRebin& SetPerformRebin(bool val) {
104  perform_rebin_ = val;
105  return *this;
106  }
107 
108 
109  private:
110  unsigned v_;
111  int rebin_mode_;
112  bool perform_rebin_;
113  double bin_threshold_;
114  double bin_uncert_fraction_;
115 };
116 }
117 
118 #endif
Tests for any bins below a certain threshold and if they exist merges them with neighborouring bins.
Definition: AutoRebin.h:19
void FindNewBinning(TH1F &total_bkg, std::vector< double > &new_bins, double bin_condition, double bin_uncert_fraction, int mode)
Pass through the total background histogram to find bins failing the required condition ("empty" bins...
Definition: AutoRebin.cc:104
AutoRebin & SetRebinMode(int val)
Flag to perform different versions of rebinning algorithm.
Definition: AutoRebin.h:95
int GetMaximumFracUncertBin(TH1F &total_bkg)
Return bin with maximum value of fractional error.
Definition: AutoRebin.cc:336
AutoRebin & SetPerformRebin(bool val)
Whether to actually perform the rebinning or just print it out.
Definition: AutoRebin.h:103
AutoRebin & SetVerbosity(unsigned verbosity)
Set to a value greater than zero for more verbose output.
Definition: AutoRebin.h:69
AutoRebin & SetBinThreshold(double val)
The threshold for which we consider merging bins containing less than this value.
Definition: AutoRebin.h:78
AutoRebin & SetBinUncertFraction(double val)
The threshold on the bin uncertainty fraction for which we consider merging bins containing less than...
Definition: AutoRebin.h:87
void Rebin(CombineHarvester &src, CombineHarvester &dest)
Work out optimal binning using the total background histogram built from src, and apply the binning t...
Definition: AutoRebin.cc:18
Definition: Algorithm.h:10