Logo ROOT  
Reference Guide
NormalizationHelpers.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Jonas Rembser, CERN 2022
5 *
6 * Copyright (c) 2022, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#ifndef RooFit_Detail_NormalizationHelpers_h
14#define RooFit_Detail_NormalizationHelpers_h
15
16#include <memory>
17#include <unordered_map>
18
19class RooAbsArg;
20class RooArgSet;
21
22class TNamed;
23
24namespace RooFit {
25
26namespace Detail {
27
29public:
30 CompileContext(RooArgSet const &topLevelNormSet);
31
33
34 template <class T>
35 T *compile(T &arg, RooAbsArg &owner, RooArgSet const &normSet)
36 {
37 return static_cast<T *>(compileImpl(arg, owner, normSet));
38 }
39
40 void compileServers(RooAbsArg &arg, RooArgSet const &normSet);
41
42private:
43 RooAbsArg *compileImpl(RooAbsArg &arg, RooAbsArg &owner, RooArgSet const &normSet);
44 void add(RooAbsArg &arg);
45 RooAbsArg *find(RooAbsArg &arg) const;
46
48 std::unordered_map<TNamed const *, RooAbsArg *> _clonedArgsSet;
49};
50
51template <class T>
52std::unique_ptr<T> compileForNormSet(T const &arg, RooArgSet const &normSet)
53{
55 std::unique_ptr<RooAbsArg> head = arg.compileForNormSet(normSet, ctx);
56 return std::unique_ptr<T>{static_cast<T *>(head.release())};
57}
58
59} // namespace Detail
60
61} // namespace RooFit
62
63#endif
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
RooAbsArg * find(RooAbsArg &arg) const
RooAbsArg * compileImpl(RooAbsArg &arg, RooAbsArg &owner, RooArgSet const &normSet)
std::unordered_map< TNamed const *, RooAbsArg * > _clonedArgsSet
CompileContext(RooArgSet const &topLevelNormSet)
T * compile(T &arg, RooAbsArg &owner, RooArgSet const &normSet)
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
double T(double x)
Definition: ChebyshevPol.h:34
std::unique_ptr< T > compileForNormSet(T const &arg, RooArgSet const &normSet)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18