00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef ROO_MATH
00017 #define ROO_MATH
00018 
00019 #include "RooComplex.h"
00020 
00021 #include <math.h>
00022 #include <fstream>
00023 
00024 typedef RooComplex* pRooComplex ;
00025 typedef Double_t* pDouble_t ;
00026 
00027 class RooMath {
00028 public:
00029 
00030   virtual ~RooMath() {} ;
00031 
00032   
00033   static RooComplex ComplexErrFunc(Double_t re, Double_t im= 0);
00034   static RooComplex ComplexErrFunc(const RooComplex& z);
00035 
00036   
00037   static RooComplex FastComplexErrFunc(const RooComplex& z) ;
00038   
00039   
00040   static Double_t FastComplexErrFuncRe(const RooComplex& z) ;
00041 
00042   
00043   static Double_t FastComplexErrFuncIm(const RooComplex& z) ;
00044 
00045   
00046   static RooComplex ITPComplexErrFunc(const RooComplex& z, Int_t nOrder) ;
00047   static Double_t ITPComplexErrFuncRe(const RooComplex& z, Int_t nOrder) ;
00048   static Double_t ITPComplexErrFuncIm(const RooComplex& z, Int_t nOrder) ;
00049 
00050   
00051   static void cacheCERF(Bool_t flag=kTRUE) ;
00052 
00053   
00054   static Double_t interpolate(Double_t yArr[],Int_t nOrder, Double_t x) ;
00055   static Double_t interpolate(Double_t xa[], Double_t ya[], Int_t n, Double_t x) ;
00056 
00057   static Double_t erf(Double_t x) ;
00058   static Double_t erfc(Double_t x) ;
00059   
00060   static void cleanup() ;
00061 
00062 private:
00063 
00064   static Bool_t loadCache() ;
00065   static void storeCache() ;
00066   static const char* cacheFileName() ;
00067 
00068   
00069   static void initFastCERF(Int_t reBins= 800, Double_t reMin=-4.0, Double_t reMax=4.0, 
00070                            Int_t imBins=1000, Double_t imMin=-4.0, Double_t imMax=6.0) ;
00071 
00072   
00073   static pDouble_t* _imCerfArray ; 
00074   static pDouble_t* _reCerfArray ; 
00075 
00076   
00077   static Int_t _reBins ;      
00078   static Double_t _reMin ;    
00079   static Double_t _reMax ;    
00080   static Double_t _reRange ;  
00081   static Double_t _reStep ;   
00082 
00083   static Int_t _imBins ;      
00084   static Double_t _imMin ;    
00085   static Double_t _imMax ;    
00086   static Double_t _imRange ;  
00087   static Double_t _imStep ;   
00088 
00089   static Bool_t _cacheTable ; 
00090   
00091   ClassDef(RooMath,0) 
00092 };
00093 
00094 #endif