RooMCIntegrator.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooMCIntegrator.h,v 1.15 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_MC_INTEGRATOR
00017 #define ROO_MC_INTEGRATOR
00018 
00019 #include "RooAbsIntegrator.h"
00020 #include "RooGrid.h"
00021 #include "RooNumIntConfig.h"
00022 #include "TStopwatch.h"
00023 
00024 class RooMCIntegrator : public RooAbsIntegrator {
00025 public:
00026 
00027   // Constructors, assignment etc
00028   enum SamplingMode { Importance, ImportanceOnly, Stratified };
00029   enum GeneratorType { QuasiRandom, PseudoRandom };
00030   RooMCIntegrator() ;
00031   RooMCIntegrator(const RooAbsFunc& function, SamplingMode mode= Importance,
00032                   GeneratorType genType= QuasiRandom, Bool_t verbose= kFALSE);
00033   RooMCIntegrator(const RooAbsFunc& function, const RooNumIntConfig& config);
00034   virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
00035   virtual ~RooMCIntegrator();
00036 
00037   virtual Bool_t checkLimits() const;
00038   virtual Double_t integral(const Double_t* yvec=0);
00039 
00040   enum Stage { AllStages, ReuseGrid, RefineGrid };
00041   Double_t vegas(Stage stage, UInt_t calls, UInt_t iterations, Double_t *absError= 0);
00042 
00043   Double_t getAlpha() const { return _alpha;   }
00044   void setAlpha(Double_t alpha) { _alpha= alpha; }
00045 
00046   GeneratorType getGenType() const { return _genType; }
00047   void setGenType(GeneratorType type) { _genType= type; }
00048 
00049   const RooGrid &grid() const { return _grid; }
00050 
00051   virtual Bool_t canIntegrate1D() const { return kTRUE ; }
00052   virtual Bool_t canIntegrate2D() const { return kTRUE ; }
00053   virtual Bool_t canIntegrateND() const { return kTRUE ; }
00054   virtual Bool_t canIntegrateOpenEnded() const { return kFALSE ; }
00055 
00056 protected:
00057 
00058   friend class RooNumIntFactory ;
00059   static void registerIntegrator(RooNumIntFactory& fact) ;      
00060 
00061   mutable RooGrid _grid;  // Sampling grid definition
00062 
00063   // control variables
00064   Bool_t _verbose;          // Verbosity control
00065   Double_t _alpha;          // Grid stiffness parameter
00066   Int_t _mode;              // Sampling mode
00067   GeneratorType _genType;   // Generator type
00068   Int_t _nRefineIter ;      // Number of refinement iterations
00069   Int_t _nRefinePerDim ;    // Number of refinement samplings (per dim)
00070   Int_t _nIntegratePerDim ; // Number of integration samplings (per dim)
00071 
00072   TStopwatch _timer;        // Timer
00073 
00074   Double_t _jac,_wtd_int_sum,_sum_wgts,_chi_sum,_chisq,_result,_sigma; // Scratch variables preserved between calls to vegas1/2/2
00075   UInt_t _it_start,_it_num,_samples,_calls_per_box;                    // Scratch variables preserved between calls to vegas1/2/2
00076 
00077   ClassDef(RooMCIntegrator,0) // VEGAS based multi-dimensional numerical integration engine
00078 };
00079 
00080 #endif

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