master
|
a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models
|
|
Go to the documentation of this file.
8 #ifndef __MONTECARLOENGINE__H
9 #define __MONTECARLOENGINE__H
17 #include <BAT/BCModel.h>
18 #include <BAT/BCH1D.h>
19 #include <BAT/BCH2D.h>
21 #include <TPrincipal.h>
26 #include <boost/ptr_container/ptr_vector.hpp>
53 boost::ptr_vector<Observable>& Obs_i,
54 std::vector<Observable2D>& Obs2D_i,
55 std::vector<CorrelatedGaussianObservables>& CGO_i,
56 std::vector<CorrelatedGaussianParameters>& CGP_i);
111 double LogLikelihood(
const std::vector <double>& parameters);
129 void Print1D(BCH1D hist1D,
const char * filename,
int ww=0,
int wh=0);
131 void Print2D(BCH2D hist2D,
const char * filename,
int ww=0,
int wh=0);
150 void PrintHistogram(std::string& OutFile,
const std::string OutputDir);
272 double SecondDerivative(BCParameter par1, BCParameter par2, std::vector<double> point);
292 void setDParsFromParameters(
const std::vector<double>& parameters, std::map<std::string,double>& DPars_i);
442 const std::vector<CorrelatedGaussianParameters>&
CGP;
445 std::vector<CorrelatedGaussianObservables>&
CGO;
447 std::map<std::string, double>
DPars;
451 std::map<std::string, double>
thMin;
452 std::map<std::string, double>
thMax;
TColor * HEPfit_green
< The number of significant digits in the Statistics File.
std::vector< std::vector< double > > hMCMCObservables
A vector of vectors containing the observables values of all the chains to be put into the ROOT tree.
const std::vector< ModelParameter > & ModPars
A vector of model parameters.
void setAlpha2D(double alpha)
A set method to toggle the printing of legends in 1D and 2D histograms.
bool WriteParametersChain
A flag to toggle the writing of parameters chains in the ROOT tree.
unsigned int nBins1D
The number of bins in a 1D histogram.
TColor * HEPfit_red
< The colour green for HEPfit.
void MCMCUserIterationInterface()
Overloaded from BCEngineMCMC in BAT
void PrintHistogram(std::string &OutFile, Observable &it, const std::string OutputDir)
Overloaded from PrintHistogram(BCModelOutput&, const std::string) to print histogram for observables.
void CreateHistogramMaps()
Creation of the histogram maps for Observables, Observable2D and Correlated Gaussian Observable.
unsigned int nBins2D
The number of bins in a 2D histogram.
void setHistogramBufferSize(unsigned int histogramBufferSize_i)
A set method to set the size of the buffer used by the histograms.
void PrintCorrelationMatrixToLaTeX(const std::string filename)
This member generates the correlation matrix using BCH2D from the BAT libraries.
std::vector< double > hMCMCTree_Observables_weight
A vector containing the observables weight to be put into the ROOT tree.
boost::ptr_vector< Observable > & Obs_ALL
A vector of all observables.
std::vector< Observable2D > & Obs2D_ALL
A vector of all pairs of observable for Observable2D.
double alpha2D
A number between 0. and 1. that sets the opacity level of 2D Histograms, 1. being fully opaque.
bool getWriteLogLikelihoodChain()
A get method to get the value of the bool the writing of Loglikelihood in the ROOT tree.
TTree * hMCMCObservableTree
A ROOT tree that contains the observables values and weight when the chains are written.
StandardModel * Mod
A pointer to an abject of type Model.
A model class for the Standard Model.
double hMCMCLogProbability
A variable containing the LogProbability values to be put into the ROOT tree.
std::map< std::string, BCH1D > Histo1D
A map between pointers to objects of type BCH1D (BAT) and their given names.
void CheckHistogram(TH1 &hist, const std::string name)
This member checks if there is overflow of the 1D histogram.
void AddChains()
A method to add the observable values and weights to the chain information.
void setPrintLogo(bool print)
A set method to toggle the printing of logo on the histogram pdf.
void setNBins1D(unsigned int nbins)
A set method to set the number of bins for a 1D histograms.
int getMPIWorldSize()
A get method to get the number of MPI world size.
void Print2D(BCH2D hist2D, const char *filename, int ww=0, int wh=0)
std::vector< double > hMCMCTree_Parameters
A vector containing the parameter values to be put into the ROOT tree.
std::vector< std::string > unknownParameters
A vector to contain the unkenown parameters passed in the configuration file.
std::map< std::string, double > thMin
A map between the name of a theory observable and its minimum value.
std::map< std::string, double > thMax
A map between the name of a theory observable and its maximum value.
void InChainFillParametersTree()
int getPrecision(double value, double rms)
A get method to calculate the precision of the numbers in the Statistics file based on the rms.
std::vector< double > par_at_LL_max
< The size of the buffer used for the histograms.
unsigned int histogramBufferSize
< The colour red for HEPfit.
void setNBins2D(unsigned int nbins)
A set method to set the number of bins for a 2D histograms.
int getchainedObsSize() const
A get method to access the number of Observable chains requested.
std::vector< std::vector< double > > hMCMCParameters
A vector of vectors containing the parameter values of all the chains to be put into the ROOT tree.
void setDParsFromParameters(const std::vector< double > ¶meters, std::map< std::string, double > &DPars_i)
A method to rotate the diagonalized parameters to the original basis for correlated parameters.
unsigned int significants
std::map< std::string, double > DPars
A map between parameter names and their values.
int getNumOfUsedEvents() const
A get method to access the number of events used in the MCMC run.
int nSmooth
The number of times a 1D histogram should be smoothed.
double computeNormalizationLME()
A method to calculate the normalization based on the Laplace-Metropolis Estimator.
double LogLikelihood(const std::vector< double > ¶meters)
This member calculates the loglikelihood for the observables included in the MCMC run.
std::vector< std::map< std::string, double > > DPars_allChains
A vector of maps between parameter names and their values for all chains.
double LogLikelihood_max
< vector to store the value of the parameters at maximum LogLikelihood;
std::string computeStatistics()
A get method to compute the mean and rms of the computed observables.
double FirstDerivative(BCParameter par, std::vector< double > point)
A method to calculate the first derivative.
void setHistogram2DType(int type)
A set method to set the band fill type for 2D histograms.
std::string writePreRunData()
A method to write in a text file the best fit parameters and the prerun scale factors.
MonteCarloEngine(const std::vector< ModelParameter > &ModPars_i, boost::ptr_vector< Observable > &Obs_i, std::vector< Observable2D > &Obs2D_i, std::vector< CorrelatedGaussianObservables > &CGO_i, std::vector< CorrelatedGaussianParameters > &CGP_i)
Constructor.
void setNChains(unsigned int i)
A set method to fix the number of chains.
unsigned int kchainedObs
The number of observables for which the chains should be written.
double hMCMCLogLikelihood
A variable containing the LogLikelihood values to be put into the ROOT tree.
std::ostringstream HistoLog
A stream to store the output messages from printing and checking histograms.
int rank
Rank of the process for a MPI run. Value is 0 for a serial run.
int NumOfUsedEvents
The number of events for which the model is successfully updated and hence used for the MCMC run.
std::string getHistoLog() const
A get method to access the stream that stores the log messages coming from histogram printing and che...
bool noLegend
A flag to toggle the histogram legends.
std::map< std::string, BCH2D > getHistograms2D() const
A get method to access the map of 2D histograms.
void setNoLegend(bool legend)
A set method to toggle the printing of legends in 1D and 2D histograms.
std::map< std::string, BCH2D > Histo2D
A map between pointers to objects of type BCH2D (BAT) and their given names.
void DefineParameters()
A member to classify the prior of the model parameters varied in the Monte Carlo.
std::map< std::string, TPrincipal * > CorrelationMap
A map between the name of a theory observable and its maximum value.
std::vector< double > computeNormalizationMC(int NIterationNormalizationMC)
A method to calculate the normalization based on the Monte Carlo Simulation.
unsigned int kmax
The number of observables.
std::map< std::string, BCH1D > getHistograms1D() const
A get method to access the map of 1D histograms.
void setSmooth(int int_N)
A set method to set the number of smoothing passes for ROOT in 1D histograms.
void setSignificants(unsigned int significants_i)
A set method to set the number of significant digits in the output.
bool WriteLogLikelihoodChain
A flag to toggle the writing of Loglikelihood chains in the ROOT tree.
bool getWriteParametersChain()
A get method to get the value of the bool the writing of parameters in the ROOT tree.
unsigned int cindex
An index to distinguish between succesive canvases used to draw histograms.
bool PrintLoglikelihoodPlots
A flag to toggle the printing of Parameters vs. Loglikelihood.
TTree * hMCMCParameterTree
A ROOT tree that contains the parameter values when the chains are written.
void setWriteParametersChain(bool LL)
A set method to toggle the writing of parameters in the ROOT tree.
void InChainFillObservablesTree()
int histogram2Dtype
Type of 2D Histogram 1001 -> box pixel, 101 -> filled, 1 -> contour.
std::vector< CorrelatedGaussianObservables > & CGO
A vector of correlated Gaussian observables.
~MonteCarloEngine()
The default destructor. Some pointers defined in this class are explicitly freed.
An engine class for Monte Carlo.
unsigned int kwmax
The number of observables whose weights are used for the MCMC.
int NumOfDiscardedEvents
The number of events for which the update of the model fails and these events are not used for the MC...
const std::vector< CorrelatedGaussianParameters > & CGP
A vector of correlated Gaussian parameters.
double SecondDerivative(BCParameter par1, BCParameter par2, std::vector< double > point)
A method to calculate the second derivative.
void Print1D(BCH1D hist1D, const char *filename, int ww=0, int wh=0)
void Initialize(StandardModel *Mod_i)
Initialization of the Monte Carlo Engine.
void setWriteLogLikelihoodChain(bool LL)
A set method to toggle the writing of Loglikelihood in the ROOT tree.
std::vector< std::vector< double > > hMCMCObservables_weight
A vector of vectors containing the observables weight of all the chains to be put into the ROOT tree.
double * obval
A pointer to the vector of observable values.
double Function_h(std::vector< double > point)
A method to calculate the LogLikelihood + LogAprioriProbability.
double * obweight
A pointer to the vector of observable weights.
std::vector< double > hMCMCTree_Observables
A vector containing the observables values to be put into the ROOT tree.
bool printLogo
A flag that is set to true for printing the logo on the histogram pdf.
double hMCMCLogPriorProbability
A variable containing the LogPriorProbability values to be put into the ROOT tree.
int getNumOfDiscardedEvents() const
A get method to access the number of events discarded due to failure to update model....
void setPrintLoglikelihoodPlots(bool plot)
A set method to toggle the printing of Parameters vs. Loglikelihood.