#include <RandGeneral.h>
|
| RandGeneral (const double *aProbFunc, int theProbSize, int IntType=0) |
|
| RandGeneral (HepRandomEngine &anEngine, const double *aProbFunc, int theProbSize, int IntType=0) |
|
| RandGeneral (HepRandomEngine *anEngine, const double *aProbFunc, int theProbSize, int IntType=0) |
|
virtual | ~RandGeneral () |
|
double | shoot () |
|
void | shootArray (const int size, double *vect) |
|
double | shoot (HepRandomEngine *anEngine) |
|
void | shootArray (HepRandomEngine *anEngine, const int size, double *vect) |
|
double | fire () |
|
void | fireArray (const int size, double *vect) |
|
double | operator() () |
|
std::ostream & | put (std::ostream &os) const |
|
std::istream & | get (std::istream &is) |
|
std::string | name () const |
|
HepRandomEngine & | engine () |
|
Public Member Functions inherited from CLHEP::HepRandom |
| HepRandom () |
|
| HepRandom (long seed) |
|
| HepRandom (HepRandomEngine &algorithm) |
|
| HepRandom (HepRandomEngine *algorithm) |
|
virtual | ~HepRandom () |
|
double | flat () |
|
void | flatArray (const int size, double *vect) |
|
double | flat (HepRandomEngine *theNewEngine) |
|
void | flatArray (HepRandomEngine *theNewEngine, const int size, double *vect) |
|
- Author
Definition at line 39 of file RandGeneral.h.
◆ RandGeneral() [1/3]
CLHEP::RandGeneral::RandGeneral |
( |
const double * |
aProbFunc, |
|
|
int |
theProbSize, |
|
|
int |
IntType = 0 |
|
) |
| |
Definition at line 64 of file RandGeneral.cc.
void prepareTable(const double *aProbFunc)
static HepRandomEngine * getTheEngine()
std::shared_ptr< HepRandomEngine > localEngine
◆ RandGeneral() [2/3]
CLHEP::RandGeneral::RandGeneral |
( |
HepRandomEngine & |
anEngine, |
|
|
const double * |
aProbFunc, |
|
|
int |
theProbSize, |
|
|
int |
IntType = 0 |
|
) |
| |
Definition at line 75 of file RandGeneral.cc.
void prepareTable(const double *aProbFunc)
std::shared_ptr< HepRandomEngine > localEngine
◆ RandGeneral() [3/3]
CLHEP::RandGeneral::RandGeneral |
( |
HepRandomEngine * |
anEngine, |
|
|
const double * |
aProbFunc, |
|
|
int |
theProbSize, |
|
|
int |
IntType = 0 |
|
) |
| |
Definition at line 87 of file RandGeneral.cc.
void prepareTable(const double *aProbFunc)
std::shared_ptr< HepRandomEngine > localEngine
◆ ~RandGeneral()
CLHEP::RandGeneral::~RandGeneral |
( |
| ) |
|
|
virtual |
◆ distributionName()
static std::string CLHEP::RandGeneral::distributionName |
( |
| ) |
|
|
inlinestatic |
◆ engine()
◆ fire()
double CLHEP::RandGeneral::fire |
( |
| ) |
|
◆ fireArray()
void CLHEP::RandGeneral::fireArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
◆ get()
std::istream & CLHEP::RandGeneral::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandom.
Definition at line 264 of file RandGeneral.cc.
267 if (inName !=
name()) {
268 is.clear(std::ios::badbit | is.rdstate());
269 std::cerr <<
"Mismatch when expecting to read state of a " 270 <<
name() <<
" distribution\n" 271 <<
"Name found was " << inName
272 <<
"\nistream is left in the badbit state\n";
276 std::vector<unsigned long> t(2);
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
std::vector< double > theIntegralPdf
static double longs2double(const std::vector< unsigned long > &v)
◆ mapRandom()
double CLHEP::RandGeneral::mapRandom |
( |
double |
rand | ) |
const |
|
private |
Definition at line 180 of file RandGeneral.cc.
190 while (nabove > nbelow+1) {
191 middle = (nabove + nbelow+1)>>1;
198 assert ( nabove == nbelow+1 );
214 if ( binMeasure == 0 ) {
221 double binFraction = (rand - theIntegralPdf[nbelow]) / binMeasure;
std::vector< double > theIntegralPdf
◆ name()
std::string CLHEP::RandGeneral::name |
( |
| ) |
const |
|
virtual |
◆ operator()()
double CLHEP::RandGeneral::operator() |
( |
| ) |
|
|
virtual |
◆ prepareTable()
void CLHEP::RandGeneral::prepareTable |
( |
const double * |
aProbFunc | ) |
|
|
private |
Definition at line 99 of file RandGeneral.cc.
105 "RandGeneral constructed with no bins - will use flat distribution\n";
115 for ( ptn = 0; ptn<
nBins; ++ptn ) {
116 weight = aProbFunc[ptn];
121 "RandGeneral constructed with negative-weight bin " << ptn <<
122 " = " << weight <<
" \n -- will substitute 0 weight \n";
131 "RandGeneral constructed nothing in bins - will use flat distribution\n";
136 for ( ptn = 0; ptn < nBins+1; ++ptn ) {
149 <<
"\n Will use type 0 (continuous linear interpolation \n";
150 InterpolationType = 0;
void useFlatDistribution()
std::vector< double > theIntegralPdf
◆ put()
std::ostream & CLHEP::RandGeneral::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandom.
Definition at line 247 of file RandGeneral.cc.
248 int pr=os.precision(20);
249 std::vector<unsigned long> t(2);
250 os <<
" " <<
name() <<
"\n";
251 os <<
"Uvec" <<
"\n";
254 os << t[0] <<
" " << t[1] <<
"\n";
std::vector< double > theIntegralPdf
static std::vector< unsigned long > dto2longs(double d)
◆ shoot() [1/2]
double CLHEP::RandGeneral::shoot |
( |
| ) |
|
|
inline |
◆ shoot() [2/2]
◆ shootArray() [1/2]
void CLHEP::RandGeneral::shootArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
|
inline |
◆ shootArray() [2/2]
void CLHEP::RandGeneral::shootArray |
( |
HepRandomEngine * |
anEngine, |
|
|
const int |
size, |
|
|
double * |
vect |
|
) |
| |
◆ useFlatDistribution()
void CLHEP::RandGeneral::useFlatDistribution |
( |
| ) |
|
|
private |
◆ InterpolationType
int CLHEP::RandGeneral::InterpolationType |
|
private |
◆ localEngine
◆ nBins
int CLHEP::RandGeneral::nBins |
|
private |
◆ oneOverNbins
double CLHEP::RandGeneral::oneOverNbins |
|
private |
◆ theIntegralPdf
std::vector<double> CLHEP::RandGeneral::theIntegralPdf |
|
private |
The documentation for this class was generated from the following files: