8 #ifndef __MONTECARLOENGINE__H
9 #define __MONTECARLOENGINE__H
13 #include "CorrelatedGaussianObservables.h"
17 #include <BAT/BCModel.h>
18 #include <BAT/BCH1D.h>
19 #include <BAT/BCH2D.h>
20 #include <BAT/BCModelOutput.h>
25 #include <TPrincipal.h>
29 #include <boost/ptr_container/ptr_vector.hpp>
31 #define NBINSMODELPARS 100
57 boost::ptr_vector<Observable>& Obs_i,
58 std::vector<Observable2D>& Obs2D_i,
59 std::vector<CorrelatedGaussianObservables>& CGO_i,
60 std::vector<CorrelatedGaussianParameters>& CGP_i);
115 double LogLikelihood(
const std::vector <double>& parameters);
150 void PrintHistogram(BCModelOutput& out,
const std::string OutputDir);
237 if (overflow) TH1::StatOverflows(kTRUE);
238 else TH1::StatOverflows(kFALSE);
243 double SecondDerivative(
const BCParameter * par1,
const BCParameter * par2, std::vector<double> point);
245 double FirstDerivative(
const BCParameter * par, std::vector<double> point);
249 void setDParsFromParameters(
const std::vector<double>& parameters, std::map<std::string,double>& DPars_i);
253 const std::vector<CorrelatedGaussianParameters>&
CGP;
256 std::vector<CorrelatedGaussianObservables>&
CGO;
258 std::map<std::string, double>
DPars;
261 std::map<std::string, double>
thMin;
262 std::map<std::string, double>
thMax;
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< ModelParameter > & ModPars
A vector of model parameters.
std::map< std::string, double > thMax
A map between the name of a theory observable and its maximum value.
std::vector< Observable2D > & Obs2D_ALL
A vector of all pairs of observable for Observable2D.
A class for the template of models.
double FirstDerivative(const BCParameter *par, std::vector< double > point)
boost::ptr_vector< Observable > & Obs_ALL
A vector of all observables.
unsigned int kwmax
The number of observables whose weights are used for the MCMC.
const std::vector< CorrelatedGaussianParameters > & CGP
A vector of correlated Gaussian parameters.
double SecondDerivative(const BCParameter *par1, const BCParameter *par2, std::vector< double > point)
double LogLikelihood(const std::vector< double > ¶meters)
This member calculates the loglikelihood for the observables included in the MCMC run...
std::string computeStatistics()
A get method to compute the mean and rms of the computed observables.
std::string getHistoLog() const
A get method to access the stream that stores the log messages coming from histogram printing and che...
int getNumOfDiscardedEvents() const
A get method to access the number of events discarded due to failure to update model. These events are not used for the MCMC run.
std::map< std::string, double > thMin
A map between the name of a theory observable and its minimum value.
double * obval
A pointer to the vector of observable values.
void CheckHistogram(const TH1D &hist, const std::string name)
This member checks if there is overflow of the 1D histogram.
std::map< std::string, double > DPars
A map between parameter names and their values.
void PrintHistogram(BCModelOutput &out, Observable &it, const std::string OutputDir)
Overloaded from PrintHistogram(BCModelOutput&, const std::string) to print histogram for observables...
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.
double computeNormalization()
std::map< std::string, BCH1D * > getHistograms1D() const
void AddChains()
A method to add the observable values and weights to the chain information.
std::map< std::string, BCH2D * > getHistograms2D() const
void setDParsFromParameters(const std::vector< double > ¶meters, std::map< std::string, double > &DPars_i)
An engine class for Monte Carlo.
void setNChains(unsigned int i)
A set method to fix the number of chains.
std::string writePreRunData()
A method to write in a text file the best fit parameters and the prerun scale factors.
int NumOfUsedEvents
The number of events for which the model is successfully updated and hence used for the MCMC run...
~MonteCarloEngine()
The default destructor. Some pointers defined in this class are explicitly freed. ...
int rank
Rank of the process for a MPI run. Value is 0 for a serial run.
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.
void setHistogramOverFlow(bool overflow)
std::map< std::string, BCH2D * > Histo2D
A map between pointers to objects of type BCH2D (BAT) and their given names.
void PrintCorrelationMatrix(const std::string filename)
This member generates the correlation matrix using BCH2D from the BAT libraries.
double Function_h(std::vector< double > point)
double * obweight
A pointer to the vector of observable weights.
unsigned int kmax
The number of observables.
void Initialize(Model *Mod_i)
Initialization of the Monte Carlo Engine.
void MCMCIterationInterface()
Overloaded from BCEngineMCMC in BAT
std::map< std::string, BCH1D * > Histo1D
A map between pointers to objects of type BCH1D (BAT) and their given names.
std::ostringstream HistoLog
A stream to store the output messages from printing and checking histograms.
int getNumOfUsedEvents() const
A get method to access the number of events used in the MCMC run.
Model * Mod
A pointer to an abject of type Model.
std::vector< CorrelatedGaussianObservables > & CGO
A vector of correlated Gaussian observables.