Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
77857f91
Commit
77857f91
authored
Mar 12, 2005
by
Lynn Garren
Browse files
renaming the class to StdHep::RandomState to avoid confusion with std::random()
parent
fd78c1fe
Changes
9
Hide whitespace changes
Inline
Side-by-side
StdHep/ChangeLog
View file @
77857f91
2005-03-
07
Lynn Garren <garren@fnal.gov>
2005-03-
11
Lynn Garren <garren@fnal.gov>
* add
Std
Random class which "saves" the random state as a string
* add Random
State
class which "saves" the random state as a string
==============================
29.11.04 Release CLHEP-1.9.1.2
...
...
StdHep/StdHep/Makefile.am
View file @
77857f91
...
...
@@ -19,7 +19,7 @@ pkginclude_HEADERS = \
StdHep.hh
\
StdHeptoGenEvent.icc
\
StdHepVersion.h
\
Std
Random.hh
\
Random
State
.hh
\
StdRunInfoConvert.hh
\
StdRunInfoConvert.icc
\
StdRunInfo.hh
\
...
...
StdHep/StdHep/
Std
Random.hh
→
StdHep/StdHep/Random
State
.hh
View file @
77857f91
#ifndef STDRANDOM_HH
#define STDRANDOM_HH
#ifndef STD
HEP_
RANDOM
STATE
_HH
#define STD
HEP_
RANDOM
STATE
_HH
// ----------------------------------------------------------------------
//
Std
Random.hh
// Random
State
.hh
//
// Container for the random state
// ----------------------------------------------------------------------
...
...
@@ -16,16 +16,16 @@ namespace StdHep {
* @author
* @ingroup stdhep
*/
class
Std
Random
{
class
Random
State
{
public:
// --- birth/death:
//
Std
Random
(
);
Std
Random
(
const
Std
Random
&
orig
);
Std
Random
&
operator
=
(
const
Std
Random
&
);
~
Std
Random
();
Random
State
(
);
Random
State
(
const
Random
State
&
orig
);
Random
State
&
operator
=
(
const
Random
State
&
);
~
Random
State
();
// --- accessors:
//
...
...
@@ -48,8 +48,8 @@ private:
std
::
string
myRandomState
;
};
//
Std
Random
};
// Random
State
}
#endif // STDRANDOM_HH
#endif // STD
HEP_
RANDOM
STATE
_HH
StdHep/StdHep/StdRunInfo.hh
View file @
77857f91
...
...
@@ -8,7 +8,7 @@
#include <vector>
#include <string>
#include "CLHEP/StdHep/
Std
Random.hh"
#include "CLHEP/StdHep/Random
State
.hh"
namespace
StdHep
{
...
...
@@ -68,7 +68,7 @@ private:
std
::
string
itsRunIdentifier
;
std
::
string
itsGeneratorName
;
std
::
string
itsPDFName
;
Std
Random
itsSeedList
;
Random
State
itsSeedList
;
};
// StdRunInfo
...
...
StdHep/src/Makefile.am
View file @
77857f91
...
...
@@ -31,7 +31,7 @@ libCLHEP_StdHep_@VERSION@_a_SOURCES = \
StdEventVDescendants.cc
\
StdEventVertex.cc
\
StdEventVParents.cc
\
Std
Random.cc
\
Random
State
.cc
\
StdRunInfo.cc
\
tree.cc
\
writeEventKey.cc
\
...
...
StdHep/src/
Std
Random.cc
→
StdHep/src/Random
State
.cc
View file @
77857f91
// ----------------------------------------------------------------------
//
Std
Random.cc
// Random
State
.cc
// ----------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include "CLHEP/StdHep/
Std
Random.hh"
#include "CLHEP/StdHep/Random
State
.hh"
#include "CLHEP/HepMC/DoubleConversion.hh"
namespace
StdHep
{
Std
Random
::
Std
Random
(
)
Random
State
::
Random
State
(
)
:
myRandomState
(
""
)
{
;
}
Std
Random
::
Std
Random
(
const
Std
Random
&
orig
)
Random
State
::
Random
State
(
const
Random
State
&
orig
)
:
myRandomState
(
orig
.
myRandomState
)
{
;
}
Std
Random
&
Std
Random
::
operator
=
(
const
Std
Random
&
rhs
)
Random
State
&
Random
State
::
operator
=
(
const
Random
State
&
rhs
)
{
if
(
this
!=
&
rhs
)
{
myRandomState
=
rhs
.
myRandomState
;
...
...
@@ -28,17 +28,17 @@ StdRandom& StdRandom::operator=( const StdRandom & rhs )
return
*
this
;
}
Std
Random
::
~
Std
Random
()
Random
State
::
~
Random
State
()
{
;
}
std
::
ostream
&
Std
Random
::
getStateAsStream
(
std
::
ostream
&
os
)
const
std
::
ostream
&
Random
State
::
getStateAsStream
(
std
::
ostream
&
os
)
const
{
os
<<
myRandomState
<<
std
::
endl
;
return
os
;
}
std
::
vector
<
unsigned
long
>
Std
Random
::
getStateAsLongs
(
)
const
std
::
vector
<
unsigned
long
>
Random
State
::
getStateAsLongs
(
)
const
{
// we assume here that this makes sense
// this method assumes that the state consists solely of a list of longs
...
...
@@ -53,14 +53,14 @@ std::vector<unsigned long> StdRandom::getStateAsLongs( ) const
}
void
Std
Random
::
print
(
std
::
ostream
&
os
)
const
void
Random
State
::
print
(
std
::
ostream
&
os
)
const
{
os
<<
"begin
Std
Random state"
<<
std
::
endl
;
os
<<
"begin Random
State
state"
<<
std
::
endl
;
os
<<
myRandomState
<<
std
::
endl
;
os
<<
"end
Std
Random state"
<<
std
::
endl
;
os
<<
"end Random
State
state"
<<
std
::
endl
;
}
void
Std
Random
::
putState
(
std
::
istream
&
ist
)
void
Random
State
::
putState
(
std
::
istream
&
ist
)
{
std
::
ostringstream
st
;
std
::
string
str
;
...
...
@@ -71,12 +71,12 @@ void StdRandom::putState( std::istream& ist )
myRandomState
=
st
.
str
();
}
void
Std
Random
::
putState
(
std
::
string
const
&
st
)
void
Random
State
::
putState
(
std
::
string
const
&
st
)
{
myRandomState
=
st
;
}
void
Std
Random
::
putState
(
std
::
vector
<
unsigned
long
>
const
&
rs
)
void
Random
State
::
putState
(
std
::
vector
<
unsigned
long
>
const
&
rs
)
{
std
::
ostringstream
st
;
for
(
unsigned
int
i
=
0
;
i
<
rs
.
size
();
++
i
)
{
...
...
@@ -85,14 +85,14 @@ void StdRandom::putState( std::vector<unsigned long> const & rs )
myRandomState
=
st
.
str
();
}
void
Std
Random
::
appendSeed
(
unsigned
long
sd
)
void
Random
State
::
appendSeed
(
unsigned
long
sd
)
{
std
::
ostringstream
st
(
myRandomState
);
st
<<
" "
<<
sd
;
myRandomState
=
st
.
str
();
}
void
Std
Random
::
appendSeed
(
double
sd
)
void
Random
State
::
appendSeed
(
double
sd
)
{
std
::
ostringstream
st
(
myRandomState
);
std
::
vector
<
unsigned
long
>
two
;
...
...
@@ -103,7 +103,7 @@ void StdRandom::appendSeed( double sd )
myRandomState
=
st
.
str
();
}
void
Std
Random
::
clear
(
)
void
Random
State
::
clear
(
)
{
myRandomState
=
""
;
}
...
...
StdHep/src/StdRunInfo.cc
View file @
77857f91
...
...
@@ -20,7 +20,7 @@ StdRunInfo::StdRunInfo( int runno, int togen, int ngen, int nwrt,
itsRunIdentifier
(
" "
),
itsGeneratorName
(
" "
),
itsPDFName
(
" "
),
itsSeedList
(
Std
Random
()
)
itsSeedList
(
Random
State
()
)
{
;
}
StdRunInfo
::
StdRunInfo
(
const
StdRunInfo
&
orig
)
...
...
StdHep/test/Makefile.am
View file @
77857f91
...
...
@@ -15,19 +15,19 @@ endif
# Identify executables needed during testing:
check_PROGRAMS
=
\
testStdRandom
testStd
Hep
Random
State
#check_SCRIPTS =
# Identify test(s) to run when 'make check' is requested:
TESTS
=
\
testStdRandom
testStd
Hep
Random
State
# Identify the test(s) for which failure is the intended outcome:
XFAIL_TESTS
=
# Identify the dependencies on a per-test basis:
testStdRandom_SOURCES
=
testStdRandom.cc SimpleRand.cc
testStd
Hep
Random
State
_SOURCES
=
testStd
Hep
Random
State
.cc SimpleRand.cc
# Identify input data file(s) and prototype output file(s):
#EXTRA_DIST =
...
...
StdHep/test/testStdRandom.cc
→
StdHep/test/testStd
Hep
Random
State
.cc
View file @
77857f91
//////////////////////////////////////////////////////////////////////////
// Lynn Garren
//
// This program tests StdHep::
Std
Random
// This program tests StdHep::Random
State
//
//////////////////////////////////////////////////////////////////////////
...
...
@@ -10,7 +10,7 @@
#include <sstream>
#include <string>
#include "CLHEP/StdHep/
Std
Random.hh"
#include "CLHEP/StdHep/Random
State
.hh"
#include "SimpleRand.hh"
...
...
@@ -18,7 +18,7 @@ int main() {
int
status
=
0
;
double
d
,
saved
;
StdHep
::
Std
Random
rstate
;
StdHep
::
Random
State
rstate
;
// fill and save an arbitrary vector just for grins
std
::
vector
<
unsigned
long
>
rs
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment