00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOLINEARMORPH
00013 #define ROOLINEARMORPH
00014
00015 #include "RooAbsCachedPdf.h"
00016 #include "RooRealProxy.h"
00017 #include "RooCategoryProxy.h"
00018 #include "RooAbsReal.h"
00019 #include "RooAbsCategory.h"
00020 class RooBrentRootFinder ;
00021
00022 class TH1D ;
00023
00024 class RooIntegralMorph : public RooAbsCachedPdf {
00025 public:
00026 RooIntegralMorph() {
00027
00028 } ;
00029 RooIntegralMorph(const char *name, const char *title,
00030 RooAbsReal& _pdf1,
00031 RooAbsReal& _pdf2,
00032 RooAbsReal& _x,
00033 RooAbsReal& _alpha, Bool_t cacheAlpha=kFALSE);
00034 RooIntegralMorph(const RooIntegralMorph& other, const char* name=0) ;
00035 virtual TObject* clone(const char* newname) const { return new RooIntegralMorph(*this,newname); }
00036 inline virtual ~RooIntegralMorph() { }
00037
00038 Bool_t selfNormalized() const {
00039
00040 return kTRUE ;
00041 }
00042 void setCacheAlpha(Bool_t flag) {
00043
00044 _cacheMgr.sterilize() ; _cacheAlpha = flag ;
00045 }
00046 Bool_t cacheAlpha() const {
00047
00048 return _cacheAlpha ;
00049 }
00050
00051 virtual void preferredObservableScanOrder(const RooArgSet& obs, RooArgSet& orderedObs) const ;
00052
00053 class MorphCacheElem : public PdfCacheElem {
00054 public:
00055 MorphCacheElem(RooIntegralMorph& self, const RooArgSet* nset) ;
00056 ~MorphCacheElem() ;
00057 void calculate(TIterator* iter) ;
00058 virtual RooArgList containedArgs(Action) ;
00059
00060 protected:
00061
00062 void findRange() ;
00063 Double_t calcX(Double_t y, Bool_t& ok) ;
00064 Int_t binX(Double_t x) ;
00065 void fillGap(Int_t ixlo, Int_t ixhi,Double_t splitPoint=0.5) ;
00066 void interpolateGap(Int_t ixlo, Int_t ixhi) ;
00067
00068 RooIntegralMorph* _self ;
00069 RooArgSet* _nset ;
00070 RooAbsPdf* _pdf1 ;
00071 RooAbsPdf* _pdf2 ;
00072 RooRealVar* _x ;
00073 RooAbsReal* _alpha ;
00074 RooAbsReal* _c1 ;
00075 RooAbsReal* _c2 ;
00076 RooAbsFunc* _cb1 ;
00077 RooAbsFunc* _cb2 ;
00078 RooBrentRootFinder* _rf1 ;
00079 RooBrentRootFinder* _rf2 ;
00080
00081 Double_t* _yatX ;
00082 Double_t* _calcX;
00083 Int_t _yatXmin, _yatXmax ;
00084 Int_t _ccounter ;
00085
00086 Double_t _ycutoff ;
00087
00088 } ;
00089
00090 protected:
00091
00092 friend class MorphCacheElem ;
00093 virtual PdfCacheElem* createCache(const RooArgSet* nset) const ;
00094 virtual const char* inputBaseName() const ;
00095 virtual RooArgSet* actualObservables(const RooArgSet& nset) const ;
00096 virtual RooArgSet* actualParameters(const RooArgSet& nset) const ;
00097 virtual void fillCacheObject(PdfCacheElem& cache) const ;
00098
00099 RooRealProxy pdf1 ;
00100 RooRealProxy pdf2 ;
00101 RooRealProxy x ;
00102 RooRealProxy alpha ;
00103 Bool_t _cacheAlpha ;
00104 mutable MorphCacheElem* _cache ;
00105
00106
00107 Double_t evaluate() const ;
00108
00109 private:
00110
00111 ClassDef(RooIntegralMorph,1)
00112 };
00113
00114 #endif