Belle II Software  release-08-01-10
RunInfo.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 #pragma once
9 
10 #include <TObject.h>
11 #include <string>
12 #include <framework/gearbox/Const.h>
13 #include <framework/logging/Logger.h>
14 
15 namespace Belle2 {
24  class RunInfo: public TObject {
25  public:
26 
30  RunInfo() {}
31 
35  void setExp(unsigned int exp) { m_exp = exp; }
36 
40  void setRun(unsigned int run) { m_run = run; }
41 
45  void setRunType(const std::string& run_type) {m_runType = run_type;}
46 
50  void setStartTime(unsigned long long int start_time) { m_startTime = start_time; }
51 
55  void setStopTime(unsigned long long int stop_time) { m_stopTime = stop_time; }
56 
60  void setReceivedNevent(unsigned int received_nevent) {m_receivedNevent = received_nevent; }
61 
65  void setAcceptedNevent(unsigned int accepted_nevent) {m_acceptedNevent = accepted_nevent; }
66 
70  void setSentNevent(unsigned int sent_nevent) {m_sentNevent = sent_nevent; }
71 
75  void setRunLength(unsigned int run_length) { m_runLength = run_length; }
76 
80  void setTriggerRate(double trigger_rate) { m_triggerRate = trigger_rate; }
81 
86  void setBelle2Detector(unsigned int pxd, unsigned int svd,
87  unsigned int cdc, unsigned int top,
88  unsigned int arich, unsigned int ecl,
89  unsigned int klm)
90  {
91  if (pxd > 0)
92  m_Belle2Detector = m_Belle2Detector + Const::PXD ;
93  if (svd > 0)
94  m_Belle2Detector = m_Belle2Detector + Const::SVD ;
95  if (cdc > 0)
96  m_Belle2Detector = m_Belle2Detector + Const::CDC ;
97  if (top > 0)
98  m_Belle2Detector = m_Belle2Detector + Const::TOP ;
99  if (arich > 0)
100  m_Belle2Detector = m_Belle2Detector + Const::ARICH ;
101  if (ecl > 0)
102  m_Belle2Detector = m_Belle2Detector + Const::ECL ;
103  if (klm > 0)
104  m_Belle2Detector = m_Belle2Detector + Const::KLM ;
105  }
106 
107 
108 
112  void setBadRun(unsigned int bad_run) {m_badRun = bad_run; }
113 
114 
118  void setPreScaleTrigger(unsigned int prescaleTrigger, int bit)
119  {
120  if (bit > -1 && bit < 192) {
121  m_prescaleTrigger[bit] = prescaleTrigger;
122  } else {
123  B2FATAL("setPreScaleTrigger Error : " << bit << " not a valid range. \n Terminate");
124  }
125  }
126 
127 
128 
132  unsigned int getExp() const { return m_exp; }
133 
137  unsigned int getRun() const { return m_run; }
138 
142  const std::string& getRunType() const {return m_runType;}
143 
147  unsigned long long int getStartTime() const { return m_startTime; }
148 
149 
153  unsigned long long int getStopTime() const { return m_stopTime; }
154 
158  unsigned int getReceivedNevent() const { return m_receivedNevent; }
159 
163  unsigned int getAcceptedNevent() const { return m_acceptedNevent; }
164 
168  unsigned int getSentNevent() const { return m_sentNevent; }
169 
173  unsigned int getRunLength() const { return m_runLength; }
174 
178  double getTriggerRate() const { return m_triggerRate; }
179 
180 
184  unsigned int getBadRun() const { return m_badRun; }
185 
186 
191 
192 
196  unsigned int getPreScaleTrigger(int bit) const
197  {
198  if (bit > -1 && bit < 192) {
199  return m_prescaleTrigger[bit];
200  } else {
201  B2FATAL("getPreScaleTrigger Error : " << bit << " not a valid range. \n Terminate");
202  }
203  }
204 
205 
206 
210  virtual void Print(Option_t* option = "") const override;
211 
212 
213 
214  private:
216  unsigned int m_exp{0};
217 
219  unsigned int m_run{0};
220 
222  std::string m_runType{""};
223 
225  unsigned long long int m_startTime{0};
226 
228  unsigned long long int m_stopTime{0};
229 
231  unsigned int m_receivedNevent{0};
232 
234  unsigned int m_acceptedNevent{0};
235 
237  unsigned int m_sentNevent{0};
238 
240  double m_triggerRate{0};
241 
243  unsigned int m_runLength{0};
244 
246  unsigned int m_badRun{0};
247 
250 
252  unsigned int m_prescaleTrigger[192] = {0};
253 
255  };
256 
258 } // end namespace Belle2
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:71
Database object for Run Information.
Definition: RunInfo.h:24
void setAcceptedNevent(unsigned int accepted_nevent)
Set No.
Definition: RunInfo.h:65
virtual void Print(Option_t *option="") const override
Print the content value.
Definition: RunInfo.cc:19
unsigned int getExp() const
Get Experiment number.
Definition: RunInfo.h:132
void setExp(unsigned int exp)
Set Experimental Number.
Definition: RunInfo.h:35
unsigned int m_sentNevent
No.
Definition: RunInfo.h:237
void setBadRun(unsigned int bad_run)
Set Bad run tag (=0 means good run)
Definition: RunInfo.h:112
void setReceivedNevent(unsigned int received_nevent)
Set No.
Definition: RunInfo.h:60
unsigned int getRun() const
Get Run number.
Definition: RunInfo.h:137
Const::DetectorSet getBelle2Detector() const
Get DetectorSet for the subdetectors included in the set.
Definition: RunInfo.h:190
void setStopTime(unsigned long long int stop_time)
Set Run Stop time (Epoch time)
Definition: RunInfo.h:55
unsigned int m_acceptedNevent
Get No.
Definition: RunInfo.h:234
RunInfo()
Default constructor.
Definition: RunInfo.h:30
unsigned int getPreScaleTrigger(int bit) const
Get L1 preScale Trigger factors.
Definition: RunInfo.h:196
unsigned int getReceivedNevent() const
Get No.
Definition: RunInfo.h:158
unsigned int m_exp
Experiment Number.
Definition: RunInfo.h:216
unsigned long long int m_stopTime
Run stop time (Epoch time)
Definition: RunInfo.h:228
unsigned int getAcceptedNevent() const
Get No.
Definition: RunInfo.h:163
void setRun(unsigned int run)
Set Run Number.
Definition: RunInfo.h:40
void setBelle2Detector(unsigned int pxd, unsigned int svd, unsigned int cdc, unsigned int top, unsigned int arich, unsigned int ecl, unsigned int klm)
Set DetectorSet based on which sub-detectors is included.
Definition: RunInfo.h:86
ClassDefOverride(RunInfo, 2)
ClassDef.
double getTriggerRate() const
Get Trigger rate (Hz)
Definition: RunInfo.h:178
void setPreScaleTrigger(unsigned int prescaleTrigger, int bit)
Set L1 preScale Trigger factors.
Definition: RunInfo.h:118
std::string m_runType
Run type
Definition: RunInfo.h:222
unsigned int m_run
Run Number.
Definition: RunInfo.h:219
unsigned long long int m_startTime
Run start time (Epoch time)
Definition: RunInfo.h:225
unsigned int m_prescaleTrigger[192]
L1 Trigger Prescale factors.
Definition: RunInfo.h:252
unsigned int getSentNevent() const
Get No.
Definition: RunInfo.h:168
unsigned int getBadRun() const
Get Bad run tag.
Definition: RunInfo.h:184
unsigned int getRunLength() const
Get Run length (in sec) by DAQ.
Definition: RunInfo.h:173
void setSentNevent(unsigned int sent_nevent)
Set No.
Definition: RunInfo.h:70
unsigned long long int getStartTime() const
Get Run start time (Epoch time)
Definition: RunInfo.h:147
Const::DetectorSet m_Belle2Detector
DetectorSet for the sub-detector used.
Definition: RunInfo.h:249
void setTriggerRate(double trigger_rate)
Set Trigger rate (in Hz)
Definition: RunInfo.h:80
unsigned long long int getStopTime() const
Get Run stop time (Epoch time)
Definition: RunInfo.h:153
unsigned int m_runLength
Run length (in sec) by DAQ.
Definition: RunInfo.h:243
const std::string & getRunType() const
Get Run type.
Definition: RunInfo.h:142
double m_triggerRate
Trigger rate (in Hz)
Definition: RunInfo.h:240
void setRunLength(unsigned int run_length)
Set Run length (in sec) by DAQ.
Definition: RunInfo.h:75
unsigned int m_receivedNevent
No.
Definition: RunInfo.h:231
unsigned int m_badRun
Bad run tag (=0 means good run)
Definition: RunInfo.h:246
void setRunType(const std::string &run_type)
Set Run Type.
Definition: RunInfo.h:45
void setStartTime(unsigned long long int start_time)
Set Run Start time (Epoch time)
Definition: RunInfo.h:50
Abstract base class for different kinds of events.