LDMX Software
RandomNumberSeedService.h
Go to the documentation of this file.
1
7#ifndef FRAMEWORK_RANDOMNUMBERSEEDSERVICE_H_
8#define FRAMEWORK_RANDOMNUMBERSEEDSERVICE_H_
9
10/*~~~~~~~~~~~~~~~*/
11/* Framework */
12/*~~~~~~~~~~~~~~~*/
15
16namespace framework {
17
35 public:
37 static const std::string CONDITIONS_OBJECT_NAME;
38
51 RandomNumberSeedService(const std::string& name, const std::string& tagname,
52 const framework::config::Parameters& parameters,
54
66 virtual void onNewRun(ldmx::RunHeader& header);
67
79 uint64_t getSeed(const std::string& name) const;
80
86 std::vector<std::string> getSeedNames() const;
87
93 uint64_t getMasterSeed() const { return masterSeed_; }
94
105 virtual std::pair<const ConditionsObject*, ConditionsIOV> getCondition(
106 const ldmx::EventHeader& context);
107
115 } // it is us, never destroy it.
116
122 void stream(std::ostream& s) const;
123
132 friend std::ostream& operator<<(std::ostream& s,
133 const RandomNumberSeedService& o) {
134 o.stream(s);
135 return s;
136 }
137
138 private:
140 bool initialized_{false};
141
143 int seedMode_{0};
144
146 uint64_t masterSeed_{0};
147
149 mutable std::map<std::string, uint64_t> seeds_;
150};
151
152} // namespace framework
153
154#endif // FRAMEWORK_RANDOMNUMBERSEEDSERVICE_H_
Base class for provider of conditions information like pedestals, gains, electronics maps,...
Base class for conditions information like pedestals, gains, electronics maps, etc.
Base class for all providers of conditions objects.
const Process & process() const
Get the process handle.
Base class for all conditions objects, very simple.
Class which represents the process under execution.
Definition Process.h:36
System for consistent seeding of random number generators.
virtual std::pair< const ConditionsObject *, ConditionsIOV > getCondition(const ldmx::EventHeader &context)
Get the seed service as a conditions object.
bool initialized_
whether the master seed has been initialized
std::map< std::string, uint64_t > seeds_
cache of seeds by name
friend std::ostream & operator<<(std::ostream &s, const RandomNumberSeedService &o)
Output streaming operator.
std::vector< std::string > getSeedNames() const
Get a list of all the known seeds.
virtual void releaseConditionsObject(const ConditionsObject *co)
This object is both the provider of the seed service and the conditions object itself,...
static const std::string CONDITIONS_OBJECT_NAME
Conditions object name.
int seedMode_
what mode of master seed are we using
uint64_t getMasterSeed() const
Access the master seed.
uint64_t masterSeed_
what the master seed actually is
uint64_t getSeed(const std::string &name) const
Access a given seed by name.
virtual void onNewRun(ldmx::RunHeader &header)
Configure the seed service when a new run starts.
void stream(std::ostream &s) const
Stream the configuration of this object to the input ostream.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:54
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45