ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
tree
geant4-10.6-release
config
environments
examples
source
analysis
digits_hits
error_propagation
event
externals
clhep
include
src
AxisAngle.cc
BasicVector3D.cc
Boost.cc
BoostX.cc
BoostY.cc
BoostZ.cc
DoubConv.cc
DualRand.cc
EngineFactory.cc
engineIDulong.cc
erfQ.cc
EulerAngles.cc
Evaluator.cc
flatToGaussian.cc
gammln.cc
JamesRandom.cc
LorentzRotation.cc
LorentzRotationC.cc
LorentzRotationD.cc
LorentzVector.cc
LorentzVectorB.cc
LorentzVectorC.cc
LorentzVectorK.cc
LorentzVectorL.cc
LorentzVectorR.cc
MixMaxRng.cc
MTwistEngine.cc
NonRandomEngine.cc
Normal3D.cc
Plane3D.cc
Point3D.cc
RandBinomial.cc
RandBit.cc
RandBreitWigner.cc
RandChiSquare.cc
RandExponential.cc
RandExpZiggurat.cc
RandFlat.cc
RandGamma.cc
RandGauss.cc
RandGaussQ.cc
RandGaussZiggurat.cc
RandGeneral.cc
RandLandau.cc
Random.cc
RandomEngine.cc
RandPoisson.cc
RandPoissonQ.cc
RandStudentT.cc
RanecuEngine.cc
Ranlux64Engine.cc
RanluxEngine.cc
RanshiEngine.cc
Rotation.cc
RotationA.cc
RotationC.cc
RotationE.cc
RotationInterfaces.cc
RotationIO.cc
RotationL.cc
RotationP.cc
RotationX.cc
RotationY.cc
RotationZ.cc
setStdMath.cc
setSystemOfUnits.cc
SpaceVector.cc
SpaceVectorD.cc
SpaceVectorP.cc
SpaceVectorR.cc
StaticRandomStates.cc
ThreeVector.cc
ThreeVectorR.cc
Transform3D.cc
TwoVector.cc
Vector3D.cc
ZMinput.cc
expat
zlib
g3tog4
geometry
global
graphics_reps
intercoms
interfaces
materials
parameterisations
particles
persistency
physics_lists
processes
readout
run
track
tracking
visualization
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RandExponential.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RandExponential.cc
1
// -*- C++ -*-
2
//
3
// -----------------------------------------------------------------------
4
// HEP Random
5
// --- RandExponential ---
6
// class implementation file
7
// -----------------------------------------------------------------------
8
// This file is part of Geant4 (simulation toolkit for HEP).
9
10
// =======================================================================
11
// Gabriele Cosmo - Created: 17th May 1996
12
// - Added methods to shoot arrays: 28th July 1997
13
// J.Marraffino - Added default mean as attribute and
14
// operator() with mean: 16th Feb 1998
15
// M Fischler - put and get to/from streams 12/15/04
16
// M Fischler - put/get to/from streams uses pairs of ulongs when
17
// + storing doubles avoid problems with precision
18
// 4/14/05
19
// =======================================================================
20
21
#include "
CLHEP/Random/RandExponential.h
"
22
#include "
CLHEP/Random/DoubConv.h
"
23
24
namespace
CLHEP {
25
26
std::string
RandExponential::name
()
const
{
return
"RandExponential"
;}
27
HepRandomEngine
&
RandExponential::engine
() {
return
*
localEngine
;}
28
29
RandExponential::~RandExponential
() {
30
}
31
32
double
RandExponential::operator()
() {
33
return
fire
(
defaultMean
);
34
}
35
36
double
RandExponential::operator()
(
double
mean ) {
37
return
fire
( mean );
38
}
39
40
double
RandExponential::shoot
() {
41
return
-std::log(
HepRandom::getTheEngine
()->
flat
());
42
}
43
44
double
RandExponential::shoot
(
double
mean) {
45
return
-std::log(
HepRandom::getTheEngine
()->
flat
())*mean;
46
}
47
48
void
RandExponential::shootArray
(
const
int
size,
double
* vect,
49
double
mean )
50
{
51
for
(
double
*
v
= vect;
v
!= vect+size; ++
v
)
52
*
v
=
shoot
(mean);
53
}
54
55
void
RandExponential::shootArray
(
HepRandomEngine
* anEngine,
const
int
size,
56
double
* vect,
double
mean )
57
{
58
for
(
double
*
v
= vect;
v
!= vect+size; ++
v
)
59
*
v
=
shoot
(anEngine, mean);
60
}
61
62
void
RandExponential::fireArray
(
const
int
size,
double
* vect)
63
{
64
for
(
double
*
v
= vect;
v
!= vect+size; ++
v
)
65
*
v
=
fire
(
defaultMean
);
66
}
67
68
void
RandExponential::fireArray
(
const
int
size,
double
* vect,
69
double
mean )
70
{
71
for
(
double
*
v
= vect;
v
!= vect+size; ++
v
)
72
*
v
=
fire
( mean );
73
}
74
75
std::ostream &
RandExponential::put
( std::ostream & os )
const
{
76
int
pr
=os.precision(20);
77
std::vector<unsigned long>
t
(2);
78
os <<
" "
<<
name
() <<
"\n"
;
79
os <<
"Uvec"
<<
"\n"
;
80
t =
DoubConv::dto2longs
(
defaultMean
);
81
os <<
defaultMean
<<
" "
<< t[0] <<
" "
<< t[1] <<
"\n"
;
82
os.precision(pr);
83
return
os;
84
}
85
86
std::istream &
RandExponential::get
( std::istream & is ) {
87
std::string inName;
88
is >> inName;
89
if
(inName !=
name
()) {
90
is.clear(std::ios::badbit | is.rdstate());
91
std::cerr <<
"Mismatch when expecting to read state of a "
92
<<
name
() <<
" distribution\n"
93
<<
"Name found was "
<< inName
94
<<
"\nistream is left in the badbit state\n"
;
95
return
is;
96
}
97
if
(
possibleKeywordInput
(is,
"Uvec"
,
defaultMean
)) {
98
std::vector<unsigned long>
t
(2);
99
is >>
defaultMean
>> t[0] >> t[1];
defaultMean
=
DoubConv::longs2double
(t);
100
return
is;
101
}
102
// is >> defaultMean encompassed by possibleKeywordInput
103
return
is;
104
}
105
106
107
}
// namespace CLHEP
geant4
tree
geant4-10.6-release
source
externals
clhep
src
RandExponential.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:14
using
1.8.2 with
ECCE GitHub integration