Belle II Software  release-05-02-19
TRGSummary.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Hideyuki Nakazawa, Thomas Hauth *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef TRGSUMMARY_H
12 #define TRGSUMMARY_H
13 
14 #include <framework/datastore/RelationsObject.h>
15 
16 #include <string>
17 
18 namespace Belle2 {
35  class TRGSummary final : public RelationsObject {
36 
37  public:
38 
40  static const unsigned int c_trgWordSize = 32;
41 
43  static const unsigned int c_ntrgWords = 10;
44 
46  enum ETimingType {
48  TTYP_ECL = 0,
50  TTYP_PID1 = 4,
52  TTYP_PID2 = 8,
54  TTYP_PID3 = 12,
56  TTYP_SELF = 2,
58  TTYP_RSV1 = 6,
60  TTYP_RSV2 = 10,
62  TTYP_RSV3 = 14,
64  TTYP_TOP = 1,
66  TTYP_CDC = 3,
68  TTYP_DPHY = 5,
70  TTYP_RAND = 7,
72  TTYP_TEST = 9,
74  TTYP_RSV4 = 11,
76  TTYP_POIS = 13,
78  TTYP_NONE = 15
79  };
80 
83  /* Non. Must not happen for TOP/ECL/CDC timing events */
84  TTYQ_NONE = 0,
85  /* Coarse */
86  TTYQ_CORS = 1,
87  /* Fine */
88  TTYQ_FINE = 2,
89  /* Super Fine */
90  TTYQ_SFIN = 3,
91  };
92 
94  TRGSummary() = default;
95 
97  TRGSummary(unsigned int inputBits[10],
98  unsigned int ftdlBits[10],
99  unsigned int psnmBits[10],
100  ETimingType timType);
101 
105  bool test() const;
106 
111  bool testInput(unsigned int bit) const;
112 
117  bool testInput(const std::string& name) const {return testInput(getInputBitNumber(name));}
118 
123  bool testFtdl(unsigned int bit) const;
124 
129  bool testFtdl(const std::string& name) const {return testFtdl(getOutputBitNumber(name));}
130 
135  bool testPsnm(unsigned int bit) const;
136 
141  bool testPsnm(const std::string& name) const {return testPsnm(getOutputBitNumber(name));}
142 
146  bool isPoissonInInjectionVeto() const
147  {
149  }
150 
154  {
156  }
157 
159  void setTRGSummary(int i, int word) { m_ftdlBits[i] = word;}
160 
162  void setPreScale(int i, int bit, int pre) {m_prescaleBits[i][bit] = pre;}
163 
165  void setInputBits(int i, int word) {m_inputBits[i] = word;}
166 
168  void setFtdlBits(int i, int word) {m_ftdlBits[i] = word;}
169 
171  void setPsnmBits(int i, int word) {m_psnmBits[i] = word;}
172 
174  unsigned int getTRGSummary(int i) const {return m_ftdlBits[i];}
175 
177  unsigned int getPreScale(int i, int bit) const {return m_prescaleBits[i][bit];}
178 
180  void setTimType(ETimingType timType) {m_timType = timType;}
181 
183  void setTimQuality(ETimingQuality timQuality) {m_timQuality = timQuality;}
184 
189  unsigned int getInputBits(const unsigned i) const
190  {
191  return m_inputBits[i];
192  }
193 
198  unsigned int getFtdlBits(const unsigned i) const
199  {
200  return m_ftdlBits[i];
201  }
202 
207  unsigned int getPsnmBits(const unsigned i) const
208  {
209  return m_psnmBits[i];
210  }
211 
216  {
217  return m_timType;
218  }
219 
224  {
225  return m_timQuality;
226  }
227 
229  std::string getInfoHTML() const override;
230 
235  unsigned int getInputBitNumber(const std::string& name) const;
236 
241  unsigned int getOutputBitNumber(const std::string& name) const;
242 
243  private:
244 
246  std::string outputBitWithColor(bool bit) const;
247 
251  static const int c_Version = 1;
252 
254  unsigned int m_inputBits[c_ntrgWords] = {0};
255 
257  unsigned int m_ftdlBits[c_ntrgWords] = {0};
258 
262  unsigned int m_psnmBits[c_ntrgWords] = {0};
263 
266 
268  ETimingQuality m_timQuality = TTYQ_NONE;
269 
271  unsigned int m_prescaleBits[c_ntrgWords][c_trgWordSize] = {0};
272 
274  bool m_isPoissonInInjectionVeto = false;
275 
278  };
279 
280 
282 } // end namespace Belle2
283 
284 #endif
Belle2::TRGSummary::TTYP_DPHY
@ TTYP_DPHY
delayed physics events for background
Definition: TRGSummary.h:76
Belle2::TRGSummary::TTYP_PID2
@ TTYP_PID2
reserved (not defined yet)
Definition: TRGSummary.h:60
Belle2::TRGSummary::setPreScale
void setPreScale(int i, int bit, int pre)
set the prescale factor of each bit
Definition: TRGSummary.h:170
Belle2::TRGSummary::getTimQuality
ETimingQuality getTimQuality() const
get timing source quality
Definition: TRGSummary.h:231
Belle2::TRGSummary::getTimType
ETimingType getTimType() const
get timing source information
Definition: TRGSummary.h:223
Belle2::TRGSummary::setPsnmBits
void setPsnmBits(int i, int word)
set the Prescaled ftdl bits
Definition: TRGSummary.h:179
Belle2::TRGSummary::c_Version
static const int c_Version
version of this code
Definition: TRGSummary.h:259
Belle2::TRGSummary::TTYP_PID3
@ TTYP_PID3
reserved (not defined yet)
Definition: TRGSummary.h:62
Belle2::TRGSummary::getFtdlBits
unsigned int getFtdlBits(const unsigned i) const
get ftdl bits (directly determined by the trigger conditions)
Definition: TRGSummary.h:206
Belle2::TRGSummary::TTYP_CDC
@ TTYP_CDC
events triggered by CDC timing
Definition: TRGSummary.h:74
Belle2::TRGSummary::isPoissonInInjectionVeto
bool isPoissonInInjectionVeto() const
check whether poisson random trigger is within injection veto
Definition: TRGSummary.h:154
Belle2::TRGSummary::setFtdlBits
void setFtdlBits(int i, int word)
set the ftdl bits, the same as setTRGSummary(int i, int word)
Definition: TRGSummary.h:176
Belle2::TRGSummary::TTYP_RAND
@ TTYP_RAND
random trigger events
Definition: TRGSummary.h:78
Belle2::TRGSummary::testPsnm
bool testPsnm(unsigned int bit) const
check whether a psnm bit is set
Definition: TRGSummary.cc:58
Belle2::TRGSummary::testInput
bool testInput(unsigned int bit) const
check whether an input bit is set
Definition: TRGSummary.cc:36
Belle2::TRGSummary::ClassDefOverride
ClassDefOverride(TRGSummary, 7)
Trigger Summary Information including bit (input, ftdl, psnm), timing and trigger source.
Belle2::TRGSummary::setTRGSummary
void setTRGSummary(int i, int word)
set the Final Trigger Decision Logic bit
Definition: TRGSummary.h:167
Belle2::TRGSummary::ETimingQuality
ETimingQuality
trigger timing type quality
Definition: TRGSummary.h:90
Belle2::TRGSummary::getPsnmBits
unsigned int getPsnmBits(const unsigned i) const
get psnm bits (prescaled ftdl bits)
Definition: TRGSummary.h:215
Belle2::TRGSummary::test
bool test() const
check whether any psnm bit is set
Definition: TRGSummary.cc:28
Belle2::TRGSummary::TTYP_RSV1
@ TTYP_RSV1
reserved (not defined yet)
Definition: TRGSummary.h:66
Belle2::TRGSummary::testFtdl
bool testFtdl(unsigned int bit) const
check whether a ftdl bit is set
Definition: TRGSummary.cc:47
Belle2::TRGSummary::m_timQuality
ETimingQuality m_timQuality
trigger timing type quality
Definition: TRGSummary.h:276
Belle2::TRGSummary::TTYP_ECL
@ TTYP_ECL
events triggered by ECL timing
Definition: TRGSummary.h:56
Belle2::TRGSummary::TTYP_SELF
@ TTYP_SELF
events triggered by self trigger
Definition: TRGSummary.h:64
Belle2::TRGSummary::TTYP_PID1
@ TTYP_PID1
reserved (not defined yet)
Definition: TRGSummary.h:58
Belle2::TRGSummary
Trigger Summary Information input bits input bits from subdetectors ftdl (Final Trigger Decision Logi...
Definition: TRGSummary.h:43
Belle2::TRGSummary::TTYP_RSV4
@ TTYP_RSV4
reserved (not defined yet)
Definition: TRGSummary.h:82
Belle2::TRGSummary::m_isPoissonInInjectionVeto
bool m_isPoissonInInjectionVeto
Poisson random trigger in injection veto or not.
Definition: TRGSummary.h:282
Belle2::TRGSummary::m_timType
ETimingType m_timType
types of trigger timing source defined in b2tt firmware
Definition: TRGSummary.h:273
Belle2::TRGSummary::m_psnmBits
unsigned int m_psnmBits[c_ntrgWords]
psnm (PreScale aNd Mask) bits.
Definition: TRGSummary.h:270
Belle2::TRGSummary::getOutputBitNumber
unsigned int getOutputBitNumber(const std::string &name) const
get number of an output trigger bit
Definition: TRGSummary.cc:88
Belle2::TRGSummary::TTYP_RSV3
@ TTYP_RSV3
reserved (not defined yet)
Definition: TRGSummary.h:70
Belle2::TRGSummary::getTRGSummary
unsigned int getTRGSummary(int i) const
get the trigger result, each word has 32 bits
Definition: TRGSummary.h:182
Belle2::TRGSummary::getInputBitNumber
unsigned int getInputBitNumber(const std::string &name) const
get number of an input trigger bit
Definition: TRGSummary.cc:69
Belle2::TRGSummary::getInputBits
unsigned int getInputBits(const unsigned i) const
get input bits
Definition: TRGSummary.h:197
Belle2::TRGSummary::TTYP_TOP
@ TTYP_TOP
events triggered by TOP timing
Definition: TRGSummary.h:72
Belle2::TRGSummary::setInputBits
void setInputBits(int i, int word)
set the input bits
Definition: TRGSummary.h:173
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGSummary::c_trgWordSize
static const unsigned int c_trgWordSize
size of a l1 trigger word
Definition: TRGSummary.h:48
Belle2::TRGSummary::setPoissonInInjectionVeto
void setPoissonInInjectionVeto()
set true if poisson random trigger is within injection veto
Definition: TRGSummary.h:161
Belle2::TRGSummary::c_ntrgWords
static const unsigned int c_ntrgWords
number of l1 trigger words
Definition: TRGSummary.h:51
Belle2::TRGSummary::getInfoHTML
std::string getInfoHTML() const override
Return a short summary of this object's contents in HTML format.
Definition: TRGSummary.cc:106
Belle2::TRGSummary::setTimQuality
void setTimQuality(ETimingQuality timQuality)
set the timQuality
Definition: TRGSummary.h:191
Belle2::TRGSummary::getPreScale
unsigned int getPreScale(int i, int bit) const
get the prescale factor which the bit is corresponding
Definition: TRGSummary.h:185
Belle2::TRGSummary::outputBitWithColor
std::string outputBitWithColor(bool bit) const
return the td part of an HTML table with green of the bit is > 0
Definition: TRGSummary.cc:144
Belle2::TRGSummary::TRGSummary
TRGSummary()=default
default constructor: xxx
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::TRGSummary::setTimType
void setTimType(ETimingType timType)
set the timType
Definition: TRGSummary.h:188
Belle2::TRGSummary::ETimingType
ETimingType
types of trigger timing source defined in b2tt firmware
Definition: TRGSummary.h:54
Belle2::TRGSummary::TTYP_NONE
@ TTYP_NONE
reserved (not defined yet)
Definition: TRGSummary.h:86
Belle2::TRGSummary::TTYP_TEST
@ TTYP_TEST
test pulse input
Definition: TRGSummary.h:80
Belle2::TRGSummary::TTYP_RSV2
@ TTYP_RSV2
reserved (not defined yet)
Definition: TRGSummary.h:68
Belle2::TRGSummary::m_prescaleBits
unsigned int m_prescaleBits[c_ntrgWords][c_trgWordSize]
the prescale factor of each bit
Definition: TRGSummary.h:279
Belle2::TRGSummary::m_ftdlBits
unsigned int m_ftdlBits[c_ntrgWords]
ftdl (Final Trigger Decision Logic) bits.
Definition: TRGSummary.h:265
Belle2::TRGSummary::m_inputBits
unsigned int m_inputBits[c_ntrgWords]
input bits from subdetectors
Definition: TRGSummary.h:262
Belle2::TRGSummary::TTYP_POIS
@ TTYP_POIS
poisson random trigger
Definition: TRGSummary.h:84