Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooMomentMorphFunc.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 ROO_MOMENT_MORPH_FUNC
12#define ROO_MOMENT_MORPH_FUNC
13
14#include "RooAbsPdf.h"
15#include "RooRealProxy.h"
16#include "RooCategoryProxy.h"
17#include "RooAbsReal.h"
18#include "RooAbsCategory.h"
19#include "RooSetProxy.h"
20#include "RooListProxy.h"
21#include "RooArgList.h"
22
23#include "TMatrixD.h"
24#include "TVectorD.h"
25
26#include <list>
27
29
31public:
33
35
36 RooMomentMorphFunc(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
37 const RooArgList &pdfList, const RooArgList &mrefList, Setting setting = NonLinearPosFractions);
38 RooMomentMorphFunc(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
39 const RooArgList &pdfList, const TVectorD &mrefpoints, Setting setting = NonLinearPosFractions);
40 RooMomentMorphFunc(const RooMomentMorphFunc &other, const char *name = nullptr);
41 TObject *clone(const char *newname) const override { return new RooMomentMorphFunc(*this, newname); }
42 ~RooMomentMorphFunc() override;
43
44 void setMode(const Setting &setting) { _setting = setting; }
45
46 void useHorizontalMorphing(bool val) { _useHorizMorph = val; }
47
48 virtual bool selfNormalized() const
49 {
50 // P.d.f is self normalized
51 return true;
52 }
53
54 double getValV(const RooArgSet *set = nullptr) const override;
55 RooAbsReal *sumFunc(const RooArgSet *nset);
56 const RooAbsReal *sumFunc(const RooArgSet *nset) const;
57
58 std::list<double> *plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override;
59 std::list<double> *binBoundaries(RooAbsRealLValue & /*obs*/, double /*xlo*/, double /*xhi*/) const override;
60 bool isBinnedDistribution(const RooArgSet &obs) const override;
61
62protected:
64 public:
66 : _sumFunc(&sumFunc), _tracker(&tracker)
67 {
68 _frac.add(flist);
69 };
70 ~CacheElem() override;
75
77 const RooRealVar *frac(Int_t i) const;
78 void calculateFractions(const RooMomentMorphFunc &self, bool verbose = true) const;
79 };
80 mutable RooObjCacheManager _cacheMgr; //! The cache manager
81 mutable RooArgSet *_curNormSet = nullptr; //! Current normalization set
82
83 friend class CacheElem; // Cache needs to be able to clear _norm pointer
84
85 double evaluate() const override;
86
87 void initialize();
88 CacheElem *getCache(const RooArgSet *nset) const;
89
90 inline Int_t ij(const Int_t &i, const Int_t &j) const { return (i * _varList.size() + j); }
91 int idxmin(const double &m) const;
92 int idxmax(const double &m) const;
93
97 mutable TVectorD *_mref = nullptr;
98
99 mutable TMatrixD *_M = nullptr;
100
102
103 bool _useHorizMorph = true;
104
106};
107
108#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Meta object that tracks value changes in a given set of RooAbsArgs by registering itself as value cli...
void calculateFractions(const RooMomentMorphFunc &self, bool verbose=true) const
RooArgList containedArgs(Action) override
CacheElem(RooAbsReal &sumFunc, RooChangeTracker &tracker, const RooArgList &flist)
double getValV(const RooArgSet *set=nullptr) const override
Return value of object.
RooArgSet * _curNormSet
The cache manager.
bool isBinnedDistribution(const RooArgSet &obs) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
RooObjCacheManager _cacheMgr
CacheElem * getCache(const RooArgSet *nset) const
void useHorizontalMorphing(bool val)
virtual bool selfNormalized() const
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsReal * sumFunc(const RooArgSet *nset)
void setMode(const Setting &setting)
int idxmin(const double &m) const
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Retrieve bin boundaries if this distribution is binned in obs.
TObject * clone(const char *newname) const override
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Int_t ij(const Int_t &i, const Int_t &j) const
int idxmax(const double &m) const
Implementation of a RooCacheManager<RooAbsCacheElement> that specializes in the storage of cache elem...
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Mother of all ROOT objects.
Definition TObject.h:41