CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandomEngine.cc
Go to the documentation of this file.
1// $Id: RandomEngine.cc,v 1.7 2010/10/25 18:18:47 garren Exp $
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
18#include "CLHEP/Random/defs.h"
19#include "CLHEP/Random/RandomEngine.h"
20#include "CLHEP/Random/EngineFactory.h"
21
22//------------------------- HepRandomEngine ------------------------------
23
24namespace CLHEP {
25
27: theSeed (19780503L)
28, theSeeds(&theSeed)
29{ }
30
32
33HepRandomEngine::operator double() {
34 return flat();
35}
36
37HepRandomEngine::operator float() {
38 return float( flat() );
39}
40
41HepRandomEngine::operator unsigned int() {
42 return (unsigned int)( flat() * exponent_bit_32() );
43}
44
45bool
46HepRandomEngine::checkFile (std::istream & file,
47 const std::string & filename,
48 const std::string & classname,
49 const std::string & methodname) {
50 if (!file) {
51 std::cerr << "Failure to find or open file " << filename <<
52 " in " << classname << "::" << methodname << "()\n";
53 return false;
54 }
55 return true;
56}
57
58std::ostream & HepRandomEngine::put (std::ostream & os) const {
59 std::cerr << "HepRandomEngine::put called -- no effect!\n";
60 return os;
61}
62std::istream & HepRandomEngine::get (std::istream & is) {
63 std::cerr << "HepRandomEngine::get called -- no effect!\n";
64 return is;
65}
66
67std::string HepRandomEngine::beginTag ( ) {
68 return "HepRandomEngine-begin";
69}
70
71std::istream & HepRandomEngine::getState ( std::istream & is ) {
72 std::cerr << "HepRandomEngine::getState called -- no effect!\n";
73 return is;
74}
75
76std::vector<unsigned long> HepRandomEngine::put () const {
77 std::cerr << "v=HepRandomEngine::put() called -- no data!\n";
78 std::vector<unsigned long> v;
79 return v;
80}
81bool HepRandomEngine::get (const std::vector<unsigned long> & ) {
82 std::cerr << "HepRandomEngine::get(v) called -- no effect!\n";
83 return false;
84}
85bool HepRandomEngine::getState (const std::vector<unsigned long> & ) {
86 std::cerr << "HepRandomEngine::getState(v) called -- no effect!\n";
87 return false;
88}
89
93
95HepRandomEngine::newEngine(const std::vector<unsigned long> & v) {
97}
98
99std::ostream & operator<< (std::ostream & os, const HepRandomEngine & e) {
100 return e.put(os);
101}
102
103std::istream & operator>> (std::istream & is, HepRandomEngine & e) {
104 return e.get(is);
105}
106
107
108} // namespace CLHEP
static HepRandomEngine * newEngine(std::istream &is)
virtual std::ostream & put(std::ostream &os) const
virtual std::istream & getState(std::istream &is)
static bool checkFile(std::istream &file, const std::string &filename, const std::string &classname, const std::string &methodname)
virtual std::istream & get(std::istream &is)
static HepRandomEngine * newEngine(std::istream &is)
static std::string beginTag()
virtual std::vector< unsigned long > put() const
#define double(obj)
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)
Definition AxisAngle.cc:86
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)
Definition AxisAngle.cc:96