30 #if ((defined(G4MULTITHREADED) && !defined(G4USE_STD11)) || \
31 !__has_feature(cxx_thread_local))
32 #define CLANG_NOSTDTLS
36 #if (defined(G4MULTITHREADED) && \
37 (!defined(G4USE_STD11) || (defined(CLANG_NOSTDTLS))))
48 : deleteEngine(false),
50 InterpolationType(IntType)
53 prepareTable(aProbFunc);
60 : localEngine(&anEngine),
63 InterpolationType(IntType)
65 prepareTable(aProbFunc);
72 : localEngine(anEngine),
75 InterpolationType(IntType)
77 prepareTable(aProbFunc);
87 "G4MTRandGeneral constructed with no bins - will use flat distribution\n";
97 for ( ptn = 0; ptn<
nBins; ++ptn ) {
98 weight = aProbFunc[ptn];
103 "G4MTRandGeneral constructed with negative-weight bin " << ptn <<
104 " = " << weight <<
" \n -- will substitute 0 weight \n";
113 "G4MTRandGeneral constructed nothing in bins - will use flat distribution\n";
118 for ( ptn = 0; ptn < nBins+1; ++ptn ) {
131 <<
"\n Will use type 0 (continuous linear interpolation \n";
132 InterpolationType = 0;
175 while (nabove > nbelow+1) {
176 middle = (nabove + nbelow+1)>>1;
199 if ( binMeasure == 0 ) {
206 G4double binFraction = (rand - theIntegralPdf[nbelow]) / binMeasure;
217 for (
G4int i=0; i<size; ++i)
218 vect[i] =
shoot(anEngine);
223 for (
G4int i=0; i<size; ++i)
static CLHEP::HepRandomEngine * getTheEngine()
void shootArray(const G4int size, G4double *vect)
G4double mapRandom(G4double rand) const
void fireArray(const G4int size, G4double *vect)
CLHEP::HepRandomEngine * localEngine
std::vector< G4double > theIntegralPdf
G4MTRandGeneral(const G4double *aProbFunc, G4int theProbSize, G4int IntType=0)
void prepareTable(const G4double *aProbFunc)
virtual ~G4MTRandGeneral()
void useFlatDistribution()