1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // $Id: G4InclRandomNumbers.hh,v 1.3 2008/06/25 17:20:04 kaitanie Exp $ |
---|
27 | // Translation of INCL4.2/ABLA V3 |
---|
28 | // Pekka Kaitaniemi, HIP (translation) |
---|
29 | // Christelle Schmidt, IPNL (fission code) |
---|
30 | // Alain Boudard, CEA (contact person INCL/ABLA) |
---|
31 | // Aatos Heikkinen, HIP (project coordination) |
---|
32 | |
---|
33 | #include "globals.hh" |
---|
34 | #include "Randomize.hh" |
---|
35 | |
---|
36 | #ifndef G4InclRandomNumbers_hh |
---|
37 | #define G4InclRandomNumbers_hh 1 |
---|
38 | |
---|
39 | /** |
---|
40 | * Interface for the random number services. |
---|
41 | */ |
---|
42 | class G4InclRandomInterface { |
---|
43 | |
---|
44 | public: |
---|
45 | G4InclRandomInterface() { } |
---|
46 | G4InclRandomInterface(G4long seed) { |
---|
47 | this->seed = seed; |
---|
48 | } |
---|
49 | |
---|
50 | ~G4InclRandomInterface() { } |
---|
51 | |
---|
52 | /** |
---|
53 | * Provide evenly distributed random numbers. |
---|
54 | */ |
---|
55 | virtual G4double getRandom() = 0; |
---|
56 | |
---|
57 | private: |
---|
58 | G4long seed; |
---|
59 | }; |
---|
60 | |
---|
61 | /** |
---|
62 | * Provides dummy random number generator that always produces one |
---|
63 | * number. |
---|
64 | */ |
---|
65 | class G4InclDummyRandom : public G4InclRandomInterface { |
---|
66 | |
---|
67 | public: |
---|
68 | G4InclDummyRandom() { } |
---|
69 | |
---|
70 | ~G4InclDummyRandom() { } |
---|
71 | |
---|
72 | /** |
---|
73 | * Always return one "random" number. This interface is intended as |
---|
74 | * a debugging tool in order to produce some specific event. |
---|
75 | */ |
---|
76 | G4double getRandom() { |
---|
77 | return 0.5; |
---|
78 | } |
---|
79 | }; |
---|
80 | |
---|
81 | /** |
---|
82 | * Interface to the Geant4 random number services. |
---|
83 | */ |
---|
84 | class G4InclGeant4Random : public G4InclRandomInterface { |
---|
85 | |
---|
86 | public: |
---|
87 | G4InclGeant4Random() { } |
---|
88 | |
---|
89 | ~G4InclGeant4Random() { } |
---|
90 | |
---|
91 | /** |
---|
92 | * Always return one "random" number. This interface is intended as |
---|
93 | * a debugging tool in order to produce some specific event. |
---|
94 | */ |
---|
95 | G4double getRandom() { |
---|
96 | return G4UniformRand(); |
---|
97 | } |
---|
98 | }; |
---|
99 | |
---|
100 | #endif |
---|