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 {
20
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
43 static constexpr unsigned int c_trgDataSize = c_trgWordSize * c_ntrgWords;
44
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
147 {
149 }
150
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
250
252 unsigned int m_inputBits[c_ntrgWords] = {0};
253
255 unsigned int m_ftdlBits[c_ntrgWords] = {0};
256
260 unsigned int m_psnmBits[c_ntrgWords] = {0};
261
265 static const int c_Version = 1;
266
269
274
277 };
278
279
281} // end namespace Belle2
ETimingType getTimType() const
get timing source information
Definition TRGSummary.h:215
void setTimType(ETimingType timType)
set the timType
Definition TRGSummary.h:180
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:271
void setInputBits(int i, int word)
set the input bits
Definition TRGSummary.h:165
static constexpr unsigned int c_trgDataSize
combined value of trigger word size and number
Definition TRGSummary.h:43
ETimingQuality getTimQuality() const
get timing source quality
Definition TRGSummary.h:223
unsigned int m_ftdlBits[c_ntrgWords]
ftdl (Final Trigger Decision Logic) bits.
Definition TRGSummary.h:255
ClassDefOverride(TRGSummary, 8)
Trigger Summary Information including bit (input, ftdl, psnm), timing and trigger source.
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
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.
unsigned int m_inputBits[c_ntrgWords]
input bits from subdetectors
Definition TRGSummary.h:252
bool testInput(const std::string &name) const
check whether an input bit is set
Definition TRGSummary.h:117
ETimingType
types of trigger timing source defined in b2tt firmware
Definition TRGSummary.h:46
@ TTYP_RSV3
reserved (not defined yet)
Definition TRGSummary.h:62
@ TTYP_DPHY
delayed physics events for background
Definition TRGSummary.h:68
@ TTYP_PID3
reserved (not defined yet)
Definition TRGSummary.h:54
@ TTYP_RSV4
reserved (not defined yet)
Definition TRGSummary.h:74
@ TTYP_SELF
events triggered by self trigger
Definition TRGSummary.h:56
@ TTYP_POIS
poisson random trigger
Definition TRGSummary.h:76
@ TTYP_PID1
reserved (not defined yet)
Definition TRGSummary.h:50
@ TTYP_NONE
reserved (not defined yet)
Definition TRGSummary.h:78
@ TTYP_TOP
events triggered by TOP timing
Definition TRGSummary.h:64
@ TTYP_RSV2
reserved (not defined yet)
Definition TRGSummary.h:60
@ TTYP_PID2
reserved (not defined yet)
Definition TRGSummary.h:52
@ TTYP_CDC
events triggered by CDC timing
Definition TRGSummary.h:66
@ TTYP_TEST
test pulse input
Definition TRGSummary.h:72
@ TTYP_RSV1
reserved (not defined yet)
Definition TRGSummary.h:58
@ TTYP_ECL
events triggered by ECL timing
Definition TRGSummary.h:48
@ TTYP_RAND
random trigger events
Definition TRGSummary.h:70
void setPreScale(int i, int bit, int pre)
set the prescale factor of each bit
Definition TRGSummary.h:162
void setPsnmBits(int i, int word)
set the Prescaled ftdl bits
Definition TRGSummary.h:171
unsigned int m_psnmBits[c_ntrgWords]
psnm (PreScale aNd Mask) bits.
Definition TRGSummary.h:260
unsigned int getPreScale(int i, int bit) const
get the prescale factor which the bit is corresponding
Definition TRGSummary.h:177
void setFtdlBits(int i, int word)
set the ftdl bits, the same as setTRGSummary(int i, int word)
Definition TRGSummary.h:168
unsigned int getTRGSummary(int i) const
get the trigger result, each word has 32 bits
Definition TRGSummary.h:174
void setTimQuality(ETimingQuality timQuality)
set the timQuality
Definition TRGSummary.h:183
bool m_isPoissonInInjectionVeto
Poisson random trigger in injection veto or not.
Definition TRGSummary.h:273
TRGSummary()=default
default constructor: xxx
unsigned int getFtdlBits(const unsigned i) const
get ftdl bits (directly determined by the trigger conditions)
Definition TRGSummary.h:198
void setPoissonInInjectionVeto()
set true if poisson random trigger is within injection veto
Definition TRGSummary.h:153
ETimingType m_timType
types of trigger timing source defined in b2tt firmware
Definition TRGSummary.h:268
unsigned int getInputBits(const unsigned i) const
get input bits
Definition TRGSummary.h:189
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:129
bool testPsnm(const std::string &name) const
check whether a psnm bit is set
Definition TRGSummary.h:141
static const int c_Version
version of this code
Definition TRGSummary.h:265
void setTRGSummary(int i, int word)
set the Final Trigger Decision Logic bit
Definition TRGSummary.h:159
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:207
ETimingQuality
trigger timing type quality
Definition TRGSummary.h:82
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:146
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:249
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Abstract base class for different kinds of events.