42 if (
step % 10000 == 0) {
54 std::vector<double> pars;
55 const int NumPar = (*it)->GetNumParams();
58 for(
int i = 0; i < NumPar; ++i, ++ParCounter)
60 double ParVal = x[ParCounter];
64 if(ParVal < (*it)->GetLowerBound(i))
66 ParVal = (*it)->GetLowerBound(i) + ((*it)->GetLowerBound(i) - ParVal);
68 else if (ParVal > (*it)->GetUpperBound(i))
70 ParVal = (*it)->GetUpperBound(i) - ( ParVal - (*it)->GetUpperBound(i));
75 (*it)->SetParameters(pars);
79 std::vector<double> pars;
80 const int NumPar = (*it)->GetNParameters();
83 for(
int i = 0; i < NumPar; ++i, ++ParCounter)
85 double ParVal = x[ParCounter];
89 (*it)->GetPCAHandler()->SetParametersPCA(pars);
96 for (std::vector<ParameterHandlerBase*>::iterator it =
systematics.begin(); it !=
systematics.end(); ++it, ++stdIt)
99 syst_llh[stdIt] = (*it)->CalcLikelihood();
102 if (debug) debugFile <<
"LLH after " <<
systematics[stdIt]->GetName() <<
" " << llh << std::endl;
107 for (
size_t i = 0; i <
samples.size(); i++)
113 for (
size_t i = 0; i <
samples.size(); i++) {
118 if (debug) debugFile <<
"LLH after sample " << i <<
" " << llh << std::endl;
MaCh3Plotting::PlottingManager * man
Base class for implementing fitting algorithms.
std::vector< SampleHandlerBase * > samples
Sample holder.
double logLProp
proposed likelihood
int accCount
counts accepted steps
void SaveSettings()
Save the settings that the MCMC was run with.
manager * fitMan
The manager.
unsigned int step
current state
void PrepareOutput()
Prepare the output file.
double accProb
current acceptance prob
std::vector< double > sample_llh
store the llh breakdowns
double stepTime
Time of single step.
std::unique_ptr< TStopwatch > stepClock
tells how long single step/fit iteration took
double logLCurr
current likelihood
std::vector< double > syst_llh
systematic llh breakdowns
int auto_save
auto save every N steps
TTree * outTree
Output tree with posteriors.
std::vector< ParameterHandlerBase * > systematics
Systematic holder.
int NParsPCA
Number of all parameters from all covariances in PCA base.
LikelihoodFit(manager *const fitMan)
Constructor.
virtual ~LikelihoodFit()
Destructor.
int NPars
Number of all parameters from all covariances.
void PrepareFit()
prepare output and perform sanity checks
bool fMirroring
Flag telling if mirroring is used or not.
virtual double CalcChi2(const double *x)
Chi2 calculation over all included samples and syst objects.
The manager class is responsible for managing configurations and settings.
YAML::Node const & raw()
Return config.