Skip to content

Commit 6471550

Browse files
committed
[RF] Make RooFit::MsgTopic enum name for numeric integration consistent
Use the new enum name in all the RooFit code and tutorials, and preserve an alias with the old name for full backwards compatibility. Closes #19422.
1 parent a77c6ff commit 6471550

21 files changed

+56
-52
lines changed

roofit/histfactory/test/testHistFactory.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ TEST(Sample, CopyAssignment)
8686

8787
TEST(HistFactory, Read_ROOT6_16_Model)
8888
{
89-
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumIntegration, true};
89+
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumericIntegration, true};
9090

9191
std::string filename = "./ref_6.16_example_UsingC_channel1_meas_model.root";
9292
std::unique_ptr<TFile> file(TFile::Open(filename.c_str()));
@@ -115,7 +115,7 @@ TEST(HistFactory, Read_ROOT6_16_Model)
115115

116116
TEST(HistFactory, Read_ROOT6_16_Combined_Model)
117117
{
118-
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumIntegration, true};
118+
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumericIntegration, true};
119119

120120
std::string filename = "./ref_6.16_example_UsingC_combined_meas_model.root";
121121
std::unique_ptr<TFile> file(TFile::Open(filename.c_str()));

roofit/roofit/test/testRooCrystalBall.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ TEST(RooCrystalBall, FullyParametrized)
256256

257257
TEST(RooCrystalBall, Integral)
258258
{
259-
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumIntegration, true};
259+
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::WARNING, 0u, RooFit::NumericIntegration, true};
260260

261261
auto ws = makeWorkspace();
262262
auto &x = *ws->var("x");

roofit/roofitcore/inc/RooGlobalFunc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ enum MsgLevel { DEBUG=0, INFO=1, PROGRESS=2, WARNING=3, ERROR=4, FATAL=5 } ;
6363
/// Topics for a RooMsgService::StreamConfig in RooMsgService
6464
enum MsgTopic { Generation=1, Minimization=2, Plotting=4, Fitting=8, Integration=16, LinkStateMgmt=32,
6565
Eval=64, Caching=128, Optimization=256, ObjectHandling=512, InputArguments=1024, Tracing=2048,
66-
Contents=4096, DataHandling=8192, NumIntegration=16384, FastEvaluations=1<<15, HistFactory=1<<16, IO=1<<17 };
66+
Contents=4096, DataHandling=8192, NumericIntegration=16384, FastEvaluations=1<<15, HistFactory=1<<16, IO=1<<17 };
6767
enum MPSplit { BulkPartition=0, Interleave=1, SimComponents=2, Hybrid=3 } ;
6868

69+
/// Alias of MsgLevel::NumericIntegration for backwards compatibility.
70+
/// \see https://github.com/root-project/root/issues/19422
71+
constexpr static auto NumIntegration = NumericIntegration;
72+
6973
/// For setting the offset mode with the Offset() command argument to
7074
/// RooAbsPdf::fitTo()
7175
enum class OffsetMode { None, Initial, Bin };

roofit/roofitcore/src/RooAbsIntegrator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ double RooAbsIntegrator::calculate(const double *yvec)
5454
double ret = integral(yvec) ;
5555
integrand()->restoreXVec() ;
5656

57-
oocxcoutD(static_cast<TObject*>(nullptr), NumIntegration) << "RooAbsIntegrator::calculate(" << _function->getName() << ") number of function calls = " << integrand()->numCall()<<", result = "<<ret << std::endl ;
57+
oocxcoutD(static_cast<TObject*>(nullptr), NumericIntegration) << "RooAbsIntegrator::calculate(" << _function->getName() << ") number of function calls = " << integrand()->numCall()<<", result = "<<ret << std::endl ;
5858
return ret ;
5959
}
6060

roofit/roofitcore/src/RooAbsPdf.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2536,7 +2536,7 @@ RooFit::OwningPtr<RooAbsReal> RooAbsPdf::createCdf(const RooArgSet& iset, const
25362536
Int_t isNum= !static_cast<RooRealIntegral&>(*tmp).numIntRealVars().empty();
25372537

25382538
if (isNum) {
2539-
coutI(NumIntegration) << "RooAbsPdf::createCdf(" << GetName() << ") integration over observable(s) " << iset << " involves numeric integration," << std::endl
2539+
coutI(NumericIntegration) << "RooAbsPdf::createCdf(" << GetName() << ") integration over observable(s) " << iset << " involves numeric integration," << std::endl
25402540
<< " constructing cdf though numeric integration of sampled pdf in " << numScanBins << " bins and applying order "
25412541
<< intOrder << " interpolation on integrated histogram." << std::endl
25422542
<< " To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << std::endl ;

roofit/roofitcore/src/RooAbsReal.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3678,7 +3678,7 @@ RooFit::OwningPtr<RooAbsReal> RooAbsReal::createRunningIntegral(const RooArgSet&
36783678
Int_t isNum= !static_cast<RooRealIntegral&>(*tmp).numIntRealVars().empty();
36793679

36803680
if (isNum) {
3681-
coutI(NumIntegration) << "RooAbsPdf::createRunningIntegral(" << GetName() << ") integration over observable(s) " << iset << " involves numeric integration," << std::endl
3681+
coutI(NumericIntegration) << "RooAbsPdf::createRunningIntegral(" << GetName() << ") integration over observable(s) " << iset << " involves numeric integration," << std::endl
36823682
<< " constructing cdf though numeric integration of sampled pdf in " << numScanBins << " bins and applying order "
36833683
<< intOrder << " interpolation on integrated histogram." << std::endl
36843684
<< " To override this choice of technique use argument ScanNone(), to change scan parameters use ScanParameters(nbins,order) argument" << std::endl ;

roofit/roofitcore/src/RooAdaptiveIntegratorND.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ RooAdaptiveIntegratorND::~RooAdaptiveIntegratorND()
107107
{
108108
delete _integrator ;
109109
if (_nError>_nWarn) {
110-
oocoutW(nullptr, NumIntegration) << "RooAdaptiveIntegratorND::dtor(" << _intName
110+
oocoutW(nullptr, NumericIntegration) << "RooAdaptiveIntegratorND::dtor(" << _intName
111111
<< ") WARNING: Number of suppressed warningings about integral evaluations where target precision was not reached is " << _nError-_nWarn << std::endl;
112112
}
113113

@@ -168,11 +168,11 @@ double RooAdaptiveIntegratorND::integral(const double* /*yvec*/)
168168
if (_integrator->Status()==1) {
169169
_nError++ ;
170170
if (_nError<=_nWarn) {
171-
oocoutW(nullptr, NumIntegration) << "RooAdaptiveIntegratorND::integral(" << integrand()->getName() << ") WARNING: target rel. precision not reached due to nEval limit of "
171+
oocoutW(nullptr, NumericIntegration) << "RooAdaptiveIntegratorND::integral(" << integrand()->getName() << ") WARNING: target rel. precision not reached due to nEval limit of "
172172
<< _nmax << ", estimated rel. precision is " << Form("%3.1e",_integrator->RelError()) << std::endl ;
173173
}
174174
if (_nError==_nWarn) {
175-
oocoutW(nullptr, NumIntegration) << "RooAdaptiveIntegratorND::integral(" << integrand()->getName()
175+
oocoutW(nullptr, NumericIntegration) << "RooAdaptiveIntegratorND::integral(" << integrand()->getName()
176176
<< ") Further warnings on target precision are suppressed conform specification in integrator specification" << std::endl ;
177177
}
178178
}

roofit/roofitcore/src/RooMsgService.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ RooMsgService::RooMsgService()
101101
_topicNames[Tracing]="Tracing" ;
102102
_topicNames[Contents]="Contents" ;
103103
_topicNames[DataHandling]="DataHandling" ;
104-
_topicNames[NumIntegration]="NumericIntegration" ;
104+
_topicNames[NumericIntegration]="NumericIntegration" ;
105105
_topicNames[FastEvaluations] = "FastEvaluations";
106106
_topicNames[HistFactory]="HistFactory";
107107

@@ -123,7 +123,7 @@ void RooMsgService::reset() {
123123
// Old-style streams
124124
_streams.clear();
125125
addStream(RooFit::PROGRESS, Topic(RooFit::HistFactory - 1));//All before HistFactory
126-
addStream(RooFit::INFO,Topic(RooFit::Eval|RooFit::Plotting|RooFit::Fitting|RooFit::Minimization|RooFit::Caching|RooFit::ObjectHandling|RooFit::NumIntegration|RooFit::InputArguments|RooFit::DataHandling)) ;
126+
addStream(RooFit::INFO,Topic(RooFit::Eval|RooFit::Plotting|RooFit::Fitting|RooFit::Minimization|RooFit::Caching|RooFit::ObjectHandling|RooFit::NumericIntegration|RooFit::InputArguments|RooFit::DataHandling)) ;
127127
addStream(RooFit::INFO, Topic(RooFit::HistFactory));
128128
}
129129

roofit/roofitcore/src/RooRealIntegral.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ bool RooRealIntegral::initNumIntegrator() const
694694
return false;
695695
}
696696

697-
cxcoutI(NumIntegration) << "RooRealIntegral::init(" << GetName() << ") using numeric integrator "
697+
cxcoutI(NumericIntegration) << "RooRealIntegral::init(" << GetName() << ") using numeric integrator "
698698
<< integratorName << " to calculate Int" << _intList << std::endl ;
699699

700700
if (_intList.size()>3) {
701-
cxcoutI(NumIntegration) << "RooRealIntegral::init(" << GetName() << ") evaluation requires " << _intList.size() << "-D numeric integration step. Evaluation may be slow, sufficient numeric precision for fitting & minimization is not guaranteed" << std::endl ;
701+
cxcoutI(NumericIntegration) << "RooRealIntegral::init(" << GetName() << ") evaluation requires " << _intList.size() << "-D numeric integration step. Evaluation may be slow, sufficient numeric precision for fitting & minimization is not guaranteed" << std::endl ;
702702
}
703703

704704
_restartNumIntEngine = false ;

roofit/roofitcore/test/stressRooFit_tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ class TestBasic313 : public RooUnitTest {
21912191
{
21922192
// To remove the INFO:NumericIntegration output from the stressRooFit output,
21932193
// change the message level locally.
2194-
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::INFO, 0u, RooFit::NumIntegration, false};
2194+
RooHelpers::LocalChangeMsgLevel chmsglvl{RooFit::INFO, 0u, RooFit::NumericIntegration, false};
21952195

21962196
// Create integral over normalized pdf model over x,y,z in "R" region
21972197
std::unique_ptr<RooAbsReal> intPdf{pxyz.createIntegral(RooArgSet(x, y, z), RooArgSet(x, y, z), "R")};

0 commit comments

Comments
 (0)