13 #ifndef DDG4_PLUGINS_GEANT4EVENTSEED_H
14 #define DDG4_PLUGINS_GEANT4EVENTSEED_H
20 #if defined __has_cpp_attribute
21 #if __has_cpp_attribute(fallthrough)
22 #define ATTR_FALLTHROUGH [[fallthrough]]
24 #define ATTR_FALLTHROUGH
27 #define ATTR_FALLTHROUGH
52 class Geant4EventSeed:
public Geant4RunAction {
66 void begin(
const G4Run*);
83 #define hashsize(n) ( 1U << (n) )
84 #define hashmask(n) ( hashsize ( n ) - 1 )
115 a -= b; a -= c; a ^= (c>>13); \
116 b -= c; b -= a; b ^= (a<<8); \
117 c -= a; c -= b; c ^= (b>>13); \
118 a -= b; a -= c; a ^= (c>>12); \
119 b -= c; b -= a; b ^= (a<<16); \
120 c -= a; c -= b; c ^= (b>>5); \
121 a -= b; a -= c; a ^= (c>>3); \
122 b -= c; b -= a; b ^= (a<<10); \
123 c -= a; c -= b; c ^= (b>>15); \
153 unsigned jenkins_hash (
unsigned char *k,
unsigned length,
unsigned initval )
156 unsigned c = initval;
157 unsigned len = length;
161 while ( len >= 12 ) {
162 a += ( k[0] + ( (unsigned)k[1] << 8 )
163 + ( (unsigned)k[2] << 16 )
164 + ( (unsigned)k[3] << 24 ) );
165 b += ( k[4] + ( (unsigned)k[5] << 8 )
166 + ( (unsigned)k[6] << 16 )
167 + ( (unsigned)k[7] << 24 ) );
168 c += ( k[8] + ( (unsigned)k[9] << 8 )
169 + ( (unsigned)k[10] << 16 )
170 + ( (unsigned)k[11] << 24 ) );
201 unsigned int hash(
unsigned int initialSeed,
unsigned int eventNumber,
unsigned int runNumber ){
202 unsigned int seed = 0;
203 unsigned char * c = (
unsigned char *) &eventNumber ;
206 c = (
unsigned char *) &runNumber ;
209 c = (
unsigned char *) &initialSeed ;
218 #endif // DDG4_PLUGINS_GEANT4EVENTSEED_H