thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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
15namespace ACDCGenerator {
16
17struct ACDCGenCellInfo;
18
21
22public:
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
183public:
184
190 double theG;
191
195 double theV;
196
201
206
211
216
217private:
218
223
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
271
277
278};
279
280}
281
282#include "ACDCGenCell.icc"
283
284#endif
is the main config header file for ACDCGen.
ACDCGenCell is the class representing a generation cell in ACDCGen.
Definition: ACDCGenCell.h:20
~ACDCGenCell()
The destuctor will also delete all child cells.
double g() const
Return the overestimated maximum function value in this cell.
ACDCGenCell * getCell(long i)
Return the cell corresponding to the given index i.
ACDCGenCell * getCell(long i, long &indx)
Helper function for getCell(long) with an extra argument to use as counter.
long getIndex(const ACDCGenCell *c, long &indx) const
Helper function for getIndex(const ACDCGenCell *) with an extra argument to use as counter.
ACDCGenCell * generate(DVector &lo, DVector &up, DVector &rndv)
Choose a cell recursively according to their relative overestimated integrals.
double theG
If the cell has not been split this is the overestimated maximum function value in this cell.
Definition: ACDCGenCell.h:190
bool isSplit() const
Returns true if this cell has been split.
ACDCGenCell()
Default constructor is private and not implemented.
long getIndex(const ACDCGenCell *c) const
Get the index of the given cell.
DimType theSplitDimension
The direction in which it has been split.
Definition: ACDCGenCell.h:215
void splitme(double lo, double newDiv, double up, DimType newDim)
Split this cell into two.
int nBins() const
Return the number of cells in this sub-tree which have not been split.
ACDCGenCell * generate(DVector &lo, DVector &up, RndType *rnd)
Choose a cell recursively according to their relative overestimated integrals.
double v() const
Return the volume of this cell.
ACDCGenCell & operator=(const ACDCGenCell &)=delete
Assignment is private and not implemented.
double theDivision
The point of division in the dim() direction.
Definition: ACDCGenCell.h:210
int depth() const
Return the maximum depth of this sub-tree.
ACDCGenCell(double newG, double newV)
Constructor taking the maximum value and the volume as argument.
ACDCGenCell * theLower
Pointers to the lower sub-cell.
Definition: ACDCGenCell.h:205
ACDCGenCell(double newG)
Constructor taking the maximum value as argument.
ACDCGenCell * getCell(DVector &lo, const DVector &x, DVector &up)
Find a cell.
DimType dim() const
Return the direction in which it has been split.
void smooth(double frac)
Smooth out the levels.
double theV
The volume of this cell.
Definition: ACDCGenCell.h:195
ACDCGenCell(const ACDCGenCell &)
Copy constructor is private and not implemented.
ACDCGenCell * lower() const
Return the lower sub-cell.
void g(double newG)
Set a new overestimated maximum function value in this cell.
double doMaxInt(double rescale=1.0)
Recalculate (recursively) the overestimated integral for this cell (and of the sub-cells) and return ...
ACDCGenCell * theUpper
Pointers to the upper sub-cell.
Definition: ACDCGenCell.h:200
void extract(DVector &lo, DVector &up, vector< ACDCGenCellInfo > &v) const
Append ACDCGenCellInfo objects describing this subtree to a given vector.
ACDCGenCell * upper() const
Return the upper sub-cell.
double div() const
Return the point of division in the dim() direction.
double maxInt() const
Return the last calculated the overestimated integral for this cell.
The namespace in which all ACDCGen classes are defined.
Definition: ACDCGen.h:18
short DimType
The integer type used to represent the dimension of the a functions to be sampled-.
Definition: ACDCGenConfig.h:45
vector< double > DVector
A vector of doubles.
Definition: ACDCGenConfig.h:58
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
DVector up
The upper-right corner of the corresponding cell.
Definition: ACDCGenCell.h:260
double g
The overestimated maximum function value of this cell.
Definition: ACDCGenCell.h:250
Index iup
The index of the upper sub-cells in the vector in which the corresponding cell was inserted.
Definition: ACDCGenCell.h:270
double v
The volume of the corresponding cell.
Definition: ACDCGenCell.h:255
DVector lo
The lower-left corner of the corresponding cell.
Definition: ACDCGenCell.h:264
Index ilo
The index of the lower sub-cell in the vector in which the corresponding cell was inserted.
Definition: ACDCGenCell.h:276