Logo ROOT   6.14/05
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 <map>
25 
26 class RooChangeTracker;
27 
29 
30 public:
31  class Grid2 {
32  public:
33  Grid2(){};
34  Grid2(const Grid2 &other);
35  Grid2(const RooAbsBinning &binning_x) { _grid.push_back(binning_x.clone()); };
36  Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y)
37  {
38  _grid.push_back(binning_x.clone());
39  _grid.push_back(binning_y.clone());
40  };
41  Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y, const RooAbsBinning &binning_z)
42  {
43  _grid.push_back(binning_x.clone());
44  _grid.push_back(binning_y.clone());
45  _grid.push_back(binning_z.clone());
46  };
47  Grid2(const std::vector<RooAbsBinning *> binnings)
48  {
49  for (unsigned int i = 0; i < binnings.size(); i++) {
50  _grid.push_back(binnings[i]->clone());
51  }
52  };
53 
54  virtual ~Grid2();
55 
56  void addPdf(const RooAbsReal &func, int bin_x);
57  void addPdf(const RooAbsReal &func, int bin_x, int bin_y);
58  void addPdf(const RooAbsReal &func, int bin_x, int bin_y, int bin_z);
59  void addPdf(const RooAbsReal &func, std::vector<int> bins);
60  void addBinning(const RooAbsBinning &binning) { _grid.push_back(binning.clone()); };
61 
62  mutable std::vector<RooAbsBinning *> _grid;
64  mutable std::map<std::vector<int>, int> _pdfMap;
65 
66  mutable std::vector<std::vector<double>> _nref;
67  mutable std::vector<int> _nnuis;
68 
70  };
71 
72 protected:
73  class CacheElem : public RooAbsCacheElement {
74  public:
76  : _sumFunc(&sumFunc), _tracker(&tracker)
77  {
78  _frac.add(flist);
79  };
81  virtual ~CacheElem();
82  virtual RooArgList containedArgs(Action);
86 
87  RooRealVar *frac(int i);
88  const RooRealVar *frac(int i) const;
89  void calculateFractions(const RooMomentMorphFuncND &self, Bool_t verbose = kTRUE) const;
90  };
91 
92 public:
94 
96  RooMomentMorphFuncND(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
97  const RooArgList &pdfList, const RooArgList &mrefList, Setting setting);
98  RooMomentMorphFuncND(const char *name, const char *title, const RooArgList &parList, const RooArgList &obsList,
99  const Grid2 &referenceGrid, const Setting &setting);
100  RooMomentMorphFuncND(const RooMomentMorphFuncND &other, const char *name = 0);
101  RooMomentMorphFuncND(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
102  const RooArgList &pdfList, const TVectorD &mrefpoints, Setting setting);
103  virtual ~RooMomentMorphFuncND();
104  virtual TObject *clone(const char *newname) const { return new RooMomentMorphFuncND(*this, newname); }
105 
106  void setMode(const Setting &setting) { _setting = setting; }
107  virtual Bool_t selfNormalized() const { return kTRUE; }
110 
111  Double_t evaluate() const;
112  virtual Double_t getVal(const RooArgSet *set = 0) const;
113 
114 protected:
115  void initialize();
116  void initializeParameters(const RooArgList &parList);
117  void initializeObservables(const RooArgList &obsList);
118 
119  RooAbsReal *sumFunc(const RooArgSet *nset);
120  CacheElem *getCache(const RooArgSet *nset) const;
121 
122  template <typename T>
123  struct Digits {
124  typename std::vector<T>::const_iterator begin;
125  typename std::vector<T>::const_iterator end;
126  typename std::vector<T>::const_iterator me;
127  };
128 
129  template <typename T>
130  static void cartesian_product(std::vector<std::vector<T>> &out, std::vector<std::vector<T>> &in);
131  template <typename Iterator>
132  static bool next_combination(const Iterator first, Iterator k, const Iterator last);
133  void findShape(const std::vector<double> &x) const;
134 
135  friend class CacheElem;
136  friend class Grid2;
137 
140 
143  // RooListProxy _pdfList ;
144  TIterator *_parItr; //! do not persist
148 
149  mutable TMatrixD *_M;
150  mutable TMatrixD *_MSqr;
151  mutable std::vector<std::vector<double>> _squareVec;
152  mutable std::vector<int> _squareIdx;
153 
156 
157  inline int sij(const int &i, const int &j) const { return (i * _obsList.getSize() + j); }
158 
160 };
161 
162 #endif
void setMode(const Setting &setting)
TIterator * _obsItr
do not persist
CacheElem(RooAbsReal &sumFunc, RooChangeTracker &tracker, const RooArgList &flist)
std::vector< T >::const_iterator me
RooAbsReal * sumFunc(const RooArgSet *nset)
void initializeObservables(const RooArgList &obsList)
Grid2(const RooAbsBinning &binning_x)
CacheElem * getCache(const RooArgSet *nset) const
Bool_t setBinIntegrator(RooArgSet &allVars)
void initializeParameters(const RooArgList &parList)
void addPdf(const RooAbsReal &func, int bin_x)
std::vector< T >::const_iterator begin
int sij(const int &i, const int &j) const
Grid2(const std::vector< RooAbsBinning *> binnings)
bool Bool_t
Definition: RtypesCore.h:59
virtual RooAbsBinning * clone(const char *name=0) const =0
Iterator abstract base class.
Definition: TIterator.h:30
TMatrixT.
Definition: TMatrixDfwd.h:22
std::map< std::vector< int >, int > _pdfMap
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
std::vector< int > _squareIdx
void operModeHook(RooAbsArg::OperMode)
Interface for operation mode change calls.
std::vector< std::vector< double > > _squareVec
virtual Double_t getVal(const RooArgSet *set=0) const
RooObjCacheManager _cacheMgr
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Int_t getSize() const
std::vector< RooAbsBinning * > _grid
static void cartesian_product(std::vector< std::vector< T >> &out, std::vector< std::vector< T >> &in)
static bool next_combination(const Iterator first, Iterator k, const Iterator last)
std::vector< T >::const_iterator end
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
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...
void findShape(const std::vector< double > &x) const
Grid2(const RooAbsBinning &binning_x, const RooAbsBinning &binning_y)
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
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:24
std::vector< std::vector< double > > _nref
Definition: first.py:1
void addBinning(const RooAbsBinning &binning)
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual Bool_t selfNormalized() const
char name[80]
Definition: TGX11.cxx:109