Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooGrid.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*****************************************************************************
4 * Project: RooFit *
5 * Package: RooFitCore *
6 * File: $Id: RooGrid.h,v 1.10 2007/05/11 09:11:30 verkerke Exp $
7 * Authors: *
8 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
9 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
10 * *
11 * Copyright (c) 2000-2005, Regents of the University of California *
12 * and Stanford University. All rights reserved. *
13 * *
14 * Redistribution and use in source and binary forms, *
15 * with or without modification, are permitted according to the terms *
16 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
17 *****************************************************************************/
18#ifndef ROO_GRID
19#define ROO_GRID
20
21#include <RtypesCore.h>
22
23#include <ostream>
24#include <vector>
25
26class RooAbsFunc;
27
28// Utility class for RooMCIntegrator holding a multi-dimensional grid
29class RooGrid {
30public:
31 RooGrid() {}
32 RooGrid(const RooAbsFunc &function);
33
34 // Printing interface
35 void print(std::ostream& os, bool verbose=false, std::string const& indent="") const;
36
37 inline bool isValid() const { return _valid; }
38 inline UInt_t getDimension() const { return _dim; }
39 inline double getVolume() const { return _vol; }
40 inline UInt_t getNBins() const { return _bins; }
41 inline UInt_t getNBoxes() const { return _boxes; }
42 inline void setNBoxes(UInt_t boxes) { _boxes= boxes; }
43
44 bool initialize(const RooAbsFunc &function);
45 void resize(UInt_t bins);
46 void resetValues();
47 void generatePoint(const UInt_t box[], double x[], UInt_t bin[],
48 double &vol, bool useQuasiRandom= true) const;
49 void accumulate(const UInt_t bin[], double amount);
50 void refine(double alpha= 1.5);
51
52 void firstBox(UInt_t box[]) const;
53 bool nextBox(UInt_t box[]) const;
54
55 enum { maxBins = 50 }; // must be even
56
57 // Accessor for the j-th normalized grid point along the i-th dimension
58 inline double coord(Int_t i, Int_t j) const { return _xi[i*_dim + j]; }
59 inline double value(Int_t i,Int_t j) const { return _d[i*_dim + j]; }
60
61protected:
62 inline double& coord(Int_t i, Int_t j) { return _xi[i*_dim + j]; }
63 inline double& value(Int_t i,Int_t j) { return _d[i*_dim + j]; }
64 inline double& newCoord(Int_t i) { return _xin[i]; }
65
66 bool _valid = false; ///< Is configuration valid
67 UInt_t _dim = 0; ///< Number of dimensions, bins and boxes
68 UInt_t _bins = 0; ///< Number of bins
69 UInt_t _boxes = 0; ///<Numbser of boxes
70 double _vol = 0.0; ///< Volume
71
72 std::vector<double> _xl; ///<! Internal workspace
73 std::vector<double> _xu; ///<! Internal workspace
74 std::vector<double> _delx; ///<! Internal workspace
75 std::vector<double> _d; ///<! Internal workspace
76 std::vector<double> _xi; ///<! Internal workspace
77 std::vector<double> _xin; ///<! Internal workspace
78 std::vector<double> _weight; ///<! Internal workspace
79
80};
81
82#endif
83
84/// \endcond
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t x[n]
Definition legend1.C:17
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
Definition Functions.h:282