diff --git a/mcmc/FitterBase.cpp b/mcmc/FitterBase.cpp index 75962ce7..fc158162 100644 --- a/mcmc/FitterBase.cpp +++ b/mcmc/FitterBase.cpp @@ -418,6 +418,52 @@ void FitterBase::ProcessMCMC() { } } +// ************************* +// Run Drag Race +void FitterBase::DragRace() { +// ************************* + + MACH3LOG_INFO("Let the Race Begin!"); + // Reweight the MC + for(unsigned int ivs = 0; ivs < samples.size(); ivs++ ) + { + double *fake = 0; + TStopwatch clockRace; + clockRace.Start(); + samples[ivs]->reweight(fake); + clockRace.Stop(); + MACH3LOG_INFO("It took {:.6f} s for a single reweight of sample: {}", clockRace.RealTime(), samples[ivs]->GetName()); + } + + for(unsigned int ivs = 0; ivs < samples.size(); ivs++ ) + { + TStopwatch clockRace; + clockRace.Start(); + samples[ivs]->GetLikelihood(); + clockRace.Stop(); + MACH3LOG_INFO("It took {:.6f} s for a single GetLikelihood of sample: {}", clockRace.RealTime(), samples[ivs]->GetName()); + } + + + for (size_t s = 0; s < systematics.size(); ++s) { + TStopwatch clockRace; + clockRace.Start(); + systematics[s]->proposeStep(); + clockRace.Stop(); + MACH3LOG_INFO("It took {:.6f} s for a single propose step of cov: {}", clockRace.RealTime(), systematics[s]->getName()); + } + + for (size_t s = 0; s < systematics.size(); ++s) { + TStopwatch clockRace; + clockRace.Start(); + systematics[s]->GetLikelihood(); + clockRace.Stop(); + MACH3LOG_INFO("It took {:.6f} s for a single get likelihood of cov: {}", clockRace.RealTime(), systematics[s]->getName()); + } + MACH3LOG_INFO("End of race"); + +} + // ************************* // Run LLH scan void FitterBase::RunLLHScan() { diff --git a/mcmc/FitterBase.h b/mcmc/FitterBase.h index 450ac04b..bd1896e4 100644 --- a/mcmc/FitterBase.h +++ b/mcmc/FitterBase.h @@ -48,6 +48,9 @@ class FitterBase { /// @brief The specific fitting algorithm implemented in this function depends on the derived class. It could be Markov Chain Monte Carlo (MCMC), MinuitFit, or another algorithm. virtual void runMCMC() = 0; + /// @brief Checks how much time we need for every sample/covariance object + void DragRace(); + /// @brief Perform a 1D likelihood scan. void RunLLHScan();