Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
HistFactoryInterpolationCodeUtils.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3#ifndef ROOSTATS_HISTFACTORY_HISTFACTORYINTERPOLATIONCODEUTILS_H
4#define ROOSTATS_HISTFACTORY_HISTFACTORYINTERPOLATIONCODEUTILS_H
5
6#include <RooAbsReal.h>
7#include <RooMsgService.h>
8
9#include <cstddef>
10#include <vector>
11
12namespace RooStats {
13namespace HistFactory {
14namespace Detail {
15
16/// Validate an interpolation code and store it in `codes[iParam]`.
17///
18/// Shared implementation for FlexibleInterpVar and PiecewiseInterpolation, which
19/// only differ in the highest supported code. Codes outside [0, maxCode] are
20/// rejected and the current code is kept. Code 3 is mapped to code 2 to preserve
21/// the historical behaviour where the two were equivalent. `self` and `param` are
22/// only used for the error messages.
23///
24/// \return true if a code was stored, so the caller can flag itself value-dirty.
25inline bool setInterpolationCode(RooAbsReal const &self, const char *className, RooAbsArg const &param,
26 std::vector<int> &codes, std::size_t iParam, int code, int maxCode)
27{
29 oocoutE(&self, InputArguments) << className << "::setInterpCode ERROR: " << param.GetName()
30 << " with unknown interpolation code " << code << ", keeping current code "
31 << codes[iParam] << std::endl;
32 return false;
33 }
34 if (code == 3) {
35 // In the past, code 3 was equivalent to code 2, which confused users.
36 // Now, we just say that code 3 doesn't exist and default to code 2 in
37 // that case for backwards compatible behavior.
38 oocoutE(&self, InputArguments) << className << "::setInterpCode ERROR: " << param.GetName()
39 << " with unknown interpolation code " << code << ", defaulting to code 2"
40 << std::endl;
41 code = 2;
42 }
43 codes.at(iParam) = code;
44 return true;
45}
46
47} // namespace Detail
48} // namespace HistFactory
49} // namespace RooStats
50
51#endif
52
53/// \endcond
#define oocoutE(o, a)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:76
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Namespace for the RooStats classes.
Definition CodegenImpl.h:66