Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFitImplHelpers.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 *
4 * Copyright (c) 2023, CERN
5 *
6 * Redistribution and use in source and binary forms,
7 * with or without modification, are permitted according to the terms
8 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
9 */
10
11#ifndef RooFit_RooFitImplHelpers_h
12#define RooFit_RooFitImplHelpers_h
13
14#include <RooMsgService.h>
15#include <RooAbsArg.h>
16#include <RooAbsReal.h>
17
18#include <sstream>
19#include <string>
20#include <string_view>
21#include <utility>
22#include <vector>
23
24class RooAbsPdf;
25class RooAbsData;
26
27/// Disable all caches for sub-branches in an expression tree.
28/// This is helpful when an expression with cached sub-branches needs to be integrated numerically.
30public:
31 /// Inhibit all dirty-state propagation, and assume every node as dirty.
32 /// \param[in] oldState Restore this state when going out of scope.
34
37
39
40private:
42};
43
44/// Struct to temporarily change the operation mode of a RooAbsArg until it
45/// goes out of scope.
47public:
49 {
50 arg->setOperMode(opMode, /*recurse=*/false);
51 }
52
55
56 ~ChangeOperModeRAII() { _arg->setOperMode(_oldOpMode, /*recurse=*/false); }
57
58private:
59 RooAbsArg *_arg = nullptr;
61};
62
63namespace RooHelpers {
64
65std::pair<double, double> getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName);
66
67bool checkIfRangesOverlap(RooArgSet const &observables, std::vector<std::string> const &rangeNames);
68
69std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim = ':');
70RooArgSet selectFromArgSet(RooArgSet const &, std::string const &names);
71
72namespace Detail {
73
76
77} // namespace Detail
78
79/// Clone RooAbsArg object and reattach to original parameters.
80template <class T>
81std::unique_ptr<T> cloneTreeWithSameParameters(T const &arg, RooArgSet const *observables = nullptr)
82{
83 return std::unique_ptr<T>{static_cast<T *>(Detail::cloneTreeWithSameParametersImpl(arg, observables))};
84}
85
86std::string getRangeNameForSimComponent(std::string const &rangeName, bool splitRange, std::string const &catName);
87
89 RooAbsPdf *binnedPdf = nullptr;
90 bool isBinnedL = false;
91};
92
94
96
97} // namespace RooHelpers
98
99namespace RooFit {
100namespace Detail {
101
102std::string makeValidVarName(std::string const &in);
103
104void replaceAll(std::string &inOut, std::string_view what, std::string_view with);
105
106} // namespace Detail
107} // namespace RooFit
108
109#endif
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Struct to temporarily change the operation mode of a RooAbsArg until it goes out of scope.
ChangeOperModeRAII(RooAbsArg *arg, RooAbsArg::OperMode opMode)
ChangeOperModeRAII & operator=(ChangeOperModeRAII const &other)=delete
RooAbsArg::OperMode _oldOpMode
ChangeOperModeRAII(ChangeOperModeRAII const &other)=delete
Disable all caches for sub-branches in an expression tree.
DisableCachingRAII(DisableCachingRAII const &other)=delete
DisableCachingRAII & operator=(DisableCachingRAII const &other)=delete
DisableCachingRAII(bool oldState)
Inhibit all dirty-state propagation, and assume every node as dirty.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
void setOperMode(OperMode mode, bool recurseADirty=true)
Set the operation mode of this node.
static void setDirtyInhibit(bool flag)
Control global dirty inhibit mode.
Abstract container object that can hold multiple RooAbsArg objects.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
std::string makeValidVarName(std::string const &in)
void replaceAll(std::string &inOut, std::string_view what, std::string_view with)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:64
RooAbsArg * cloneTreeWithSameParametersImpl(RooAbsArg const &arg, RooArgSet const *observables)
bool snapshotImpl(RooAbsCollection const &input, RooAbsCollection &output, bool deepCopy, RooArgSet const *observables)
RooArgSet selectFromArgSet(RooArgSet const &, std::string const &names)
bool checkIfRangesOverlap(RooArgSet const &observables, std::vector< std::string > const &rangeNames)
std::unique_ptr< T > cloneTreeWithSameParameters(T const &arg, RooArgSet const *observables=nullptr)
Clone RooAbsArg object and reattach to original parameters.
std::string getRangeNameForSimComponent(std::string const &rangeName, bool splitRange, std::string const &catName)
void getSortedComputationGraph(RooAbsArg const &func, RooArgSet &out)
BinnedLOutput getBinnedL(RooAbsPdf const &pdf)
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')
std::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
static const char * what
Definition stlLoader.cc:5
static void output()