Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RandBreitWigner.h
Go to the documentation of this file.
1 // $Id:$
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandBreitWigner ---
7 // class header file
8 // -----------------------------------------------------------------------
9 // This file is part of Geant4 (simulation toolkit for HEP).
10 //
11 // Class defining methods for shooting numbers according to the
12 // Breit-Wigner distribution algorithms (plain or mean^2).
13 // Default values are set: mean=1, gamma=.2, cut=1.
14 // Plain algorithm is used for shootArray() and fireArray().
15 // Plain algorithm with default values is used for operator()().
16 
17 // =======================================================================
18 // Gabriele Cosmo - Created: 5th September 1995
19 // - Added methods to shoot arrays: 28th July 1997
20 // J.Marraffino - Added default arguments as attributes and
21 // operator() with arguments: 16th Feb 1998
22 // M Fischler - put and get to/from streams 12/10/04
23 // =======================================================================
24 
25 #ifndef RandBreitWigner_h
26 #define RandBreitWigner_h 1
27 
28 #include "CLHEP/Random/RandFlat.h"
29 #include "CLHEP/Utility/memory.h"
30 
31 namespace CLHEP {
32 
37 class RandBreitWigner : public HepRandom {
38 
39 public:
40 
41  inline RandBreitWigner ( HepRandomEngine& anEngine, double a=1.0,
42  double b=0.2 );
43  inline RandBreitWigner ( HepRandomEngine* anEngine, double a=1.0,
44  double b=0.2 );
45  // These constructors should be used to instantiate a RandBreitWigner
46  // distribution object defining a local engine for it.
47  // The static generator will be skipped using the non-static methods
48  // defined below.
49  // If the engine is passed by pointer the corresponding engine object
50  // will be deleted by the RandBreitWigner destructor.
51  // If the engine is passed by reference the corresponding engine object
52  // will not be deleted by the RandBreitWigner destructor.
53 
54  virtual ~RandBreitWigner();
55  // Destructor
56 
57  // Static methods to shoot random values using the static generator
58 
59  static double shoot( double a=1.0, double b=0.2 );
60 
61  static double shoot( double a, double b, double c );
62 
63  static double shootM2( double a=1.0, double b=0.2 );
64 
65  static double shootM2( double a, double b, double c );
66 
67  static void shootArray ( const int size, double* vect);
68 
69  static void shootArray ( const int size, double* vect,
70  double a, double b );
71 
72  static void shootArray ( const int size, double* vect,
73  double a, double b, double c );
74 
75  // Static methods to shoot random values using a given engine
76  // by-passing the static generator.
77 
78  static double shoot( HepRandomEngine* anEngine, double a=1.0,
79  double b=0.2 );
80  static double shoot( HepRandomEngine* anEngine, double a,
81  double b, double c );
82  static double shootM2( HepRandomEngine* anEngine, double a=1.0,
83  double b=0.2 );
84  static double shootM2( HepRandomEngine* anEngine, double a,
85  double b, double c );
86  static void shootArray ( HepRandomEngine* anEngine,
87  const int size, double* vect );
88  static void shootArray ( HepRandomEngine* anEngine,
89  const int size, double* vect,
90  double a, double b );
91  static void shootArray ( HepRandomEngine* anEngine,
92  const int size, double* vect,
93  double a, double b, double c );
94 
95  // Methods using the localEngine to shoot random values, by-passing
96  // the static generator. These methods respect distribution parameters
97  // passed by the user at instantiation unless superseded by actual
98  // arguments in the call.
99 
100  double fire();
101 
102  double fire( double a, double b );
103 
104  double fire( double a, double b, double c );
105 
106  double fireM2();
107 
108  double fireM2( double a, double b );
109 
110  double fireM2( double a, double b, double c );
111 
112  void fireArray ( const int size, double* vect);
113 
114  void fireArray ( const int size, double* vect,
115  double a, double b );
116 
117  void fireArray ( const int size, double* vect,
118  double a, double b, double c );
119  double operator()();
120  double operator()( double a, double b );
121  double operator()( double a, double b, double c );
122 
123  // Save and restore to/from streams
124 
125  std::ostream & put ( std::ostream & os ) const;
126  std::istream & get ( std::istream & is );
127 
128  std::string name() const;
130 
131  static std::string distributionName() {return "RandBreitWigner";}
132  // Provides the name of this distribution class
133 
134 private:
135 
136  std::shared_ptr<HepRandomEngine> localEngine;
137  double defaultA;
138  double defaultB;
139 
140 };
141 
142 } // namespace CLHEP
143 
144 #include "CLHEP/Random/RandBreitWigner.icc"
145 
146 #endif
RandBreitWigner(HepRandomEngine &anEngine, double a=1.0, double b=0.2)
static double shootM2(double a=1.0, double b=0.2)
static void shootArray(const int size, double *vect)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
std::string name() const
tuple b
Definition: test.py:12
static std::string distributionName()
HepRandomEngine & engine()
std::ostream & put(std::ostream &os) const
tuple c
Definition: test.py:13
void fireArray(const int size, double *vect)
static double shoot(double a=1.0, double b=0.2)