Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:27

0001 /*
0002  * Project: RooFit
0003  * Authors:
0004  *   Jonas Rembser, CERN 2023
0005  *
0006  * Copyright (c) 2023, CERN
0007  *
0008  * Redistribution and use in source and binary forms,
0009  * with or without modification, are permitted according to the terms
0010  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
0011  */
0012 
0013 #ifndef HistFactoryImplHelpers_h
0014 #define HistFactoryImplHelpers_h
0015 
0016 #include <RooStats/HistFactory/Systematics.h>
0017 
0018 #include <RooGlobalFunc.h>
0019 #include <RooWorkspace.h>
0020 
0021 #include <ROOT/RSpan.hxx>
0022 
0023 namespace RooStats {
0024 namespace HistFactory {
0025 namespace Detail {
0026 
0027 namespace MagicConstants {
0028 
0029 constexpr double defaultGammaMin = 0;
0030 constexpr double defaultShapeFactorGammaMax = 1000;
0031 constexpr double defaultShapeSysGammaMax = 10;
0032 constexpr double defaultStatErrorGammaMax = 10;
0033 constexpr double minShapeUncertainty = 0.0;
0034 
0035 } // namespace MagicConstants
0036 
0037 template <class Arg_t, class... Params_t>
0038 Arg_t &getOrCreate(RooWorkspace &ws, std::string const &name, Params_t &&...params)
0039 {
0040    Arg_t *arg = static_cast<Arg_t *>(ws.obj(name));
0041    if (arg)
0042       return *arg;
0043    Arg_t newArg(name.c_str(), name.c_str(), std::forward<Params_t>(params)...);
0044    ws.import(newArg, RooFit::RecycleConflictNodes(true), RooFit::Silence(true));
0045    return *static_cast<Arg_t *>(ws.obj(name));
0046 }
0047 
0048 void configureConstrainedGammas(RooArgList const &gammas, std::span<const double> relSigmas, double minSigma);
0049 
0050 struct CreateGammaConstraintsOutput {
0051    std::vector<std::unique_ptr<RooAbsPdf>> constraints;
0052    std::vector<RooRealVar*> globalObservables;
0053 };
0054 
0055 CreateGammaConstraintsOutput createGammaConstraints(RooArgList const &paramList,
0056                                                     std::span<const double> relSigmas, double minSigma,
0057                                                     Constraint::Type type);
0058 
0059 } // namespace Detail
0060 } // namespace HistFactory
0061 } // namespace RooStats
0062 
0063 #endif