CombineHarvester
ch::AutoRebin Class Reference

Tests for any bins below a certain threshold and if they exist merges them with neighborouring bins. More...

#include "/afs/cern.ch/user/a/agilbert/CMSSW_14_1_0_pre4/src/CombineHarvester/CombineTools/interface/AutoRebin.h"

Public Member Functions

 AutoRebin ()
 
void Rebin (CombineHarvester &src, CombineHarvester &dest)
 Work out optimal binning using the total background histogram built from src, and apply the binning to dest More...
 
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). More...
 
int GetMaximumFracUncertBin (TH1F &total_bkg)
 Return bin with maximum value of fractional error. More...
 
AutoRebinSetVerbosity (unsigned verbosity)
 Set to a value greater than zero for more verbose output. More...
 
AutoRebinSetBinThreshold (double val)
 The threshold for which we consider merging bins containing less than this value. More...
 
AutoRebinSetBinUncertFraction (double val)
 The threshold on the bin uncertainty fraction for which we consider merging bins containing less than this value. More...
 
AutoRebinSetRebinMode (int val)
 Flag to perform different versions of rebinning algorithm. More...
 
AutoRebinSetPerformRebin (bool val)
 Whether to actually perform the rebinning or just print it out. More...
 

Detailed Description

Tests for any bins below a certain threshold and if they exist merges them with neighborouring bins.

Typical usage:

auto rebin = ch::AutoRebin()
    .SetEmptyBinThreshold(0.);
rebin.Rebin(cb.cp().channel({"tt"}), cb);

See below for details on each class method.

Definition at line 19 of file AutoRebin.h.

Constructor & Destructor Documentation

◆ AutoRebin()

ch::AutoRebin::AutoRebin ( )

Definition at line 10 of file AutoRebin.cc.

Member Function Documentation

◆ Rebin()

void ch::AutoRebin::Rebin ( CombineHarvester src,
CombineHarvester dest 
)

Work out optimal binning using the total background histogram built from src, and apply the binning to dest

  • Builds the total background histogram and creates vectors for the original binning and the new binning
  • Calls the FindNewBinning function passing it the empty new_bins vector, the total background histogram, and the condition for what we consider to be an empty bin

Definition at line 18 of file AutoRebin.cc.

◆ FindNewBinning()

void ch::AutoRebin::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).

For RebinMode==0:

  • Starts from the bin with maximum bin content and moves left first. For any binnings passing the condition their value of BinLowEdge is added to new_bins vector.
  • Then moves from maximum bin content to end of distribution moving right and does the same.
  • Creates new total background hist with the new binning and checks if all bins pass the condition. Continues recursively until they all do.

For RebinMode==1:

  • Starts from bin with lowest content which fails the condition. Tries moving left and right merging bins until threshold is met.
  • Chooses from left and right to minimise number of bins lost
  • Repeats with new lowest bin until all bins pass threshold

Definition at line 104 of file AutoRebin.cc.

◆ GetMaximumFracUncertBin()

int ch::AutoRebin::GetMaximumFracUncertBin ( TH1F &  total_bkg)

Return bin with maximum value of fractional error.

Definition at line 336 of file AutoRebin.cc.

◆ SetVerbosity()

AutoRebin& ch::AutoRebin::SetVerbosity ( unsigned  verbosity)
inline

Set to a value greater than zero for more verbose output.

Definition at line 69 of file AutoRebin.h.

◆ SetBinThreshold()

AutoRebin& ch::AutoRebin::SetBinThreshold ( double  val)
inline

The threshold for which we consider merging bins containing less than this value.

Definition at line 78 of file AutoRebin.h.

◆ SetBinUncertFraction()

AutoRebin& ch::AutoRebin::SetBinUncertFraction ( double  val)
inline

The threshold on the bin uncertainty fraction for which we consider merging bins containing less than this value.

Definition at line 87 of file AutoRebin.h.

◆ SetRebinMode()

AutoRebin& ch::AutoRebin::SetRebinMode ( int  val)
inline

Flag to perform different versions of rebinning algorithm.

Definition at line 95 of file AutoRebin.h.

◆ SetPerformRebin()

AutoRebin& ch::AutoRebin::SetPerformRebin ( bool  val)
inline

Whether to actually perform the rebinning or just print it out.

Definition at line 103 of file AutoRebin.h.


The documentation for this class was generated from the following files: