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
57class RunHeader {
58 public:
64 RunHeader(int runNumber);
65
71 RunHeader() = default;
72
74 virtual ~RunHeader() {}
75
77 int getRunNumber() const { return runNumber_; }
78
80 const std::string &getDetectorName() const { return detectorName_; }
81
83 void setDetectorName(const std::string &det) { detectorName_ = det; }
84
89 const std::string &getSoftwareTag() const { return softwareTag_; }
90
94 const std::string &getLdmxswVersion() const { return ldmxsw_version_; }
95
97 const std::string &getDescription() const { return description_; }
98
100 void setDescription(const std::string &des) { description_ = des; }
101
108 int getRunStart() const { return runStart_; }
109
115 void setRunStart(const int runStart) { runStart_ = runStart; }
116
122 int getRunEnd() const { return runEnd_; }
123
129 void setRunEnd(const int runEnd) { runEnd_ = runEnd; }
130
137 int getNumTries() const { return numTries_; }
138
149 void setNumTries(const int numTries) { numTries_ = numTries; }
150
157 int getIntParameter(const std::string &name) const {
158 return intParameters_.at(name);
159 }
160
162 const std::map<std::string, int> &getIntParameters() const {
163 return intParameters_;
164 }
165
172 void setIntParameter(const std::string &name, int value) {
173 intParameters_[name] = value;
174 }
175
182 float getFloatParameter(const std::string &name) const {
183 return floatParameters_.at(name);
184 }
185
187 const std::map<std::string, float> &getFloatParameters() const {
188 return floatParameters_;
189 }
190
197 void setFloatParameter(const std::string &name, float value) {
198 floatParameters_[name] = value;
199 }
200
207 std::string getStringParameter(const std::string &name) const {
208 return stringParameters_.at(name);
209 }
210
212 const std::map<std::string, std::string> &getStringParameters() const {
213 return stringParameters_;
214 }
215
222 void setStringParameter(const std::string &name, std::string value) {
223 stringParameters_[name] = value;
224 }
225
233 void stream(std::ostream &s) const;
234
236 void Print() const;
237
249 friend std::ostream &operator<<(std::ostream &s, const ldmx::RunHeader &h) {
250 h.stream(s);
251 return s;
252 }
253
254 private:
257
259 std::string detectorName_{""};
260
262 std::string description_{""};
263
265 int runStart_{0};
266
268 int runEnd_{0};
269
284 int numTries_{0};
285
290 std::string softwareTag_{GIT_SHA1};
291
295 std::string ldmxsw_version_{LDMXSW_VERSION};
296
298 std::map<std::string, int> intParameters_;
299
301 std::map<std::string, float> floatParameters_;
302
304 std::map<std::string, std::string> stringParameters_;
305
306 ClassDef(RunHeader, 5);
307
308}; // RunHeader
309
310} // namespace ldmx
311
312#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:57
int getIntParameter(const std::string &name) const
Get an int parameter value.
Definition RunHeader.h:157
std::string softwareTag_
git SHA-1 hash associated with the software tag used to generate this file.
Definition RunHeader.h:290
void setFloatParameter(const std::string &name, float value)
Set a float parameter value.
Definition RunHeader.h:197
std::string getStringParameter(const std::string &name) const
Get a string parameter value.
Definition RunHeader.h:207
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:182
void setRunEnd(const int runEnd)
Set the end time of the run in seconds since epoch.
Definition RunHeader.h:129
const std::map< std::string, int > & getIntParameters() const
Get a const reference to all int parameters.
Definition RunHeader.h:162
void setDetectorName(const std::string &det)
Set the name of the detector that was used in this run.
Definition RunHeader.h:83
std::string detectorName_
Detector name.
Definition RunHeader.h:259
void setStringParameter(const std::string &name, std::string value)
Set a string parameter value.
Definition RunHeader.h:222
virtual ~RunHeader()
Destructor.
Definition RunHeader.h:74
std::string description_
Run description.
Definition RunHeader.h:262
const std::string & getSoftwareTag() const
Definition RunHeader.h:89
int getNumTries() const
Get the total number of tries that were done during the production of this run.
Definition RunHeader.h:137
int numTries_
Total number of events that were begun during the production of this run.
Definition RunHeader.h:284
const std::string & getLdmxswVersion() const
Definition RunHeader.h:94
void setRunStart(const int runStart)
Set the run start time in seconds since epoch.
Definition RunHeader.h:115
const std::string & getDescription() const
Definition RunHeader.h:97
std::map< std::string, float > floatParameters_
Map of float parameters.
Definition RunHeader.h:301
int getRunStart() const
Get the start time of the run in seconds since epoch.
Definition RunHeader.h:108
std::map< std::string, std::string > stringParameters_
Map of string parameters.
Definition RunHeader.h:304
void Print() const
Print a string desciption of this object.
Definition RunHeader.cxx:34
const std::string & getDetectorName() const
Definition RunHeader.h:80
int getRunEnd() const
Get the end time of the run in seconds since epoch.
Definition RunHeader.h:122
friend std::ostream & operator<<(std::ostream &s, const ldmx::RunHeader &h)
Stream this object to an output stream.
Definition RunHeader.h:249
void setDescription(const std::string &des)
Set the description of this run.
Definition RunHeader.h:100
std::map< std::string, int > intParameters_
Map of int parameters.
Definition RunHeader.h:298
int runStart_
Run start in seconds since epoch.
Definition RunHeader.h:265
const std::map< std::string, float > & getFloatParameters() const
Get a const reference to all float parameters.
Definition RunHeader.h:187
void setNumTries(const int numTries)
Set the total number of tries that were done during the production of this run.
Definition RunHeader.h:149
std::string ldmxsw_version_
ldmx-sw software version
Definition RunHeader.h:295
const std::map< std::string, std::string > & getStringParameters() const
Get a const reference to all string parameters.
Definition RunHeader.h:212
int runNumber_
Run number.
Definition RunHeader.h:256
void setIntParameter(const std::string &name, int value)
Set an int parameter value.
Definition RunHeader.h:172
int getRunNumber() const
Definition RunHeader.h:77
int runEnd_
Run end in seconds since epoch.
Definition RunHeader.h:268