simpleEvtGen default EvtRandomEngine [message #9149] |
Thu, 06 August 2009 17:57 |
Marius Mertens
Messages: 55 Registered: January 2009
|
continuous participant |
From: *ikp.kfa-juelich.de
|
|
Hi all,
the default EvtRandomEngine used by simpleEvtGen is basically the generator below:
double EvtRandomEngine::random(){
static unsigned long int next = 1;
next=next*1103515245+123345;
unsigned temp=(unsigned)(next/65536) % 32768;
return ( temp + 1.0 ) / 32769.0;
}
At the first glance, it does seem rather simple, but I don't have sufficient experience with pseudo random number generation to estimate the properties of the sequences generated with above code. Can anybody tell me something about the properties/random quality of the sequences and their suitability for event generation?
Best regards,
Marius
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: simpleEvtGen default EvtRandomEngine [message #9173 is a reply to message #9172] |
Mon, 10 August 2009 22:41 |
Marius Mertens
Messages: 55 Registered: January 2009
|
continuous participant |
From: *ikp.kfa-juelich.de
|
|
Hi Bertram,
actually even simpler once again, sorry to keep bothering
How to plug different random engines into the EvtRandomEngine interface is perfectly clear.
I don't know much (despite the documentation you referred to) about the Ranecu framework with its management abilities, though.
As Stefano pointed out earlier that it would be advantageous to benefit from e.g., BaBar experience with randomness generation it seems worth a look.
So I think the question basically breaks down to this:
Would you consider it useful to plug that framework into EvtRandomEngine or would you consider it kind of an overkill in that context and rather implement a small, simple engine?
I took a look at JamesRandom which (purely from a point of provided function count) is also fairly simple. My guess from the Ranecu documentation is that in comparison it needs much more setup/options (as in complexity being the price one has to pay for more power)?
As I said, to me it'd be reasonable and perfectly sufficient to use something very simple there (like a Boost PRNG, which is what I'm actually using right now), but maybe the additional features of Ranecu might be useful in the future so the higher complexity in implementing this could pay off later?
As a general note I think it'd be useful to have a reasonable default PRNG implementation which is suitable for production use "as is", otherwise at a later stage other people might run into the same issue again and probably start similar considerations on what might be the "best" choice for that purpose.
|
|
|
|
|
|
|
|
|
|
Re: simpleEvtGen default EvtRandomEngine - PndMTRandomEngine Suggestion [message #9238 is a reply to message #9237] |
Wed, 26 August 2009 16:14 |
StefanoSpataro
Messages: 2736 Registered: June 2005 Location: Torino
|
first-grade participant |
From: *0-87-r.retail.telecomitalia.it
|
|
this is what I get without changing the config.mk:
Toggle Spoiler
make[1]: Entering directory `/home/stefano/july09/pandaroot/pgenerators/EvtGen/EvtGenBase'
Checking makedepend in EvtGenBase
makedepend: warning: /usr/include/gnu/stubs.h: non-portable whitespace encountered at line 7
makedepend: warning: /usr/include/c++/3.4.6/i386-redhat-linux/bits/c++config.h: non-portable whitespace encountered at line 140
makedepend: warning: /usr/include/c++/3.4.6/i386-redhat-linux/bits/c++config.h: non-portable whitespace encountered at line 142
makedepend: warning: /usr/include/c++/3.4.6/bits/stl_algobase.h: non-portable whitespace encountered at line 135
makedepend: warning: /usr/include/c++/3.4.6/bits/stl_algobase.h: non-portable whitespace encountered at line 136
makedepend: warning: /usr/include/c++/3.4.6/bits/locale_facets.h: non-portable whitespace encountered at line 132
makedepend: warning: /usr/include/c++/3.4.6/bits/locale_facets.h: non-portable whitespace encountered at line 1508
makedepend: warning: /usr/include/c++/3.4.6/bits/locale_facets.h: non-portable whitespace encountered at line 1533
makedepend: warning: /usr/include/c++/3.4.6/bits/codecvt.h: non-portable whitespace encountered at line 475
makedepend: warning: /usr/include/c++/3.4.6/bits/locale_facets.h: non-portable whitespace encountered at line 2963
makedepend: warning: /usr/include/c++/3.4.6/bits/locale_facets.h: non-portable whitespace encountered at line 4483
makedepend: warning: /usr/include/c++/3.4.6/typeinfo: non-portable whitespace encountered at line 49
makedepend: warning: /usr/include/c++/3.4.6/typeinfo: non-portable whitespace encountered at line 52
"/usr/include/boost/static_assert.hpp":66: !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && !BOOST_WORKAROUND(__MWERKS__, < 0x3003)
^--- expecting variable or number
makedepend: warning: PndMTRandomEngine.cc (reading /usr/include/boost/cstdint.hpp), line 159: # error defaults not correct; you must hand modify boost/cstdint.hpp
makedepend: warning: PndMTRandomEngine.cc (reading /usr/include/boost/cstdint.hpp), line 189: # error defaults not correct; you must hand modify boost/cstdint.hpp
makedepend: warning: PndMTRandomEngine.cc (reading /usr/include/boost/cstdint.hpp), line 209: # error defaults not correct; you must hand modify boost/cstdint.hpp
makedepend: warning: PndMTRandomEngine.cc (reading /usr/include/boost/cstdint.hpp), line 247: # error defaults not correct; you must hand modify boost/cstdint.hpp
"/usr/include/boost/random/linear_congruential.hpp":139: !defined(__SGI_STL_PORT) && BOOST_WORKAROUND(__GNUC__, == 2)
^--- expecting variable or number
"/usr/include/boost/random/variate_generator.hpp":28: BOOST_WORKAROUND(__BORLANDC__, <= 0x564)
^--- expecting variable or number
"/usr/include/boost/random/variate_generator.hpp":114: BOOST_WORKAROUND(__BORLANDC__, <= 0x564)
^--- expecting variable or number
gcc -I. -DEVTSTANDALONE -I/home/stefano/july09/cern/clhep/include -I/home/stefano/july09/tools/root/include -I../ -I/home/stefano/july09/cern/clhep/include -I/home/stefano/july09/tools/root/include -I../ -I/home/stefano/july09/cern/clhep/include -I/home/stefano/july09/tools/root/include -I../ -c PndMTRandomEngine.cc
/usr/include/boost/random/mersenne_twister.hpp: In member function `void boost::random::mersenne_twister<UIntType, w, n, m, r, a, u, s, b, t, c, l, val>::seed(Generator&) [with Generator = const long unsigned int, UIntType = uint32_t, int w = 32, int n = 624, int m = 397, int r = 31, UIntType a = -1727483681u,int u = 11, int s = 7, UIntType b = -1658038656u, int t = 15, UIntType c = -272236544u, int l = 18, UIntType val = -948541730u]':
PndMTRandomEngine.cc:20: instantiated from here
/usr/include/boost/random/mersenne_twister.hpp:96: error: `gen' cannot be used as a function
make[1]: *** [PndMTRandomEngine.o] Error 1
make[1]: Leaving directory `/home/stefano/july09/pandaroot/pgenerators/EvtGen/EvtGenBase'
|
|
|
|
Re: simpleEvtGen default EvtRandomEngine - PndMTRandomEngine Suggestion [message #9240 is a reply to message #9239] |
Wed, 26 August 2009 17:22 |
Elwin Dijck
Messages: 16 Registered: June 2009 Location: Groningen, The Netherland...
|
occasional visitor |
From: *KVI.nl
|
|
Hello all,
Perhaps you found this out already, but it seems that actually the Boost interface has changed: they initialize the Mersenne Twister (which actually needs a few hundred integers as initialization) now in a different way than in older versions. Instead of using a single integer, they want a function/functor that gives a sequence of values to initialize the internal state of the Mersenne Twister.
The Boost documentation says "The seeding from an integer was changed in April 2005 to address a weakness." and refers to here.
Also see how ROOT initializes the Mersenne Twister.
So casting will not help, for the newer Boost versions the argument to seed() must be a function or functor. Simplest is to make a small class that has an operator() that just returns the seed number, though it might be better to use one of the more advanced schemes.
Best regards,
Elwin Dijck
|
|
|
|
|
|