1#ifndef FIRE_EVENTHEADER_H
2#define FIRE_EVENTHEADER_H
11#include "fire/version/Version.h"
13#include "fire/io/Data.h"
14#include "fire/io/ParameterStorage.h"
18#include "TTimeStamp.h"
49 std::string_view label{eh.
isRealData_ ?
"DATA" :
"MC"};
51 return s <<
"EventHeader {"
53 <<
", run: " << eh.
run_
70 int number()
const {
return eventNumber_; }
82 int run()
const {
return run_; }
94 double weight()
const {
return weight_; }
112 void setRun(
int run) { this->run_ = run; }
126 void setWeight(
double weight) { this->weight_ = weight; }
145 template<
typename ParameterType>
147 return parameters_.get<ParameterType>(name);
157 template<
typename ParameterType>
159 parameters_.set(name,val);
175 template<
typename DataSet>
179 d.attach(
"run",run_);
180 d.attach(
"timestamp",time_);
181 d.attach(
"weight",weight_);
182 d.attach(
"isRealData",isRealData_);
183 d.attach(
"parameters",parameters_);
189 int eventNumber_{-1};
209 bool isRealData_{
false};
224 TTimeStamp timestamp_;
229 std::map<std::string,int> intParameters_;
234 std::map<std::string,float> floatParameters_;
239 std::map<std::string,std::string> stringParameters_;
246 ClassDef(EventHeader, 4);
277class Data<ldmx::
EventHeader> :
public AbstractData<ldmx::EventHeader> {
288 explicit Data(
const std::string& path, Reader* input_file, ldmx::EventHeader* eh);
295 void load(h5::Reader& r)
final override;
306 void load(root::Reader& r)
final override;
313 void save(Writer& w)
final override;
319 void structure(Writer& w)
final override;
331 template <
typename MemberType>
332 void attach(
const std::string& name, MemberType& m) {
334 std::make_unique<Data<MemberType>>(this->path_ +
"/" + name, input_file_, &m));
Definitions for names of structures required by serialization methods.
General data set.
Definition: Data.h:90
Provides dynamic parameter storage by interfacing between a map to variants storing parameters and a ...
Definition: ParameterStorage.h:40
empty struct for connecting a instance of Data and the type it wraps
Definition: Access.h:22
static const std::string NUMBER_NAME
the name of the variable in event and run headers corresponding to their ID
Definition: Constants.h:20