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

RandomObjects/CLHEP/Random/NonRandomEngine.h
Go to the documentation of this file.
1 // $Id: NonRandomEngine.h,v 1.7 2011/07/01 15:20:30 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- NonRandomEngine ---
7 // class header file
8 // -----------------------------------------------------------------------
9 
10 // This class is present EXCLUSIVELY as a means to test distributions (and
11 // other programs that depend on random numbers) by feeding them a stream
12 // of "randoms" that the testing program supplies explicitly.
13 //
14 // The testing program calls setNextRandom (double) to setup the next
15 // value to be produced when flat() is done.
16 //
17 // To protect against accidental use of this NON-RANDOM engine as a random
18 // engine, if setNextRandom () is never called, all attempts to generate
19 // a random will fail and exit.
20 
21 // =======================================================================
22 // Mark Fischler - Created: 9/30/99
23 // Mark Fischler methods for distrib. instance save/restore 12/8/04
24 // Mark Fischler methods for anonymous save/restore 12/27/04
25 // =======================================================================
26 
27 #ifndef NonRandomEngine_h
28 #define NonRandomEngine_h 1
29 
30 #include "CLHEP/Random/defs.h"
31 #include "CLHEP/Random/RandomEngine.h"
32 #include <vector>
33 
34 namespace CLHEP {
35 
40 class NonRandomEngine : public HepRandomEngine {
41 
42 public:
43 
45  virtual ~NonRandomEngine();
46  // Constructors and destructor
47 
48  void setNextRandom (double r);
49  // Preset the next random to be delivered
50  void setRandomSequence (double *s, int n);
51  // Establish a sequence of n next randoms;
52  // replaces setNextRandom n times.
53  void setRandomInterval (double x);
54  // Establish that if there is no sequence active each
55  // random should be bumped by this interval (mod 1) compared
56  // to the last. x should be between 0 and 1.
57 
58  double flat();
59  // It returns the previously established setNextRandom and bumps that up
60  // by the non-zero randomInterval supplied. Thus repeated calls to flat()
61  // generate an evenly spaced sequence (mod 1).
62 
63  void flatArray (const int size, double* vect);
64  // Fills the array "vect" of specified size with flat random values.
65 
66  virtual std::ostream & put (std::ostream & os) const;
67  virtual std::istream & get (std::istream & is);
68  static std::string beginTag ( );
69  virtual std::istream & getState ( std::istream & is );
70 
71  std::string name() const;
72  static std::string engineName() {return "NonRandomEngine";}
73 
74  std::vector<unsigned long> put () const;
75  bool get (const std::vector<unsigned long> & v);
76  bool getState (const std::vector<unsigned long> & v);
77 
78 private:
79 
80  bool nextHasBeenSet;
81  bool sequenceHasBeenSet;
82  bool intervalHasBeenSet;
83  double nextRandom;
84  std::vector<double> sequence;
85  unsigned int nInSeq;
86  double randomInterval;
87 
88  // The following are necessary to fill virtual methods but should never
89  // be used:
90 
91  virtual void setSeed(long , int) {};
92  virtual void setSeeds(const long * , int) {};
93  virtual void saveStatus( const char* ) const {};
94  virtual void restoreStatus( const char* ) {};
95  virtual void showStatus() const {};
96 
97 
98 };
99 
100 } // namespace CLHEP
101 
102 #endif
CLHEP::NonRandomEngine::setNextRandom
void setNextRandom(double r)
Definition: NonRandomEngine.cc:46
CLHEP::NonRandomEngine::NonRandomEngine
NonRandomEngine()
Definition: NonRandomEngine.cc:36
CLHEP::NonRandomEngine::name
std::string name() const
Definition: NonRandomEngine.cc:34
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::NonRandomEngine::get
virtual std::istream & get(std::istream &is)
Definition: NonRandomEngine.cc:147
CLHEP::NonRandomEngine::put
std::vector< unsigned long > put() const
Definition: NonRandomEngine.cc:127
CLHEP::NonRandomEngine::getState
virtual std::istream & getState(std::istream &is)
Definition: NonRandomEngine.cc:164
CLHEP::NonRandomEngine::flatArray
void flatArray(const int size, double *vect)
Definition: NonRandomEngine.cc:95
CLHEP::detail::n
n
Definition: Ranlux64Engine.cc:85
CLHEP::NonRandomEngine::~NonRandomEngine
virtual ~NonRandomEngine()
Definition: NonRandomEngine.cc:43
size
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno size() Return the(integer) number of ZMthrow 'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available(see next function) to user code to track ZMthrow 'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the(integer) number of ZMthrow 'n exceptions that have been recorded via ZMerrno.write()
CLHEP
Definition: ClhepVersion.h:13
v
they are gone ZOOM Features Discontinued The following features of the ZOOM package were felt to be extreme overkill These have been after checking that no existing user code was utilizing as in SpaceVector v
Definition: keyMergeIssues.doc:324
CLHEP::NonRandomEngine::engineName
static std::string engineName()
Definition: RandomObjects/CLHEP/Random/NonRandomEngine.h:72
CLHEP::NonRandomEngine::flat
double flat()
Definition: NonRandomEngine.cc:68
x
any side effects of that construction would occur twice The semantics of throw x
Definition: whyZMthrowRethrows.txt:37
CLHEP::NonRandomEngine::setRandomSequence
void setRandomSequence(double *s, int n)
Definition: NonRandomEngine.cc:52
CLHEP::NonRandomEngine::beginTag
static std::string beginTag()
Definition: NonRandomEngine.cc:160
CLHEP::NonRandomEngine::setRandomInterval
void setRandomInterval(double x)
Definition: NonRandomEngine.cc:62