Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RooBinIntegrator.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id$
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_BIN_INTEGRATOR
17 #define ROO_BIN_INTEGRATOR
18 
19 #include "RooAbsIntegrator.h"
20 #include "RooNumIntConfig.h"
21 #include <vector>
22 
23 class RooBinIntegrator : public RooAbsIntegrator {
24 public:
25 
26  // Constructors, assignment etc
27  RooBinIntegrator() ;
28 
29  RooBinIntegrator(const RooAbsFunc& function) ;
30  RooBinIntegrator(const RooAbsFunc& function, const RooNumIntConfig& config) ;
31 
32  virtual RooAbsIntegrator* clone(const RooAbsFunc& function, const RooNumIntConfig& config) const ;
33  virtual ~RooBinIntegrator();
34 
35  virtual Bool_t checkLimits() const;
36  virtual Double_t integral(const Double_t *yvec=0) ;
37 
38  using RooAbsIntegrator::setLimits ;
39  Bool_t setLimits(Double_t* xmin, Double_t* xmax);
40  virtual Bool_t setUseIntegrandLimits(Bool_t flag) {_useIntegrandLimits = flag ; return kTRUE ; }
41 
42  virtual Bool_t canIntegrate1D() const { return kTRUE ; }
43  virtual Bool_t canIntegrate2D() const { return kTRUE ; }
44  virtual Bool_t canIntegrateND() const { return kTRUE ; }
45  virtual Bool_t canIntegrateOpenEnded() const { return kFALSE ; }
46 
47 protected:
48 
49  friend class RooNumIntFactory ;
50  static void registerIntegrator(RooNumIntFactory& fact) ;
51  RooBinIntegrator(const RooBinIntegrator&) ;
52 
53  // Numerical integrator workspace
54  mutable std::vector<Double_t> _xmin; //! Lower integration bound
55  mutable std::vector<Double_t> _xmax; //! Upper integration bound
56  std::vector<std::list<Double_t>*> _binb ; //! list of bin boundaries
57  mutable Int_t _numBins; //! Size of integration range
58 
59  Bool_t _useIntegrandLimits; // If true limits of function binding are ued
60 
61  Double_t* xvec(Double_t& xx) { _x[0] = xx ; return _x ; }
62  Double_t* xvec(Double_t& xx, Double_t &yy) { _x[0] = xx ; _x[1] = yy ; return _x ; }
63  Double_t* xvec(Double_t& xx, Double_t &yy, Double_t &zz) { _x[0] = xx ; _x[1] = yy ; _x[2] = zz ; return _x ; }
64 
65  Double_t *_x ; //! do not persist
66 
67  ClassDef(RooBinIntegrator,0) // 1-dimensional numerical integration engine
68 };
69 
70 #endif