thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
ACDCGenCell.h
1 // -*- C++ -*-
2 //
3 // ACDCGenCell.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ACDCGenCell_H
10 #define ACDCGenCell_H
11 
12 #include "ACDCGenConfig.h"
13 #include "ACDCTraits.h"
14 
15 namespace ACDCGenerator {
16 
17 struct ACDCGenCellInfo;
18 
20 class ACDCGenCell {
21 
22 public:
23 
27  inline ACDCGenCell(double newG);
28 
32  inline ACDCGenCell(double newG, double newV);
33 
37  inline ~ACDCGenCell();
38 
48  template <typename RndType>
49  inline ACDCGenCell * generate(DVector & lo, DVector & up, RndType * rnd);
50 
61  inline ACDCGenCell * generate(DVector & lo, DVector & up, DVector & rndv);
62 
69  inline ACDCGenCell * getCell(DVector & lo, const DVector & x, DVector & up);
70 
76  inline void smooth(double frac);
77 
81  inline bool isSplit() const;
82 
88  inline double doMaxInt(double rescale = 1.0);
89 
94  inline double maxInt() const;
95 
101  inline void splitme(double lo, double newDiv, double up, DimType newDim);
102 
106  inline void g(double newG);
107 
111  inline double g() const;
112 
116  inline double v() const;
117 
122  inline DimType dim() const;
123 
128  inline double div() const;
129 
133  inline ACDCGenCell * upper() const;
134 
138  inline ACDCGenCell * lower() const;
139 
144  inline int nBins() const;
145 
149  inline int depth() const;
150 
158  inline void extract(DVector & lo, DVector & up,
159  vector<ACDCGenCellInfo> & v) const;
160 
164  inline long getIndex(const ACDCGenCell * c) const;
165 
170  inline long getIndex(const ACDCGenCell * c, long & indx) const;
171 
175  inline ACDCGenCell * getCell(long i);
176 
181  inline ACDCGenCell * getCell(long i, long & indx);
182 
183 public:
184 
190  double theG;
191 
195  double theV;
196 
201 
206 
210  double theDivision;
211 
216 
217 private:
218 
222  ACDCGenCell();
223 
227  ACDCGenCell(const ACDCGenCell &);
228 
232  ACDCGenCell & operator=(const ACDCGenCell &) = delete;
233 
234 };
235 
236 
243 
245  typedef vector<ACDCGenCellInfo>::size_type Index;
246 
250  double g;
251 
255  double v;
256 
265 
270  Index iup;
271 
276  Index ilo;
277 
278 };
279 
280 }
281 
282 #include "ACDCGenCell.icc"
283 
284 #endif
double div() const
Return the point of division in the dim() direction.
int depth() const
Return the maximum depth of this sub-tree.
double v() const
Return the volume of this cell.
Index iup
The index of the upper sub-cells in the vector in which the corresponding cell was inserted...
Definition: ACDCGenCell.h:270
ACDCGenCell * lower() const
Return the lower sub-cell.
ACDCGenCell * generate(DVector &lo, DVector &up, RndType *rnd)
Choose a cell recursively according to their relative overestimated integrals.
ACDCGenCell & operator=(const ACDCGenCell &)=delete
Assignment is private and not implemented.
double theG
If the cell has not been split this is the overestimated maximum function value in this cell...
Definition: ACDCGenCell.h:190
double g
The overestimated maximum function value of this cell.
Definition: ACDCGenCell.h:250
DimType theSplitDimension
The direction in which it has been split.
Definition: ACDCGenCell.h:215
This is a class describing cells to the outside world to be used for debugging purposes.
Definition: ACDCGenCell.h:242
vector< ACDCGenCellInfo >::size_type Index
the integer used for indices.
Definition: ACDCGenCell.h:245
long getIndex(const ACDCGenCell *c) const
Get the index of the given cell.
ACDCGenCell * theLower
Pointers to the lower sub-cell.
Definition: ACDCGenCell.h:205
double maxInt() const
Return the last calculated the overestimated integral for this cell.
ACDCGenCell()
Default constructor is private and not implemented.
DVector up
The upper-right corner of the corresponding cell.
Definition: ACDCGenCell.h:260
ACDCGenCell * theUpper
Pointers to the upper sub-cell.
Definition: ACDCGenCell.h:200
int nBins() const
Return the number of cells in this sub-tree which have not been split.
DVector lo
The lower-left corner of the corresponding cell.
Definition: ACDCGenCell.h:264
~ACDCGenCell()
The destuctor will also delete all child cells.
double theDivision
The point of division in the dim() direction.
Definition: ACDCGenCell.h:210
ACDCGenCell * upper() const
Return the upper sub-cell.
short DimType
The integer type used to represent the dimension of the a functions to be sampled-.
Definition: ACDCGenConfig.h:45
double doMaxInt(double rescale=1.0)
Recalculate (recursively) the overestimated integral for this cell (and of the sub-cells) and return ...
void extract(DVector &lo, DVector &up, vector< ACDCGenCellInfo > &v) const
Append ACDCGenCellInfo objects describing this subtree to a given vector.
vector< double > DVector
A vector of doubles.
Definition: ACDCGenConfig.h:58
is the main config header file for ACDCGen.
bool isSplit() const
Returns true if this cell has been split.
void smooth(double frac)
Smooth out the levels.
DimType dim() const
Return the direction in which it has been split.
ACDCGenCell * getCell(DVector &lo, const DVector &x, DVector &up)
Find a cell.
double theV
The volume of this cell.
Definition: ACDCGenCell.h:195
Index ilo
The index of the lower sub-cell in the vector in which the corresponding cell was inserted...
Definition: ACDCGenCell.h:276
The namespace in which all ACDCGen classes are defined.
Definition: ACDCGen.h:18
double v
The volume of the corresponding cell.
Definition: ACDCGenCell.h:255
void splitme(double lo, double newDiv, double up, DimType newDim)
Split this cell into two.
double g() const
Return the overestimated maximum function value in this cell.
ACDCGenCell is the class representing a generation cell in ACDCGen.
Definition: ACDCGenCell.h:20