14 #ifndef DD4HEP_GEANT4RANDOM_H
15 #define DD4HEP_GEANT4RANDOM_H
27 namespace CLHEP {
class HepRandomEngine; }
33 namespace Simulation {
120 virtual void setSeed(
long seed);
126 virtual void setSeeds(
const long * seeds,
int size);
128 virtual void saveStatus(
const char filename[] =
"Config.conf")
const;
130 virtual void restoreStatus(
const char filename[] =
"Config.conf" );
143 double rndm(
int i=0);
151 double uniform(
double x1,
double x2);
154 double exp(
double tau);
156 double gauss(
double mean=0,
double sigma=1);
158 double landau(
double mean=0,
double sigma=1);
160 void circle(
double &x,
double &y,
double r);
162 void sphere(
double &x,
double &y,
double &z,
double r);
167 #endif // DD4HEP_GEANT4RANDOM_H
TRandom * m_rootRandom
Reference to ROOT random instance.
virtual void setSeeds(const long *seeds, int size)
Should initialise the status of the algorithm.
double uniform(double x1=1)
Create uniformly disributed random numbers in the interval ]0,x1].
bool m_inited
Flag to remember initialization.
double exp(double tau)
Create exponentially distributed random numbers.
double landau(double mean=0, double sigma=1)
Create landau distributed random numbers.
double rndm_clhep()
Create flat distributed random numbers in the interval ]0,1] calling CLHEP.
void sphere(double &x, double &y, double &z, double r)
Create tuple of randum number on a sphere with radius r.
Geant4Context * context() const
Access the context.
void circle(double &x, double &y, double r)
Create tuple of randum number around a circle with radius r.
const std::string & name() const
Access name of the action.
double rndm(int i=0)
Create flat distributed random numbers in the interval ]0,1].
long m_seed
Property: Initial random seed. Default: 123456789.
Main executor steering the Geant4 execution.
static Geant4Random * setMainInstance(Geant4Random *ptr)
Make this random generator instance the one used by Geant4.
virtual void saveStatus(const char filename[]="Config.conf") const
Should save on a file specific to the instantiated engine in use the current status.
void initialize()
Initialize the instance.
static Geant4Random * instance(bool throw_exception=true)
Access the main Geant4 random generator instance. Must be created before used!
bool m_replace
Property: Indicator to replace the ROOT gRandom instance.
void rndmArray(int n, float *array)
Create a float array of flat distributed random numbers in the interval ]0,1].
CLHEP::HepRandomEngine * m_engine
Reference to the CLHEP random number engine (valid only after initialization)
virtual void setSeed(long seed)
Should initialise the status of the algorithm according to seed.
virtual ~Geant4Random()
Default destructor.
double gauss(double mean=0, double sigma=1)
Create gaussian distributed random numbers.
CLHEP::HepRandomEngine * engine()
CLHEP random number engine (valid after initialization only)
std::string m_engineType
Property: Engine type. default: "HepJamesRandom".
virtual void restoreStatus(const char filename[]="Config.conf")
Should read from a file and restore the last saved engine configuration.
Geant4Random(Geant4Context *context, const std::string &name)
Standard constructor.
virtual void showStatus() const
Should dump the current engine status on the screen.
Generic context to extend user, run and event information.
Mini interface to THE random generator of the application.
std::string m_file
Property: File name if initialized from file. If set, engine name and seeds are ignored.
Default base class for all Geant 4 actions and derivates thereof.