Skip to content

Commit

Permalink
Fix offsetting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeff020 authored and guitargeek committed Jan 25, 2023
1 parent ba7616b commit fe6935b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions roofit/roofitcore/src/RooAbsPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1591,12 +1591,6 @@ std::unique_ptr<RooFitResult> RooAbsPdf::minimizeNLL(RooAbsReal & nll,
/// backend and uses the number given as the number of workers to use in the parallelization. -1 also enables
/// RooFit's parallel minimization backend, and sets the number of workers to the number of available processes.
/// 0 disables this feature.
/// <tr><td> `Offset(std::string const& mode)` <td> Likelihood offsetting mode. Can be either:
/// - `"none"` (default): no offsetting
/// - `"initial"`: Offset likelihood by initial value (so that starting value of FCN in minuit is zero).
/// This can improve numeric stability in simultaneous fits with components with large likelihood values.
/// Note that this named argument only works if combined with `modularL` or `Parallelize`. For non-modular
/// likelihoods offsetting is enabled on the likelihood itself.
/// <tr><td> `ParallelGradientOptions(bool enable=true, int orderStrategy=0, int chainFactor=1)` <td> **Experimental** Control gradient parallelization settings. The first argument
/// only disables or enables gradient parallelization, this is on by default.
/// The second argument determines the internal partial derivative calculation
Expand All @@ -1620,10 +1614,15 @@ RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooLinkedList& cmdList)
RooCmdConfig pc(Form("RooAbsPdf::fitTo(%s)",GetName())) ;

RooLinkedList fitCmdList(cmdList) ;
RooLinkedList nllCmdList = pc.filterCmdList(fitCmdList,"ProjectedObservables,Extended,Range,"
std::string nllCmdListString = "ProjectedObservables,Extended,Range,"
"RangeWithName,SumCoefRange,NumCPU,SplitRange,Constrained,Constrain,ExternalConstraints,"
"CloneData,GlobalObservables,GlobalObservablesSource,GlobalObservablesTag,OffsetLikelihood,"
"BatchMode,IntegrateBins,ModularL");
"CloneData,GlobalObservables,GlobalObservablesSource,GlobalObservablesTag,"
"BatchMode,IntegrateBins,ModularL";

if (((RooCmdArg*)cmdList.FindObject("ModularL")) && !((RooCmdArg*)cmdList.FindObject("ModularL"))->getInt(0))
nllCmdListString += ",OffsetLikelihood";

RooLinkedList nllCmdList = pc.filterCmdList(fitCmdList, nllCmdListString.c_str());

// Default-initialized instance of MinimizerConfig to get the default
// minimizer parameter values.
Expand Down

0 comments on commit fe6935b

Please sign in to comment.