SeedCreator.h
Go to the documentation of this file.
1 /**
2  * @file SeedCreator.h
3  * @brief Tools and modules for checking out the basics of the Monte Carlo.
4  * @author Ben Carls (bcarls@fnal.gov)
5  *
6  * Coding note: Never put @code #include "SeedCreator.h" @endcode in your code.
7  * It would force a dependency in your class on every other class in the
8  * Simulation directory; e.g., if I changed the `MCTruth` code, your
9  * code that generates Electrons would re-compile. This class exists
10  * solely as a bookkeeping tool.
11  */
12 
13 #ifndef SEEDCREATOR_H
14 #define SEEDCREATOR_H
15 
16 #include "TRandom3.h"
17 
18 namespace SeedCreator{
19 
20  inline unsigned int CreateRandomNumberSeed()
21  {
22 
23  // the maximum allowed seed for the art::RandomNumberGenerator
24  // is 900000000. Use TRandom3 to get the seed value in that range.
25  // Instantiating TRandom3 with a 0 means that its seed is set based
26  // on the TUUID and should always be random, even for jobs running on the
27  // same machine
28  TRandom3 rand(0);
29  return rand.Integer(900000000);
30  }
31 
32 }
33 
34 #endif// SEEDCREATOR_H
unsigned int CreateRandomNumberSeed()
Definition: SeedCreator.h:20