Skip to content

Commit

Permalink
Added offsetting to RooAbsPdf::fitTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeff020 authored and guitargeek committed Jan 25, 2023
1 parent 77d8ab2 commit ba7616b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions roofit/roofitcore/inc/RooAbsPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class RooAbsPdf : public RooAbsReal {
int doSumW2 = -1;
int doAsymptotic = -1;
int maxCalls = -1;
int doOffset = -1;
int parallelize = 0;
bool enableParallelGradient = true;
bool enableParallelDescent = false;
Expand Down
8 changes: 8 additions & 0 deletions roofit/roofitcore/src/RooAbsPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ std::unique_ptr<RooFitResult> RooAbsPdf::minimizeNLL(RooAbsReal & nll,
minimizerConfig.enableParallelDescent = cfg.enableParallelDescent;
minimizerConfig.parallelize = cfg.parallelize;
minimizerConfig.timingAnalysis = cfg.timingAnalysis;
minimizerConfig.offsetting = cfg.doOffset;
RooMinimizer m(nll, minimizerConfig);

m.setMinimizerType(cfg.minType.c_str());
Expand Down Expand Up @@ -1590,6 +1591,12 @@ 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 Down Expand Up @@ -1743,6 +1750,7 @@ RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooLinkedList& cmdList)
cfg.minosSet = pc.getSet("minosSet");
cfg.minType = pc.getString("mintype","");
cfg.minAlg = pc.getString("minalg","minuit");
cfg.doOffset = pc.getInt("doOffset");
cfg.parallelize = pc.getInt("parallelize");
cfg.enableParallelGradient = pc.getInt("enableParallelGradient");
cfg.enableParallelDescent = pc.getInt("enableParallelDescent");
Expand Down

0 comments on commit ba7616b

Please sign in to comment.