Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
RandBreitWigner.h
이 파일의 문서화 페이지로 가기
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
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static void shootArray(const int size, double *vect)
static double shoot(double a=1.0, double b=0.2)
std::ostream & put(std::ostream &os) const
RandBreitWigner(HepRandomEngine &anEngine, double a=1.0, double b=0.2)
HepRandomEngine & engine()
void fireArray(const int size, double *vect)
std::string name() const
std::shared_ptr< HepRandomEngine > localEngine
static std::string distributionName()
static double shootM2(double a=1.0, double b=0.2)