File indexing completed on 2026-09-27 09:26:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef HistFactoryImplHelpers_h
0014 #define HistFactoryImplHelpers_h
0015
0016 #include <RooGlobalFunc.h>
0017 #include <RooWorkspace.h>
0018
0019 #include <ROOT/RSpan.hxx>
0020
0021 namespace RooStats::HistFactory {
0022
0023 namespace Constraint {
0024
0025 enum Type {
0026 Gaussian,
0027 Poisson
0028 };
0029 std::string Name(Type type);
0030 Type GetType(const std::string &Name);
0031
0032 }
0033
0034 namespace Detail {
0035
0036 namespace MagicConstants {
0037
0038 constexpr double defaultGammaMin = 0;
0039 constexpr double defaultShapeFactorGammaMax = 1000;
0040 constexpr double defaultShapeSysGammaMax = 10;
0041 constexpr double defaultStatErrorGammaMax = 10;
0042 constexpr double minShapeUncertainty = 0.0;
0043
0044 }
0045
0046 template <class Arg_t, class... Params_t>
0047 Arg_t &getOrCreate(RooWorkspace &ws, std::string const &name, Params_t &&...params)
0048 {
0049 Arg_t *arg = static_cast<Arg_t *>(ws.obj(name));
0050 if (arg)
0051 return *arg;
0052 Arg_t newArg(name.c_str(), name.c_str(), std::forward<Params_t>(params)...);
0053 ws.import(newArg, RooFit::RecycleConflictNodes(true), RooFit::Silence(true));
0054 return *static_cast<Arg_t *>(ws.obj(name));
0055 }
0056
0057 void configureConstrainedGammas(RooArgList const &gammas, std::span<const double> relSigmas, double minSigma);
0058
0059 struct CreateGammaConstraintsOutput {
0060 std::vector<std::unique_ptr<RooAbsPdf>> constraints;
0061 std::vector<RooRealVar *> globalObservables;
0062 };
0063
0064 CreateGammaConstraintsOutput createGammaConstraints(RooArgList const ¶mList, std::span<const double> relSigmas,
0065 double minSigma, Constraint::Type type);
0066
0067 }
0068 }
0069
0070 #endif