41 if (
step % 10000 == 0) {
53 std::vector<double> pars;
54 const int NumPar = (*it)->GetNumParams();
57 for(
int i = 0; i < NumPar; ++i, ++ParCounter)
59 double ParVal = x[ParCounter];
63 if(ParVal < (*it)->GetLowerBound(i))
65 ParVal = (*it)->GetLowerBound(i) + ((*it)->GetLowerBound(i) - ParVal);
67 else if (ParVal > (*it)->GetUpperBound(i))
69 ParVal = (*it)->GetUpperBound(i) - ( ParVal - (*it)->GetUpperBound(i));
74 (*it)->SetParameters(pars);
78 std::vector<double> pars;
79 const int NumPar = (*it)->GetNParameters();
82 for(
int i = 0; i < NumPar; ++i, ++ParCounter)
84 double ParVal = x[ParCounter];
88 (*it)->GetPCAHandler()->SetParametersPCA(pars);
95 for (std::vector<ParameterHandlerBase*>::iterator it =
systematics.begin(); it !=
systematics.end(); ++it, ++stdIt)
98 syst_llh[stdIt] = (*it)->CalcLikelihood();
101 if (debug) debugFile <<
"LLH after " <<
systematics[stdIt]->GetName() <<
" " << llh << std::endl;
106 for (
size_t i = 0; i <
samples.size(); i++)
112 for (
size_t i = 0; i <
samples.size(); i++) {
117 if (debug) debugFile <<
"LLH after sample " << i <<
" " << llh << std::endl;
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.
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.
Manager * fitMan
The manager for configuration handling.
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() const
Return config.