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