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
RandomEngine.cc
Go to the documentation of this file.
1// $Id:$
2// -*- C++ -*-
3//
4// ------------------------------------------------------------------------
5// HEP Random
6// --- HepRandomEngine ---
7// class implementation file
8// ------------------------------------------------------------------------
9// This file is part of Geant4 (simulation toolkit for HEP).
10
11// ========================================================================
12// Gabriele Cosmo - Created: 5th September 1995
13// - Minor corrections: 31st October 1996
14// - Moved table of seeds to HepRandom: 19th March 1998
15// Ken Smith - Added conversion operators: 6th Aug 1998
16// =======================================================================
17
20
21//------------------------- HepRandomEngine ------------------------------
22
23namespace CLHEP {
24
26: theSeed (19780503L)
27, theSeeds(&theSeed)
28{ }
29
31
32HepRandomEngine::operator double() {
33 return flat();
34}
35
36HepRandomEngine::operator float() {
37 return float( flat() );
38}
39
40HepRandomEngine::operator unsigned int() {
41 return (unsigned int)( flat() * exponent_bit_32() );
42}
43
44bool
45HepRandomEngine::checkFile (std::istream & file,
46 const std::string & filename,
47 const std::string & classname,
48 const std::string & methodname) {
49 if (!file) {
50 std::cerr << "Failure to find or open file " << filename <<
51 " in " << classname << "::" << methodname << "()\n";
52 return false;
53 }
54 return true;
55}
56
57std::ostream & HepRandomEngine::put (std::ostream & os) const {
58 std::cerr << "HepRandomEngine::put called -- no effect!\n";
59 return os;
60}
61std::istream & HepRandomEngine::get (std::istream & is) {
62 std::cerr << "HepRandomEngine::get called -- no effect!\n";
63 return is;
64}
65
66std::string HepRandomEngine::beginTag ( ) {
67 return "HepRandomEngine-begin";
68}
69
70std::istream & HepRandomEngine::getState ( std::istream & is ) {
71 std::cerr << "HepRandomEngine::getState called -- no effect!\n";
72 return is;
73}
74
75std::vector<unsigned long> HepRandomEngine::put () const {
76 std::cerr << "v=HepRandomEngine::put() called -- no data!\n";
77 std::vector<unsigned long> v;
78 return v;
79}
80bool HepRandomEngine::get (const std::vector<unsigned long> & ) {
81 std::cerr << "HepRandomEngine::get(v) called -- no effect!\n";
82 return false;
83}
84bool HepRandomEngine::getState (const std::vector<unsigned long> & ) {
85 std::cerr << "HepRandomEngine::getState(v) called -- no effect!\n";
86 return false;
87}
88
90 return EngineFactory::newEngine(is);
91}
92
94HepRandomEngine::newEngine(const std::vector<unsigned long> & v) {
96}
97
98std::ostream & operator<< (std::ostream & os, const HepRandomEngine & e) {
99 return e.put(os);
100}
101
102std::istream & operator>> (std::istream & is, HepRandomEngine & e) {
103 return e.get(is);
104}
105
106
107} // namespace CLHEP
static HepRandomEngine * newEngine(std::istream &is)
virtual std::ostream & put(std::ostream &os) const
Definition: RandomEngine.cc:57
virtual std::istream & getState(std::istream &is)
Definition: RandomEngine.cc:70
static bool checkFile(std::istream &file, const std::string &filename, const std::string &classname, const std::string &methodname)
Definition: RandomEngine.cc:45
virtual std::istream & get(std::istream &is)
Definition: RandomEngine.cc:61
static HepRandomEngine * newEngine(std::istream &is)
Definition: RandomEngine.cc:89
static std::string beginTag()
Definition: RandomEngine.cc:66
virtual std::vector< unsigned long > put() const
Definition: RandomEngine.cc:75
Definition: DoubConv.h:17
std::istream & operator>>(std::istream &is, HepRandom &dist)
Definition: Random.cc:120
std::ostream & operator<<(std::ostream &os, const HepRandom &dist)
Definition: Random.cc:116