[967] | 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 | // |
---|
[1347] | 26 | // $Id: G4InclRandomNumbers.hh,v 1.8 2010/11/13 00:08:36 kaitanie Exp $ |
---|
[967] | 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: |
---|
[1347] | 45 | G4InclRandomInterface() { |
---|
| 46 | this->seed = 1337; // Default seed, this is never actually used. |
---|
| 47 | } |
---|
[967] | 48 | G4InclRandomInterface(G4long seed) { |
---|
| 49 | this->seed = seed; |
---|
| 50 | } |
---|
| 51 | |
---|
[1337] | 52 | virtual ~G4InclRandomInterface() { } |
---|
[967] | 53 | |
---|
| 54 | /** |
---|
| 55 | * Provide evenly distributed random numbers. |
---|
| 56 | */ |
---|
| 57 | virtual G4double getRandom() = 0; |
---|
[1340] | 58 | virtual void printSeeds() = 0; |
---|
[967] | 59 | private: |
---|
| 60 | G4long seed; |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | * Provides dummy random number generator that always produces one |
---|
| 65 | * number. |
---|
| 66 | */ |
---|
| 67 | class G4InclDummyRandom : public G4InclRandomInterface { |
---|
| 68 | |
---|
| 69 | public: |
---|
| 70 | G4InclDummyRandom() { } |
---|
| 71 | |
---|
| 72 | ~G4InclDummyRandom() { } |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Always return one "random" number. This interface is intended as |
---|
| 76 | * a debugging tool in order to produce some specific event. |
---|
| 77 | */ |
---|
| 78 | G4double getRandom() { |
---|
| 79 | return 0.5; |
---|
| 80 | } |
---|
[1340] | 81 | |
---|
| 82 | void printSeeds() {}; |
---|
[967] | 83 | }; |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | * Interface to the Geant4 random number services. |
---|
| 87 | */ |
---|
| 88 | class G4InclGeant4Random : public G4InclRandomInterface { |
---|
| 89 | |
---|
| 90 | public: |
---|
| 91 | G4InclGeant4Random() { } |
---|
| 92 | |
---|
| 93 | ~G4InclGeant4Random() { } |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * Always return one "random" number. This interface is intended as |
---|
| 97 | * a debugging tool in order to produce some specific event. |
---|
| 98 | */ |
---|
| 99 | G4double getRandom() { |
---|
| 100 | return G4UniformRand(); |
---|
| 101 | } |
---|
[1340] | 102 | |
---|
| 103 | void printSeeds() { |
---|
| 104 | G4cout <<"Using Geant4 random number generator." << G4endl; |
---|
| 105 | }; |
---|
[967] | 106 | }; |
---|
| 107 | |
---|
| 108 | #endif |
---|