Bayeux  3.4.1
Core Foundation library for SuperNEMO
g4_prng.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2011-02-26
4  * Last modified : 2013-03-09
5  *
6  * Copyright (C) 2011-2013 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * GEANT4 PRNG based on mygsl::rng
26  *
27  * History:
28  *
29  */
30 
31 #ifndef MCTOOLS_G4_G4_PRNG_H
32 #define MCTOOLS_G4_G4_PRNG_H 1
33 
34 // Standard library:
35 #include <iostream>
36 #include <string>
37 
38 // Third party:
39 // - CLHEP:
40 #include <CLHEP/Random/RandomEngine.h>
41 
42 namespace mygsl {
43  class rng;
44 }
45 namespace mctools {
46 
47  namespace g4 {
48 
49  class g4_prng : public CLHEP::HepRandomEngine
50  {
51  public:
52 
53  static const int SEED_INVALID = -1;
54  static const int SEED_TIME = 0;
55 
57  g4_prng ();
58 
60  g4_prng (mygsl::rng &);
61 
63  virtual ~g4_prng ();
64 
65  void set_random (mygsl::rng & rng_);
66 
67  virtual double flat ();
68 
69  virtual void flatArray (const int size, double* vect);
70 
71  virtual void setSeed (long seed, int dummy_ = 0);
72 
73  virtual void setSeeds (const long * seeds, int index_ = -1);
74 
75  virtual void saveStatus ( const char filename[] = "G4PRNG.conf") const;
76 
77  virtual void restoreStatus ( const char filename[] = "G4PRNG.conf" );
78 
79  virtual void showStatus () const;
80 
81  virtual std::string name () const;
82 
83  private:
84 
85  int _random_seed_;
86  mygsl::rng * _random_;
87 
88  };
89 
90  } // end of namespace g4
91 
92 } // end of namespace mctools
93 
94 #endif // MCTOOLS_G4_G4_PRNG_H
95 
96 /*
97 ** Local Variables: --
98 ** mode: c++ --
99 ** c-file-style: "gnu" --
100 ** tab-width: 2 --
101 ** End: --
102 */
virtual void showStatus() const
Definition: base_step_hit.h:32
Definition: g4_prng.h:49
virtual std::string name() const
virtual void saveStatus(const char filename[]="G4PRNG.conf") const
static const int SEED_TIME
Definition: g4_prng.h:54
static const int SEED_INVALID
Definition: g4_prng.h:53
g4_prng()
Constructor.
virtual void restoreStatus(const char filename[]="G4PRNG.conf")
virtual void setSeed(long seed, int dummy_=0)
void set_random(mygsl::rng &rng_)
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
virtual ~g4_prng()
Destructor.
virtual void setSeeds(const long *seeds, int index_=-1)
virtual double flat()
virtual void flatArray(const int size, double *vect)
Pseudo random number generator.
Definition: rng.h:53