Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooMomentMorphFunc.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * *
4  * This code was autogenerated by RooClassFactory *
5  *****************************************************************************/
6 
7 #ifndef ROO_MOMENT_MORPH_FUNC
8 #define ROO_MOMENT_MORPH_FUNC
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 
19 #include "TMatrixD.h"
20 #include "TVectorD.h"
21 
22 #include <vector>
23 #include <string>
24 class RooChangeTracker;
25 
26 class RooMomentMorphFunc : public RooAbsReal {
27 public:
28  enum Setting { Linear, NonLinear, NonLinearPosFractions, NonLinearLinFractions, SineLinear };
29 
30  RooMomentMorphFunc();
31 
32  RooMomentMorphFunc(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
33  const RooArgList &pdfList, const RooArgList &mrefList, Setting setting = NonLinearPosFractions);
34  RooMomentMorphFunc(const char *name, const char *title, RooAbsReal &_m, const RooArgList &varList,
35  const RooArgList &pdfList, const TVectorD &mrefpoints, Setting setting = NonLinearPosFractions);
36  RooMomentMorphFunc(const RooMomentMorphFunc &other, const char *name = 0);
37  virtual TObject *clone(const char *newname) const { return new RooMomentMorphFunc(*this, newname); }
38  virtual ~RooMomentMorphFunc();
39 
40  void setMode(const Setting &setting) { _setting = setting; }
41 
42  void useHorizontalMorphing(bool val) { _useHorizMorph = val; }
43 
44  virtual Bool_t selfNormalized() const
45  {
46  // P.d.f is self normalized
47  return kTRUE;
48  }
49 
50  virtual Double_t getVal(const RooArgSet *set = 0) const;
51  RooAbsReal *sumFunc(const RooArgSet *nset);
52  const RooAbsReal *sumFunc(const RooArgSet *nset) const;
53 
54  virtual std::list<Double_t> *plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const;
55  virtual std::list<Double_t> *binBoundaries(RooAbsRealLValue & /*obs*/, Double_t /*xlo*/, Double_t /*xhi*/) const;
56  Bool_t isBinnedDistribution(const RooArgSet &obs) const;
57 
58 protected:
59  class CacheElem : public RooAbsCacheElement {
60  public:
61  CacheElem(RooAbsReal &sumFunc, RooChangeTracker &tracker, const RooArgList &flist)
62  : _sumFunc(&sumFunc), _tracker(&tracker)
63  {
64  _frac.add(flist);
65  };
66  void operModeHook(RooAbsArg::OperMode){};
67  virtual ~CacheElem();
68  virtual RooArgList containedArgs(Action);
69  RooAbsReal *_sumFunc;
70  RooChangeTracker *_tracker;
71  RooArgList _frac;
72 
73  RooRealVar *frac(Int_t i);
74  const RooRealVar *frac(Int_t i) const;
75  void calculateFractions(const RooMomentMorphFunc &self, Bool_t verbose = kTRUE) const;
76  };
77  mutable RooObjCacheManager _cacheMgr; //! The cache manager
78  mutable RooArgSet *_curNormSet; //! Current normalization set
79 
80  friend class CacheElem; // Cache needs to be able to clear _norm pointer
81 
82  Double_t evaluate() const;
83 
84  void initialize();
85  CacheElem *getCache(const RooArgSet *nset) const;
86 
87  inline Int_t ij(const Int_t &i, const Int_t &j) const { return (i * _varList.getSize() + j); }
88  int idxmin(const double &m) const;
89  int idxmax(const double &m) const;
90 
91  RooRealProxy m;
92  RooSetProxy _varList;
93  RooListProxy _pdfList;
94  mutable TVectorD *_mref;
95 
96  TIterator *_varItr; //! do not persist
97  TIterator *_pdfItr; //!
98  mutable TMatrixD *_M; //
99 
100  Setting _setting;
101 
102  bool _useHorizMorph;
103 
104  ClassDef(RooMomentMorphFunc, 3) // Your description goes here...
105 };
106 
107 #endif