LDMX Software
RunHeader.h
1#ifndef FRAMEWORK_EVENT_RUNHEADER_H_
2#define FRAMEWORK_EVENT_RUNHEADER_H_
3
4/*~~~~~~~~~~*/
5/* ROOT */
6/*~~~~~~~~~~*/
7#include "TObject.h"
8
9/*~~~~~~~~~~~~~~~~*/
10/* C++ StdLib */
11/*~~~~~~~~~~~~~~~~*/
12#include <map>
13#include <string>
14
15/*~~~~~~~~~~~~~~~*/
16/* Framework */
17/*~~~~~~~~~~~~~~~*/
18#include "Framework/Version.h"
19
20namespace ldmx {
21
54class RunHeader {
55 public:
61 RunHeader(int runNumber);
62
68 RunHeader() = default;
69
71 virtual ~RunHeader() {}
72
74 int getRunNumber() const { return runNumber_; }
75
77 const std::string &getDetectorName() const { return detectorName_; }
78
80 void setDetectorName(const std::string &det) { detectorName_ = det; }
81
86 const std::string &getSoftwareTag() const { return softwareTag_; }
87
89 const std::string &getDescription() const { return description_; }
90
92 void setDescription(const std::string &des) { description_ = des; }
93
100 int getRunStart() const { return runStart_; }
101
107 void setRunStart(const int runStart) { runStart_ = runStart; }
108
114 int getRunEnd() const { return runEnd_; }
115
121 void setRunEnd(const int runEnd) { runEnd_ = runEnd; }
122
129 int getNumTries() const { return numTries_; }
130
141 void setNumTries(const int numTries) { numTries_ = numTries; }
142
149 int getIntParameter(const std::string &name) const {
150 return intParameters_.at(name);
151 }
152
154 const std::map<std::string, int> &getIntParameters() const {
155 return intParameters_;
156 }
157
164 void setIntParameter(const std::string &name, int value) {
165 intParameters_[name] = value;
166 }
167
174 float getFloatParameter(const std::string &name) const {
175 return floatParameters_.at(name);
176 }
177
179 const std::map<std::string, float> &getFloatParameters() const {
180 return floatParameters_;
181 }
182
189 void setFloatParameter(const std::string &name, float value) {
190 floatParameters_[name] = value;
191 }
192
199 std::string getStringParameter(const std::string &name) const {
200 return stringParameters_.at(name);
201 }
202
204 const std::map<std::string, std::string> &getStringParameters() const {
205 return stringParameters_;
206 }
207
214 void setStringParameter(const std::string &name, std::string value) {
215 stringParameters_[name] = value;
216 }
217
225 void stream(std::ostream &s) const;
226
228 void Print() const;
229
241 friend std::ostream &operator<<(std::ostream &s, const ldmx::RunHeader &h) {
242 h.stream(s);
243 return s;
244 }
245
246 private:
249
251 std::string detectorName_{""};
252
254 std::string description_{""};
255
257 int runStart_{0};
258
260 int runEnd_{0};
261
276 int numTries_{0};
277
282 std::string softwareTag_{GIT_SHA1};
283
285 std::map<std::string, int> intParameters_;
286
288 std::map<std::string, float> floatParameters_;
289
291 std::map<std::string, std::string> stringParameters_;
292
293 ClassDef(RunHeader, 4);
294
295}; // RunHeader
296
297} // namespace ldmx
298
299#endif // _FRAMEWORK_EVENT_RUN_HEADER_H_
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:54
int getIntParameter(const std::string &name) const
Get an int parameter value.
Definition RunHeader.h:149
std::string softwareTag_
git SHA-1 hash associated with the software tag used to generate this file.
Definition RunHeader.h:282
void setFloatParameter(const std::string &name, float value)
Set a float parameter value.
Definition RunHeader.h:189
std::string getStringParameter(const std::string &name) const
Get a string parameter value.
Definition RunHeader.h:199
RunHeader()=default
Default constructor.
void stream(std::ostream &s) const
Stream this object into the input ostream.
Definition RunHeader.cxx:15
float getFloatParameter(const std::string &name) const
Get a float parameter value.
Definition RunHeader.h:174
void setRunEnd(const int runEnd)
Set the end time of the run in seconds since epoch.
Definition RunHeader.h:121
const std::map< std::string, int > & getIntParameters() const
Get a const reference to all int parameters.
Definition RunHeader.h:154
void setDetectorName(const std::string &det)
Set the name of the detector that was used in this run.
Definition RunHeader.h:80
std::string detectorName_
Detector name.
Definition RunHeader.h:251
void setStringParameter(const std::string &name, std::string value)
Set a string parameter value.
Definition RunHeader.h:214
virtual ~RunHeader()
Destructor.
Definition RunHeader.h:71
std::string description_
Run description.
Definition RunHeader.h:254
const std::string & getSoftwareTag() const
Definition RunHeader.h:86
int getNumTries() const
Get the total number of tries that were done during the production of this run.
Definition RunHeader.h:129
int numTries_
Total number of events that were begun during the production of this run.
Definition RunHeader.h:276
void setRunStart(const int runStart)
Set the run start time in seconds since epoch.
Definition RunHeader.h:107
const std::string & getDescription() const
Definition RunHeader.h:89
std::map< std::string, float > floatParameters_
Map of float parameters.
Definition RunHeader.h:288
int getRunStart() const
Get the start time of the run in seconds since epoch.
Definition RunHeader.h:100
std::map< std::string, std::string > stringParameters_
Map of string parameters.
Definition RunHeader.h:291
void Print() const
Print a string desciption of this object.
Definition RunHeader.cxx:34
const std::string & getDetectorName() const
Definition RunHeader.h:77
int getRunEnd() const
Get the end time of the run in seconds since epoch.
Definition RunHeader.h:114
friend std::ostream & operator<<(std::ostream &s, const ldmx::RunHeader &h)
Stream this object to an output stream.
Definition RunHeader.h:241
void setDescription(const std::string &des)
Set the description of this run.
Definition RunHeader.h:92
std::map< std::string, int > intParameters_
Map of int parameters.
Definition RunHeader.h:285
int runStart_
Run start in seconds since epoch.
Definition RunHeader.h:257
const std::map< std::string, float > & getFloatParameters() const
Get a const reference to all float parameters.
Definition RunHeader.h:179
void setNumTries(const int numTries)
Set the total number of tries that were done during the production of this run.
Definition RunHeader.h:141
const std::map< std::string, std::string > & getStringParameters() const
Get a const reference to all string parameters.
Definition RunHeader.h:204
int runNumber_
Run number.
Definition RunHeader.h:248
void setIntParameter(const std::string &name, int value)
Set an int parameter value.
Definition RunHeader.h:164
int getRunNumber() const
Definition RunHeader.h:74
int runEnd_
Run end in seconds since epoch.
Definition RunHeader.h:260