Logo ROOT   6.12/07
Reference Guide
RooMomentMorphFuncND.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * *
4  * This code was autogenerated by RooClassFactory *
5  *****************************************************************************/
6 
7 #ifndef ROOMOMENTMORPHFUNCND
8 #define ROOMOMENTMORPHFUNCND
9 
10 #include "RooAbsPdf.h"
11 #include "RooRealProxy.h"
12 #include "RooCategoryProxy.h"
13 #include "RooAbsReal.h"
14 #include "RooAbsCategory.h"
15 #include "RooSetProxy.h"
16 #include "RooListProxy.h"
17 #include "RooArgList.h"
18 #include "RooBinning.h"
19 
20 #include "TMatrixD.h"
21 #include "TMap.h"
22 
23 #include <vector>
24 #include <string>
25 #include <map>
26 
27 using namespace std;
28 
29 class RooChangeTracker;
30 
32 
33 public:
34  class Grid2 {
35  public:
36  Grid2(){};
37  Grid2(const Grid2 &other);
38  Grid2(const RooAbsBinning &binning_x) { _grid.push_back(binning_x.clone()); };
39  Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y)
40  {
41  _grid.push_back(binning_x.clone());
42  _grid.push_back(binning_y.clone());
43  };
44  Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y, const RooAbsBinning &binning_z)
45  {
46  _grid.push_back(binning_x.clone());
47  _grid.push_back(binning_y.clone());
48  _grid.push_back(binning_z.clone());
49  };
50  Grid2(const vector<RooAbsBinning *> binnings)
51  {
52  for (unsigned int i = 0; i < binnings.size(); i++) {
53  _grid.push_back(binnings[i]->clone());
54  }
55  };
56 
57  virtual ~Grid2();
58 
59  void addPdf(const RooAbsReal &func, int bin_x);
60  void addPdf(const RooAbsReal &func, int bin_x, int bin_y);
61  void addPdf(const RooAbsReal &func, int bin_x, int bin_y, int bin_z);
62  void addPdf(const RooAbsReal &func, vector<int> bins);
63  void addBinning(const RooAbsBinning &binning) { _grid.push_back(binning.clone()); };
64 
65  mutable vector<RooAbsBinning *> _grid;
67  mutable map<vector<int>, int> _pdfMap;
68 
69  mutable vector<vector<double>> _nref;
70  mutable vector<int> _nnuis;
71 
73  };
74 
75 protected:
76  class CacheElem : public RooAbsCacheElement {
77  public:
78  CacheElem(RooAbsReal &sumFunc, RooChangeTracker &tracker, const RooArgList &flist)
79  : _sumFunc(&sumFunc), _tracker(&tracker)
80  {
81  _frac.add(flist);
82  };
84  virtual ~CacheElem();
85  virtual RooArgList containedArgs(Action);
89 
90  RooRealVar *frac(int i);
91  const RooRealVar *frac(int i) const;
92  void calculateFractions(const RooMomentMorphFuncND &self, Bool_t verbose = kTRUE) const;
93  };
94 
95 public:
96  enum Setting { Linear, SineLinear, NonLinear, NonLinearPosFractions, NonLinearLinFractions };
97 
99  RooMomentMorphFuncND(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
100  const RooArgList &pdfList, const RooArgList &mrefList, Setting setting);
101  RooMomentMorphFuncND(const char *name, const char *title, const RooArgList &parList, const RooArgList &obsList,
102  const Grid2 &referenceGrid, const Setting &setting);
103  RooMomentMorphFuncND(const RooMomentMorphFuncND &other, const char *name = 0);
104  RooMomentMorphFuncND(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
105  const RooArgList &pdfList, const TVectorD &mrefpoints, Setting setting);
106  virtual ~RooMomentMorphFuncND();
107  virtual TObject *clone(const char *newname) const { return new RooMomentMorphFuncND(*this, newname); }
108 
109  void setMode(const Setting &setting) { _setting = setting; }
110  virtual Bool_t selfNormalized() const { return kTRUE; }
111  Bool_t setBinIntegrator(RooArgSet &allVars);
112  void useHorizontalMorphing(Bool_t val) { _useHorizMorph = val; }
113 
114  Double_t evaluate() const;
115  virtual Double_t getVal(const RooArgSet *set = 0) const;
116 
117 protected:
118  void initialize();
119  void initializeParameters(const RooArgList &parList);
120  void initializeObservables(const RooArgList &obsList);
121 
122  RooAbsReal *sumFunc(const RooArgSet *nset);
123  CacheElem *getCache(const RooArgSet *nset) const;
124 
125  template <typename T>
126  struct Digits {
127  typename vector<T>::const_iterator begin;
128  typename vector<T>::const_iterator end;
129  typename vector<T>::const_iterator me;
130  };
131 
132  template <typename T>
133  static void cartesian_product(vector<vector<T>> &out, vector<vector<T>> &in);
134  template <typename Iterator>
135  static bool next_combination(const Iterator first, Iterator k, const Iterator last);
136  void findShape(const vector<double> &x) const;
137 
138  friend class CacheElem;
139  friend class Grid2;
140 
143 
146  // RooListProxy _pdfList ;
147  TIterator *_parItr; //! do not persist
151 
152  mutable TMatrixD *_M;
153  mutable TMatrixD *_MSqr;
154  mutable vector<vector<double>> _squareVec;
155  mutable vector<int> _squareIdx;
156 
159 
160  inline int sij(const int &i, const int &j) const { return (i * _obsList.getSize() + j); }
161 
163 };
164 
165 #endif
void setMode(const Setting &setting)
TIterator * _obsItr
do not persist
vector< T >::const_iterator begin
CacheElem(RooAbsReal &sumFunc, RooChangeTracker &tracker, const RooArgList &flist)
Grid2(const RooAbsBinning &binning_x)
vector< vector< double > > _squareVec
int sij(const int &i, const int &j) const
bool Bool_t
Definition: RtypesCore.h:59
Grid2(const vector< RooAbsBinning *> binnings)
STL namespace.
virtual RooAbsBinning * clone(const char *name=0) const =0
Iterator abstract base class.
Definition: TIterator.h:30
void evaluate(typename Architecture_t::Matrix_t &A, EActivationFunction f)
Apply the given activation function to each value in the given matrix A.
Definition: Functions.h:85
bool next_combination(const Iterator first, Iterator k, const Iterator last)
TMatrixT.
Definition: TMatrixDfwd.h:22
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
void operModeHook(RooAbsArg::OperMode)
Interface for operation mode change calls.
vector< vector< double > > _nref
RooObjCacheManager _cacheMgr
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
vector< T >::const_iterator me
Int_t getSize() const
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
void useHorizontalMorphing(Bool_t val)
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:25
Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y, const RooAbsBinning &binning_z)
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
virtual TObject * clone(const char *newname) const
vector< T >::const_iterator end
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Class RooObjCacheManager is an implementation of class RooCacheManager<RooAbsCacheElement> and specia...
Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y)
void cartesian_product(vector< vector< T >> &out, vector< vector< T >> &in)
RooChangeTracker is a meta object that tracks value changes in a given set of RooAbsArgs by registeri...
Mother of all ROOT objects.
Definition: TObject.h:37
static std::shared_ptr< std::function< double(double)> > Linear
Definition: NeuralNet.icc:59
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:24
map< vector< int >, int > _pdfMap
Definition: first.py:1
void addBinning(const RooAbsBinning &binning)
const Bool_t kTRUE
Definition: RtypesCore.h:87
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
Definition: Functions.h:249
virtual Bool_t selfNormalized() const
char name[80]
Definition: TGX11.cxx:109