27#ifdef ROOFIT_MULTIPROCESS
32namespace TestStatistics {
53 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean,
55 : likelihood_(std::move(likelihood)),
56 calculation_is_clean_(std::move(calculation_is_clean)),
57 shared_offset_(std::move(
offset))
69 throw std::logic_error(
"in LikelihoodWrapper constructor: _likelihood is not of a valid subclass!");
76 const std::vector<ROOT::Fit::ParameterSettings> & )
82 likelihood_->constOptimizeTestStatistic(opcode, doAlsoTrackingOpt);
112 <<
"LikelihoodWrapper::setOffsettingMode(" <<
GetName()
113 <<
"): changed offsetting mode while offsetting was enabled; resetting offset values" << std::endl;
147 assert(sum_likelihood !=
nullptr);
148 for (std::size_t comp_ix = 0; comp_ix <
likelihood_->getNComponents(); ++comp_ix) {
149 auto component_subsidiary_cast =
150 dynamic_cast<RooSubsidiaryL *
>(sum_likelihood->GetComponents()[comp_ix].get());
157 <<
"LikelihoodSerial::evaluate(" <<
GetName() <<
"): Likelihood offset now set to "
175 std::vector<std::size_t> comp_was_changed;
179 assert(unbinned_likelihood !=
nullptr);
180 if (unbinned_likelihood->setApplyWeightSquared(flag))
181 comp_was_changed.emplace_back(0);
186 assert(sum_likelihood !=
nullptr);
187 for (std::size_t comp_ix = 0; comp_ix <
likelihood_->getNComponents(); ++comp_ix) {
188 auto component_unbinned_cast =
dynamic_cast<RooUnbinnedL *
>(sum_likelihood->GetComponents()[comp_ix].get());
189 if (component_unbinned_cast !=
nullptr) {
190 if (component_unbinned_cast->setApplyWeightSquared(flag))
191 comp_was_changed.emplace_back(comp_ix);
197 throw std::logic_error(
"LikelihoodWrapper::setApplyWeightSquared can only be used on unbinned likelihoods, but "
198 "the wrapped likelihood_ member is not a RooUnbinnedL nor a RooSumL containing an unbinned"
202 if (!comp_was_changed.empty()) {
211std::unique_ptr<LikelihoodWrapper>
213 std::shared_ptr<WrapperCalculationCleanFlags> calculationIsClean,
SharedOffset offset)
215 switch (likelihoodMode) {
217 return std::make_unique<LikelihoodSerial>(std::move(likelihood), std::move(calculationIsClean),
221#ifdef ROOFIT_MULTIPROCESS
222 return std::make_unique<LikelihoodJob>(std::move(likelihood), std::move(calculationIsClean), std::move(
offset));
224 throw std::runtime_error(
"MinuitFcnGrad ctor with LikelihoodMode::multiprocess is not available in this build "
225 "without RooFit::Multiprocess!");
229 throw std::logic_error(
"In MinuitFcnGrad constructor: likelihoodMode has an unsupported value!");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char mode
virtual bool isOffsetting() const
virtual void synchronizeParameterSettings(const std::vector< ROOT::Fit::ParameterSettings > ¶meter_settings)
std::shared_ptr< RooAbsL > likelihood_
void constOptimizeTestStatistic(RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)
SharedOffset shared_offset_
virtual std::string GetTitle() const
void setOffsettingMode(OffsettingMode mode)
virtual std::string GetName() const
virtual void enableOffsetting(bool flag)
OffsettingMode offsetting_mode_
double defaultErrorLevel() const
virtual void updateMinuitExternalParameterValues(const std::vector< double > &minuit_external_x)
virtual void updateMinuitInternalParameterValues(const std::vector< double > &minuit_internal_x)
Minuit passes in parameter values that may not conform to RooFit internal standards (like applying ra...
void calculate_offsets()
(Re)calculate (on each worker) all component offsets.
static std::unique_ptr< LikelihoodWrapper > create(LikelihoodMode likelihoodMode, std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculationIsClean, SharedOffset offset)
Factory method.
LikelihoodWrapper(std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, SharedOffset offset)
virtual void synchronizeWithMinimizer(const ROOT::Math::MinimizerOptions &options)
Synchronize minimizer settings with calculators in child classes.
void setApplyWeightSquared(bool flag)
LikelihoodType likelihood_type_
Likelihood class that sums over multiple -log components.
void swap(const std::vector< std::size_t > &component_keys)
When calculating an unbinned likelihood with square weights applied, a different offset is necessary.
OffsetVec & offsets_save()
OffsettingMode
Previously, offsetting was only implemented for RooNLLVar components of a likelihood,...
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...