Warning, file /include/root/RooFit/Detail/NormalizationHelpers.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RooFit_Detail_NormalizationHelpers_h
0014 #define RooFit_Detail_NormalizationHelpers_h
0015
0016 #include <memory>
0017 #include <string>
0018 #include <unordered_map>
0019
0020 class RooAbsArg;
0021 class RooArgSet;
0022
0023 class TNamed;
0024
0025 namespace RooFit {
0026
0027 namespace Detail {
0028
0029 class CompileContext {
0030 public:
0031 CompileContext(RooArgSet const &topLevelNormSet);
0032
0033 ~CompileContext();
0034
0035 template <class T>
0036 T *compile(T &arg, RooAbsArg &owner, RooArgSet const &normSet)
0037 {
0038 return static_cast<T *>(compileImpl(arg, owner, normSet));
0039 }
0040
0041 void compileServers(RooAbsArg &arg, RooArgSet const &normSet);
0042 void compileServer(RooAbsArg &server, RooAbsArg &arg, RooArgSet const &normSet);
0043
0044 void markAsCompiled(RooAbsArg &arg) const;
0045 void markSubtreeAsCompiled(RooAbsArg &arg) const;
0046
0047
0048 void setLikelihoodMode(bool flag) { _likelihoodMode = flag; }
0049 bool likelihoodMode() const { return _likelihoodMode; }
0050 void setBinnedLikelihoodMode(bool flag) { _binnedLikelihoodMode = flag; }
0051 bool binnedLikelihoodMode() const { return _binnedLikelihoodMode; }
0052 void setBinWidthFuncFlag(bool flag) { _binWidthFuncFlag = flag; }
0053 bool binWidthFuncFlag() const { return _binWidthFuncFlag; }
0054
0055 private:
0056 RooAbsArg *compileImpl(RooAbsArg &arg, RooAbsArg &owner, RooArgSet const &normSet);
0057 void add(RooAbsArg &arg);
0058 RooAbsArg *find(RooAbsArg &arg) const;
0059 bool isMarkedAsCompiled(RooAbsArg const &arg) const;
0060
0061 RooArgSet const &_topLevelNormSet;
0062 std::unordered_map<TNamed const *, RooAbsArg *> _clonedArgsSet;
0063 std::unordered_map<RooAbsArg *, RooAbsArg *> _replacements;
0064
0065 bool _likelihoodMode = false;
0066 bool _binnedLikelihoodMode = false;
0067 bool _binWidthFuncFlag = false;
0068 };
0069
0070 template <class T>
0071 std::unique_ptr<T> compileForNormSet(T const &arg, RooArgSet const &normSet)
0072 {
0073 RooFit::Detail::CompileContext ctx{normSet};
0074 return std::unique_ptr<T>{static_cast<T *>(arg.compileForNormSet(normSet, ctx).release())};
0075 }
0076
0077 }
0078
0079 }
0080
0081 #endif