Skip to content

Commit 356b093

Browse files
committed
Fix Constant Flag in Data axes
1 parent fcf1cdc commit 356b093

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

roofit/hs3/inc/RooFitHS3/RooJSONFactoryWSTool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ class RooJSONFactoryWSTool {
229229
void importVariable(const RooFit::Detail::JSONNode &p);
230230
void importDependants(const RooFit::Detail::JSONNode &n);
231231

232-
void exportVariable(const RooAbsArg *v, RooFit::Detail::JSONNode &p);
233-
void exportVariables(const RooArgSet &allElems, RooFit::Detail::JSONNode &n);
232+
void exportVariable(const RooAbsArg *v, RooFit::Detail::JSONNode &n, const bool storeConstant=true);
233+
void exportVariables(const RooArgSet &allElems, RooFit::Detail::JSONNode &n, const bool storeConstant=true);
234234

235235
void exportAllObjects(RooFit::Detail::JSONNode &n);
236236

roofit/hs3/src/RooJSONFactoryWSTool.cxx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ RooAbsReal *RooJSONFactoryWSTool::requestImpl<RooAbsReal>(const std::string &obj
965965
* @param node The JSONNode to which the variable will be exported.
966966
* @return void
967967
*/
968-
void RooJSONFactoryWSTool::exportVariable(const RooAbsArg *v, JSONNode &node)
968+
void RooJSONFactoryWSTool::exportVariable(const RooAbsArg *v, JSONNode &node, const bool storeConstant)
969969
{
970970
auto *cv = dynamic_cast<const RooConstVar *>(v);
971971
auto *rrv = dynamic_cast<const RooRealVar *>(v);
@@ -984,7 +984,7 @@ void RooJSONFactoryWSTool::exportVariable(const RooAbsArg *v, JSONNode &node)
984984
var["const"] << true;
985985
} else if (rrv) {
986986
var["value"] << rrv->getVal();
987-
if (rrv->isConstant()) {
987+
if (rrv->isConstant() && storeConstant) {
988988
var["const"] << rrv->isConstant();
989989
}
990990
if (rrv->getBins() != 100) {
@@ -1004,12 +1004,12 @@ void RooJSONFactoryWSTool::exportVariable(const RooAbsArg *v, JSONNode &node)
10041004
* @param n The JSONNode to which the variables will be exported.
10051005
* @return void
10061006
*/
1007-
void RooJSONFactoryWSTool::exportVariables(const RooArgSet &allElems, JSONNode &n)
1007+
void RooJSONFactoryWSTool::exportVariables(const RooArgSet &allElems, JSONNode &n, const bool storeConstant)
10081008
{
10091009
// export a list of RooRealVar objects
10101010
n.set_seq();
10111011
for (RooAbsArg *arg : allElems) {
1012-
exportVariable(arg, n);
1012+
exportVariable(arg, n, storeConstant);
10131013
}
10141014
}
10151015

@@ -1554,18 +1554,14 @@ void RooJSONFactoryWSTool::exportData(RooAbsData const &data)
15541554

15551555
// this really is an unbinned dataset
15561556
output["type"] << "unbinned";
1557-
exportVariables(variables, output["axes"]);
1557+
exportVariables(variables, output["axes"], false);
15581558
auto &coords = output["entries"].set_seq();
15591559
std::vector<double> weightVals;
15601560
bool hasNonUnityWeights = false;
15611561
for (int i = 0; i < data.numEntries(); ++i) {
15621562
data.get(i);
15631563
coords.append_child().fill_seq(variables, [](auto x) { return static_cast<RooRealVar *>(x)->getVal(); });
15641564
std::string datasetName = data.GetName();
1565-
/*if (datasetName.find("combData_ZvvH126.5") != std::string::npos) {
1566-
file << dynamic_cast<RooAbsReal *>(data.get(i)->find("atlas_invMass_PttEtaConvVBFCat1"))->getVal() <<
1567-
std::endl;
1568-
}*/
15691565
if (data.isWeighted()) {
15701566
weightVals.push_back(data.weight());
15711567
if (data.weight() != 1.)
@@ -1575,7 +1571,6 @@ void RooJSONFactoryWSTool::exportData(RooAbsData const &data)
15751571
if (data.isWeighted() && hasNonUnityWeights) {
15761572
output["weights"].fill_seq(weightVals);
15771573
}
1578-
// file.close();
15791574
}
15801575

15811576
/**

0 commit comments

Comments
 (0)