Skip to content

Commit fc08972

Browse files
committed
Make combineCreateNLL available in Python via utility class
1 parent 7fc9281 commit fc08972

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

interface/Combine.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "RooAbsReal.h"
88
#include "RooRealVar.h"
99

10+
#include "CombineUtils.h"
11+
1012
class TDirectory;
1113
class TTree;
1214
class LimitAlgo;
@@ -123,10 +125,4 @@ class Combine {
123125
static std::string textToWorkspaceString_;
124126
};
125127

126-
std::unique_ptr<RooAbsReal> combineCreateNLL(RooAbsPdf &pdf,
127-
RooAbsData &data,
128-
RooArgSet const *constraint = nullptr,
129-
bool offset = false,
130-
bool warnAboutDifferentBackend = true);
131-
132128
#endif

interface/CombineUtils.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef HiggsAnalysis_CombinedLimit_CombineUtils_h
2+
#define HiggsAnalysis_CombinedLimit_CombineUtils_h
3+
4+
std::unique_ptr<RooAbsReal> combineCreateNLL(RooAbsPdf& pdf,
5+
RooAbsData& data,
6+
RooArgSet const* constraint = nullptr,
7+
bool offset = false,
8+
bool warnAboutDifferentBackend = true);
9+
10+
// Class that makes the utility functions also available in Python (adding classes to the dictionaries is less brittle than adding functions)
11+
class CombineUtils {
12+
public:
13+
static std::unique_ptr<RooAbsReal> combineCreateNLL(RooAbsPdf& pdf,
14+
RooAbsData& data,
15+
RooArgSet const* constraint = nullptr,
16+
bool offset = false,
17+
bool warnAboutDifferentBackend = true) {
18+
return ::combineCreateNLL(pdf, data, constraint, offset, warnAboutDifferentBackend);
19+
}
20+
};
21+
22+
#endif

python/tool_base/FastScan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def run_method(self):
5757
data = f_d.Get(ws_d[1])
5858
else:
5959
data = f_d.Get(ws_d[1]).data(ws_d[2])
60-
nll = ROOT.combineCreateNLL(pdf, data)
60+
nll = ROOT.CombineUtils.combineCreateNLL(pdf, data)
6161
pars = pdf.getParameters(data)
6262
pars.Print()
6363
snap = pars.snapshot()

python/tool_base/TaylorExpand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def load_workspace(self, file, POIs, data="data_obs", snapshot="MultiDimFit"):
186186
mc = self.loaded_wsp.genobj("ModelConfig")
187187
pdf = mc.GetPdf()
188188
data = self.loaded_wsp.data(data)
189-
self.nll = ROOT.combineCreateNLL(pdf, data)
189+
self.nll = ROOT.CombineUtils.combineCreateNLL(pdf, data)
190190
self.loaded_wsp.loadSnapshot("MultiDimFit")
191191
print("...NLL loaded")
192192
# nll.Print()

src/classes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@
6363
#include "HiggsAnalysis/CombinedLimit/interface/RooEFTScalingFunction.h"
6464

6565
#include "HiggsAnalysis/CombinedLimit/interface/CombineCodegenImpl.h"
66+
#include "HiggsAnalysis/CombinedLimit/interface/CombineUtils.h"

src/classes_def.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,5 @@
220220
<class name="RooSumTwoExpPdf" />
221221
<class name="RooPowerLawPdf" />
222222
<class name="RooSumTwoPowerLawPdf" />
223+
<class name="CombineUtils" />
223224
</lcgdict>

0 commit comments

Comments
 (0)