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

StaticRandomStates.cc
Go to the documentation of this file.
1 // $Id:
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- StaticRandomStates ---
7 // class implementation file
8 // -----------------------------------------------------------------------
9 //
10 // =======================================================================
11 // Mark Fischler - Created: Dec. 21, 2004
12 // Mark Fischler - Modified restore() to utilize anonymous engine input
13 // to create anonymous restore of the static distributions
14 //
15 // =======================================================================
16 
17 #include "CLHEP/Random/StaticRandomStates.h"
18 #include "CLHEP/Random/RandGauss.h"
19 #include "CLHEP/Random/RandFlat.h"
20 #include <string>
21 #include <sstream>
22 
23 //======================//
24 // //
25 // Maintenance warning: //
26 // //
27 //======================//
28 //
29 // Currently, only two distributions (RandFlat and RandGauss) have cached
30 // distribution state. All such distributions must be saved below, so if
31 // another such distribution is added, this implementation file must be
32 // modified to reflect that.
33 
34 namespace CLHEP {
35 
36 
37 std::ostream & StaticRandomStates::save(std::ostream & os){
40  return os;
41 }
42 
43 #ifdef NOTYET
44 std::istream & StaticRandomStates::restore(std::istream & is) {
47  return is;
48 }
49 #endif
50 
51 std::istream & StaticRandomStates::restore(std::istream & 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 }
76 
77 } // namespace CLHEP
CLHEP::HepRandomEngine
Definition: Matrix/CLHEP/Random/RandomEngine.h:55
CLHEP::RandGauss::restoreDistState
static std::istream & restoreDistState(std::istream &is)
Definition: RandGauss.cc:338
CLHEP::HepRandomEngine::newEngine
static HepRandomEngine * newEngine(std::istream &is)
Definition: RandomEngine.cc:90
CLHEP::RandFlat::restoreDistState
static std::istream & restoreDistState(std::istream &is)
Definition: RandFlat.cc:234
is
HepRotation and so forth isNear() norm2() rectify() static Rotation row1 row4(To avoid bloat in the code pulled in for programs which don 't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation there is no longer much content in the distinct ZOOM PhysicsVectors library The only content left in the library is the object files representing the various Exception objects When we build the CLHEP classes for the ZOOM we will set up so as to use ZOOM SpaceVector is(but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace
CLHEP::RandGauss::restoreFullState
static std::istream & restoreFullState(std::istream &is)
Definition: RandGauss.cc:388
CLHEP::HepRandom::setTheEngine
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:171
CLHEP::HepRandomEngine::name
virtual std::string name() const =0
CLHEP::StaticRandomStates::restore
static std::istream & restore(std::istream &is)
Definition: StaticRandomStates.cc:51
CLHEP
Definition: ClhepVersion.h:13
CLHEP::StaticRandomStates::save
static std::ostream & save(std::ostream &os)
Definition: StaticRandomStates.cc:37
CLHEP::RandFlat::saveDistState
static std::ostream & saveDistState(std::ostream &os)
Definition: RandFlat.cc:225
CLHEP::RandGauss::saveFullState
static std::ostream & saveFullState(std::ostream &os)
Definition: RandGauss.cc:382
CLHEP::HepRandom::getTheEngine
static HepRandomEngine * getTheEngine()
Definition: Random.cc:166