File indexing completed on 2025-01-18 10:11:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RooFit_RooHelpers_h
0014 #define RooFit_RooHelpers_h
0015
0016 #include <RooMsgService.h>
0017 #include <RooAbsArg.h>
0018 #include <RooAbsReal.h>
0019
0020 #include <sstream>
0021 #include <vector>
0022 #include <string>
0023 #include <utility>
0024
0025 class RooAbsPdf;
0026 class RooAbsData;
0027
0028 namespace RooHelpers {
0029
0030
0031
0032
0033
0034
0035
0036
0037 class LocalChangeMsgLevel {
0038 public:
0039
0040
0041
0042
0043
0044 LocalChangeMsgLevel(RooFit::MsgLevel lvl = RooFit::DEBUG, unsigned int extraTopics = 0u,
0045 unsigned int removeTopics = 0u, bool overrideExternalLevel = true);
0046
0047 ~LocalChangeMsgLevel();
0048
0049 private:
0050 RooFit::MsgLevel fOldKillBelow;
0051 std::vector<RooMsgService::StreamConfig> fOldConf;
0052 int fExtraStream{-1};
0053 };
0054
0055
0056 template <typename T>
0057 struct WrapIntoTObject : public TObject {
0058 WrapIntoTObject(T &obj) : _payload(&obj) {}
0059 T *_payload;
0060 };
0061
0062
0063
0064
0065 class HijackMessageStream {
0066 public:
0067 HijackMessageStream(RooFit::MsgLevel level, RooFit::MsgTopic topics, const char *objectName = nullptr);
0068 template <typename T>
0069 const HijackMessageStream &operator<<(const T &v) const
0070 {
0071 _str << v;
0072 return *this;
0073 }
0074 std::string str() { return _str.str(); }
0075 std::ostringstream &stream() { return _str; };
0076 ~HijackMessageStream();
0077
0078 private:
0079 std::ostringstream _str;
0080 RooFit::MsgLevel _oldKillBelow;
0081 std::vector<RooMsgService::StreamConfig> _oldConf;
0082 Int_t _thisStream;
0083 };
0084
0085
0086 void checkRangeOfParameters(const RooAbsReal *callingClass, std::initializer_list<const RooAbsReal *> pars,
0087 double min = -std::numeric_limits<double>::max(),
0088 double max = std::numeric_limits<double>::max(), bool limitsInAllowedRange = false,
0089 std::string const &extraMessage = "");
0090
0091
0092 }
0093
0094 #endif