8#include <mdst/dataobjects/TRGSummary.h>
10#include <framework/logging/Logger.h>
11#include <framework/database/DBObjPtr.h>
12#include <mdst/dbobjects/TRGGDLDBInputBits.h>
13#include <mdst/dbobjects/TRGGDLDBFTDLBits.h>
24 unsigned int ftdlBits[10],
25 unsigned int psnmBits[10],
28 for (
int i = 0; i < 10; i++) {
38 for (
unsigned int word = 0; word <
c_ntrgWords; word++) {
47 B2ERROR(
"Requested input trigger bit number is out of range" <<
LogVar(
"bit", bit));
48 throw std::out_of_range(
"The requested input trigger bit is out of range: " + std::to_string(bit));
58 B2ERROR(
"Requested ftdl trigger bit number is out of range" <<
LogVar(
"bit", bit));
59 throw std::out_of_range(
"The requested FTDL trigger bit is out of range: " + std::to_string(bit));
63 return (
m_ftdlBits[iWord] & (1u << iBit)) != 0;
69 B2ERROR(
"Requested psnm trigger bit number is out of range" <<
LogVar(
"bit", bit));
70 throw std::out_of_range(
"The requested PSNM trigger bit is out of range: " + std::to_string(bit));
74 return (
m_psnmBits[iWord] & (1u << iBit)) != 0;
85 B2WARNING(
"The mapping of input trigger names does not exist in the given globaltags");
86 throw std::runtime_error(
"No input trigger map in the given globaltags");
90 if (std::string(inputBits->getinbitname((
int)bit)) == name) {
95 B2WARNING(
"The requested input trigger name does not exist" <<
LogVar(
"name", name));
96 throw std::invalid_argument(
"The requested input trigger name does not exist: " + name);
107 B2WARNING(
"The mapping of output trigger names does not exist in the given globaltags");
108 throw std::runtime_error(
"No input trigger map in the given globaltags");
112 if (std::string(ftdlBits->getoutbitname((
int)bit)) == name) {
117 B2WARNING(
"The requested output trigger name does not exist" <<
LogVar(
"name", name));
121 throw std::invalid_argument(
"The requested input trigger name does not exist: " + name);
126 std::stringstream htmlOutput;
128 htmlOutput <<
"<table>";
130 <<
"<tr><td></td><td bgcolor='#cccccc'>GDL Input</td><td bgcolor='#cccccc' colspan='2'>GDL Output</td></tr>";
132 <<
"<tr><td>Bit</td><td>Input Bits</td><td>Final Trg DL</td><td>Prescaled Trg and Mask</td></tr>";
134 for (
unsigned int currentBit = 0;
136 htmlOutput <<
"<tr>";
142 (
getFtdlBits(currentWord) & ((
unsigned int)1 << currentBitInWord)) > 0;
144 (
getPsnmBits(currentWord) & ((
unsigned int)1 << currentBitInWord)) > 0;
146 & ((
unsigned int)1 << currentBitInWord)) > 0;
148 htmlOutput <<
"<td>" << currentBit <<
"(word " << currentWord <<
" bit "
149 << currentBitInWord <<
")</td>";
153 htmlOutput <<
"</tr>";
155 htmlOutput <<
"</table>";
157 return htmlOutput.str();
164 const std::string colorNeutral = gROOT->GetColor(kWhite)->AsHexString();
165 const std::string colorAccept = gROOT->GetColor(kGreen)->AsHexString();
167 std::string color = bit > 0 ? colorAccept : colorNeutral;
168 std::stringstream outStream;
169 outStream <<
"<td bgcolor=\"" << color <<
"\">" << bit <<
"</td>";
170 return outStream.str();
Class for accessing objects in the database.
static const unsigned int c_trgWordSize
size of a l1 trigger word
unsigned int m_ftdlBits[c_ntrgWords]
ftdl (Final Trigger Decision Logic) bits.
bool test() const
check whether any psnm bit is set
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
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
ETimingType
types of trigger timing source defined in b2tt firmware
unsigned int m_psnmBits[c_ntrgWords]
psnm (PreScale aNd Mask) bits.
TRGSummary()=default
default constructor: xxx
unsigned int getFtdlBits(const unsigned i) const
get ftdl bits (directly determined by the trigger conditions)
ETimingType m_timType
types of trigger timing source defined in b2tt firmware
unsigned int getInputBits(const unsigned i) const
get input bits
unsigned int getOutputBitNumber(const std::string &name) const
get number of an output trigger bit
unsigned int getInputBitNumber(const std::string &name) const
get number of an input trigger bit
static const unsigned int c_ntrgWords
number of l1 trigger words
unsigned int getPsnmBits(const unsigned i) const
get psnm bits (prescaled ftdl bits)
bool testInput(unsigned int bit) const
check whether an input bit is set
bool testFtdl(unsigned int bit) const
check whether a ftdl bit is set
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.