LDMX Software
EventHeader.h
Go to the documentation of this file.
1
8#ifndef EVENT_EVENTHEADER_H_
9#define EVENT_EVENTHEADER_H_
10
11// ROOT
12#include "TObject.h" //For ClassDef
13#include "TTimeStamp.h"
14
15// STL
16#include <iostream>
17#include <map>
18#include <string>
19
20namespace ldmx {
21
45 public:
49 static const std::string BRANCH;
50
54 EventHeader() = default;
55
59 virtual ~EventHeader() = default;
60
66 void Clear(Option_t* o = "");
67
72 void Print(Option_t* o = "") const;
73
78 int getEventNumber() const { return eventNumber_; }
79
84 int getRun() const { return run_; }
85
92 const TTimeStamp& getTimestamp() const { return timestamp_; }
93
98 double getWeight() const { return weight_; }
99
104 bool isRealData() const { return isRealData_; }
105
110 void setRealData(bool yes = true) { isRealData_ = yes; }
111
120 void setEventNumber(int eventNumber) { this->eventNumber_ = eventNumber; }
121
129 void setRun(int run) { this->run_ = run; }
130
138 void setTimestamp(const TTimeStamp& timestamp) {
139 this->timestamp_ = timestamp;
140 }
141
152 void setWeight(double weight) { this->weight_ = weight; }
153
160 int getIntParameter(const std::string& name) const;
161
168 void setIntParameter(const std::string& name, int value) {
169 intParameters_[name] = value;
170 }
171
178 float getFloatParameter(const std::string& name) const;
179
185 void setFloatParameter(const std::string& name, float value) {
186 floatParameters_[name] = value;
187 }
188
195 std::string getStringParameter(const std::string& name) const;
196
202 void setStringParameter(const std::string& name, std::string value) {
203 stringParameters_[name] = value;
204 }
205
206 protected:
211
215 int run_{-1};
216
220 TTimeStamp timestamp_{0, 0};
221
225 double weight_{1.0};
226
230 bool isRealData_{false};
231
235 std::map<std::string, int> intParameters_;
236
240 std::map<std::string, float> floatParameters_;
241
245 std::map<std::string, std::string> stringParameters_;
246
251};
252
253} // namespace ldmx
254
255#endif /* EVENT_EVENTHEADER_H_ */
Provides header information an event such as event number and timestamp.
Definition EventHeader.h:44
std::map< std::string, int > intParameters_
The int parameters.
double weight_
The event weight.
TTimeStamp timestamp_
The event timestamp.
int getRun() const
Return the run number.
Definition EventHeader.h:84
int getIntParameter(const std::string &name) const
Get an int parameter value.
int run_
The run number.
const TTimeStamp & getTimestamp() const
Get the event's timestamp.
Definition EventHeader.h:92
bool isRealData_
Is this event real data?
void setEventNumber(int eventNumber)
Set the event number.
std::map< std::string, float > floatParameters_
The float parameters.
float getFloatParameter(const std::string &name) const
Get a float parameter value.
bool isRealData() const
Is this a real data event?
std::map< std::string, std::string > stringParameters_
The string parameters.
void setRun(int run)
Set the run number.
void setStringParameter(const std::string &name, std::string value)
Set a string parameter value.
double getWeight() const
Get the event weight (default of 1.0).
Definition EventHeader.h:98
int getEventNumber() const
Return the event number.
Definition EventHeader.h:78
void setRealData(bool yes=true)
set whether this event is real or MC data
void setIntParameter(const std::string &name, int value)
Set an int parameter value.
ClassDef(EventHeader, 2)
ROOT class definition.
void setTimestamp(const TTimeStamp &timestamp)
Set the timestamp.
void Print(Option_t *o="") const
Print this object.
EventHeader()=default
Class constructor.
void setWeight(double weight)
Set the event weight.
void setFloatParameter(const std::string &name, float value)
Set a float parameter value.
virtual ~EventHeader()=default
Class destructor.
static const std::string BRANCH
Name of EventHeader branch.
Definition EventHeader.h:49
std::string getStringParameter(const std::string &name) const
Get a string parameter value.
int eventNumber_
The event number.
void Clear(Option_t *o="")
Clear information from this object.