CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
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 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 37 of file RandBreitWigner.cc.

37 {
38}

Member Function Documentation

◆ distributionName()

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

Definition at line 132 of file RandBreitWigner.h.

132{return "RandBreitWigner";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 35 of file RandBreitWigner.cc.

35{return *localEngine;}

◆ fire() [1/3]

double CLHEP::RandBreitWigner::fire ( )

Definition at line 202 of file RandBreitWigner.cc.

203{
204 return fire( defaultA, defaultB );
205}

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

◆ fire() [2/3]

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

Definition at line 207 of file RandBreitWigner.cc.

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

◆ fire() [3/3]

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

Definition at line 217 of file RandBreitWigner.cc.

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

◆ fireArray() [1/3]

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

Definition at line 261 of file RandBreitWigner.cc.

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

◆ fireArray() [2/3]

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

Definition at line 267 of file RandBreitWigner.cc.

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

◆ fireArray() [3/3]

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

Definition at line 274 of file RandBreitWigner.cc.

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

◆ fireM2() [1/3]

double CLHEP::RandBreitWigner::fireM2 ( )

Definition at line 229 of file RandBreitWigner.cc.

230{
231 return fireM2( defaultA, defaultB );
232}

Referenced by dist_layout(), and fireM2().

◆ fireM2() [2/3]

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

Definition at line 234 of file RandBreitWigner.cc.

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

◆ fireM2() [3/3]

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

Definition at line 246 of file RandBreitWigner.cc.

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

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 302 of file RandBreitWigner.cc.

302 {
303 std::string inName;
304 is >> inName;
305 if (inName != name()) {
306 is.clear(std::ios::badbit | is.rdstate());
307 std::cerr << "Mismatch when expecting to read state of a "
308 << name() << " distribution\n"
309 << "Name found was " << inName
310 << "\nistream is left in the badbit state\n";
311 return is;
312 }
313 if (possibleKeywordInput(is, "Uvec", defaultA)) {
314 std::vector<unsigned long> t(2);
315 is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t);
316 is >> defaultB >> t[0] >> t[1]; defaultB = DoubConv::longs2double(t);
317 return is;
318 }
319 // is >> defaultA encompassed by possibleKeywordInput
320 is >> defaultB;
321 return is;
322}
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)
Definition: RandomEngine.h:168

◆ name()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 34 of file RandBreitWigner.cc.

34{return "RandBreitWigner";}

Referenced by get(), and put().

◆ operator()() [1/3]

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

Reimplemented from CLHEP::HepRandom.

Definition at line 40 of file RandBreitWigner.cc.

40 {
41 return fire( defaultA, defaultB );
42}

◆ operator()() [2/3]

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

Definition at line 44 of file RandBreitWigner.cc.

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

◆ operator()() [3/3]

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

Definition at line 48 of file RandBreitWigner.cc.

48 {
49 return fire( a, b, c );
50}

◆ put()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 282 of file RandBreitWigner.cc.

282 {
283 long pr=os.precision(20);
284 std::vector<unsigned long> t(2);
285 os << " " << name() << "\n";
286 os << "Uvec" << "\n";
287 t = DoubConv::dto2longs(defaultA);
288 os << defaultA << " " << t[0] << " " << t[1] << "\n";
289 t = DoubConv::dto2longs(defaultB);
290 os << defaultB << " " << t[0] << " " << t[1] << "\n";
291 os.precision(pr);
292 return os;
293#ifdef REMOVED
294 long pr=os.precision(20);
295 os << " " << name() << "\n";
296 os << defaultA << " " << defaultB << "\n";
297 os.precision(pr);
298 return os;
299#endif
300}
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 62 of file RandBreitWigner.cc.

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

◆ shoot() [2/4]

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

Definition at line 52 of file RandBreitWigner.cc.

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

Referenced by captureStatics(), layout(), randomizeStatics(), shootArray(), and user_layout().

◆ shoot() [3/4]

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

Definition at line 135 of file RandBreitWigner.cc.

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

◆ shoot() [4/4]

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

Definition at line 124 of file RandBreitWigner.cc.

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

◆ shootArray() [1/6]

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

Definition at line 101 of file RandBreitWigner.cc.

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

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

◆ shootArray() [3/6]

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

Definition at line 114 of file RandBreitWigner.cc.

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

◆ shootArray() [4/6]

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

Definition at line 177 of file RandBreitWigner.cc.

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

◆ shootArray() [5/6]

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

Definition at line 184 of file RandBreitWigner.cc.

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

◆ shootArray() [6/6]

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

Definition at line 192 of file RandBreitWigner.cc.

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

◆ shootM2() [1/4]

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

Definition at line 86 of file RandBreitWigner.cc.

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

◆ shootM2() [2/4]

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

Definition at line 74 of file RandBreitWigner.cc.

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

Referenced by layout(), and user_layout().

◆ shootM2() [3/4]

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

Definition at line 161 of file RandBreitWigner.cc.

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

◆ shootM2() [4/4]

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

Definition at line 148 of file RandBreitWigner.cc.

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

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