hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BumpHunter Class Reference

description More...

#include <BumpHunter.h>

Public Member Functions

 BumpHunter (FitFunction::BkgModel model, int poly_order, int toy_poly_order, int res_factor, double res_scale=1.00, bool asymptotic_limit=true)
 Default Constructor.
 
 ~BumpHunter ()
 
HpsFitResultperformSearch (TH1 *histogram, double mass_hypothesis, bool skip_bkg_fit, bool skip_ul)
 Perform a search for a resonance at the given mass hypothesis.
 
void initialize (TH1 *histogram, double &mass_hypothesis)
 Given the mass of interest, setup the window parameters and initialize the fit parameters.
 
void calculatePValue (HpsFitResult *result)
 description
 
void fitBkgOnly ()
 Fit using a background only model.
 
void setBounds (double low_bound, double high_bound)
 Set the histogram bounds.
 
void enableDebug (bool debug=true)
 Enable/disable debug.
 
void runBatchMode (bool batch=true)
 Enable batch running.
 
void writeResults (bool write_results=true)
 Write the fit results to a text file.
 
void getUpperLimit (TH1 *histogram, HpsFitResult *result)
 Get the signal upper limit.
 
void getUpperLimitAsymptotic (TH1 *histogram, HpsFitResult *result)
 description
 
void getUpperLimitAsymCLs (TH1 *histogram, HpsFitResult *result)
 description
 
void getUpperLimitPower (TH1 *histogram, HpsFitResult *result)
 description
 
void setResolutionScale (double res_scale)
 Set the resolution after instantiation.
 
void setWindowSizeUsesResScale (bool window_use_res_scale)
 Sets whether the window size is scaled according to the resolution scaling factor.
 
std::vector< TH1 * > generateToys (TH1 *histogram, double n_toys, int seed, int toy_sig_samples, int bkg_mult=1, TH1 *signal_hist=nullptr)
 description
 
double getMassResolution (double mass)
 

Private Member Functions

double getMassResolution (double mass, double res_scale)
 Get Mass Resolution.
 
double correctMass (double mass)
 description
 
void printDebug (std::string message)
 Print debug statement.
 
void getChi2Prob (double min_nll_null, double min_nll, double &q0, double &p_value)
 description
 

Private Attributes

HpsFitResultbkg_only_result_ {nullptr}
 
std::ofstream * ofs
 
double corr_mass_ {0}
 
double lower_bound_ {0.016}
 
double upper_bound_ {0.115}
 
double integral_ {0}
 
FitFunction::BkgModel bkg_model_ {FitFunction::BkgModel::EXP_CHEBYSHEV}
 
bool asymptotic_limit_ {true}
 
double res_factor_ {13}
 
double window_size_ {0}
 
int bins_ {0}
 
double bin_width_ {0.0}
 
int poly_order_ {0}
 
int toy_poly_order_ {0}
 
double res_scale_ {1.00}
 
bool _batch {false}
 
bool debug {false}
 
bool _write_results {false}
 
double window_start_ {0}
 
double window_end_ {0}
 
double mass_hypothesis_ {0}
 
double mass_resolution_ {0}
 
bool window_use_res_scale_ {true}
 

Detailed Description

description

more details

Definition at line 49 of file BumpHunter.h.

Constructor & Destructor Documentation

◆ BumpHunter()

BumpHunter ( FitFunction::BkgModel  model,
int  poly_order,
int  toy_poly_order,
int  res_factor,
double  res_scale = 1.00,
bool  asymptotic_limit = true 
)

Default Constructor.

Parameters
model
poly_order
toy_poly_order
res_factor
res_scale
asymptotic_limit

Definition at line 14 of file BumpHunter.cxx.

◆ ~BumpHunter()

~BumpHunter ( )

Destructor

Definition at line 23 of file BumpHunter.cxx.

Member Function Documentation

◆ calculatePValue()

void calculatePValue ( HpsFitResult result)

description

Parameters
result

Definition at line 271 of file BumpHunter.cxx.

◆ correctMass()

double correctMass ( double  mass)
private

description

Parameters
mass
Returns
double

Definition at line 640 of file BumpHunter.cxx.

◆ enableDebug()

void enableDebug ( bool  debug = true)
inline

Enable/disable debug.

Parameters
debug

Definition at line 117 of file BumpHunter.h.

◆ fitBkgOnly()

void fitBkgOnly ( )

Fit using a background only model.

◆ generateToys()

std::vector< TH1 * > generateToys ( TH1 *  histogram,
double  n_toys,
int  seed,
int  toy_sig_samples,
int  bkg_mult = 1,
TH1 *  signal_hist = nullptr 
)

description

Parameters
histogram
n_toys
seed
toy_sig_samples
bkg_mult
signal_hist
Returns
std::vector<TH1*>

Definition at line 589 of file BumpHunter.cxx.

◆ getChi2Prob()

void getChi2Prob ( double  min_nll_null,
double  min_nll,
double &  q0,
double &  p_value 
)
private

description

Parameters
min_nll_null
min_nll
q0
p_value

Definition at line 619 of file BumpHunter.cxx.

◆ getMassResolution() [1/2]

double getMassResolution ( double  mass)
inline

Get the HPS mass resolution at the given mass. The functional form of the mass resolution was determined using MC.

Parameters
massThe mass of interest.
Returns
The mass resolution at the given mass.

Definition at line 202 of file BumpHunter.h.

◆ getMassResolution() [2/2]

double getMassResolution ( double  mass,
double  res_scale 
)
inlineprivate

Get Mass Resolution.

Parameters
mass
res_scale
Returns
double

Definition at line 223 of file BumpHunter.h.

◆ getUpperLimit()

void getUpperLimit ( TH1 *  histogram,
HpsFitResult result 
)

Get the signal upper limit.

Parameters
histogram
result

Definition at line 320 of file BumpHunter.cxx.

◆ getUpperLimitAsymCLs()

void getUpperLimitAsymCLs ( TH1 *  histogram,
HpsFitResult result 
)

description

Parameters
histogram
result

Definition at line 357 of file BumpHunter.cxx.

◆ getUpperLimitAsymptotic()

void getUpperLimitAsymptotic ( TH1 *  histogram,
HpsFitResult result 
)

description

Parameters
histogram
result

Definition at line 328 of file BumpHunter.cxx.

◆ getUpperLimitPower()

void getUpperLimitPower ( TH1 *  histogram,
HpsFitResult result 
)

description

Parameters
histogram
result

Definition at line 489 of file BumpHunter.cxx.

◆ initialize()

void initialize ( TH1 *  histogram,
double &  mass_hypothesis 
)

Given the mass of interest, setup the window parameters and initialize the fit parameters.

This includes setting the size of the window and the window edges as well as estimating the initial value of some fit parameters.

Parameters
histogramHistogram containing the mass spectrum that will be used to search for a resonance.
mass_hypothesisThe mass of interest.

Definition at line 25 of file BumpHunter.cxx.

◆ performSearch()

HpsFitResult * performSearch ( TH1 *  histogram,
double  mass_hypothesis,
bool  skip_bkg_fit,
bool  skip_ul 
)

Perform a search for a resonance at the given mass hypothesis.

Parameters
histogramHistogram containing the mass spectrum that will be used to search for a resonance.
mass_hypothesisThe mass of interest.

Definition at line 108 of file BumpHunter.cxx.

◆ printDebug()

void printDebug ( std::string  message)
private

Print debug statement.

Parameters
messageDebug statement to print.

Definition at line 316 of file BumpHunter.cxx.

◆ runBatchMode()

void runBatchMode ( bool  batch = true)
inline

Enable batch running.

Parameters
batch

Definition at line 124 of file BumpHunter.h.

◆ setBounds()

void setBounds ( double  low_bound,
double  high_bound 
)

Set the histogram bounds.

Parameters
low_bound
high_bound

Definition at line 634 of file BumpHunter.cxx.

◆ setResolutionScale()

void setResolutionScale ( double  res_scale)
inline

Set the resolution after instantiation.

Parameters
res_scale

Definition at line 170 of file BumpHunter.h.

◆ setWindowSizeUsesResScale()

void setWindowSizeUsesResScale ( bool  window_use_res_scale)
inline

Sets whether the window size is scaled according to the resolution scaling factor.

Parameters
window_use_res_scale

Definition at line 177 of file BumpHunter.h.

◆ writeResults()

void writeResults ( bool  write_results = true)
inline

Write the fit results to a text file.

Parameters
write_results

Definition at line 131 of file BumpHunter.h.

Member Data Documentation

◆ _batch

bool _batch {false}
private

Flag denoting if application should run in batch mode. If set to true, plots aren't generated and fit results aren't logged.

Definition at line 311 of file BumpHunter.h.

◆ _write_results

bool _write_results {false}
private

Write the results to a file.

Definition at line 317 of file BumpHunter.h.

◆ asymptotic_limit_

bool asymptotic_limit_ {true}
private

Flag to specify whether the power constrained or asymptotic upper limit should be employed.

Definition at line 280 of file BumpHunter.h.

◆ bin_width_

double bin_width_ {0.0}
private

The bin width

Definition at line 295 of file BumpHunter.h.

◆ bins_

int bins_ {0}
private

The total number of bins

Definition at line 292 of file BumpHunter.h.

◆ bkg_model_

The background fit function model to use.

Definition at line 274 of file BumpHunter.h.

◆ bkg_only_result_

HpsFitResult* bkg_only_result_ {nullptr}
private

Background only fit result.

Definition at line 253 of file BumpHunter.h.

◆ corr_mass_

double corr_mass_ {0}
private

The mass after the mass scale correction.

Definition at line 262 of file BumpHunter.h.

◆ debug

bool debug {false}
private

Debug flag

Definition at line 314 of file BumpHunter.h.

◆ integral_

double integral_ {0}
private

The total number of events within the fit window.

Definition at line 271 of file BumpHunter.h.

◆ lower_bound_

double lower_bound_ {0.016}
private

The lower bound of the histogram.

Definition at line 265 of file BumpHunter.h.

◆ mass_hypothesis_

double mass_hypothesis_ {0}
private

mass hypothesis

Definition at line 326 of file BumpHunter.h.

◆ mass_resolution_

double mass_resolution_ {0}
private

mass resolution

Definition at line 329 of file BumpHunter.h.

◆ ofs

std::ofstream* ofs
private

Output file stream

Definition at line 256 of file BumpHunter.h.

◆ poly_order_

int poly_order_ {0}
private

Polynomial order used to model the background.

Definition at line 298 of file BumpHunter.h.

◆ res_factor_

double res_factor_ {13}
private

Resolution multiplicative factor used in determining the fit window size.

Definition at line 286 of file BumpHunter.h.

◆ res_scale_

double res_scale_ {1.00}
private

The scaling factor for the mass resolution. Was 1.56 for Sebouh's, should 1.00 for Rafo's.

Definition at line 305 of file BumpHunter.h.

◆ toy_poly_order_

int toy_poly_order_ {0}
private

Polynomial order used to model the toy fit.

Definition at line 301 of file BumpHunter.h.

◆ upper_bound_

double upper_bound_ {0.115}
private

The upper bound of the histogram.

Definition at line 268 of file BumpHunter.h.

◆ window_end_

double window_end_ {0}
private

end of mass window

Definition at line 323 of file BumpHunter.h.

◆ window_size_

double window_size_ {0}
private

Size of the background window that will be used to fit.

Definition at line 289 of file BumpHunter.h.

◆ window_start_

double window_start_ {0}
private

start of mass window

Definition at line 320 of file BumpHunter.h.

◆ window_use_res_scale_

bool window_use_res_scale_ {true}
private

desription

Definition at line 332 of file BumpHunter.h.


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