Belle II Software  release-08-01-10
EventMetaData.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <TObject.h>
12 
13 #include <string>
14 
15 namespace Belle2 {
33  class EventMetaData : public TObject {
34  public:
35 
37  explicit EventMetaData(unsigned int event = 1, int run = 0, int experiment = 0);
38 
41 
46  c_HLTCrash = 0x4,
48  c_HLTDiscard = 0x10,
49  };
50 
55  void setEvent(unsigned int event) { m_event = event; }
56 
61  void setRun(int run) { m_run = run; }
62 
67  void setSubrun(int subrun) { m_subrun = subrun; }
68 
73  void setExperiment(int experiment) { m_experiment = experiment; }
74 
79  void setProduction(int production) { m_production = production; }
80 
85  void setTime(unsigned long long int time) { m_time = time; }
86 
97  void setEndOfData();
98 
103  void setEndOfRun(unsigned int experimentNumber, unsigned int runNumber);
104 
106  bool isEndOfData() const;
107 
109  bool isEndOfRun() const;
110 
115  void setParentLfn(const std::string& parent) { m_parentLfn = parent; }
116 
121  void setGeneratedWeight(double weight) { m_generatedWeight = weight; }
122 
127  void setErrorFlag(unsigned int errorFlag) { m_errorFlag = errorFlag; }
128 
133  void addErrorFlag(EventErrorFlag errorFlag) { m_errorFlag |= errorFlag; }
134 
139  unsigned int getErrorFlag() const { return m_errorFlag; }
140 
145  unsigned int getEvent() const { return m_event; }
146 
151  int getRun() const { return m_run; }
152 
158  int getSubrun() const { return m_subrun; }
159 
164  int getExperiment() const { return m_experiment; }
165 
170  int getProduction() const { return m_production; }
171 
176  unsigned long long int getTime() const { return m_time; }
177 
180  const std::string& getParentLfn() const { return m_parentLfn; }
181 
186  double getGeneratedWeight() const { return m_generatedWeight; }
187 
193  bool operator== (const EventMetaData& eventMetaData) const;
194 
200  bool operator!= (const EventMetaData& eventMetaData) const { return !(*this == eventMetaData); }
201 
202 
203  private:
204  unsigned int m_event;
205  int m_run;
206  int m_subrun;
210  unsigned long long int m_time;
211  std::string m_parentLfn;
213  unsigned int m_errorFlag;
216  }; //class
218 } // namespace Belle2
Store event, run, and experiment numbers.
Definition: EventMetaData.h:33
void setEvent(unsigned int event)
Event Setter.
Definition: EventMetaData.h:55
double getGeneratedWeight() const
Generated Weight Getter.
int m_subrun
Sub-run number, increases indicate recovery from DAQ-internal trouble without change to detector cons...
~EventMetaData()
Destructor.
Definition: EventMetaData.h:40
void setExperiment(int experiment)
Experiment Setter.
Definition: EventMetaData.h:73
void setEndOfRun(unsigned int experimentNumber, unsigned int runNumber)
Marks the end of the current run.
void setEndOfData()
Marks the end of the data processing.
ClassDef(EventMetaData, 4)
Store event number, run number, and experiment number.
bool operator!=(const EventMetaData &eventMetaData) const
Comparison Operator.
int getRun() const
Run Getter.
bool operator==(const EventMetaData &eventMetaData) const
Comparison Operator.
void setGeneratedWeight(double weight)
Generated Weight Setter.
double m_generatedWeight
Generated weight.
int getSubrun() const
Sub run Getter.
unsigned int getEvent() const
Event Getter.
EventErrorFlag
bit-flag format of m_error_flag
Definition: EventMetaData.h:43
@ c_B2LinkPacketCRCError
Belle2link CRC error is detected in the event.
Definition: EventMetaData.h:44
@ c_HLTCrash
The HLT reconstruction crashed in this event or the event before.
Definition: EventMetaData.h:46
@ c_ReconstructionAbort
The event was not reconstructed, e.g.
Definition: EventMetaData.h:47
@ c_B2LinkEventCRCError
HSLB_COPPER CRC error is detected in the event.
Definition: EventMetaData.h:45
@ c_HLTDiscard
The HLT discarded the event and only metadata is kept.
Definition: EventMetaData.h:48
int getProduction() const
Production Getter.
bool isEndOfRun() const
is end-of-run set? (see setEndOfRun()).
void setErrorFlag(unsigned int errorFlag)
Set Error Flag.
void setProduction(int production)
Production Setter.
Definition: EventMetaData.h:79
std::string m_parentLfn
LFN of the parent file.
void setRun(int run)
Run Setter.
Definition: EventMetaData.h:61
int m_production
Unique identifier of the production of the event.
unsigned long long int m_time
Time in ns since epoch (1970-01-01).
void setParentLfn(const std::string &parent)
Parent LFN Setter.
int m_experiment
Experiment number.
unsigned int m_event
Event number ('normal' data has values > 0).
void setTime(unsigned long long int time)
Time Setter.
Definition: EventMetaData.h:85
int getExperiment() const
Experiment Getter.
unsigned long long int getTime() const
Time Getter.
void addErrorFlag(EventErrorFlag errorFlag)
Add Error Flag.
EventMetaData(unsigned int event=1, int run=0, int experiment=0)
Constructor.
unsigned int getErrorFlag() const
Get error flag.
const std::string & getParentLfn() const
Return LFN of the current parent file, or an empty string if not set.
bool isEndOfData() const
is end-of-data set? (see setEndOfData()).
unsigned int m_errorFlag
Indicator of error conditions during data taking, ORed combination of EventErrorFlag values.
int m_run
Run number (usually > 0, run-independent MC has run == 0).
void setSubrun(int subrun)
Sub run Setter.
Definition: EventMetaData.h:67
Abstract base class for different kinds of events.