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

RandomObjects/CLHEP/Random/RandSkewNormal.h
Go to the documentation of this file.
1 // $Id: RandSkewNormal.h,v 1.1 2011/05/27 20:36:28 garren Exp $
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandSkewNormal ---
7 // class header file
8 // -----------------------------------------------------------------------
9 
10 // RandSkewNormal ---
11 // returns a skew-normal distribution with shape parameter k
12 // To get a distribution with scale parameter b and location m:
13 // r = m + b * RandSkewNormal.fire(k);
14 // http://azzalini.stat.unipd.it/SN/
15 // algorithm from K. McFarlane, June 2010.
16 
17 // =======================================================================
18 // M Fischler and L Garren - Created: 26 May 2011
19 // =======================================================================
20 
21 #ifndef RandSkewNormal_h
22 #define RandSkewNormal_h 1
23 
24 #include "CLHEP/Random/defs.h"
25 #include "CLHEP/Random/Random.h"
26 #include "CLHEP/Utility/memory.h"
27 
28 namespace CLHEP {
29 
34 class RandSkewNormal : public HepRandom {
35 
36 public:
37 
38  inline RandSkewNormal ( HepRandomEngine& anEngine, double shape=0. );
39  inline RandSkewNormal ( HepRandomEngine* anEngine, double shape=0. );
40  // These constructors should be used to instantiate a RandSkewNormal
41  // distribution object defining a local engine for it.
42  // The static generator will be skipped using the non-static methods
43  // defined below.
44  // If the engine is passed by pointer the corresponding engine object
45  // will be deleted by the RandSkewNormal destructor.
46  // If the engine is passed by reference the corresponding engine object
47  // will not be deleted by the RandSkewNormal destructor.
48 
49  virtual ~RandSkewNormal();
50  // Destructor
51 
52  // Static methods to shoot random values using the static generator
53 
54  static double shoot();
55 
56  static double shoot( double shape );
57 
58  static void shootArray ( const int size, double* vect,
59  double shape=0. );
60 
61  // Static methods to shoot random values using a given engine
62  // by-passing the static generator.
63 
64  static double shoot( HepRandomEngine* anEngine );
65 
66  static double shoot( HepRandomEngine* anEngine, double shape );
67 
68  static void shootArray ( HepRandomEngine* anEngine, const int size,
69  double* vect, double shape=0. );
70 
71  // Methods using the localEngine to shoot random values, by-passing
72  // the static generator.
73 
74  double fire();
75 
76  double fire( double shape );
77 
78  void fireArray ( const int size, double* vect );
79  void fireArray ( const int size, double* vect, double shape );
80 
81  double operator()();
82  double operator()( double shape );
83 
84  // Save and restore to/from streams
85 
86  std::ostream & put ( std::ostream & os ) const;
87  std::istream & get ( std::istream & is );
88 
89  std::string name() const;
90  HepRandomEngine & engine();
91 
92  static std::string distributionName() {return "RandSkewNormal";}
93  // Provides the name of this distribution class
94 
95 protected:
96 
97  static double gaussianSkewNormal ( HepRandomEngine *e, double k);
98  double getShapeParameter() { return shapeParameter; }
99 
101 
102 private:
103 
104  shared_ptr<HepRandomEngine> localEngine;
105  double shapeParameter;
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/RandSkewNormal.icc"
117 
118 #endif
CLHEP::shared_ptr
Definition: Matrix/CLHEP/Utility/memory.h:66
CLHEP::RandSkewNormal::distributionName
static std::string distributionName()
Definition: RandomObjects/CLHEP/Random/RandSkewNormal.h:92
CLHEP::RandSkewNormal::fireArray
void fireArray(const int size, double *vect)
Definition: RandSkewNormal.cc:88
CLHEP::HepRandomEngine
Definition: Matrix/CLHEP/Random/RandomEngine.h:55
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::RandSkewNormal::getShapeParameter
double getShapeParameter()
Definition: RandomObjects/CLHEP/Random/RandSkewNormal.h:98
CLHEP::RandSkewNormal::shootArray
static void shootArray(const int size, double *vect, double shape=0.)
Definition: RandSkewNormal.cc:64
CLHEP::RandSkewNormal::RandSkewNormal
RandSkewNormal(HepRandomEngine &anEngine, double shape=0.)
CLHEP::RandSkewNormal::gaussianSkewNormal
static double gaussianSkewNormal(HepRandomEngine *e, double k)
Definition: RandSkewNormal.cc:103
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::RandSkewNormal::fire
double fire()
Definition: RandSkewNormal.cc:80
CLHEP
Definition: ClhepVersion.h:13
CLHEP::RandSkewNormal::operator()
double operator()()
Definition: RandSkewNormal.cc:26
CLHEP::RandSkewNormal::getLocalEngine
HepRandomEngine * getLocalEngine()
CLHEP::RandSkewNormal::~RandSkewNormal
virtual ~RandSkewNormal()
Definition: RandSkewNormal.cc:24
CLHEP::RandSkewNormal::get
std::istream & get(std::istream &is)
Definition: RandSkewNormal.cc:132
CLHEP::RandSkewNormal::name
std::string name() const
Definition: RandSkewNormal.cc:21
CLHEP::RandSkewNormal::engine
HepRandomEngine & engine()
Definition: RandSkewNormal.cc:22
k
long k
Definition: JamesRandomSeeding.txt:29
CLHEP::RandSkewNormal::shoot
static double shoot()
Definition: RandSkewNormal.cc:50
CLHEP::RandSkewNormal::put
std::ostream & put(std::ostream &os) const
Definition: RandSkewNormal.cc:121