Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CLHEP::RandBreitWigner Class Reference

#include <RandBreitWigner.h>

+ Inheritance diagram for CLHEP::RandBreitWigner:

Public Member Functions

 RandBreitWigner (HepRandomEngine &anEngine, double a=1.0, double b=0.2)
 
 RandBreitWigner (HepRandomEngine *anEngine, double a=1.0, double b=0.2)
 
virtual ~RandBreitWigner ()
 
double fire ()
 
double fire (double a, double b)
 
double fire (double a, double b, double c)
 
double fireM2 ()
 
double fireM2 (double a, double b)
 
double fireM2 (double a, double b, double c)
 
void fireArray (const int size, double *vect)
 
void fireArray (const int size, double *vect, double a, double b)
 
void fireArray (const int size, double *vect, double a, double b, double c)
 
double operator() ()
 
double operator() (double a, double b)
 
double operator() (double a, double b, double c)
 
std::ostream & put (std::ostream &os) const
 
std::istream & get (std::istream &is)
 
std::string name () const
 
HepRandomEngineengine ()
 
- Public Member Functions inherited from CLHEP::HepRandom
 HepRandom ()
 
 HepRandom (long seed)
 
 HepRandom (HepRandomEngine &algorithm)
 
 HepRandom (HepRandomEngine *algorithm)
 
virtual ~HepRandom ()
 
double flat ()
 
void flatArray (const int size, double *vect)
 
double flat (HepRandomEngine *theNewEngine)
 
void flatArray (HepRandomEngine *theNewEngine, const int size, double *vect)
 

Static Public Member Functions

static double shoot (double a=1.0, double b=0.2)
 
static double shoot (double a, double b, double c)
 
static double shootM2 (double a=1.0, double b=0.2)
 
static double shootM2 (double a, double b, double c)
 
static void shootArray (const int size, double *vect)
 
static void shootArray (const int size, double *vect, double a, double b)
 
static void shootArray (const int size, double *vect, double a, double b, double c)
 
static double shoot (HepRandomEngine *anEngine, double a=1.0, double b=0.2)
 
static double shoot (HepRandomEngine *anEngine, double a, double b, double c)
 
static double shootM2 (HepRandomEngine *anEngine, double a=1.0, double b=0.2)
 
static double shootM2 (HepRandomEngine *anEngine, double a, double b, double c)
 
static void shootArray (HepRandomEngine *anEngine, const int size, double *vect)
 
static void shootArray (HepRandomEngine *anEngine, const int size, double *vect, double a, double b)
 
static void shootArray (HepRandomEngine *anEngine, const int size, double *vect, double a, double b, double c)
 
static std::string distributionName ()
 
- Static Public Member Functions inherited from CLHEP::HepRandom
static void setTheSeed (long seed, int lxr=3)
 
static long getTheSeed ()
 
static void setTheSeeds (const long *seeds, int aux=-1)
 
static const long * getTheSeeds ()
 
static void getTheTableSeeds (long *seeds, int index)
 
static HepRandomgetTheGenerator ()
 
static void setTheEngine (HepRandomEngine *theNewEngine)
 
static HepRandomEnginegetTheEngine ()
 
static void saveEngineStatus (const char filename[]="Config.conf")
 
static void restoreEngineStatus (const char filename[]="Config.conf")
 
static std::ostream & saveFullState (std::ostream &os)
 
static std::istream & restoreFullState (std::istream &is)
 
static std::ostream & saveDistState (std::ostream &os)
 
static std::istream & restoreDistState (std::istream &is)
 
static std::ostream & saveStaticRandomStates (std::ostream &os)
 
static std::istream & restoreStaticRandomStates (std::istream &is)
 
static void showEngineStatus ()
 
static int createInstance ()
 
static std::string distributionName ()
 

Additional Inherited Members

- Static Protected Attributes inherited from CLHEP::HepRandom
static const long seedTable [215][2]
 

Detailed Description

Constructor & Destructor Documentation

◆ RandBreitWigner() [1/2]

CLHEP::RandBreitWigner::RandBreitWigner ( HepRandomEngine & anEngine,
double a = 1.0,
double b = 0.2 )
inline

◆ RandBreitWigner() [2/2]

CLHEP::RandBreitWigner::RandBreitWigner ( HepRandomEngine * anEngine,
double a = 1.0,
double b = 0.2 )
inline

◆ ~RandBreitWigner()

CLHEP::RandBreitWigner::~RandBreitWigner ( )
virtual

Definition at line 35 of file RandBreitWigner.cc.

35 {
36}

Member Function Documentation

◆ distributionName()

static std::string CLHEP::RandBreitWigner::distributionName ( )
inlinestatic

Definition at line 130 of file RandBreitWigner.h.

130{return "RandBreitWigner";}

◆ engine()

HepRandomEngine & CLHEP::RandBreitWigner::engine ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 33 of file RandBreitWigner.cc.

33{return *localEngine;}

◆ fire() [1/3]

double CLHEP::RandBreitWigner::fire ( )

Definition at line 200 of file RandBreitWigner.cc.

201{
202 return fire( defaultA, defaultB );
203}

Referenced by fire(), fireArray(), fireArray(), fireArray(), operator()(), operator()(), and operator()().

◆ fire() [2/3]

double CLHEP::RandBreitWigner::fire ( double a,
double b )

Definition at line 205 of file RandBreitWigner.cc.

206{
207 double rval, displ;
208
209 rval = 2.0*localEngine->flat()-1.0;
210 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
211
212 return mean + displ;
213}

◆ fire() [3/3]

double CLHEP::RandBreitWigner::fire ( double a,
double b,
double c )

Definition at line 215 of file RandBreitWigner.cc.

216{
217 double val, rval, displ;
218
219 if ( gamma == 0.0 ) return mean;
220 val = std::atan(2.0*cut/gamma);
221 rval = 2.0*localEngine->flat()-1.0;
222 displ = 0.5*gamma*std::tan(rval*val);
223
224 return mean + displ;
225}

◆ fireArray() [1/3]

void CLHEP::RandBreitWigner::fireArray ( const int size,
double * vect )

Definition at line 259 of file RandBreitWigner.cc.

260{
261 for( double* v = vect; v != vect + size; ++v )
262 *v = fire(defaultA, defaultB );
263}

◆ fireArray() [2/3]

void CLHEP::RandBreitWigner::fireArray ( const int size,
double * vect,
double a,
double b )

Definition at line 265 of file RandBreitWigner.cc.

267{
268 for( double* v = vect; v != vect + size; ++v )
269 *v = fire( a, b );
270}

◆ fireArray() [3/3]

void CLHEP::RandBreitWigner::fireArray ( const int size,
double * vect,
double a,
double b,
double c )

Definition at line 272 of file RandBreitWigner.cc.

274{
275 for( double* v = vect; v != vect + size; ++v )
276 *v = fire( a, b, c );
277}

◆ fireM2() [1/3]

double CLHEP::RandBreitWigner::fireM2 ( )

Definition at line 227 of file RandBreitWigner.cc.

228{
229 return fireM2( defaultA, defaultB );
230}

Referenced by fireM2().

◆ fireM2() [2/3]

double CLHEP::RandBreitWigner::fireM2 ( double a,
double b )

Definition at line 232 of file RandBreitWigner.cc.

233{
234 double val, rval, displ;
235
236 if ( gamma == 0.0 ) return mean;
237 val = std::atan(-mean/gamma);
238 rval = RandFlat::shoot(localEngine.get(),val, CLHEP::halfpi);
239 displ = gamma*std::tan(rval);
240
241 return std::sqrt(mean*mean + mean*displ);
242}
static double shoot()
Definition RandFlat.cc:61

◆ fireM2() [3/3]

double CLHEP::RandBreitWigner::fireM2 ( double a,
double b,
double c )

Definition at line 244 of file RandBreitWigner.cc.

245{
246 double rval, displ;
247 double lower, upper, tmp;
248
249 if ( gamma == 0.0 ) return mean;
250 tmp = std::max(0.0,(mean-cut));
251 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
252 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
253 rval = RandFlat::shoot(localEngine.get(),lower, upper);
254 displ = gamma*std::tan(rval);
255
256 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
257}

◆ get()

std::istream & CLHEP::RandBreitWigner::get ( std::istream & is)
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 293 of file RandBreitWigner.cc.

293 {
294 std::string inName;
295 is >> inName;
296 if (inName != name()) {
297 is.clear(std::ios::badbit | is.rdstate());
298 std::cerr << "Mismatch when expecting to read state of a "
299 << name() << " distribution\n"
300 << "Name found was " << inName
301 << "\nistream is left in the badbit state\n";
302 return is;
303 }
304 if (possibleKeywordInput(is, "Uvec", defaultA)) {
305 std::vector<unsigned long> t(2);
306 is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t);
307 is >> defaultB >> t[0] >> t[1]; defaultB = DoubConv::longs2double(t);
308 return is;
309 }
310 // is >> defaultA encompassed by possibleKeywordInput
311 is >> defaultB;
312 return is;
313}
static double longs2double(const std::vector< unsigned long > &v)
Definition DoubConv.cc:110
std::string name() const
bool possibleKeywordInput(IS &is, const std::string &key, T &t)

◆ name()

std::string CLHEP::RandBreitWigner::name ( ) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 32 of file RandBreitWigner.cc.

32{return "RandBreitWigner";}

Referenced by get(), and put().

◆ operator()() [1/3]

double CLHEP::RandBreitWigner::operator() ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 38 of file RandBreitWigner.cc.

38 {
39 return fire( defaultA, defaultB );
40}

◆ operator()() [2/3]

double CLHEP::RandBreitWigner::operator() ( double a,
double b )

Definition at line 42 of file RandBreitWigner.cc.

42 {
43 return fire( a, b );
44}

◆ operator()() [3/3]

double CLHEP::RandBreitWigner::operator() ( double a,
double b,
double c )

Definition at line 46 of file RandBreitWigner.cc.

46 {
47 return fire( a, b, c );
48}

◆ put()

std::ostream & CLHEP::RandBreitWigner::put ( std::ostream & os) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 280 of file RandBreitWigner.cc.

280 {
281 long pr=os.precision(20);
282 std::vector<unsigned long> t(2);
283 os << " " << name() << "\n";
284 os << "Uvec" << "\n";
285 t = DoubConv::dto2longs(defaultA);
286 os << defaultA << " " << t[0] << " " << t[1] << "\n";
287 t = DoubConv::dto2longs(defaultB);
288 os << defaultB << " " << t[0] << " " << t[1] << "\n";
289 os.precision(pr);
290 return os;
291}
static std::vector< unsigned long > dto2longs(double d)
Definition DoubConv.cc:94

◆ shoot() [1/4]

double CLHEP::RandBreitWigner::shoot ( double a,
double b,
double c )
static

Definition at line 60 of file RandBreitWigner.cc.

61{
62 double val, rval, displ;
63
64 if ( gamma == 0.0 ) return mean;
65 val = std::atan(2.0*cut/gamma);
66 rval = 2.0*HepRandom::getTheEngine()->flat()-1.0;
67 displ = 0.5*gamma*std::tan(rval*val);
68
69 return mean + displ;
70}
virtual double flat()=0
static HepRandomEngine * getTheEngine()
Definition Random.cc:268

◆ shoot() [2/4]

double CLHEP::RandBreitWigner::shoot ( double a = 1.0,
double b = 0.2 )
static

Definition at line 50 of file RandBreitWigner.cc.

51{
52 double rval, displ;
53
54 rval = 2.0*HepRandom::getTheEngine()->flat()-1.0;
55 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
56
57 return mean + displ;
58}

Referenced by shootArray(), shootArray(), shootArray(), shootArray(), shootArray(), and shootArray().

◆ shoot() [3/4]

double CLHEP::RandBreitWigner::shoot ( HepRandomEngine * anEngine,
double a,
double b,
double c )
static

Definition at line 133 of file RandBreitWigner.cc.

135{
136 double val, rval, displ;
137
138 if ( gamma == 0.0 ) return mean;
139 val = std::atan(2.0*cut/gamma);
140 rval = 2.0*anEngine->flat()-1.0;
141 displ = 0.5*gamma*std::tan(rval*val);
142
143 return mean + displ;
144}

◆ shoot() [4/4]

double CLHEP::RandBreitWigner::shoot ( HepRandomEngine * anEngine,
double a = 1.0,
double b = 0.2 )
static

Definition at line 122 of file RandBreitWigner.cc.

124{
125 double rval, displ;
126
127 rval = 2.0*anEngine->flat()-1.0;
128 displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi);
129
130 return mean + displ;
131}

◆ shootArray() [1/6]

void CLHEP::RandBreitWigner::shootArray ( const int size,
double * vect )
static

Definition at line 99 of file RandBreitWigner.cc.

100{
101 for( double* v = vect; v != vect + size; ++v )
102 *v = shoot( 1.0, 0.2 );
103}
static double shoot(double a=1.0, double b=0.2)

◆ shootArray() [2/6]

void CLHEP::RandBreitWigner::shootArray ( const int size,
double * vect,
double a,
double b )
static

Definition at line 105 of file RandBreitWigner.cc.

107{
108 for( double* v = vect; v != vect + size; ++v )
109 *v = shoot( a, b );
110}

◆ shootArray() [3/6]

void CLHEP::RandBreitWigner::shootArray ( const int size,
double * vect,
double a,
double b,
double c )
static

Definition at line 112 of file RandBreitWigner.cc.

115{
116 for( double* v = vect; v != vect + size; ++v )
117 *v = shoot( a, b, c );
118}

◆ shootArray() [4/6]

void CLHEP::RandBreitWigner::shootArray ( HepRandomEngine * anEngine,
const int size,
double * vect )
static

Definition at line 175 of file RandBreitWigner.cc.

177{
178 for( double* v = vect; v != vect + size; ++v )
179 *v = shoot( anEngine, 1.0, 0.2 );
180}

◆ shootArray() [5/6]

void CLHEP::RandBreitWigner::shootArray ( HepRandomEngine * anEngine,
const int size,
double * vect,
double a,
double b )
static

Definition at line 182 of file RandBreitWigner.cc.

185{
186 for( double* v = vect; v != vect + size; ++v )
187 *v = shoot( anEngine, a, b );
188}

◆ shootArray() [6/6]

void CLHEP::RandBreitWigner::shootArray ( HepRandomEngine * anEngine,
const int size,
double * vect,
double a,
double b,
double c )
static

Definition at line 190 of file RandBreitWigner.cc.

193{
194 for( double* v = vect; v != vect + size; ++v )
195 *v = shoot( anEngine, a, b, c );
196}

◆ shootM2() [1/4]

double CLHEP::RandBreitWigner::shootM2 ( double a,
double b,
double c )
static

Definition at line 84 of file RandBreitWigner.cc.

85{
86 double rval, displ;
87 double lower, upper, tmp;
88
89 if ( gamma == 0.0 ) return mean;
90 tmp = std::max(0.0,(mean-cut));
91 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
92 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
93 rval = RandFlat::shoot(lower, upper);
94 displ = gamma*std::tan(rval);
95
96 return std::sqrt(std::max(0.0, mean*mean + mean*displ));
97}

◆ shootM2() [2/4]

double CLHEP::RandBreitWigner::shootM2 ( double a = 1.0,
double b = 0.2 )
static

Definition at line 72 of file RandBreitWigner.cc.

73{
74 double val, rval, displ;
75
76 if ( gamma == 0.0 ) return mean;
77 val = std::atan(-mean/gamma);
78 rval = RandFlat::shoot(val, CLHEP::halfpi);
79 displ = gamma*std::tan(rval);
80
81 return std::sqrt(mean*mean + mean*displ);
82}

◆ shootM2() [3/4]

double CLHEP::RandBreitWigner::shootM2 ( HepRandomEngine * anEngine,
double a,
double b,
double c )
static

Definition at line 159 of file RandBreitWigner.cc.

161{
162 double rval, displ;
163 double lower, upper, tmp;
164
165 if ( gamma == 0.0 ) return mean;
166 tmp = std::max(0.0,(mean-cut));
167 lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) );
168 upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) );
169 rval = RandFlat::shoot(anEngine, lower, upper);
170 displ = gamma*std::tan(rval);
171
172 return std::sqrt( std::max(0.0, mean*mean+mean*displ) );
173}

◆ shootM2() [4/4]

double CLHEP::RandBreitWigner::shootM2 ( HepRandomEngine * anEngine,
double a = 1.0,
double b = 0.2 )
static

Definition at line 146 of file RandBreitWigner.cc.

148{
149 double val, rval, displ;
150
151 if ( gamma == 0.0 ) return mean;
152 val = std::atan(-mean/gamma);
153 rval = RandFlat::shoot(anEngine,val, CLHEP::halfpi);
154 displ = gamma*std::tan(rval);
155
156 return std::sqrt(mean*mean + mean*displ);
157}

The documentation for this class was generated from the following files: