Belle II Software development
TRGSummary.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 <framework/datastore/RelationsObject.h>
12
13#include <string>
14
15namespace Belle2 {
32 class TRGSummary final : public RelationsObject {
33
34 public:
35
37 static const unsigned int c_trgWordSize = 32;
38
40 static const unsigned int c_ntrgWords = 10;
41
75 TTYP_NONE = 15
76 };
77
80 /* Non. Must not happen for TOP/ECL/CDC timing events */
81 TTYQ_NONE = 0,
82 /* Coarse */
83 TTYQ_CORS = 1,
84 /* Fine */
85 TTYQ_FINE = 2,
86 /* Super Fine */
87 TTYQ_SFIN = 3,
88 };
89
91 TRGSummary() = default;
92
94 TRGSummary(unsigned int inputBits[10],
95 unsigned int ftdlBits[10],
96 unsigned int psnmBits[10],
97 ETimingType timType);
98
102 bool test() const;
103
108 bool testInput(unsigned int bit) const;
109
114 bool testInput(const std::string& name) const {return testInput(getInputBitNumber(name));}
115
120 bool testFtdl(unsigned int bit) const;
121
126 bool testFtdl(const std::string& name) const {return testFtdl(getOutputBitNumber(name));}
127
132 bool testPsnm(unsigned int bit) const;
133
138 bool testPsnm(const std::string& name) const {return testPsnm(getOutputBitNumber(name));}
139
144 {
146 }
147
151 {
153 }
154
156 void setTRGSummary(int i, int word) { m_ftdlBits[i] = word;}
157
159 void setPreScale(int i, int bit, int pre) {m_prescaleBits[i][bit] = pre;}
160
162 void setInputBits(int i, int word) {m_inputBits[i] = word;}
163
165 void setFtdlBits(int i, int word) {m_ftdlBits[i] = word;}
166
168 void setPsnmBits(int i, int word) {m_psnmBits[i] = word;}
169
171 unsigned int getTRGSummary(int i) const {return m_ftdlBits[i];}
172
174 unsigned int getPreScale(int i, int bit) const {return m_prescaleBits[i][bit];}
175
177 void setTimType(ETimingType timType) {m_timType = timType;}
178
180 void setTimQuality(ETimingQuality timQuality) {m_timQuality = timQuality;}
181
186 unsigned int getInputBits(const unsigned i) const
187 {
188 return m_inputBits[i];
189 }
190
195 unsigned int getFtdlBits(const unsigned i) const
196 {
197 return m_ftdlBits[i];
198 }
199
204 unsigned int getPsnmBits(const unsigned i) const
205 {
206 return m_psnmBits[i];
207 }
208
213 {
214 return m_timType;
215 }
216
221 {
222 return m_timQuality;
223 }
224
226 std::string getInfoHTML() const override;
227
232 unsigned int getInputBitNumber(const std::string& name) const;
233
238 unsigned int getOutputBitNumber(const std::string& name) const;
239
240 private:
241
243 std::string outputBitWithColor(bool bit) const;
244
248 static const int c_Version = 1;
249
251 unsigned int m_inputBits[c_ntrgWords] = {0};
252
254 unsigned int m_ftdlBits[c_ntrgWords] = {0};
255
259 unsigned int m_psnmBits[c_ntrgWords] = {0};
260
263
266
269
272
275 };
276
277
279} // end namespace Belle2
Defines interface for accessing relations of objects in StoreArray.
Trigger Summary Information input bits input bits from subdetectors ftdl (Final Trigger Decision Logi...
Definition: TRGSummary.h:32
ETimingType getTimType() const
get timing source information
Definition: TRGSummary.h:212
void setTimType(ETimingType timType)
set the timType
Definition: TRGSummary.h:177
static const unsigned int c_trgWordSize
size of a l1 trigger word
Definition: TRGSummary.h:37
ETimingQuality m_timQuality
trigger timing type quality
Definition: TRGSummary.h:265
void setInputBits(int i, int word)
set the input bits
Definition: TRGSummary.h:162
ClassDefOverride(TRGSummary, 7)
Trigger Summary Information including bit (input, ftdl, psnm), timing and trigger source.
ETimingQuality getTimQuality() const
get timing source quality
Definition: TRGSummary.h:220
unsigned int m_ftdlBits[c_ntrgWords]
ftdl (Final Trigger Decision Logic) bits.
Definition: TRGSummary.h:254
bool test() const
check whether any psnm bit is set
Definition: TRGSummary.cc:36
std::string outputBitWithColor(bool bit) const
return the td part of an HTML table with green of the bit is > 0
Definition: TRGSummary.cc:162
bool testPsnm(unsigned int bit) const
check whether a psnm bit is set
Definition: TRGSummary.cc:66
std::string getInfoHTML() const override
Return a short summary of this object's contents in HTML format.
Definition: TRGSummary.cc:124
unsigned int m_inputBits[c_ntrgWords]
input bits from subdetectors
Definition: TRGSummary.h:251
bool testInput(const std::string &name) const
check whether an input bit is set
Definition: TRGSummary.h:114
ETimingType
types of trigger timing source defined in b2tt firmware
Definition: TRGSummary.h:43
@ TTYP_RSV3
reserved (not defined yet)
Definition: TRGSummary.h:59
@ TTYP_DPHY
delayed physics events for background
Definition: TRGSummary.h:65
@ TTYP_PID3
reserved (not defined yet)
Definition: TRGSummary.h:51
@ TTYP_RSV4
reserved (not defined yet)
Definition: TRGSummary.h:71
@ TTYP_SELF
events triggered by self trigger
Definition: TRGSummary.h:53
@ TTYP_POIS
poisson random trigger
Definition: TRGSummary.h:73
@ TTYP_PID1
reserved (not defined yet)
Definition: TRGSummary.h:47
@ TTYP_NONE
reserved (not defined yet)
Definition: TRGSummary.h:75
@ TTYP_TOP
events triggered by TOP timing
Definition: TRGSummary.h:61
@ TTYP_RSV2
reserved (not defined yet)
Definition: TRGSummary.h:57
@ TTYP_PID2
reserved (not defined yet)
Definition: TRGSummary.h:49
@ TTYP_CDC
events triggered by CDC timing
Definition: TRGSummary.h:63
@ TTYP_TEST
test pulse input
Definition: TRGSummary.h:69
@ TTYP_RSV1
reserved (not defined yet)
Definition: TRGSummary.h:55
@ TTYP_ECL
events triggered by ECL timing
Definition: TRGSummary.h:45
@ TTYP_RAND
random trigger events
Definition: TRGSummary.h:67
void setPreScale(int i, int bit, int pre)
set the prescale factor of each bit
Definition: TRGSummary.h:159
void setPsnmBits(int i, int word)
set the Prescaled ftdl bits
Definition: TRGSummary.h:168
unsigned int m_psnmBits[c_ntrgWords]
psnm (PreScale aNd Mask) bits.
Definition: TRGSummary.h:259
unsigned int getPreScale(int i, int bit) const
get the prescale factor which the bit is corresponding
Definition: TRGSummary.h:174
void setFtdlBits(int i, int word)
set the ftdl bits, the same as setTRGSummary(int i, int word)
Definition: TRGSummary.h:165
unsigned int getTRGSummary(int i) const
get the trigger result, each word has 32 bits
Definition: TRGSummary.h:171
void setTimQuality(ETimingQuality timQuality)
set the timQuality
Definition: TRGSummary.h:180
bool m_isPoissonInInjectionVeto
Poisson random trigger in injection veto or not.
Definition: TRGSummary.h:271
TRGSummary()=default
default constructor: xxx
unsigned int getFtdlBits(const unsigned i) const
get ftdl bits (directly determined by the trigger conditions)
Definition: TRGSummary.h:195
void setPoissonInInjectionVeto()
set true if poisson random trigger is within injection veto
Definition: TRGSummary.h:150
ETimingType m_timType
types of trigger timing source defined in b2tt firmware
Definition: TRGSummary.h:262
unsigned int getInputBits(const unsigned i) const
get input bits
Definition: TRGSummary.h:186
unsigned int getOutputBitNumber(const std::string &name) const
get number of an output trigger bit
Definition: TRGSummary.cc:99
bool testFtdl(const std::string &name) const
check whether a ftdl bit is set
Definition: TRGSummary.h:126
bool testPsnm(const std::string &name) const
check whether a psnm bit is set
Definition: TRGSummary.h:138
static const int c_Version
version of this code
Definition: TRGSummary.h:248
void setTRGSummary(int i, int word)
set the Final Trigger Decision Logic bit
Definition: TRGSummary.h:156
unsigned int getInputBitNumber(const std::string &name) const
get number of an input trigger bit
Definition: TRGSummary.cc:77
static const unsigned int c_ntrgWords
number of l1 trigger words
Definition: TRGSummary.h:40
unsigned int getPsnmBits(const unsigned i) const
get psnm bits (prescaled ftdl bits)
Definition: TRGSummary.h:204
ETimingQuality
trigger timing type quality
Definition: TRGSummary.h:79
bool testInput(unsigned int bit) const
check whether an input bit is set
Definition: TRGSummary.cc:44
bool isPoissonInInjectionVeto() const
check whether poisson random trigger is within injection veto
Definition: TRGSummary.h:143
bool testFtdl(unsigned int bit) const
check whether a ftdl bit is set
Definition: TRGSummary.cc:55
unsigned int m_prescaleBits[c_ntrgWords][c_trgWordSize]
the prescale factor of each bit
Definition: TRGSummary.h:268
Abstract base class for different kinds of events.