Import Geant4 11.3.1 source tree
This commit is contained in:
Vendored
+3
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2025-02-04 Gabriele Cosmo (clhep-V11-02-00)
|
||||
- Properly export static symbols in RandFlat for DLL build support on Windows.
|
||||
|
||||
## 2023-10-13 Gabriele Cosmo (clhep-V11-01-03)
|
||||
- Synchronised with CLHEP-2.4.7.1.
|
||||
* Random (L.Garren)
|
||||
|
||||
+7
-14
@@ -29,6 +29,7 @@
|
||||
#define RandFlat_h 1
|
||||
|
||||
#include "CLHEP/Random/Random.h"
|
||||
#include "CLHEP/Utility/defs.h"
|
||||
#include "CLHEP/Utility/memory.h"
|
||||
#include "CLHEP/Utility/thread_local.h"
|
||||
|
||||
@@ -72,7 +73,7 @@ public:
|
||||
|
||||
static inline long shootInt( long a1, long n );
|
||||
|
||||
static inline int shootBit();
|
||||
static int shootBit();
|
||||
|
||||
static void shootArray ( const int size, double* vect );
|
||||
|
||||
@@ -92,7 +93,7 @@ public:
|
||||
|
||||
static inline long shootInt( HepRandomEngine* anEngine, long a1, long n );
|
||||
|
||||
static inline int shootBit( HepRandomEngine* );
|
||||
static int shootBit( HepRandomEngine* );
|
||||
|
||||
static inline void shootArray ( HepRandomEngine* anEngine,
|
||||
const int size, double* vect );
|
||||
@@ -159,14 +160,6 @@ public:
|
||||
static std::istream& restoreDistState ( std::istream & is );
|
||||
// Restores from stream the state of the cached data.
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
#if 0
|
||||
// Protected copy constructor. Defining it here disallows use by users.
|
||||
RandFlat(const RandFlat& d);
|
||||
#endif // 0
|
||||
|
||||
private:
|
||||
|
||||
// ShootBits generates an integer random number,
|
||||
@@ -174,8 +167,8 @@ private:
|
||||
// The number is stored in randomInt and firstUnusedBit
|
||||
|
||||
inline void fireBits();
|
||||
static inline void shootBits();
|
||||
static inline void shootBits(HepRandomEngine*);
|
||||
static void shootBits();
|
||||
static void shootBits(HepRandomEngine*);
|
||||
|
||||
// In MSB, the most significant bit of the integer random number
|
||||
// generated by ShootBits() is set.
|
||||
@@ -187,8 +180,8 @@ private:
|
||||
// on _each_ architecture.
|
||||
// (Aim: the random generators should be machine-independent).
|
||||
|
||||
static const unsigned long MSB;
|
||||
static const int MSBBits;
|
||||
DLL_API static const unsigned long MSB;
|
||||
DLL_API static const int MSBBits;
|
||||
// These two are set up in RandFlat.cc and need not be saved/restored
|
||||
|
||||
unsigned long randomInt;
|
||||
|
||||
@@ -62,20 +62,6 @@ inline long RandFlat::shootInt(long a1, long n) {
|
||||
return long(shoot()*double(n-a1)) + a1;
|
||||
}
|
||||
|
||||
inline void RandFlat::shootBits() {
|
||||
const double factor= 2.0*MSB; // this should fit into a double!
|
||||
staticFirstUnusedBit= MSB;
|
||||
staticRandomInt= (unsigned long)(factor*shoot());
|
||||
}
|
||||
|
||||
inline int RandFlat::shootBit() {
|
||||
if (staticFirstUnusedBit==0)
|
||||
shootBits();
|
||||
unsigned long temp= staticFirstUnusedBit&staticRandomInt;
|
||||
staticFirstUnusedBit>>= 1;
|
||||
return temp!=0;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
inline double RandFlat::shoot(HepRandomEngine* anEngine) {
|
||||
@@ -108,20 +94,6 @@ inline void RandFlat::shootArray(HepRandomEngine* anEngine,
|
||||
anEngine->flatArray(size,vect);
|
||||
}
|
||||
|
||||
inline void RandFlat::shootBits(HepRandomEngine* engine) {
|
||||
const double factor= 2.0*MSB; // this should fit into a double!
|
||||
staticFirstUnusedBit= MSB;
|
||||
staticRandomInt= (unsigned long)(factor*shoot(engine));
|
||||
}
|
||||
|
||||
inline int RandFlat::shootBit(HepRandomEngine* engine) {
|
||||
if (staticFirstUnusedBit==0)
|
||||
shootBits(engine);
|
||||
unsigned long temp= staticFirstUnusedBit&staticRandomInt;
|
||||
staticFirstUnusedBit>>= 1;
|
||||
return temp!=0;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
inline double RandFlat::fire() {
|
||||
|
||||
+28
@@ -102,6 +102,34 @@ void RandFlat::fireArray( const int size, double* vect,
|
||||
vect[i] = fire( lx, dx );
|
||||
}
|
||||
|
||||
void RandFlat::shootBits() {
|
||||
const double factor= 2.0*MSB; // this should fit into a double!
|
||||
staticFirstUnusedBit= MSB;
|
||||
staticRandomInt= (unsigned long)(factor*shoot());
|
||||
}
|
||||
|
||||
int RandFlat::shootBit() {
|
||||
if (staticFirstUnusedBit==0)
|
||||
shootBits();
|
||||
unsigned long temp= staticFirstUnusedBit&staticRandomInt;
|
||||
staticFirstUnusedBit>>= 1;
|
||||
return temp!=0;
|
||||
}
|
||||
|
||||
void RandFlat::shootBits(HepRandomEngine* engine) {
|
||||
const double factor= 2.0*MSB; // this should fit into a double!
|
||||
staticFirstUnusedBit= MSB;
|
||||
staticRandomInt= (unsigned long)(factor*shoot(engine));
|
||||
}
|
||||
|
||||
int RandFlat::shootBit(HepRandomEngine* engine) {
|
||||
if (staticFirstUnusedBit==0)
|
||||
shootBits(engine);
|
||||
unsigned long temp= staticFirstUnusedBit&staticRandomInt;
|
||||
staticFirstUnusedBit>>= 1;
|
||||
return temp!=0;
|
||||
}
|
||||
|
||||
void RandFlat::saveEngineStatus ( const char filename[] ) {
|
||||
|
||||
// First save the engine status just like the base class would do:
|
||||
|
||||
Reference in New Issue
Block a user