RooIntegralMorph.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  *                                                                           *
00004  * Copyright (c) 2000-2007, Regents of the University of California          *
00005  *                          and Stanford University. All rights reserved.    *
00006  *                                                                           *
00007  * Redistribution and use in source and binary forms,                        *
00008  * with or without modification, are permitted according to the terms        *
00009  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
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     // coverity[UNINIT_CTOR]
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     // P.d.f is self normalized
00040     return kTRUE ; 
00041   }
00042   void setCacheAlpha(Bool_t flag) { 
00043     // Activate caching of p.d.f. shape for all values of alpha as well
00044     _cacheMgr.sterilize() ; _cacheAlpha = flag ; 
00045   }
00046   Bool_t cacheAlpha() const { 
00047     // If true caching of p.d.f for all alpha values is active
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 ; // PDF1
00071     RooAbsPdf* _pdf2 ; // PDF2
00072     RooRealVar* _x   ; // X
00073     RooAbsReal* _alpha ; // ALPHA 
00074     RooAbsReal* _c1 ; // CDF of PDF 1
00075     RooAbsReal* _c2 ; // CDF of PDF 2
00076     RooAbsFunc* _cb1 ; // Binding of CDF1
00077     RooAbsFunc* _cb2 ; // Binding of CDF2
00078     RooBrentRootFinder* _rf1 ; // ROOT finder on CDF1
00079     RooBrentRootFinder* _rf2 ; // ROOT finder of CDF2 ;
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 ; // First input shape
00100   RooRealProxy pdf2 ; // Second input shape
00101   RooRealProxy x ;    // Observable
00102   RooRealProxy alpha ; // Interpolation parameter
00103   Bool_t _cacheAlpha ; // If true, both (x,alpha) are cached
00104   mutable MorphCacheElem* _cache ; // Current morph cache element in use
00105 
00106  
00107   Double_t evaluate() const ;
00108 
00109 private:
00110 
00111   ClassDef(RooIntegralMorph,1) // Linear shape interpolation operator p.d.f
00112 };
00113  
00114 #endif

Generated on Tue Jul 5 14:26:12 2011 for ROOT_528-00b_version by  doxygen 1.5.1