Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RandExponential.h
Go to the documentation of this file.
1// $Id:$
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandExponential ---
7// class header file
8// -----------------------------------------------------------------------
9// This file is part of Geant4 (simulation toolkit for HEP).
10//
11// Class defining methods for shooting exponential distributed random
12// values, given a mean (default mean = 1).
13// Default mean is used for operator()().
14
15// =======================================================================
16// Gabriele Cosmo - Created: 5th September 1995
17// - Added methods to shoot arrays: 28th July 1997
18// J.Marraffino - Added default mean as attribute and
19// operator() with mean: 16th Feb 1998
20// M Fischler - put and get to/from streams 12/10/04
21// =======================================================================
22
23#ifndef RandExponential_h
24#define RandExponential_h 1
25
26#include "CLHEP/Random/Random.h"
28
29namespace CLHEP {
30
31/**
32 * @author <Gabriele.Cosmo@cern.ch>
33 * @ingroup random
34 */
35class RandExponential : public HepRandom {
36
37public:
38
39 inline RandExponential ( HepRandomEngine& anEngine, double mean=1.0 );
40 inline RandExponential ( HepRandomEngine* anEngine, double mean=1.0 );
41 // These constructors should be used to instantiate a RandExponential
42 // distribution object defining a local engine for it.
43 // The static generator will be skipped using the non-static methods
44 // defined below.
45 // If the engine is passed by pointer the corresponding engine object
46 // will be deleted by the RandExponential destructor.
47 // If the engine is passed by reference the corresponding engine object
48 // will not be deleted by the RandExponential destructor.
49
50 virtual ~RandExponential();
51 // Destructor
52
53 // Static methods to shoot random values using the static generator
54
55 static double shoot();
56
57 static double shoot( double mean );
58
59 static void shootArray ( const int size, double* vect,
60 double mean=1.0 );
61
62 // Static methods to shoot random values using a given engine
63 // by-passing the static generator.
64
65 static inline double shoot( HepRandomEngine* anEngine );
66
67 static inline double shoot( HepRandomEngine* anEngine, double mean );
68
69 static void shootArray ( HepRandomEngine* anEngine, const int size,
70 double* vect, double mean=1.0 );
71
72 // Methods using the localEngine to shoot random values, by-passing
73 // the static generator.
74
75 inline double fire();
76
77 inline double fire( double mean );
78
79 void fireArray ( const int size, double* vect );
80 void fireArray ( const int size, double* vect, double mean );
81
82 double operator()();
83 double operator()( double mean );
84
85 // Save and restore to/from streams
86
87 std::ostream & put ( std::ostream & os ) const;
88 std::istream & get ( std::istream & is );
89
90 std::string name() const;
92
93 static std::string distributionName() {return "RandExponential";}
94 // Provides the name of this distribution class
95
96private:
97
99 double defaultMean;
100
101};
102
103} // namespace CLHEP
104
105#include "CLHEP/Random/RandExponential.icc"
106
107#endif
std::ostream & put(std::ostream &os) const
double fire(double mean)
static double shoot(HepRandomEngine *anEngine)
RandExponential(HepRandomEngine &anEngine, double mean=1.0)
static void shootArray(const int size, double *vect, double mean=1.0)
std::istream & get(std::istream &is)
RandExponential(HepRandomEngine *anEngine, double mean=1.0)
std::string name() const
void fireArray(const int size, double *vect)
static std::string distributionName()
static double shoot(HepRandomEngine *anEngine, double mean)
HepRandomEngine & engine()
Definition: DoubConv.h:17