RooMath.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooMath.h,v 1.16 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
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   // CERNLIB complex error function
00033   static RooComplex ComplexErrFunc(Double_t re, Double_t im= 0);
00034   static RooComplex ComplexErrFunc(const RooComplex& z);
00035 
00036   // Interpolated CERF with automatic interpolation order selection
00037   static RooComplex FastComplexErrFunc(const RooComplex& z) ;
00038   
00039   // Interpolated Re(CERF) with automatic interpolation order selection
00040   static Double_t FastComplexErrFuncRe(const RooComplex& z) ;
00041 
00042   // Interpolated Im(CERF) with automatic interpolation order selection
00043   static Double_t FastComplexErrFuncIm(const RooComplex& z) ;
00044 
00045   // Interpolated complex error function at specified interpolation order
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   // Switch to use file cache for CERF lookup table
00051   static void cacheCERF(Bool_t flag=kTRUE) ;
00052 
00053   // 1-D nth order polynomial interpolation routines
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   // Allocate and initialize CERF lookup grid
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   // CERF lookup grid
00073   static pDouble_t* _imCerfArray ; // Lookup table for Im part of complex error function
00074   static pDouble_t* _reCerfArray ; // Lookup table for Re part of complex error function
00075 
00076   // CERF grid dimensions and parameters
00077   static Int_t _reBins ;      // Number of grid points in real dimension of CERF-LUT
00078   static Double_t _reMin ;    // Low edge of real dimension of CERF-LUT
00079   static Double_t _reMax ;    // High edge of real dimension of CERF-LUT
00080   static Double_t _reRange ;  // Range in real dimension of CERF-LUT
00081   static Double_t _reStep ;   // Grid spacing in real dimension of CERF-LUT
00082 
00083   static Int_t _imBins ;      // Number of grid points in imaginary dimension of CERF-LUT    
00084   static Double_t _imMin ;    // Low edge of imaginary dimension of CERF-LUT
00085   static Double_t _imMax ;    // High edge of imaginary dimension of CERF-LUT
00086   static Double_t _imRange ;  // Range in imaginary dimension of CERF-LUT
00087   static Double_t _imStep ;   // Grid spacing in imaginary dimension of CERF-LUT
00088 
00089   static Bool_t _cacheTable ; // Switch activating use of file cache for CERF-LUT
00090   
00091   ClassDef(RooMath,0) // math utility routines
00092 };
00093 
00094 #endif

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