Skip to content

Commit 40fd04f

Browse files
committed
[RF] Remove NormFactor::GetConst() and SetConst() member functions
As printed out by the HistFactory in a warning message for a long time already, setting the `Const` attribute to the `<NormFactor>` tag is deprecated and it will be ignored. Instead, add `<ParamSetting Const="True"> myparam </ParamSetting>` to your top-level XML's `<Measurement>` entry. This deprecation implied that the constant parameter flag in the `RooStats:HistFactory::NormFactor` class had no effect as well. To avoid ambiguity in the future, the possibility to set and retrieve this flag with `NormFactor::SetConst()` and `NormFactor::GetConst()` was removed, and the aforementioned deprecated warning is not printed anymore.
1 parent f55b279 commit 40fd04f

File tree

8 files changed

+19
-26
lines changed

8 files changed

+19
-26
lines changed

README/ReleaseNotes/v628/index.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ hfCfg.binnedFitOptimization = false;
118118
RooStats::HistFactory::MakeModelAndMeasurementFast(measurement, hfCfg);
119119
```
120120

121-
### Removal of HistoToWorkspaceFactory (non-Fast)
121+
### Removal of deprecated HistFactory functionality
122+
123+
#### Removal of HistoToWorkspaceFactory (non-Fast version)
122124

123125
The original `HistoToWorkspaceFactory` produced models that consisted of a
124126
Poisson term for each bin. In this "number counting form" the dataset has one
@@ -134,6 +136,19 @@ histogram.
134136
Therefore, the original `HistoToWorkspaceFactory` is now removed to avoid
135137
confusion and maintainance burden.
136138

139+
#### Removing constant parameter flag from RooStats:HistFactory::NormFactor
140+
141+
As printed out by the HistFactory in a warning message for a long time already,
142+
setting the `Const` attribute to the `<NormFactor>` tag is deprecated and it
143+
will be ignored. Instead, add `<ParamSetting Const="True"> myparam </ParamSetting>` to your top-level XML's `<Measurement>` entry.
144+
145+
This deprecation implied that the constant parameter flag in the
146+
`RooStats:HistFactory::NormFactor` class had no effect as well. To avoid
147+
ambiguity in the future, the possibility to set and retrieve this flag with
148+
`NormFactor::SetConst()` and `NormFactor::GetConst()` was removed, as well as the
149+
`Sample::AddNormFactor(std::string Name, double Val, double Low, double High, bool Const)`
150+
overload. Also, the aforementioned deprecation warning is not printed anymore.
151+
137152
### Removal of `RooAbsMinimizerFcn` and `RooMinimizerFcn` from the public interface
138153

139154
The `RooAbsMinimizerFcn` class and its implementation `RooMinimizerFcn` were removed from the public interface.

roofit/histfactory/inc/RooStats/HistFactory/Sample.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Sample {
5656
void AddOverallSys( std::string Name, double Low, double High );
5757
void AddOverallSys( const OverallSys& Sys );
5858

59-
void AddNormFactor( std::string Name, double Val, double Low, double High, bool Const=false );
59+
void AddNormFactor( std::string const& Name, double Val, double Low, double High );
6060
void AddNormFactor( const NormFactor& Factor );
6161

6262
void AddHistoSys( std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow,

roofit/histfactory/inc/RooStats/HistFactory/Systematics.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ namespace HistFactory {
8686
void SetVal( double Val ) { fVal = Val; }
8787
double GetVal() const { return fVal; }
8888

89-
void SetConst( bool Const=true ) { fConst = Const; }
90-
bool GetConst() const { return fConst; }
91-
9289
void SetLow( double Low ) { fLow = Low; }
9390
void SetHigh( double High ) { fHigh = High; }
9491
double GetLow() const { return fLow; }
@@ -103,7 +100,6 @@ namespace HistFactory {
103100
double fVal;
104101
double fLow;
105102
double fHigh;
106-
bool fConst;
107103

108104
};
109105

roofit/histfactory/src/ConfigParser.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,6 @@ HistFactory::NormFactor ConfigParser::MakeNormFactor( TXMLNode* node ) {
10261026
else if( curAttr->GetName() == TString( "High" ) ) {
10271027
norm.SetHigh( atof(attrVal.c_str()) );
10281028
}
1029-
else if( curAttr->GetName() == TString( "Const" ) ) {
1030-
norm.SetConst( CheckTrueFalse(attrVal,"NormFactor") );
1031-
}
10321029

10331030
else {
10341031
cxcoutEHF << "Error: Encountered Element in NormFactor with unknown name: "

roofit/histfactory/src/HistoToWorkspaceFactoryFast.cxx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,6 @@ RooArgList HistoToWorkspaceFactoryFast::createObservables(const TH1 *hist, RooWo
480480
proto->factory(varname + range.str());
481481
}
482482

483-
if(norm.GetConst()) {
484-
// proto->var(varname)->setConstant();
485-
// cout <<"setting " << varname << " constant"<<endl;
486-
cxcoutW(HistFactory) << "Const attribute to <NormFactor> tag is deprecated, will ignore." <<
487-
" Instead, add \n\t<ParamSetting Const=\"True\"> " << varname << " </ParamSetting>\n" <<
488-
" to your top-level XML's <Measurement> entry" << endl;
489-
}
490483
prodNames.push_back(varname);
491484
rangeNames.push_back(range.str());
492485
normFactorNames.push_back(varname);

roofit/histfactory/src/Sample.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ void RooStats::HistFactory::Sample::PrintXML( std::ofstream& xml ) const {
245245
<< " Val=\"" << sys.GetVal() << "\" "
246246
<< " High=\"" << sys.GetHigh() << "\" "
247247
<< " Low=\"" << sys.GetLow() << "\" "
248-
<< " Const=\"" << (sys.GetConst() ? std::string("True") : std::string("False")) << "\" "
249248
<< " /> " << std::endl;
250249
*/
251250
}
@@ -350,15 +349,14 @@ void RooStats::HistFactory::Sample::AddOverallSys( const OverallSys& Sys ) {
350349
fOverallSysList.push_back(Sys);
351350
}
352351

353-
void RooStats::HistFactory::Sample::AddNormFactor( std::string SysName, double SysVal, double SysLow, double SysHigh, bool SysConst ) {
352+
void RooStats::HistFactory::Sample::AddNormFactor( std::string const& SysName, double SysVal, double SysLow, double SysHigh ) {
354353

355354
RooStats::HistFactory::NormFactor norm;
356355

357356
norm.SetName( SysName );
358357
norm.SetVal( SysVal );
359358
norm.SetLow( SysLow );
360359
norm.SetHigh( SysHigh );
361-
norm.SetConst( SysConst );
362360

363361
fNormFactorList.push_back( norm );
364362

roofit/histfactory/src/Systematics.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ RooStats::HistFactory::Constraint::Type RooStats::HistFactory::Constraint::GetTy
5555

5656
// Norm Factor
5757
RooStats::HistFactory::NormFactor::NormFactor() : fName(""), fVal(1.0),
58-
fLow(1.0), fHigh(1.0),
59-
fConst(true) {;}
58+
fLow(1.0), fHigh(1.0) {}
6059

6160
void RooStats::HistFactory::NormFactor::Print( std::ostream& stream ) const {
6261
stream << "\t \t Name: " << fName
6362
<< "\t Val: " << fVal
6463
<< "\t Low: " << fLow
6564
<< "\t High: " << fHigh
66-
<< "\t Const: " << fConst
6765
<< std::endl;
6866
}
6967

@@ -72,7 +70,6 @@ void RooStats::HistFactory::NormFactor::PrintXML( std::ostream& xml ) const {
7270
<< " Val=\"" << GetVal() << "\" "
7371
<< " High=\"" << GetHigh() << "\" "
7472
<< " Low=\"" << GetLow() << "\" "
75-
<< " Const=\"" << (GetConst() ? std::string("True") : std::string("False")) << "\" "
7673
<< " /> " << std::endl;
7774
}
7875

roofit/hs3/src/HistFactoryJSONTool.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ void exportMeasurement(RooStats::HistFactory::Measurement &measurement, JSONNode
178178
v["value"] << norm.GetVal();
179179
v["min"] << norm.GetLow();
180180
v["max"] << norm.GetHigh();
181-
if (norm.GetConst()) {
182-
v["const"] << true;
183-
}
184181
}
185182
}
186183
for (const auto &sys : s.GetOverallSysList()) {

0 commit comments

Comments
 (0)