BCMTF Class Reference

A class for fitting several templates to a data set. More...

#include <BCMTF.h>

Inheritance diagram for BCMTF:
[legend]
Collaboration diagram for BCMTF:
[legend]

Public Member Functions

Constructors and destructors
 BCMTF (const std::string &name="multi_template_fitter")
 A constructor. More...
 
 ~BCMTF ()
 The default destructor. More...
 
Member functions (get)
int GetNChannels () const
 
int GetNProcesses () const
 
int GetNSystematics () const
 
int GetChannelIndex (const std::string &name) const
 
int GetProcessIndex (const std::string &name) const
 
int GetSystematicIndex (const std::string &name) const
 
int GetParIndexProcess (int index) const
 
int GetParIndexSystematic (int index) const
 
BCMTFChannelGetChannel (int index)
 
double GetPValue () const
 
BCMTFProcessGetProcess (int index)
 
BCMTFSystematicGetSystematic (int index)
 
Member functions (set)
void SetData (const std::string &channelname, TH1D hist, double minimum=-1, double maximum=-1)
 Set the data histogram in a particular channel. More...
 
void SetTemplate (const std::string &channelname, const std::string &processname, TH1D hist, double efficiency=1., double norm=1.)
 Set the template for a specific process in a particular channel. More...
 
void SetTemplate (const std::string &channelname, const std::string &processname, std::vector< TF1 * > *funccont, int nbins, double efficiency=1.)
 Set the template for a specific process in a particular channel. More...
 
void SetExpectationFunction (int parindex, TF1 *func)
 Set an expectation function. More...
 
void SetSystematicVariation (const std::string &channelname, const std::string &processname, const std::string &systematicname, double variation_up, double variation_down)
 Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel. More...
 
void SetSystematicVariation (const std::string &channelname, const std::string &processname, const std::string &systematicname, TH1D hist_up, TH1D hist_down)
 Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel. More...
 
void SetSystematicVariation (const std::string &channelname, const std::string &processname, const std::string &systematicname, TH1D hist, TH1D hist_up, TH1D hist_down)
 Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel. More...
 
void SetFlagEfficiencyConstraint (bool flag)
 Set a flag for the efficiency: if true then the total efficiency including all systematic uncertainties has to be between 0 and 1 at all times. More...
 
Member functions (miscellaneous methods)
void AddChannel (const std::string &name)
 Add a channel. More...
 
void AddProcess (const std::string &name, double nmin=0., double nmax=1., int color=-1, int fillstyle=-1, int linestyle=-1)
 Add a process and the associated BAT parameter. More...
 
void AddSystematic (const std::string &name, double min=-5., double max=5.)
 Add a source of systematic uncertainty and the associated BAT (nuisance) parameter. More...
 
double Expectation (int channelindex, int binindex, const std::vector< double > &parameters)
 Return the expected number of events for a channel and bin. More...
 
double ExpectationFunction (int parindex, int channelindex, int processindex, const std::vector< double > &parameters)
 Return the function value of the expectation function for a parameter, channel and process. More...
 
double Efficiency (int channelindex, int processindex, int binindex, const std::vector< double > &parameters)
 Return the efficiency for a process in a channel and for a particular bin. More...
 
double Probability (int channelindex, int processindex, int binindex, const std::vector< double > &parameters)
 Return the probability for a process in a channel and for a particular bin. More...
 
double CalculateChi2 (int channelindex, const std::vector< double > &parameters)
 Calculate a chi2 for a single channel given a set of parameters. More...
 
double CalculateChi2 (const std::vector< double > &parameters)
 Calculate a chi2 for all channels together given a set of parameters. More...
 
double CalculateCash (int channelindex, const std::vector< double > &parameters)
 Calculate the Cash statistic for a single channel. More...
 
double CalculateCash (const std::vector< double > &parameters)
 Calculate the Cash statistic for all channels. More...
 
double CalculatePValue (int channelindex, const std::vector< double > &parameters)
 Calculates and returns the fast p-value for the total likelihood as test statistic. More...
 
double CalculatePValue (const std::vector< double > &parameters)
 Calculates and returns the fast p-value for the total likelihood as test statistic. More...
 
Member functions (output methods)
void PrintFitSummary ()
 Print a summary of the fit to the log. More...
 
void PrintStack (int channelindex, const std::vector< double > &parameters, const std::string &filename="stack.pdf", const std::string &options="e1b0stack")
 Print the stack of templates together with the data in a particular channel. More...
 
void PrintStack (const std::string &channelname, const std::vector< double > &parameters, const std::string &filename="stack.pdf", const std::string &options="e1b0stack")
 Print the stack of templates together with the data in a particular channel. More...
 
Member functions (overloaded from BCModel)
double LogLikelihood (const std::vector< double > &parameters)
 Calculate natural logarithm of the likelihood. More...
 
void MCMCUserIterationInterface ()
 Method executed for every iteration of the MCMC. More...
 
- Public Member Functions inherited from BCModel
 BCModel (const std::string &name="model")
 Default constructor. More...
 
 BCModel (const BCModel &bcmodel)
 Copy constructor. More...
 
 BCModel (const std::string &filename, const std::string &name, bool loadObservables=true)
 Read in MCMC constructor. More...
 
BCModeloperator= (const BCModel &)
 Copy-assignment operator.
 
virtual ~BCModel ()
 Destructor. More...
 
BCDataSetGetDataSet ()
 
unsigned GetNDataPoints () const
 
int GetNDoF () const
 
virtual BCPriorModelGetPriorModel (bool prepare=true, bool call_likelihood=false)
 
virtual BCH1D GetPrior (unsigned index)
 Get prior of a variable as a BCH1D. More...
 
virtual BCH2D GetPrior (unsigned index1, unsigned index2)
 Get prior of a pair of variables as a BCH2D. More...
 
BCH1DGetBCH1DPriorDrawingOptions ()
 
BCH2DGetBCH2DPriorDrawingOptions ()
 
BCH1DGetBCH1DPosteriorDrawingOptions ()
 
BCH2DGetBCH2DPosteriorDrawingOptions ()
 
bool GetDrawPriorFirst () const
 
void SetDataSet (BCDataSet *dataset)
 Sets the data set. More...
 
void SetKnowledgeUpdateDrawingStyle (BCAux::BCKnowledgeUpdateDrawingStyle style=BCAux::kKnowledgeUpdateDefaultStyle)
 Set default drawing options for knowledge update plots. More...
 
void SetDrawPriorFirst (bool b=true)
 Set drawing of prior first (true) or posterior first (false) for knowledge update plots. More...
 
virtual double APrioriProbability (const std::vector< double > &parameters)
 Returns the prior probability. More...
 
virtual double LogAPrioriProbability (const std::vector< double > &parameters)
 Returns natural logarithm of the prior probability. More...
 
virtual double Likelihood (const std::vector< double > &params)
 Returns the likelihood. More...
 
virtual double ProbabilityNN (const std::vector< double > &params)
 Returns the likelihood times prior probability given a set of parameter values. More...
 
virtual double LogProbabilityNN (const std::vector< double > &parameters)
 Returns the natural logarithm of likelihood times prior probability given a set of parameter values. More...
 
virtual double Probability (const std::vector< double > &parameters)
 Returns the a posteriori probability given a set of parameter values. More...
 
virtual double LogProbability (const std::vector< double > &parameters)
 Returns natural logarithm of the a posteriori probability given a set of parameter values. More...
 
virtual double SamplingFunction (const std::vector< double > &parameters)
 Sampling function used for importance sampling. More...
 
virtual double Eval (const std::vector< double > &parameters)
 Overloaded function to evaluate integral. More...
 
virtual double LogEval (const std::vector< double > &parameters)
 Overloaded function to evaluate integral. More...
 
virtual void InitializeMarkovChainTree (bool replacetree=false, bool replacefile=false)
 Initialize the trees containing the Markov chains and parameter info. More...
 
double HessianMatrixElement (unsigned index1, unsigned index2, const std::vector< double > &point)
 Calculates the matrix element of the Hessian matrix. More...
 
void PrintShortFitSummary ()
 Prints a short summary of the fit results on the screen. More...
 
void PrintHessianMatrix (std::vector< double > parameters)
 Prints matrix elements of the Hessian matrix. More...
 
virtual unsigned PrintKnowledgeUpdatePlots (const std::string &filename, unsigned hdiv=1, unsigned vdiv=1, bool call_likelihood=false)
 Print a comparison of the prior knowledge to the posterior knowledge for each parameter. More...
 
- Public Member Functions inherited from BCIntegrate
 BCIntegrate (const std::string &name="model")
 Default constructor.
 
 BCIntegrate (const std::string &filename, const std::string &name, bool loadObservables=true)
 Read in MCMC constructor. More...
 
 BCIntegrate (const BCIntegrate &other)
 Copy constructor.
 
BCIntegrateoperator= (const BCIntegrate &)
 Copy-assignment operator.
 
virtual ~BCIntegrate ()
 Destructor.
 
double GetIntegral () const
 
BCIntegrate::BCOptimizationMethod GetOptimizationMethod () const
 
BCIntegrate::BCIntegrationMethod GetIntegrationMethod () const
 
BCIntegrate::BCMarginalizationMethod GetMarginalizationMethod () const
 
BCIntegrate::BCSASchedule GetSASchedule () const
 
void GetRandomVectorInParameterSpace (std::vector< double > &x) const
 Fills a vector of random numbers x[i] between fMin[i] and fMax[i] into a vector. More...
 
double GetRandomPoint (std::vector< double > &x)
 Fills a vector of (flat) random numbers in the limits of the parameters and returns the probability at that point. More...
 
int GetNIterationsMin () const
 
int GetNIterationsMax () const
 
int GetNIterationsPrecisionCheck () const
 
int GetNIterations () const
 
double GetRelativePrecision () const
 
double GetAbsolutePrecision () const
 
BCCubaMethod GetCubaIntegrationMethod () const
 
const BCCubaOptions::VegasGetCubaVegasOptions () const
 
const BCCubaOptions::SuaveGetCubaSuaveOptions () const
 
const BCCubaOptions::DivonneGetCubaDivonneOptions () const
 
const BCCubaOptions::CuhreGetCubaCuhreOptions () const
 
TH1 * GetSlice (std::vector< unsigned > indices, unsigned &nIterations, double &log_max_val, const std::vector< double > parameters=std::vector< double >(0), int nbins=0, bool normalize=true)
 Returns a one-dimensional slice of the pdf at the point and along a specific direction. More...
 
TH1 * GetSlice (const std::string &name, unsigned &nIterations, double &log_max_val, const std::vector< double > parameters=std::vector< double >(0), int nbins=0, bool normalize=true)
 Returns a one-dimensional slice of the pdf at the point and along a specific direction. More...
 
TH1 * GetSlice (unsigned index, unsigned &nIterations, double &log_max_val, const std::vector< double > parameters=std::vector< double >(0), int nbins=0, bool normalize=true)
 Returns a one-dimensional slice of the pdf at the point and along a specific direction. More...
 
TH2 * GetSlice (const std::string &name1, const std::string &name2, unsigned &nIterations, double &log_max_val, const std::vector< double > parameters=std::vector< double >(0), int nbins=0, bool normalize=true)
 Returns a two-dimensional slice of the pdf at the point and along two specified directions. More...
 
TH2 * GetSlice (unsigned index1, unsigned index2, unsigned &nIterations, double &log_max_val, const std::vector< double > parameters=std::vector< double >(0), int nbins=0, bool normalize=true)
 Returns a two-dimensional slice of the pdf at the point and along two specified directions. More...
 
double GetError () const
 
TMinuitMinimizer & GetMinuit ()
 
double GetSAT0 () const
 Returns the Simulated Annealing starting temperature. More...
 
double GetSATmin () const
 Returns the Simulated Annealing threshhold temperature. More...
 
virtual const std::vector< double > & GetBestFitParameters () const
 
const std::vector< double > & GetBestFitParameterErrors () const
 Returns the set of errors on the values of the parameters at the mode.
 
double GetLogMaximum () const
 Returns the posterior at the mode. More...
 
void SetFlagIgnorePrevOptimization (bool flag)
 
void SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method)
 
void SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method)
 
void SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method)
 
void SetSASchedule (BCIntegrate::BCSASchedule schedule)
 
void SetNIterationsMin (int niterations)
 
void SetNIterationsMax (int niterations)
 
void SetNIterationsPrecisionCheck (int niterations)
 
void SetRelativePrecision (double relprecision)
 
void SetAbsolutePrecision (double absprecision)
 Set absolute precision of the numerical integation.
 
void SetCubaIntegrationMethod (BCCubaMethod type)
 Set Cuba integration method.
 
void SetCubaOptions (const BCCubaOptions::Vegas &options)
 Set options for CUBA's Vegas. More...
 
void SetCubaOptions (const BCCubaOptions::Suave &options)
 Set options for CUBA's Suave. More...
 
void SetCubaOptions (const BCCubaOptions::Divonne &options)
 Set options for CUBA's Divonne. More...
 
void SetCubaOptions (const BCCubaOptions::Cuhre &options)
 Set options for CUBA's Cuhre. More...
 
void SetSAT0 (double T0)
 Set starting temperature for Simulated Annealing. More...
 
void SetSATmin (double Tmin)
 Set threshold temperature for Simulated Annealing. More...
 
double Normalize ()
 Performs integration. More...
 
double Integrate (BCIntegrationMethod intmethod)
 Does the integration over the un-normalized probability. More...
 
double Integrate ()
 Perform the integration. More...
 
double Integrate (BCIntegrationMethod type, tRandomizer randomizer, tEvaluator evaluator, tIntegralUpdater updater, std::vector< double > &sums)
 Does the integration over the un-normalized probability. More...
 
double EvaluatorMC (std::vector< double > &sums, const std::vector< double > &point, bool &accepted)
 Evaluates integrator.
 
int MarginalizeAll ()
 Marginalize all probabilities wrt. More...
 
int MarginalizeAll (BCMarginalizationMethod margmethod)
 Marginalize all probabilities wrt. More...
 
virtual void MarginalizePreprocess ()
 Method executed for before marginalization. More...
 
virtual void MarginalizePostprocess ()
 Method executed after marginalization. More...
 
std::vector< double > FindMode (std::vector< double > start=std::vector< double >())
 Do the mode finding using a method set via SetOptimizationMethod. More...
 
std::vector< double > FindMode (BCIntegrate::BCOptimizationMethod optmethod, std::vector< double > start=std::vector< double >())
 Find mode using a specific method. More...
 
double SATemperature (double t) const
 Temperature annealing schedule for use with Simulated Annealing. More...
 
double SATemperatureBoltzmann (double t) const
 Temperature annealing schedule for use with Simulated Annealing. More...
 
double SATemperatureCauchy (double t) const
 Temperature annealing schedule for use with Simulated Annealing. More...
 
virtual double SATemperatureCustom (double t) const
 Temperature annealing schedule for use with Simulated Annealing. More...
 
std::vector< double > GetProposalPointSA (const std::vector< double > &x, int t) const
 Generates a new state in a neighbourhood around x that is to be accepted or rejected by the Simulated Annealing algorithm. More...
 
std::vector< double > GetProposalPointSABoltzmann (const std::vector< double > &x, int t) const
 Generates a new state in a neighbourhood around x that is to be accepted or rejected by the Simulated Annealing algorithm. More...
 
std::vector< double > GetProposalPointSACauchy (const std::vector< double > &x, int t) const
 Generates a new state in a neighbourhood around x that is to be accepted or rejected by the Simulated Annealing algorithm. More...
 
virtual std::vector< double > GetProposalPointSACustom (const std::vector< double > &x, int t) const
 Generates a new state in a neighbourhood around x that is to be accepted or rejected by the Simulated Annealing algorithm. More...
 
std::vector< double > SAHelperGetRandomPointOnHypersphere () const
 Generates a uniform distributed random point on the surface of a fNvar-dimensional Hypersphere. More...
 
double SAHelperGetRadialCauchy () const
 Generates the radial part of a n-dimensional Cauchy distribution. More...
 
double SAHelperSinusToNIntegral (int dim, double theta) const
 Returns the Integral of sin^dim from 0 to theta. More...
 
virtual void ResetResults ()
 Reset all information on the best-fit parameters. More...
 
std::string DumpIntegrationMethod (BCIntegrationMethod type) const
 Return string with the name for a given integration type. More...
 
std::string DumpCurrentIntegrationMethod () const
 Return string with the name for the currently set integration type. More...
 
std::string DumpUsedIntegrationMethod () const
 Return string with the name for the previously used integration type. More...
 
std::string DumpMarginalizationMethod (BCMarginalizationMethod type) const
 Return string with the name for a given marginalization type. More...
 
std::string DumpCurrentMarginalizationMethod () const
 Return string with the name for the currently set marginalization type. More...
 
std::string DumpUsedMarginalizationMethod () const
 Return string with the name for the marginalization type used. More...
 
std::string DumpOptimizationMethod (BCOptimizationMethod type) const
 Return string with the name for a given optimization type. More...
 
std::string DumpCurrentOptimizationMethod () const
 Return string with the name for the currently set optimization type. More...
 
std::string DumpUsedOptimizationMethod () const
 Return string with the name for the optimization type used to find the current mode. More...
 
std::string DumpCubaIntegrationMethod (BCCubaMethod type) const
 Return string with the name for a given Cuba integration type. More...
 
std::string DumpCubaIntegrationMethod () const
 Return string with the name for the currently set Cuba integration type. More...
 
void SetBestFitParameters (const std::vector< double > &x)
 Set best fit parameters values. More...
 
void SetBestFitParameters (const std::vector< double > &x, const double &new_value, double &old_value)
 
bool CheckMarginalizationAvailability (BCMarginalizationMethod type)
 Check availability of integration routine for marginalization. More...
 
bool CheckMarginalizationIndices (TH1 *hist, const std::vector< unsigned > &index)
 Check that indices of parameters to marginalize w/r/t are correct.
 
double IntegrateLaplace ()
 Integrate using the Laplace approximation. More...
 
- Public Member Functions inherited from BCEngineMCMC
 BCEngineMCMC (const std::string &name="model")
 Default constructor. More...
 
 BCEngineMCMC (const BCEngineMCMC &enginemcmc)
 Copy constructor. More...
 
 BCEngineMCMC (const std::string &filename, const std::string &name, bool loadObservables=true)
 Read in MCMC constructor. More...
 
BCEngineMCMCoperator= (const BCEngineMCMC &)
 Copy-assignment operator.
 
virtual ~BCEngineMCMC ()
 Destructor. More...
 
const std::string & GetName () const
 
const std::string & GetSafeName () const
 
unsigned GetNChains () const
 
unsigned GetNLag () const
 
int GetCurrentIteration () const
 
unsigned GetCurrentChain () const
 
int GetNIterationsConvergenceGlobal () const
 
unsigned GetNIterationsPreRun () const
 
unsigned GetNIterationsPreRunMin () const
 
unsigned GetNIterationsPreRunMax () const
 
unsigned GetNIterationsRun () const
 
unsigned GetNIterationsPreRunCheck () const
 
unsigned GetPreRunCheckClear ()
 
double GetMinimumEfficiency () const
 
double GetMaximumEfficiency () const
 
double GetScaleFactorLowerLimit () const
 
double GetScaleFactorUpperLimit () const
 
const std::vector< std::vector< double > > & GetScaleFactors () const
 
const ChainStateGetChainState (unsigned c) const
 
const std::vector< double > & Getx (unsigned c) const
 
double Getx (unsigned c, unsigned p) const
 
double GetLogProbx (unsigned c) const
 
BCEngineMCMC::Phase GetPhase () const
 
BCEngineMCMC::InitialPositionScheme GetInitialPositionScheme () const
 
unsigned GetInitialPositionAttemptLimit () const
 
bool GetProposeMultivariate () const
 
double GetProposalFunctionDof () const
 
unsigned GetMultivariateCovarianceUpdates () const
 
double GetMultivariateCovarianceUpdateLambda () const
 
double GetMultivariateEpsilon () const
 
double GetMultivariateScaleMultiplier () const
 
double GetRValueParametersCriterion () const
 
const std::vector< double > & GetRValueParameters () const
 
double GetRValueParameters (unsigned index) const
 
bool GetCorrectRValueForSamplingVariability () const
 Flag for correcting convergence checking for initial sampling variability. More...
 
bool GetFlagRun () const
 
TTree * GetMarkovChainTree () const
 Retrieve the tree containing the Markov chain. More...
 
TTree * GetParameterTree () const
 Retrieve the tree containing the parameter information. More...
 
TFile * GetOutputFile () const
 Retrieve output file for MCMC. More...
 
const BCEngineMCMC::StatisticsGetStatistics () const
 Get combined statistics for all chains. More...
 
const BCEngineMCMC::StatisticsGetStatistics (unsigned c) const
 Get MCMC statistics for one chain. More...
 
const std::vector< BCEngineMCMC::Statistics > & GetStatisticsVector () const
 Get vector of MCMC statistics for each chain separately. More...
 
bool GetRescaleHistogramRangesAfterPreRun () const
 
double GetHistogramRescalePadding () const
 
virtual std::vector< unsigned > GetH1DPrintOrder () const
 
virtual std::vector< std::pair< unsigned, unsigned > > GetH2DPrintOrder () const
 
bool MarginalizedHistogramExists (unsigned index) const
 
bool MarginalizedHistogramExists (unsigned index1, unsigned index2) const
 
TH1 * GetMarginalizedHistogram (const std::string &name) const
 Obtain the individual marginalized distributions with respect to one parameter as a ROOT TH1. More...
 
TH1 * GetMarginalizedHistogram (unsigned index) const
 Obtain the individual marginalized distributions with respect to one parameter as a ROOT TH1. More...
 
TH2 * GetMarginalizedHistogram (const std::string &name1, const std::string &name2) const
 Obtain the individual marginalized distributions with respect to two parameters as a ROOT TH2. More...
 
TH2 * GetMarginalizedHistogram (unsigned index1, unsigned index2) const
 Obtain the individual marginalized distributions with respect to two parameters as a ROOT TH2. More...
 
BCH1D GetMarginalized (const std::string &name) const
 Obtain the individual marginalized distributions with respect to one parameter. More...
 
BCH1D GetMarginalized (unsigned index) const
 Obtain the individual marginalized distributions with respect to one parameter. More...
 
BCH2D GetMarginalized (const std::string &name1, const std::string &name2) const
 Obtain the individual marginalized distributions with respect to two parameters. More...
 
BCH2D GetMarginalized (unsigned index1, unsigned index2) const
 Obtain the individual marginalized distributions with respect to two parameters. More...
 
unsigned GetMaximumParameterNameLength (bool observables=true) const
 
BCVariableGetVariable (unsigned index)
 
const BCVariableGetVariable (unsigned index) const
 
unsigned GetNVariables () const
 
BCParameterSetGetParameters ()
 
const BCParameterSetGetParameters () const
 
BCParameterGetParameter (unsigned index)
 
const BCParameterGetParameter (unsigned index) const
 
BCParameterGetParameter (const std::string &name)
 
const BCParameterGetParameter (const std::string &name) const
 
unsigned GetNParameters () const
 
unsigned GetNFixedParameters () const
 
unsigned GetNFreeParameters () const
 
BCObservableSetGetObservables ()
 
const BCObservableSetGetObservables () const
 
BCObservableGetObservable (unsigned index)
 
const BCObservableGetObservable (unsigned index) const
 
BCObservableGetObservable (const std::string &name)
 
const BCObservableGetObservable (const std::string &name) const
 
unsigned GetNObservables () const
 
const std::vector< double > & GetLocalModes (bool force_recalculation=false)
 
bool GetReuseObservables () const
 
BCH1DGetBCH1DdrawingOptions ()
 
BCH2DGetBCH2DdrawingOptions ()
 
void SetName (const std::string &name)
 Sets the name of the engine. More...
 
void SetScaleFactorLowerLimit (double l)
 Set scale factor lower limit.
 
void SetScaleFactorUpperLimit (double l)
 Set scale factor upper limit.
 
void SetInitialScaleFactors (const std::vector< double > &scale)
 Set the initial scale factors for the factorized proposal function. More...
 
void SetNChains (unsigned n)
 Sets the number of Markov chains which are run in parallel. More...
 
void SetNLag (unsigned n)
 Sets the lag of the Markov chains.
 
void SetNIterationsPreRunMax (unsigned n)
 Sets the maximum number of iterations in the pre-run. More...
 
void SetNIterationsRun (unsigned n)
 Sets the number of iterations. More...
 
void SetNIterationsPreRunMin (unsigned n)
 Sets the minimum number of iterations in the pre-run.
 
void SetNIterationsPreRunCheck (unsigned n)
 Sets the number of iterations between scale adjustments and convergence checks in the pre-run. More...
 
void SetPreRunCheckClear (unsigned n)
 Sets the number of prerun checks to make inbetween statistics clearing. More...
 
void SetMinimumEfficiency (double efficiency)
 Sets the minimum efficiency required for a chain. More...
 
void SetMaximumEfficiency (double efficiency)
 Sets the maximum efficiency required for a chain. More...
 
void SetRandomSeed (unsigned seed)
 Set the random number seed.
 
void SetInitialPositions (const std::vector< double > &x0s)
 Sets the initial positions for all chains. More...
 
void SetInitialPositions (const std::vector< std::vector< double > > &x0s)
 Sets the initial positions for all chains. More...
 
void SetInitialPositionScheme (BCEngineMCMC::InitialPositionScheme scheme)
 Sets flag which defines initial position. More...
 
void SetInitialPositionAttemptLimit (unsigned n)
 Sets maximum number of attempts to find a valid initial position. More...
 
void SetProposeMultivariate (bool flag)
 Set flag to true to turn on the multivariate proposal for MCMC based on (Haario et al., 2001) where the covariance is learned from the prerun. More...
 
void SetProposalFunctionDof (double dof=1)
 Set the degree of freedom of the proposal function for MCMC. More...
 
void SetMultivariateCovarianceUpdateLambda (double l)
 Set weighting for multivariate proposal function covariance update. More...
 
void SetMultivariateEpsilon (double epsilon)
 Sets multivariate-proposal-function cholesky-decomposition nudge. More...
 
void SetMultivariateScaleMultiplier (double s)
 Sets multivariate-proposal-function scale multiplier. More...
 
void SetFlagFillHistograms (bool flag)
 Sets whether to fill histograms. More...
 
void SetFlagFillHistograms (bool flag_1d, bool flag_2d)
 Sets the whether to fill histograms. More...
 
void SetFillHistogramParPar (unsigned x, unsigned y, bool flag=true)
 Sets whether to fill particular H2 histogram: par(y) vs. More...
 
void SetFillHistogramParPar (const std::string &x, const std::string &y, bool flag=true)
 Sets whether to fill particular H2 histogram: par(y) vs. More...
 
void SetFillHistogramParObs (unsigned x, unsigned y, bool flag=true)
 Sets whether to fill particular H2 histogram: obs(y) vs. More...
 
void SetFillHistogramParObs (const std::string &x, const std::string &y, bool flag=true)
 Sets whether to fill particular H2 histogram: obs(y) vs. More...
 
void SetFillHistogramObsObs (unsigned x, unsigned y, bool flag=true)
 Sets whether to fill particular H2 histogram: obs(y) vs. More...
 
void SetFillHistogramObsObs (const std::string &x, const std::string &y, bool flag=true)
 Sets whether to fill particular H2 histogram: obs(y) vs. More...
 
void SetFillHistogramObsPar (unsigned x, unsigned y, bool flag=true)
 Sets whether to fill particular H2 histogram: par(y) vs. More...
 
void SetFillHistogramObsPar (const std::string &x, const std::string &y, bool flag=true)
 Sets whether to fill particular H2 histogram: par(y) vs. More...
 
void SetFlagPreRun (bool flag)
 Set if a (new) prerun should be performed. More...
 
void SetRValueParametersCriterion (double r)
 Sets the parameter R-value criterion for convergence of all chains.
 
void SetCorrectRValueForSamplingVariability (bool flag=true)
 Set flag to correct convergence checking for initial sampling variability. More...
 
void SetPrecision (BCEngineMCMC::Precision precision)
 Set the precision for the MCMC run. More...
 
void SetPrecision (const BCEngineMCMC *other)
 Copy precision for the MCMC run from other model. More...
 
void SetPrecision (const BCEngineMCMC &other)
 Copy precision for the MCMC run from other model. More...
 
void SetNbins (unsigned int nbins)
 Set the number of bins for the marginalized distribution of all parameters. More...
 
void SetReuseObservables (bool flag)
 
void SetRescaleHistogramRangesAfterPreRun (bool flag=true)
 Set flag for rescaling histogram ranges after pre-run. More...
 
void SetHistogramRescalingPadding (double factor)
 Set enlargement factor of range for when rescaling. More...
 
void WriteMarkovChain (bool flag)
 Turn on/off writing of Markov chain to root file. More...
 
void WriteMarkovChainRun (bool flag)
 Turn on/off writing of Markov chain to root file during run. More...
 
void WriteMarkovChainPreRun (bool flag)
 Turn on/off writing of Markov chain to root file during prerun. More...
 
void WriteMarkovChain (const std::string &filename, const std::string &option, bool flag_run=true, bool flag_prerun=true)
 Turn on writing of Markov chain to root file. More...
 
void SetPriorConstant (unsigned index)
 
void SetPriorConstant (const std::string &name)
 
void SetPrior (unsigned index, TF1 &f, bool logL=true)
 
void SetPrior (const std::string &name, TF1 &f, bool logL=true)
 
void SetPriorDelta (unsigned index, double value)
 
void SetPriorDelta (const std::string &name, double value)
 
void SetPriorGauss (unsigned index, double mean, double sigma)
 
void SetPriorGauss (const std::string &name, double mean, double sigma)
 
void SetPriorGauss (unsigned index, double mode, double sigma_below, double sigma_above)
 
void SetPriorGauss (const std::string &name, double mode, double sigma_below, double sigma_above)
 
void SetPrior (unsigned index, TH1 &h, bool interpolate=false)
 
void SetPrior (const std::string &name, TH1 &h, bool interpolate=false)
 
void SetPriorConstantAll ()
 
void WriteMarginalizedDistributions (const std::string &filename, const std::string &option, bool closeExistingFile=false)
 Write marginalization histograms to file. More...
 
virtual void PrintSummary () const
 Prints a summary to the logs. More...
 
void PrintParameters (const std::vector< double > &P, void(*output)(const std::string &)=BCLog::OutSummary) const
 Print parameters. More...
 
unsigned PrintAllMarginalized (const std::string &filename, unsigned hdiv=1, unsigned vdiv=1) const
 Print all marginalizations. More...
 
unsigned PrintParameterPlot (const std::string &filename, int npar=10, double interval_content=68e-2, std::vector< double > quantile_values=std::vector< double >(0), bool rescale_ranges=true) const
 Print a summary plot for the parameters and user-defined observables. More...
 
bool DrawParameterPlot (unsigned i0, unsigned npar=0, double interval_content=68e-2, std::vector< double > quantile_values=std::vector< double >(0), bool rescale_ranges=true) const
 Draw a summary plot for the parameters in the range provided to current pad. More...
 
bool PrintCorrelationMatrix (const std::string &filename="matrix.pdf") const
 Print a correlation matrix for the parameters. More...
 
bool PrintCorrelationPlot (const std::string &filename="correlation.pdf", bool include_observables=true) const
 Print a correlation plot for the parameters. More...
 
bool PrintParameterLatex (const std::string &filename) const
 Print a LaTeX table of the parameters. More...
 
virtual void CreateHistograms (bool rescale_ranges=false)
 Create histograms from parameter and observable sets. More...
 
virtual bool AddParameter (const std::string &name, double min, double max, const std::string &latexname="", const std::string &unitstring="")
 
virtual bool AddParameter (BCParameter &parameter)
 
virtual bool AddObservable (const std::string &name, double min, double max, const std::string &latexname="", const std::string &unitstring="")
 
virtual bool AddObservable (BCObservable &obs)
 
virtual void EvaluateObservables ()
 Evaluates user-defined observables at current state of all chains and stores results in fMCMCState.
 
virtual void EvaluateObservables (unsigned chain)
 Evaluates user-defined observables at current state of chain and stores results in fMCMCState. More...
 
virtual void CalculateObservables (const std::vector< double > &pars)
 Evaluates user-defined observables. More...
 
virtual double ProposalFunction (unsigned ichain, unsigned ipar)
 The default proposal function is a Breit-Wigner random walk. More...
 
bool GetProposalPointMetropolis (unsigned chain, std::vector< double > &x)
 Return a proposal point for the Metropolis algorithm. More...
 
bool GetProposalPointMetropolis (unsigned chain, unsigned parameter, std::vector< double > &x)
 Return a proposal point for the Metropolis algorithm. More...
 
bool GetNewPointMetropolis ()
 Generate a new point using the Metropolis algorithm for all chains. More...
 
bool GetNewPointMetropolis (unsigned chain)
 Generate a new point using the Metropolis algorithm for one chain. More...
 
bool GetNewPointMetropolis (unsigned chain, unsigned parameter)
 Generate a new point using the Metropolis algorithm for one chain, varying only one parameter's value. More...
 
bool AcceptOrRejectPoint (unsigned chain, unsigned parameter)
 Accept or rejects a point for a chain and updates efficiency. More...
 
void InChainFillHistograms (const ChainState &cs)
 Fill marginalized distributions from a chain state.
 
void InChainFillHistograms ()
 Fill marginalized distributions from all chain states.
 
void InChainFillTree (const ChainState &cs, unsigned chain_number)
 Write a chain state to the tree.
 
void InChainFillTree ()
 Write all chain states to the tree.
 
bool Metropolis ()
 Runs Metropolis algorithm. More...
 
bool MetropolisPreRun ()
 Runs a pre run for the Metropolis algorithm. More...
 
void MCMCInitialize ()
 Resets all containers used in MCMC and initializes starting points. More...
 
virtual void MCMCUserInitialize ()
 User hook called from MCMCInitialize(). More...
 
virtual void MCMCCurrentPointInterface (const std::vector< double > &point, int ichain, bool accepted)
 Interface allowing to execute arbitrary code for each new point of the MCMC whether it is accepted or not. More...
 
void LoadParametersFromTree (TTree *partree, bool loadObservables=true)
 Load parameters and observables from tree. More...
 
void LoadMCMCParameters (TTree &partree)
 Load MCMC parameters from parameter tree: nchains, proposal function type, scales. More...
 
virtual bool ParameterTreeMatchesModel (TTree *partree, bool checkObservables=true)
 Check parameter tree against model. More...
 
void LoadMCMC (const std::string &filename, std::string mcmcTreeName="", std::string parameterTreeName="", bool loadObservables=true)
 Load previous MCMC run. More...
 
void LoadMCMC (TTree *mcmcTree, TTree *parTree, bool loadObservables=true)
 Load previous MCMC run. More...
 
bool ValidMCMCTree (TTree *tree, bool checkObservables=true) const
 Check tree structure for MCMC tree. More...
 
bool ValidParameterTree (TTree *tree) const
 Check tree structure for parameter tree. More...
 
void CloseOutputFile ()
 Close the root output file. More...
 
virtual void Remarginalize (bool autorange=true)
 Marginalize from TTree. More...
 
void PrepareToContinueMarginalization (const std::string &filename, const std::string &mcmcTreeName="", const std::string &parameterTreeName="", bool loadObservables=true, bool autorange=true)
 Continue the marginalization already stored in another file. More...
 
virtual bool UpdateMultivariateProposalFunctionCovariances (double a)
 Update multivariate proposal function covariances. More...
 
virtual bool UpdateMultivariateProposalFunctionCovariances ()
 Update multivariate proposal function covariances. More...
 
void CalculateCholeskyDecompositions ()
 Calculate Cholesky decompositions needed for multivariate proposal function. More...
 
void UpdateChainIndex (int chain)
 Keep track of which chain is currently computed (within a thread). More...
 

Additional Inherited Members

- Public Types inherited from BCIntegrate
enum  BCOptimizationMethod {
  kOptEmpty, kOptSimAnn, kOptMetropolis, kOptMinuit,
  kOptDefault, NOptMethods
}
 An enumerator for the mode finding algorithm. More...
 
enum  BCIntegrationMethod {
  kIntEmpty, kIntMonteCarlo, kIntCuba, kIntGrid,
  kIntLaplace, kIntDefault, NIntMethods
}
 An enumerator for integration algorithms. More...
 
enum  BCMarginalizationMethod {
  kMargEmpty, kMargMetropolis, kMargMonteCarlo, kMargGrid,
  kMargDefault, NMargMethods
}
 An enumerator for marginalization algorithms. More...
 
enum  BCSASchedule { kSACauchy, kSABoltzmann, kSACustom, NSAMethods }
 An enumerator for the Simulated Annealing schedule. More...
 
enum  BCCubaMethod {
  kCubaVegas, kCubaSuave, kCubaDivonne, kCubaCuhre,
  kCubaDefault, NCubaMethods
}
 An enumerator for Cuba integration methods. More...
 
typedef void(BCIntegrate::* tRandomizer) (std::vector< double > &) const
 A pointer for a function that chooses a next random point.
 
typedef double(BCIntegrate::* tEvaluator) (std::vector< double > &, const std::vector< double > &, bool &)
 A pointer for a function that evaluates at a point.
 
typedef void(* tIntegralUpdater) (const std::vector< double > &, const int &, double &, double &)
 A pointer for a function that updates the integral and absolute precision.
 
- Public Types inherited from BCEngineMCMC
enum  Precision {
  kLow, kQuick, kMedium, kHigh,
  kVeryHigh
}
 An enumerator for the status of a test. More...
 
enum  Phase { kPreRun = -1, kUnsetPhase = 0, kMainRun = +1 }
 An enumerator for the phase of the Markov chain. More...
 
enum  InitialPositionScheme { kInitCenter = 0, kInitRandomUniform = 1, kInitUserDefined = 2, kInitRandomPrior = 3 }
 An enumerator for markov-chain position initialization. More...
 
- Static Public Member Functions inherited from BCIntegrate
static void IntegralUpdaterMC (const std::vector< double > &sums, const int &nIterations, double &integral, double &absprecision)
 Updates info about integrator.
 
- Static Public Member Functions inherited from BCEngineMCMC
static double RValue (const std::vector< double > &means, const std::vector< double > &variances, unsigned n, bool correctForSamplingVariability=true)
 Calculate R value of set of batches of samples—represented by their means and variances, all batches containing the same number of samples—according to Brooks & Gelman, "General Methods for Monitoring Convergence of Iterative Simulations," (1988) More...
 
- Protected Member Functions inherited from BCIntegrate
virtual std::string GetBestFitSummary (unsigned i) const
 Get string summarizing best fit for single variable. More...
 
unsigned IntegrationOutputFrequency () const
 Determine frequency of output during integration.
 
void LogOutputAtEndOfIntegration (double integral, double absprecision, double relprecision, int nIterations)
 Helper method to output at end of integration. More...
 
void LogOutputAtIntegrationStatusUpdate (BCIntegrationMethod type, double integral, double absprecision, int nIterations)
 Helper method to output integration status. More...
 
void LogOutputAtStartOfIntegration (BCIntegrationMethod type, BCCubaMethod cubatype)
 Helper method to output at beginning of integration. More...
 
virtual void PrintBestFitSummary () const
 Print best fit to log.
 
virtual void PrintMarginalizationSummary () const
 Print marginalization to log. More...
 
- Protected Member Functions inherited from BCEngineMCMC
virtual void PrintModelSummary () const
 Print model summary to log. More...
 
void SetFillHistogram (int x, int y, bool flag)
 Set whether to fill 2D histogram y vs x: positive indices for parameters; negative for observables, starting at -1 and going more negative—observable index = -(index+1). More...
 
unsigned UpdateFrequency (unsigned N) const
 return appropriate update interval More...
 
void UpdateParameterTree ()
 Update Paramater TTree with scales and efficiencies. More...
 
- Protected Attributes inherited from BCModel
BCH1D fBCH1DPosteriorDrawingOptions
 knowledge update plot 1D posterior options. More...
 
BCH1D fBCH1DPriorDrawingOptions
 knowledge update plot 1D prior options. More...
 
BCH2D fBCH2DPosteriorDrawingOptions
 knowledge update plot 2D posterior options. More...
 
BCH2D fBCH2DPriorDrawingOptions
 knowledge update plot 2D prior options. More...
 
BCDataSetfDataSet
 A data set. More...
 
bool fDrawPriorFirst
 flag for ordering of drawing of prior and posterior in knowledge update plots. More...
 
bool fFactorizedPrior
 flag for whether factorized prior has been used. More...
 
BCPriorModelfPriorModel
 BCPriorModel object for drawing of knowledge update, and saving of samples according to prior. More...
 
- Protected Attributes inherited from BCIntegrate
bool fFlagIgnorePrevOptimization
 Flag for ignoring older results of optimization.
 
bool fFlagMarginalized
 flag indicating if the model was marginalized
 
double fSALogProb
 Log probability of current simulated annealing iteration. More...
 
int fSANIterations
 Number of iterations for simualted annealing. More...
 
double fSAT0
 Starting temperature for Simulated Annealing.
 
double fSATemperature
 Current temperature of simulated annealing algorithm. More...
 
double fSATmin
 Minimal/Threshold temperature for Simulated Annealing.
 
std::vector< double > fSAx
 Current simulated annealing parameter point. More...
 
- Protected Attributes inherited from BCEngineMCMC
BCH1D fBCH1DdrawingOptions
 A BCH1D (with no histogram) for storing BCH1D drawing options. More...
 
BCH2D fBCH2DdrawingOptions
 A BCH2D (with no histogram) for storing BCH2D drawing options. More...
 
bool fCorrectRValueForSamplingVariability
 flag for correcting R value for initial sampling variability. More...
 
std::vector< TH1 * > fH1Marginalized
 Vector of 1D marginalized distributions.
 
std::vector< std::vector< TH2 * > > fH2Marginalized
 Vector of 2D marginalized distributions. More...
 
double fHistogramRescalePadding
 factor for enlarging range of histograms when rescaling. More...
 
unsigned fInitialPositionAttemptLimit
 Maximum number of attempts to make to set the initial position. More...
 
BCEngineMCMC::InitialPositionScheme fInitialPositionScheme
 Variable which defines the initial position. More...
 
std::vector< double > fLocalModes
 Vector of local modes. More...
 
int fMCMCCurrentIteration
 The current iteration number. More...
 
double fMCMCEfficiencyMax
 The maximum allowed efficiency for MCMC.
 
double fMCMCEfficiencyMin
 The minimum required efficiency for MCMC.
 
bool fMCMCFlagWriteChainToFile
 Flag to write Markov chains to file.
 
bool fMCMCFlagWritePreRunToFile
 Flag to write pre run to file.
 
std::vector< std::vector< double > > fMCMCInitialPosition
 The intial position of each Markov chain. More...
 
std::vector< double > fMCMCInitialScaleFactors
 User-provided initial values of the scale factors of the factorized proposal function. More...
 
unsigned fMCMCNChains
 Number of Markov chains ran in parallel.
 
int fMCMCNIterationsConvergenceGlobal
 Number of iterations needed for all chains to convergence simultaneously.
 
unsigned fMCMCNIterationsPreRunCheck
 Number of iterations between scale adjustments and convergence checks in pre-run. More...
 
unsigned fMCMCNIterationsPreRunMax
 Maximum number of iterations for a Markov chain prerun.
 
unsigned fMCMCNIterationsPreRunMin
 Minimum number of iterations for the pre-run.
 
unsigned fMCMCNIterationsRun
 Number of iterations for a Markov chain run.
 
unsigned fMCMCNLag
 The lag for the Markov Chain.
 
TFile * fMCMCOutputFile
 Output file for for writing MCMC Tree. More...
 
std::string fMCMCOutputFilename
 Output filename for for writing MCMC Tree. More...
 
std::string fMCMCOutputFileOption
 Output file open option for for writing MCMC Tree. More...
 
BCEngineMCMC::Phase fMCMCPhase
 The phase of the run. More...
 
unsigned fMCMCPreRunCheckClear
 Number of iterations between clearing of convergence stats in pre-run. More...
 
double fMCMCProposalFunctionDof
 Degree of freedom of Student's t proposal. More...
 
std::vector< std::vector< double > > fMCMCProposalFunctionScaleFactor
 Scale factors for proposal functions. More...
 
bool fMCMCProposeMultivariate
 Flag for using multivariate proposal function. More...
 
std::vector< double > fMCMCRValueParameters
 The R-values for each parameter.
 
double fMCMCRValueParametersCriterion
 The R-value criterion for convergence of parameters.
 
double fMCMCScaleFactorLowerLimit
 Lower limit for scale factors.
 
double fMCMCScaleFactorUpperLimit
 Upper limit for scale factors.
 
std::vector< ChainStatefMCMCStates
 The current states of each Markov chain. More...
 
std::vector< BCEngineMCMC::StatisticsfMCMCStatistics
 Statistics for each Markov chain. More...
 
BCEngineMCMC::Statistics fMCMCStatistics_AllChains
 Statistics across all Markov chains. More...
 
TTree * fMCMCTree
 The tree containing the Markov chains. More...
 
unsigned int fMCMCTree_Chain
 Chain number for storing into tree.
 
ChainState fMCMCTree_State
 MC state object for storing into tree.
 
bool fMCMCTreeLoaded
 flag for whether MCMC Tree successfully loaded. More...
 
bool fMCMCTreeReuseObservables
 flag for whether to reuse MCMC Tree's observables. More...
 
double fMultivariateCovarianceUpdateLambda
 weighting parameter for multivariate-proposal-function covariance update. More...
 
unsigned fMultivariateCovarianceUpdates
 Number of multivariate-proposal-function covariance updates performed. More...
 
double fMultivariateEpsilon
 multivariate-proposal-function cholesky-decomposition nudge. More...
 
std::vector< TMatrixD > fMultivariateProposalFunctionCholeskyDecomposition
 Cholesky decompositions for multivariate proposal function. More...
 
std::vector< TMatrixDSym > fMultivariateProposalFunctionCovariance
 Covariance matrices used in multivariate proposal functions. More...
 
double fMultivariateScaleMultiplier
 factor to multiply or divide scale factors by in adjusting multivariate-proposal-function scales. More...
 
std::string fName
 Name of the engine. More...
 
BCAux::BCTrash< TObject > fObjectTrash
 Storage for plot objects with proper clean-up.
 
BCObservableSet fObservables
 User-calculated Observables Set.
 
BCParameterSet fParameters
 Parameter settings.
 
TTree * fParameterTree
 The tree containing the parameter information. More...
 
TRandom3 fRandom
 Random number generator.
 
std::vector< std::pair< int, int > > fRequestedH2
 Vector of pairs of indices for which 2D histograms should be stored. More...
 
bool fRescaleHistogramRangesAfterPreRun
 flag for rescaling of histograms after pre-run. More...
 
std::string fSafeName
 Safe name of the engine for use in naming ROOT objects. More...
 

Detailed Description

A class for fitting several templates to a data set.

Author
Daniel Kollar
Kevin Kröninger
Version
1.1
Date
06.2012

This class can be used for fitting several template histograms to a data histogram. The templates are assumed to have no statistical uncertainty whereas the data are assumed to have Poissonian fluctuations in each bin. Several methods to judge the validity of the model are available.

Definition at line 38 of file BCMTF.h.

Constructor & Destructor Documentation

BCMTF::BCMTF ( const std::string &  name = "multi_template_fitter")

A constructor.

Parameters
nameThe name of the model

Definition at line 35 of file BCMTF.cxx.

BCMTF::~BCMTF ( )

The default destructor.

Definition at line 44 of file BCMTF.cxx.

Member Function Documentation

void BCMTF::AddChannel ( const std::string &  name)

Add a channel.

Parameters
nameThe channel name.

Definition at line 245 of file BCMTF.cxx.

void BCMTF::AddProcess ( const std::string &  name,
double  nmin = 0.,
double  nmax = 1.,
int  color = -1,
int  fillstyle = -1,
int  linestyle = -1 
)

Add a process and the associated BAT parameter.

Parameters
nameThe process name
nminThe minimum number of expected events (lower limit on the BAT parameter values).
nmaxThe maximum number of expected events (upper limit on the BAT parameter values).
colorThe histogram color
fillstyleThe histogram fill style
linestyleThe histogram line style

Definition at line 289 of file BCMTF.cxx.

void BCMTF::AddSystematic ( const std::string &  name,
double  min = -5.,
double  max = 5. 
)

Add a source of systematic uncertainty and the associated BAT (nuisance) parameter.

Parameters
nameThe systematic uncertainty name.
minThe lower limit on the BAT parameter values, typically -5 sigma if Gaussian constraint is used.
maxThe upper limit on the BAT parameter values, typically +5 sigma if Gaussian constraint is used.

Definition at line 343 of file BCMTF.cxx.

double BCMTF::CalculateCash ( int  channelindex,
const std::vector< double > &  parameters 
)

Calculate the Cash statistic for a single channel.

Parameters
channelindexThe channel index.
parametersA reference to the parameters used to calculate the Cash statistic.
Returns
The Cash statistic.
See also
CalculateCash(const std::vector<double> & parameters)

Definition at line 969 of file BCMTF.cxx.

double BCMTF::CalculateCash ( const std::vector< double > &  parameters)

Calculate the Cash statistic for all channels.

Parameters
parametersA reference to the parameters used to calculate the Cash statistic.
Returns
The Cash statistic.
See also
CalculateCash(int channelindex, const std::vector<double> & parameters)

Definition at line 1013 of file BCMTF.cxx.

double BCMTF::CalculateChi2 ( int  channelindex,
const std::vector< double > &  parameters 
)

Calculate a chi2 for a single channel given a set of parameters.

Parameters
channelindexThe channel index.
parametersA reference to the parameters used to calculate the chi2.
Returns
A chi2 value.
See also
CalculateChi2(const std::vector<double> & parameters)

Definition at line 910 of file BCMTF.cxx.

double BCMTF::CalculateChi2 ( const std::vector< double > &  parameters)

Calculate a chi2 for all channels together given a set of parameters.

Parameters
parametersA reference to the parameters used to calculate the chi2.
Returns
A chi2 value.
See also
CalculateChi2(int channelindex, const std::vector<double> & parameters)

Definition at line 949 of file BCMTF.cxx.

double BCMTF::CalculatePValue ( int  channelindex,
const std::vector< double > &  parameters 
)

Calculates and returns the fast p-value for the total likelihood as test statistic.

See also
BCMath::CorrectPValue for correcting the fitting bias
Parameters
channelindexThe channel index.
parametersA reference to the parameters for which the model expectations are computed.
Returns
the uncorrected p-value

Definition at line 1033 of file BCMTF.cxx.

double BCMTF::CalculatePValue ( const std::vector< double > &  parameters)

Calculates and returns the fast p-value for the total likelihood as test statistic.

Note
The result is stored and can be accesses with GetPValue()
See also
BCMath::FastPValue()
Parameters
parametersA reference to the parameters for which the model expectations are computed.
Returns
The p-value

Definition at line 1068 of file BCMTF.cxx.

double BCMTF::Efficiency ( int  channelindex,
int  processindex,
int  binindex,
const std::vector< double > &  parameters 
)

Return the efficiency for a process in a channel and for a particular bin.

Parameters
channelindexThe channel index.
processindexThe process index.
binindexThe bin index.
parametersA reference to the parameters used to calculate the efficiency.
Returns
The efficiency.

Definition at line 575 of file BCMTF.cxx.

double BCMTF::Expectation ( int  channelindex,
int  binindex,
const std::vector< double > &  parameters 
)

Return the expected number of events for a channel and bin.

Parameters
channelindexThe channel index.
binindexThe bin index.
parametersA reference to the parameters used to calculate the expectation.
Returns
The expectation value

Definition at line 528 of file BCMTF.cxx.

double BCMTF::ExpectationFunction ( int  parindex,
int  channelindex,
int  processindex,
const std::vector< double > &  parameters 
)

Return the function value of the expectation function for a parameter, channel and process.

Parameters
parindexThe parameter index.
channelindexThe channel index.
processindexThe process index.
parametersA reference to the parameters used to calculate the expectation.
Returns
The expectation function value.

Definition at line 557 of file BCMTF.cxx.

BCMTFChannel* BCMTF::GetChannel ( int  index)
inline
Parameters
indexThe channel index.
Returns
The channel object.

Definition at line 104 of file BCMTF.h.

int BCMTF::GetChannelIndex ( const std::string &  name) const
Parameters
nameThe name of the channel.
Returns
The channel index.

Definition at line 52 of file BCMTF.cxx.

int BCMTF::GetNChannels ( ) const
inline
Returns
The number of channels.

Definition at line 61 of file BCMTF.h.

int BCMTF::GetNProcesses ( ) const
inline
Returns
The number of processes.

Definition at line 66 of file BCMTF.h.

int BCMTF::GetNSystematics ( ) const
inline
Returns
The number of systematics.

Definition at line 71 of file BCMTF.h.

int BCMTF::GetParIndexProcess ( int  index) const
inline
Parameters
indexThe parameter index (mtf counting) .
Returns
The parameter number corresponding to the parameter index (BAT counting).

Definition at line 92 of file BCMTF.h.

int BCMTF::GetParIndexSystematic ( int  index) const
inline
Parameters
indexThe systematic uncertainty index (mtf counting).
Returns
The parameter number corresponding to the systematic uncertainty (BAT counting).

Definition at line 98 of file BCMTF.h.

BCMTFProcess* BCMTF::GetProcess ( int  index)
inline
Parameters
indexThe process index.
Returns
The process object.

Definition at line 113 of file BCMTF.h.

int BCMTF::GetProcessIndex ( const std::string &  name) const
Parameters
nameThe name of the process.
Returns
The process index.

Definition at line 65 of file BCMTF.cxx.

BCMTFSystematic* BCMTF::GetSystematic ( int  index)
inline
Parameters
indexThe systematic ucnertainty index.
Returns
The systematic uncertainty object.

Definition at line 119 of file BCMTF.h.

int BCMTF::GetSystematicIndex ( const std::string &  name) const
Parameters
nameThe name of the systematic.
Returns
The systematic uncertainty index.

Definition at line 78 of file BCMTF.cxx.

double BCMTF::LogLikelihood ( const std::vector< double > &  parameters)
virtual

Calculate natural logarithm of the likelihood.

Method needs to be overloaded by the user.

Parameters
parametersA set of parameter values
Returns
Natural logarithm of the likelihood

Implements BCModel.

Definition at line 1114 of file BCMTF.cxx.

void BCMTF::MCMCUserIterationInterface ( )
virtual

Method executed for every iteration of the MCMC.

User's code should be provided via overloading in the derived class

Reimplemented from BCEngineMCMC.

Definition at line 1159 of file BCMTF.cxx.

void BCMTF::PrintFitSummary ( )

Print a summary of the fit to the log.

Definition at line 495 of file BCMTF.cxx.

void BCMTF::PrintStack ( int  channelindex,
const std::vector< double > &  parameters,
const std::string &  filename = "stack.pdf",
const std::string &  options = "e1b0stack" 
)

Print the stack of templates together with the data in a particular channel.

Several plot options are available:
"logx" : plot the x-axis on a log scale
"logy" : plot the y-axis on a log scale
"bw" : plot in black and white
"sum" : draw a line corresponding to the sum of all templates
"stack" : draw the templates as a stack
"e0" : do not draw error bars
"e1" : draw error bars corresponding to sqrt(n)
"b0" : draw an error band on the expectation corresponding to the central 68% probability
"b1" : draw bands showing the probability to observe a certain number of events given the expectation. The green (yellow, red) bands correspond to the central 68% (95%, 99.8%) probability

Parameters
channelindexThe channel index.
parametersA reference to the parameters used to scale the templates.
filenameOutput file name.
optionsThe plotting options.

Definition at line 644 of file BCMTF.cxx.

void BCMTF::PrintStack ( const std::string &  channelname,
const std::vector< double > &  parameters,
const std::string &  filename = "stack.pdf",
const std::string &  options = "e1b0stack" 
)
inline

Print the stack of templates together with the data in a particular channel.

Parameters
channelnameThe name of the channel.
parametersA reference to the parameters used to scale the templates.
optionsThe plotting options.
filenameOutput file name.
See also
PrintStack()

Definition at line 375 of file BCMTF.h.

double BCMTF::Probability ( int  channelindex,
int  processindex,
int  binindex,
const std::vector< double > &  parameters 
)

Return the probability for a process in a channel and for a particular bin.

This corresponds to the (normalized) bin content of the template.

Parameters
channelindexThe channel index.
processindexThe process index.
binindexThe bin index.
parametersA reference to the parameters used to calculate the probability.
Returns
The probability.

Definition at line 623 of file BCMTF.cxx.

void BCMTF::SetData ( const std::string &  channelname,
TH1D  hist,
double  minimum = -1,
double  maximum = -1 
)

Set the data histogram in a particular channel.

Parameters
channelnameThe name of the channel.
histThe TH1D histogram.
minimumThe minimum number of expected events (used for calculation of uncertainty bands).
maximumThe maximum number of expected events (used for calculation of uncertainty bands).

Definition at line 177 of file BCMTF.cxx.

void BCMTF::SetExpectationFunction ( int  parindex,
TF1 *  func 
)
inline

Set an expectation function.

Parameters
parindexThe index of the parameter
funcThe pointer to a TF1 function.
See also
SetTemplate(const std::string& channelname, const std::string& processname, std::vector<TF1 *> * funccont, int nbins, double efficiency = 1.)

Definition at line 165 of file BCMTF.h.

void BCMTF::SetFlagEfficiencyConstraint ( bool  flag)
inline

Set a flag for the efficiency: if true then the total efficiency including all systematic uncertainties has to be between 0 and 1 at all times.

Larger (smaller) values are set to 1 (0) during the calculation.

Parameters
flagThe flag

Definition at line 219 of file BCMTF.h.

void BCMTF::SetSystematicVariation ( const std::string &  channelname,
const std::string &  processname,
const std::string &  systematicname,
double  variation_up,
double  variation_down 
)

Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel.

The impact is the relative deviation between the varied and the nominal template, i.e., if the variation is set to 0.05 then the efficiency is multiplied by (1+0.05*eps), where eps is the corresponding nuisance parameter.

Parameters
channelnameThe name of the channel.
processnameThe name of the process.
systematicnameThe name of the source of systematic uncertainty.
variation_upThe relative shift between the up-variation and the nominal template: (up-nom)/nom.
variation_downThe relative shift between the down-variation and the nominal template: (nom-down)/nom.

Definition at line 386 of file BCMTF.cxx.

void BCMTF::SetSystematicVariation ( const std::string &  channelname,
const std::string &  processname,
const std::string &  systematicname,
TH1D  hist_up,
TH1D  hist_down 
)

Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel.

The variation depends on x and is given as a histogram.

Parameters
channelnameThe name of the channel.
processnameThe name of the process.
systematicnameThe name of the source of systematic uncertainty.
hist_upThe TH1D histogram defining the relative shift between the up-variation and the nominal template: (up-nom)/nom.
hist_downThe TH1D histogram defining the relative shift between the down-variation and the nominal template: (nom-down)/nom.
See also
SetSystematicVariation(const std::string& channelname, const std::string& processname, const std::string& systematicname, double variation_up, double variation_down)

Definition at line 439 of file BCMTF.cxx.

void BCMTF::SetSystematicVariation ( const std::string &  channelname,
const std::string &  processname,
const std::string &  systematicname,
TH1D  hist,
TH1D  hist_up,
TH1D  hist_down 
)

Set the impact of a source of systematic uncertainty for a particular source of systematic uncertainty and process in a given channel.

The variation depends on x. The histograms are the raw histograms after the shift and the variation wrt the nominal template will be calculated automatically.

Parameters
channelnameThe name of the channel.
processnameThe name of the process.
systematicnameThe name of the source of systematic uncertainty.
histThe histogram with the nominal template
hist_upThe TH1D histogram after up-scaling of the systematic uncertainty.
hist_downThe TH1D histogram after down-scaling of the systematic uncertainty.
See also
SetSystematicVariation(const std::string& channelname, const std::string& processname, const std::string& systematicname, double variation_up, double variation_down)

Definition at line 476 of file BCMTF.cxx.

void BCMTF::SetTemplate ( const std::string &  channelname,
const std::string &  processname,
TH1D  hist,
double  efficiency = 1.,
double  norm = 1. 
)

Set the template for a specific process in a particular channel.

Parameters
channelnameThe name of the channel.
processnameThe name of the process.
histThe TH1D histogram.
efficiencyThe efficiency of this process in this channel.
normThe norm of this process in this channel.

Definition at line 92 of file BCMTF.cxx.

void BCMTF::SetTemplate ( const std::string &  channelname,
const std::string &  processname,
std::vector< TF1 * > *  funccont,
int  nbins,
double  efficiency = 1. 
)

Set the template for a specific process in a particular channel.

This is an alternative way to describe the number of expected events. It is used in the rare case that processes cannot be summed directly, but interference effects have to be taken into account. The expected number of events is then parametrized as a function for each bin.

Parameters
channelnameThe name of the channel.
processnameThe name of the process.
funccontA vector of pointers of TF1 functions.
nbinsThe number of bins used for the histogram.
efficiencyThe efficiency of this process in this channel.
See also
SetTemplate(const std::string& channelname, const std::string& processname, TH1D hist, double efficiency = 1.)

Definition at line 145 of file BCMTF.cxx.


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