Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
CLHEP::RandBreitWigner Class Reference

#include <RandBreitWigner.h>

Inheritance diagram for CLHEP::RandBreitWigner:
CLHEP::HepRandom

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 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

Author
Gabri.nosp@m.ele..nosp@m.Cosmo.nosp@m.@cer.nosp@m.n.ch

Definition at line 37 of file RandBreitWigner.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file RandBreitWigner.cc.

33  {
34 }

Member Function Documentation

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

Definition at line 131 of file RandBreitWigner.h.

131 {return "RandBreitWigner";}
HepRandomEngine & CLHEP::RandBreitWigner::engine ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 31 of file RandBreitWigner.cc.

31 {return *localEngine;}
double CLHEP::RandBreitWigner::fire ( )

Definition at line 198 of file RandBreitWigner.cc.

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

199 {
200  return fire( defaultA, defaultB );
201 }
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 }
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 }
void CLHEP::RandBreitWigner::fireArray ( const int  size,
double *  vect 
)

Definition at line 257 of file RandBreitWigner.cc.

References fire(), and test::v.

258 {
259  for( double* v = vect; v != vect + size; ++v )
260  *v = fire(defaultA, defaultB );
261 }
void CLHEP::RandBreitWigner::fireArray ( const int  size,
double *  vect,
double  a,
double  b 
)

Definition at line 263 of file RandBreitWigner.cc.

References fire(), and test::v.

265 {
266  for( double* v = vect; v != vect + size; ++v )
267  *v = fire( a, b );
268 }
void CLHEP::RandBreitWigner::fireArray ( const int  size,
double *  vect,
double  a,
double  b,
double  c 
)

Definition at line 270 of file RandBreitWigner.cc.

References fire(), and test::v.

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

Definition at line 225 of file RandBreitWigner.cc.

226 {
227  return fireM2( defaultA, defaultB );
228 }
double CLHEP::RandBreitWigner::fireM2 ( double  a,
double  b 
)

Definition at line 230 of file RandBreitWigner.cc.

References CLHEP::RandFlat::shoot().

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
double CLHEP::RandBreitWigner::fireM2 ( double  a,
double  b,
double  c 
)

Definition at line 242 of file RandBreitWigner.cc.

References G4INCL::Math::max(), and CLHEP::RandFlat::shoot().

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 }
static double shoot()
Definition: RandFlat.cc:59
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::istream & CLHEP::RandBreitWigner::get ( std::istream &  is)
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 291 of file RandBreitWigner.cc.

References CLHEP::DoubConv::longs2double(), name(), and CLHEP::possibleKeywordInput().

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 }
std::string name() const
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
Definition: RandomEngine.h:167
static double longs2double(const std::vector< unsigned long > &v)
Definition: DoubConv.cc:114
std::string CLHEP::RandBreitWigner::name ( ) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 30 of file RandBreitWigner.cc.

Referenced by get(), and put().

30 {return "RandBreitWigner";}
double CLHEP::RandBreitWigner::operator() ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 36 of file RandBreitWigner.cc.

References fire().

36  {
37  return fire( defaultA, defaultB );
38 }
double CLHEP::RandBreitWigner::operator() ( double  a,
double  b 
)

Definition at line 40 of file RandBreitWigner.cc.

References fire().

40  {
41  return fire( a, b );
42 }
double CLHEP::RandBreitWigner::operator() ( double  a,
double  b,
double  c 
)

Definition at line 44 of file RandBreitWigner.cc.

References fire().

44  {
45  return fire( a, b, c );
46 }
std::ostream & CLHEP::RandBreitWigner::put ( std::ostream &  os) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 278 of file RandBreitWigner.cc.

References CLHEP::DoubConv::dto2longs(), name(), and gammaraytel::pr.

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 }
std::string name() const
static std::vector< unsigned long > dto2longs(double d)
Definition: DoubConv.cc:98
double CLHEP::RandBreitWigner::shoot ( double  a = 1.0,
double  b = 0.2 
)
static

Definition at line 48 of file RandBreitWigner.cc.

References CLHEP::HepRandomEngine::flat(), and CLHEP::HepRandom::getTheEngine().

Referenced by shootArray().

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 }
virtual double flat()=0
static HepRandomEngine * getTheEngine()
Definition: Random.cc:165
double CLHEP::RandBreitWigner::shoot ( double  a,
double  b,
double  c 
)
static

Definition at line 58 of file RandBreitWigner.cc.

References CLHEP::HepRandomEngine::flat(), and CLHEP::HepRandom::getTheEngine().

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
double CLHEP::RandBreitWigner::shoot ( HepRandomEngine anEngine,
double  a = 1.0,
double  b = 0.2 
)
static

Definition at line 120 of file RandBreitWigner.cc.

References CLHEP::HepRandomEngine::flat().

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 }
double CLHEP::RandBreitWigner::shoot ( HepRandomEngine anEngine,
double  a,
double  b,
double  c 
)
static

Definition at line 131 of file RandBreitWigner.cc.

References CLHEP::HepRandomEngine::flat().

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 }
void CLHEP::RandBreitWigner::shootArray ( const int  size,
double *  vect 
)
static

Definition at line 97 of file RandBreitWigner.cc.

References shoot(), and test::v.

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)
void CLHEP::RandBreitWigner::shootArray ( const int  size,
double *  vect,
double  a,
double  b 
)
static

Definition at line 103 of file RandBreitWigner.cc.

References shoot(), and test::v.

105 {
106  for( double* v = vect; v != vect + size; ++v )
107  *v = shoot( a, b );
108 }
static double shoot(double a=1.0, double b=0.2)
void CLHEP::RandBreitWigner::shootArray ( const int  size,
double *  vect,
double  a,
double  b,
double  c 
)
static

Definition at line 110 of file RandBreitWigner.cc.

References shoot(), and test::v.

113 {
114  for( double* v = vect; v != vect + size; ++v )
115  *v = shoot( a, b, c );
116 }
static double shoot(double a=1.0, double b=0.2)
void CLHEP::RandBreitWigner::shootArray ( HepRandomEngine anEngine,
const int  size,
double *  vect 
)
static

Definition at line 173 of file RandBreitWigner.cc.

References shoot(), and test::v.

175 {
176  for( double* v = vect; v != vect + size; ++v )
177  *v = shoot( anEngine, 1.0, 0.2 );
178 }
static double shoot(double a=1.0, double b=0.2)
void CLHEP::RandBreitWigner::shootArray ( HepRandomEngine anEngine,
const int  size,
double *  vect,
double  a,
double  b 
)
static

Definition at line 180 of file RandBreitWigner.cc.

References shoot(), and test::v.

183 {
184  for( double* v = vect; v != vect + size; ++v )
185  *v = shoot( anEngine, a, b );
186 }
static double shoot(double a=1.0, double b=0.2)
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.

References shoot(), and test::v.

191 {
192  for( double* v = vect; v != vect + size; ++v )
193  *v = shoot( anEngine, a, b, c );
194 }
static double shoot(double a=1.0, double b=0.2)
double CLHEP::RandBreitWigner::shootM2 ( double  a = 1.0,
double  b = 0.2 
)
static

Definition at line 70 of file RandBreitWigner.cc.

References CLHEP::RandFlat::shoot().

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 }
static double shoot()
Definition: RandFlat.cc:59
double CLHEP::RandBreitWigner::shootM2 ( double  a,
double  b,
double  c 
)
static

Definition at line 82 of file RandBreitWigner.cc.

References G4INCL::Math::max(), and CLHEP::RandFlat::shoot().

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 }
static double shoot()
Definition: RandFlat.cc:59
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double CLHEP::RandBreitWigner::shootM2 ( HepRandomEngine anEngine,
double  a = 1.0,
double  b = 0.2 
)
static

Definition at line 144 of file RandBreitWigner.cc.

References CLHEP::RandFlat::shoot().

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 }
static double shoot()
Definition: RandFlat.cc:59
double CLHEP::RandBreitWigner::shootM2 ( HepRandomEngine anEngine,
double  a,
double  b,
double  c 
)
static

Definition at line 157 of file RandBreitWigner.cc.

References G4INCL::Math::max(), and CLHEP::RandFlat::shoot().

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 }
static double shoot()
Definition: RandFlat.cc:59
T max(const T t1, const T t2)
brief Return the largest of the two arguments

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