Geant4 9.6.0
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)
 
virtual double operator() ()
 
virtual std::string name () const
 
virtual HepRandomEngineengine ()
 
virtual std::ostream & put (std::ostream &os) const
 
virtual std::istream & get (std::istream &is)
 

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 lux=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 33 of file RandBreitWigner.cc.

33 {
34}

Member Function Documentation

◆ distributionName()

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

Definition at line 131 of file RandBreitWigner.h.

131{return "RandBreitWigner";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 31 of file RandBreitWigner.cc.

31{return *localEngine;}

◆ fire() [1/3]

double CLHEP::RandBreitWigner::fire ( )

Definition at line 198 of file RandBreitWigner.cc.

199{
200 return fire( defaultA, defaultB );
201}

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

◆ fire() [2/3]

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

Definition at line 203 of file RandBreitWigner.cc.

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

◆ fire() [3/3]

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

Definition at line 213 of file RandBreitWigner.cc.

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

◆ fireArray() [1/3]

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

Definition at line 257 of file RandBreitWigner.cc.

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

◆ fireArray() [2/3]

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

Definition at line 263 of file RandBreitWigner.cc.

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

◆ fireArray() [3/3]

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

Definition at line 270 of file RandBreitWigner.cc.

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

◆ fireM2() [1/3]

double CLHEP::RandBreitWigner::fireM2 ( )

Definition at line 225 of file RandBreitWigner.cc.

226{
227 return fireM2( defaultA, defaultB );
228}

Referenced by fireM2().

◆ fireM2() [2/3]

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

Definition at line 230 of file RandBreitWigner.cc.

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

◆ fireM2() [3/3]

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

Definition at line 242 of file RandBreitWigner.cc.

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

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 291 of file RandBreitWigner.cc.

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

◆ name()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 30 of file RandBreitWigner.cc.

30{return "RandBreitWigner";}

Referenced by get(), and put().

◆ operator()() [1/3]

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

Reimplemented from CLHEP::HepRandom.

Definition at line 36 of file RandBreitWigner.cc.

36 {
37 return fire( defaultA, defaultB );
38}

◆ operator()() [2/3]

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

Definition at line 40 of file RandBreitWigner.cc.

40 {
41 return fire( a, b );
42}

◆ operator()() [3/3]

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

Definition at line 44 of file RandBreitWigner.cc.

44 {
45 return fire( a, b, c );
46}

◆ put()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 278 of file RandBreitWigner.cc.

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

◆ shoot() [1/4]

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

Definition at line 58 of file RandBreitWigner.cc.

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

◆ shoot() [2/4]

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

Definition at line 48 of file RandBreitWigner.cc.

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

Referenced by shootArray().

◆ shoot() [3/4]

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

Definition at line 131 of file RandBreitWigner.cc.

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

◆ shoot() [4/4]

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

Definition at line 120 of file RandBreitWigner.cc.

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

◆ shootArray() [1/6]

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

Definition at line 97 of file RandBreitWigner.cc.

98{
99 for( double* v = vect; v != vect + size; ++v )
100 *v = shoot( 1.0, 0.2 );
101}
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 103 of file RandBreitWigner.cc.

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

◆ shootArray() [3/6]

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

Definition at line 110 of file RandBreitWigner.cc.

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

◆ shootArray() [4/6]

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

Definition at line 173 of file RandBreitWigner.cc.

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

◆ shootArray() [5/6]

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

Definition at line 180 of file RandBreitWigner.cc.

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

◆ shootArray() [6/6]

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

Definition at line 188 of file RandBreitWigner.cc.

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

◆ shootM2() [1/4]

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

Definition at line 82 of file RandBreitWigner.cc.

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

◆ shootM2() [2/4]

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

Definition at line 70 of file RandBreitWigner.cc.

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

◆ shootM2() [3/4]

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

Definition at line 157 of file RandBreitWigner.cc.

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

◆ shootM2() [4/4]

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

Definition at line 144 of file RandBreitWigner.cc.

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

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