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

Matrix/CLHEP/Random/RandBit.h
Go to the documentation of this file.
1 // $Id: RandBit.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandBit ---
7 // class header file
8 // -----------------------------------------------------------------------
9 //
10 
11 // Class defining methods for shooting Flat or Bit random numbers, double or
12 // integers.
13 // It provides methods to fill with double flat values arrays of
14 // specified size, as well as methods for shooting sequences of 0,1 (bits).
15 // Default boundaries ]0.1[ for operator()().
16 
17 // This is derived from RandFlat and is a drop-in replacement. However
18 // the shootBit() and fireBit() methods are stateless (which makes them
19 // an order of magnitude slower, but allows save/restore engine status
20 // to work correctly).
21 
22 // =======================================================================
23 // M. Fischler - Created: 15th Feb 2000
24 // M Fischler - put and get to/from streams 12/10/04
25 // M Fischler - static save/restore to streams streams 12/20/04
26 // =======================================================================
27 
28 #ifndef RandBit_h
29 #define RandBit_h 1
30 
31 #include "CLHEP/Random/defs.h"
32 #include "CLHEP/Random/RandFlat.h"
33 
34 namespace CLHEP {
35 
40 class RandBit : public RandFlat {
41 
42 public:
43 
44  inline RandBit ( HepRandomEngine& anEngine );
45  inline RandBit ( HepRandomEngine& anEngine, double width );
46  inline RandBit ( HepRandomEngine& anEngine, double a, double b );
47  inline RandBit ( HepRandomEngine* anEngine );
48  inline RandBit ( HepRandomEngine* anEngine, double width );
49  inline RandBit ( HepRandomEngine* anEngine, double a, double b );
50  // These constructors should be used to instantiate a RandBit
51  // distribution object defining a local engine for it.
52  // The static generator will be skipped using the non-static methods
53  // defined below.
54  // If the engine is passed by pointer the corresponding engine object
55  // will be deleted by the RandBit destructor.
56  // If the engine is passed by reference the corresponding engine object
57  // will not be deleted by the RandBit destructor.
58 
59  virtual ~RandBit();
60  // Destructor
61 
62  // Other than the Bit routines, constructors, and destructor, everything is
63  // simply inherited from RandFlat.
64 
65  static inline int shootBit();
66 
67  static inline int shootBit( HepRandomEngine* );
68 
69  // Methods using the localEngine to shoot random values, by-passing
70  // the static generator.
71 
72  inline int fireBit();
73 
74  // Save and restore to/from streams
75 
76  std::ostream & put ( std::ostream & os ) const;
77  std::istream & get ( std::istream & is );
78 
79  std::string name() const;
80 
81  static std::string distributionName() {return "RandBit";}
82  // Provides the name of this distribution class
83 
84  static std::ostream& saveFullState ( std::ostream & os )
85  // Saves to stream the state of the engine and cached data.
86  {return RandFlat::saveFullState(os);}
87 
88  static std::istream& restoreFullState ( std::istream & is )
89  // Restores from stream the state of the engine and cached data.
91 
92  static std::ostream& saveDistState ( std::ostream & os )
93  // Saves to stream the state of the cached data.
94  {return RandFlat::saveDistState(os);}
95 
96  static std::istream& restoreDistState ( std::istream & is )
97  // Restores from stream the state of the cached data.
99 
100 
101 private:
102 
103  // All the engine info, and the default A and B, are in the RandFlat
104  // base class.
105 
106 };
107 
108 } // namespace CLHEP
109 
110 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
111 // backwards compatibility will be enabled ONLY in CLHEP 1.9
112 using namespace CLHEP;
113 #endif
114 
115 #include "CLHEP/Random/RandBit.icc"
116 
117 #endif
CLHEP::RandBit::~RandBit
virtual ~RandBit()
Definition: RandBit.cc:25
a
@ a
Definition: testCategories.cc:125
CLHEP::HepRandomEngine
Definition: Matrix/CLHEP/Random/RandomEngine.h:55
CLHEP::RandFlat::saveFullState
static std::ostream & saveFullState(std::ostream &os)
Definition: RandFlat.cc:259
b
@ b
Definition: testCategories.cc:125
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::RandBit::restoreFullState
static std::istream & restoreFullState(std::istream &is)
Definition: Matrix/CLHEP/Random/RandBit.h:88
CLHEP::RandFlat::restoreFullState
static std::istream & restoreFullState(std::istream &is)
Definition: RandFlat.cc:265
CLHEP::RandBit::get
std::istream & get(std::istream &is)
Definition: RandBit.cc:34
CLHEP::RandBit
Definition: Matrix/CLHEP/Random/RandBit.h:40
CLHEP::RandBit::shootBit
static int shootBit()
CLHEP
Definition: ClhepVersion.h:13
CLHEP::RandBit::saveDistState
static std::ostream & saveDistState(std::ostream &os)
Definition: Matrix/CLHEP/Random/RandBit.h:92
CLHEP::RandBit::RandBit
RandBit(HepRandomEngine &anEngine)
CLHEP::RandFlat::saveDistState
static std::ostream & saveDistState(std::ostream &os)
Definition: RandFlat.cc:225
CLHEP::RandBit::distributionName
static std::string distributionName()
Definition: Matrix/CLHEP/Random/RandBit.h:81
CLHEP::RandBit::restoreDistState
static std::istream & restoreDistState(std::istream &is)
Definition: Matrix/CLHEP/Random/RandBit.h:96
CLHEP::RandFlat
Definition: Matrix/CLHEP/Random/RandFlat.h:42
CLHEP::RandBit::name
std::string name() const
Definition: RandBit.cc:23
CLHEP::RandBit::fireBit
int fireBit()
CLHEP::RandBit::put
std::ostream & put(std::ostream &os) const
Definition: RandBit.cc:28
CLHEP::RandBit::saveFullState
static std::ostream & saveFullState(std::ostream &os)
Definition: Matrix/CLHEP/Random/RandBit.h:84