16 std::cout <<
"Configuring BhToysHistoProcessor" << std::endl;
18 debug_ = parameters.getInteger(
"debug");
20 mass_hypo_ = parameters.getDouble(
"mass_hypo");
24 seed_ = parameters.getInteger(
"seed");
25 nToys_ = parameters.getInteger(
"nToys");
27 bkg_mult_ = parameters.getInteger(
"toy_bkg_mult");
28 res_scale_ = parameters.getDouble(
"res_scale");
31 bkg_model_ = parameters.getInteger(
"bkg_model");
33 }
catch(std::runtime_error& error) {
34 std::cout << error.what() << std::endl;
40 inF_ =
new TFile(inFilename.c_str());
52 std::cout <<
"[BumpHunter] :: !! WARNING !! Signal injection file, but no histogram, specified! Defaulting to Gaussian.";
54 std::cout <<
"[BumpHunter] :: !! WARNING !! Signal injection histogram, but no file, specified! Defaulting to Gaussian.";
59 std::cout <<
"Background Model ID: " <<
bkg_model_ << std::endl;
137 std::cout <<
"Running on mass spectrum: " <<
massSpectrum_ << std::endl;
138 std::cout <<
"Running with polynomial order: " <<
poly_order_ << std::endl;
139 std::cout <<
"Running with window factor: " <<
win_factor_ << std::endl;
140 std::cout <<
"Running on mass hypo: " <<
mass_hypo_ << std::endl;
149 std::cout <<
"Filling Fit Results " << std::endl;
191 std::vector<HpsFitResult*> toy_results;
197 std::cout <<
"Generating " <<
nToys_ <<
" Toys" << std::endl;
202 std::cout <<
" Signal Shape :: Gaussian" << std::endl;
204 std::cout <<
" Background Multiplier :: " <<
bkg_mult_ << std::endl;
208 for(TH1* hist : toys_hist) {
209 std::cout <<
"Fitting Toy " << toyFitN << std::endl;
215 int toyModelIndex = 0;
216 for(
auto& toy_result : toy_results) {
218 TFitResultPtr toy_bkg_result = toy_result->getBkgFitResult();
226 TFitResultPtr toy_sig_result = toy_result->getCompFitResult();
#define DECLARE_PROCESSOR(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Insert description here. more details.
virtual void configure(const ParameterSet ¶meters)
Configure using given parameters.
int bkg_model_
What background model type to use.
int toy_poly_order_
Order of polynomial used to create the toy generator function.
virtual void finalize()
description
TH1 * signal_shape_h_
The signal shape histogram to use.
double mass_hypo_
The signal hypothesis to use in the fit.
int poly_order_
Order of polynomial used to model the background.
BumpHunter * bump_hunter_
The bump hunter manager.
int nToys_
Number of toys to throw and fit.
double res_scale_
The factor by which to scale the mass resolution function.
virtual void initialize(std::string inFilename, std::string outFilename)
description
BhToysHistoProcessor(const std::string &name, Process &process)
Constructor.
FlatTupleMaker * flat_tuple_
The flat tuple manager.
std::string signal_shape_h_file_
The signal shpae histogram file path, if defined.
std::string signal_shape_h_name_
The signal shape histogram name to use, if defined.
TH1 * mass_spec_h
The mass spectrum to fit.
bool asymptotic_limit_
Whether to use the asymptotic upper limit or the power constrained. Defaults to asymptotic.
virtual bool process()
description
std::string massSpectrum_
The name of the mass spectrum to fit.
void enableDebug(bool debug=true)
Enable/disable debug.
void setBounds(double low_bound, double high_bound)
Set the histogram bounds.
std::vector< TH1 * > generateToys(TH1 *histogram, double n_toys, int seed, int toy_sig_samples, int bkg_mult=1, TH1 *signal_hist=nullptr)
description
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.
void addVector(std::string vector_name)
description
void addVariable(std::string variable_name)
description
void addToVector(std::string variable_name, double value)
description
void setVariableValue(std::string variable_name, double value)
description
double getIntegral()
Get the integral within the fit window.
TFitResultPtr getBkgFitResult()
Get background fit result.
TFitResultPtr getCompFitResult()
Get the complete fit result.
float getSignalYieldErr()
Get the error of the signal yield.
double getUpperLimit()
Get the upper fit limit.
double getUpperLimitPValue()
Get the p-value at the upper limit.
double getWindowSize()
Get the size of the fit window.
double getCorrectedMass() const
Get the corrected mass.
double getPValue()
description
std::vector< double > getLikelihoods()
Get the likelihoods.
double getFullBkgRate()
Get the background rate obtained from the signal+background hit at the mass hypo.
float getSignalYield()
Get the signal yield obtained from the signal+background fit.
double getQ0()
description
double getFullBkgRateError()
Get the background rate error from the signal+background fit at the mass hypo.
TFitResultPtr getBkgToysFitResult()
Get background toy model fit result.
std::vector< double > getSignalYields()
Get the signal yields.
double getMass() const
Get the mass hypothesis for the fit.
Base class for all event processing components.