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

Random/CLHEP/Random/RandChiSquare.h
Go to the documentation of this file.
1 // $Id: RandChiSquare.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandChiSquare ---
7 // class header file
8 // -----------------------------------------------------------------------
9 
10 // Class defining methods for shooting Chi^2 distributed random values,
11 // given a number of degrees of freedom a (default=1.0).
12 // Default values are used for operator()().
13 
14 // Valid values of a satisfy a > 1. When invalid values are presented,
15 // the code silently returns -1.0.
16 
17 // =======================================================================
18 // John Marraffino - Created: 12th May 1998 Based on the C-Rand package
19 // by Ernst Stadlober and Franz Niederl of the Technical
20 // University of Graz, Austria.
21 // Gabriele Cosmo - Removed useless methods and data: 5th Jan 1999
22 // M Fischler - put and get to/from streams 12/10/04
23 // =======================================================================
24 
25 #ifndef RandChiSquare_h
26 #define RandChiSquare_h 1
27 
28 #include "CLHEP/Random/defs.h"
29 #include "CLHEP/Random/Random.h"
30 #include "CLHEP/Utility/memory.h"
31 
32 namespace CLHEP {
33 
38 class RandChiSquare : public HepRandom {
39 
40 public:
41 
42  inline RandChiSquare ( HepRandomEngine& anEngine, double a=1 );
43  inline RandChiSquare ( HepRandomEngine* anEngine, double a=1 );
44  // These constructors should be used to instantiate a RandChiSquare
45  // distribution object defining a local engine for it.
46  // The static generator will be skipped using the non-static methods
47  // defined below.
48  // If the engine is passed by pointer the corresponding engine object
49  // will be deleted by the RandChiSquare destructor.
50  // If the engine is passed by reference the corresponding engine object
51  // will not be deleted by the RandChiSquare destructor.
52 
53  virtual ~RandChiSquare();
54  // Destructor
55 
56  // Static methods to shoot random values using the static generator
57 
58  static inline double shoot();
59 
60  static double shoot( double a );
61 
62  static void shootArray ( const int size, double* vect,
63  double a=1.0 );
64 
65  // Static methods to shoot random values using a given engine
66  // by-passing the static generator.
67 
68  static inline double shoot( HepRandomEngine* anEngine );
69 
70  static double shoot( HepRandomEngine* anEngine,
71  double a );
72 
73  static void shootArray ( HepRandomEngine* anEngine, const int size,
74  double* vect, double a=1.0 );
75 
76  // Methods using the localEngine to shoot random values, by-passing
77  // the static generator.
78 
79  inline double fire();
80 
81  double fire( double a );
82 
83  void fireArray ( const int size, double* vect);
84  void fireArray ( const int size, double* vect,
85  double a );
86  inline double operator()();
87  inline double operator()( double a );
88 
89  // Save and restore to/from streams
90 
91  std::ostream & put ( std::ostream & os ) const;
92  std::istream & get ( std::istream & is );
93 
94  std::string name() const;
95  HepRandomEngine & engine();
96 
97  static std::string distributionName() {return "RandChiSquare";}
98  // Provides the name of this distribution class
99 
100 private:
101 
102  static double genChiSquare( HepRandomEngine *anEngine, double a );
103 
104  shared_ptr<HepRandomEngine> localEngine;
105  double defaultA;
106 
107 };
108 
109 } // namespace CLHEP
110 
111 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
112 // backwards compatibility will be enabled ONLY in CLHEP 1.9
113 using namespace CLHEP;
114 #endif
115 
116 #include "CLHEP/Random/RandChiSquare.icc"
117 
118 #endif
CLHEP::RandChiSquare::fire
double fire()
CLHEP::shared_ptr
Definition: Matrix/CLHEP/Utility/memory.h:66
CLHEP::RandChiSquare::name
std::string name() const
Definition: RandChiSquare.cc:25
a
@ a
Definition: testCategories.cc:125
CLHEP::RandChiSquare::operator()
double operator()()
CLHEP::HepRandomEngine
Definition: Matrix/CLHEP/Random/RandomEngine.h:55
CLHEP::RandChiSquare::get
std::istream & get(std::istream &is)
Definition: RandChiSquare.cc:156
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::RandChiSquare::distributionName
static std::string distributionName()
Definition: Random/CLHEP/Random/RandChiSquare.h:97
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::RandChiSquare::shootArray
static void shootArray(const int size, double *vect, double a=1.0)
Definition: RandChiSquare.cc:44
CLHEP::RandChiSquare::~RandChiSquare
virtual ~RandChiSquare()
Definition: RandChiSquare.cc:28
CLHEP::RandChiSquare::engine
HepRandomEngine & engine()
Definition: RandChiSquare.cc:26
CLHEP
Definition: ClhepVersion.h:13
CLHEP::RandChiSquare::put
std::ostream & put(std::ostream &os) const
Definition: RandChiSquare.cc:138
CLHEP::RandChiSquare::shoot
static double shoot()
CLHEP::RandChiSquare::fireArray
void fireArray(const int size, double *vect)
Definition: RandChiSquare.cc:58
CLHEP::RandChiSquare::RandChiSquare
RandChiSquare(HepRandomEngine &anEngine, double a=1)