Logo ROOT   6.08/07
Reference Guide
RooMCIntegrator.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooMCIntegrator.h,v 1.15 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_MC_INTEGRATOR
17 #define ROO_MC_INTEGRATOR
18 
19 #include "RooAbsIntegrator.h"
20 #include "RooGrid.h"
21 #include "RooNumIntConfig.h"
22 #include "TStopwatch.h"
23 
25 public:
26 
27  // Constructors, assignment etc
30  RooMCIntegrator() ;
31  RooMCIntegrator(const RooAbsFunc& function, SamplingMode mode= Importance,
33  RooMCIntegrator(const RooAbsFunc& function, const RooNumIntConfig& config);
34  virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
35  virtual ~RooMCIntegrator();
36 
37  virtual Bool_t checkLimits() const;
38  virtual Double_t integral(const Double_t* yvec=0);
39 
41  Double_t vegas(Stage stage, UInt_t calls, UInt_t iterations, Double_t *absError= 0);
42 
43  Double_t getAlpha() const { return _alpha; }
44  void setAlpha(Double_t alpha) { _alpha= alpha; }
45 
46  GeneratorType getGenType() const { return _genType; }
48 
49  const RooGrid &grid() const { return _grid; }
50 
51  virtual Bool_t canIntegrate1D() const { return kTRUE ; }
52  virtual Bool_t canIntegrate2D() const { return kTRUE ; }
53  virtual Bool_t canIntegrateND() const { return kTRUE ; }
54  virtual Bool_t canIntegrateOpenEnded() const { return kFALSE ; }
55 
56 protected:
57 
58  friend class RooNumIntFactory ;
59  static void registerIntegrator(RooNumIntFactory& fact) ;
60 
61  mutable RooGrid _grid; // Sampling grid definition
62 
63  // control variables
64  Bool_t _verbose; // Verbosity control
65  Double_t _alpha; // Grid stiffness parameter
66  Int_t _mode; // Sampling mode
67  GeneratorType _genType; // Generator type
68  Int_t _nRefineIter ; // Number of refinement iterations
69  Int_t _nRefinePerDim ; // Number of refinement samplings (per dim)
70  Int_t _nIntegratePerDim ; // Number of integration samplings (per dim)
71 
72  TStopwatch _timer; // Timer
73 
74  Double_t _jac,_wtd_int_sum,_sum_wgts,_chi_sum,_chisq,_result,_sigma; // Scratch variables preserved between calls to vegas1/2/2
75  UInt_t _it_start,_it_num,_samples,_calls_per_box; // Scratch variables preserved between calls to vegas1/2/2
76 
77  ClassDef(RooMCIntegrator,0) // VEGAS based multi-dimensional numerical integration engine
78 };
79 
80 #endif
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
void setGenType(GeneratorType type)
RooNumIntFactory is a factory to instantiate numeric integrators from a given function binding and a ...
Double_t getAlpha() const
GeneratorType _genType
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
RooMCIntegrator()
Default constructor.
const RooGrid & grid() const
GeneratorType getGenType() const
virtual Bool_t canIntegrateND() const
#define ClassDef(name, id)
Definition: Rtypes.h:254
TStopwatch _timer
RooMCIntegrator implements an adaptive multi-dimensional Monte Carlo numerical integration, following the VEGAS algorithm originally described in G.
void setAlpha(Double_t alpha)
virtual Bool_t canIntegrateOpenEnded() const
virtual Double_t integral(const Double_t *yvec=0)
Evaluate the integral using a fixed number of calls to evaluate the integrand equal to about 10k per ...
unsigned int UInt_t
Definition: RtypesCore.h:42
bool verbose
static void registerIntegrator(RooNumIntFactory &fact)
This function registers class RooMCIntegrator, its configuration options and its capabilities with Ro...
virtual ~RooMCIntegrator()
Destructor.
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
Double_t _wtd_int_sum
virtual RooAbsIntegrator * clone(const RooAbsFunc &function, const RooNumIntConfig &config) const
Return clone of this generator operating on given function with given configuration Needed to support...
virtual Bool_t canIntegrate1D() const
Double_t vegas(Stage stage, UInt_t calls, UInt_t iterations, Double_t *absError=0)
Perform one step of Monte Carlo integration using the specified number of iterations with (approximat...
virtual Bool_t checkLimits() const
Check if we can integrate over the current domain.
const Bool_t kTRUE
Definition: Rtypes.h:91
RooGrid is a utility class for RooMCIntegrator which implements an adaptive multi-dimensional Monte C...
Definition: RooGrid.h:24
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:23
virtual Bool_t canIntegrate2D() const
Stopwatch class.
Definition: TStopwatch.h:30