Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CLHEP::StaticRandomStates Class Reference

#include <StaticRandomStates.h>

Static Public Member Functions

static std::ostream & save (std::ostream &os)
 
static std::istream & restore (std::istream &is)
 

Detailed Description

Author
mf@fn.nosp@m.al.g.nosp@m.ov

Definition at line 26 of file StaticRandomStates.h.

Member Function Documentation

◆ restore()

std::istream & CLHEP::StaticRandomStates::restore ( std::istream &  is)
static

Definition at line 51 of file StaticRandomStates.cc.

51 {
52 HepRandomEngine * e = HepRandom::getTheEngine();
53 HepRandomEngine *ne = HepRandomEngine::newEngine(is);
54 if ( !is ) return is;
55 if ( !ne ) return is;
56 if (ne->name() == e->name()) {
57 // Because e has const data members, cannot simply do *e = *ne
58 std::ostringstream os;
59 os << *ne;
60 std::istringstream istst(os.str());
61 istst >> *e;
62 if (!istst) {
63 std::cerr << "???? Unexpected behavior in StaticRandomStates::restore:\n"
64 << "The new engine, which had been input successfully from istream\n"
65 << "has encountered a problem when used to set state of theEngine\n";
66 is.clear(std::ios::badbit | is.rdstate());
67 return is;
68 }
69 } else {
71 }
74 return is;
75}
static HepRandomEngine * newEngine(std::istream &is)
Definition: RandomEngine.cc:91
static HepRandomEngine * getTheEngine()
Definition: Random.cc:268
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:273
static std::istream & restoreDistState(std::istream &is)
Definition: RandFlat.cc:213
static std::istream & restoreDistState(std::istream &is)
Definition: RandGauss.cc:346

◆ save()

std::ostream & CLHEP::StaticRandomStates::save ( std::ostream &  os)
static

Definition at line 37 of file StaticRandomStates.cc.

37 {
40 return os;
41}
static std::ostream & saveDistState(std::ostream &os)
Definition: RandFlat.cc:204
static std::ostream & saveFullState(std::ostream &os)
Definition: RandGauss.cc:390

The documentation for this class was generated from the following files: