42 TrigConf::LogicParser logicParser;
53 if (chain.l1item().empty() || chain.l1item().find(
',')!=std::string::npos) {
continue;}
56 std::map<std::string,unsigned int> thresholds = logicParser.parse(item.
definition())->elementsCount();
57 for (
const auto& [thrName, multiplicity] : thresholds) {
64 m_thresholdMap[chain.namehash()].insert({thrNameHash, multiplicity});
68 catch (
const std::exception& ex) {
69 ATH_MSG_ERROR(
"Exception caught while parsing L1 thresholds for chain " << chain.name() <<
": " << ex.what());
70 return StatusCode::FAILURE;
74 for (
const std::shared_ptr<TrigConf::L1Threshold>& thr : l1Menu->thresholds()) {
80 return StatusCode::SUCCESS;
86 StatusCode
sc = StatusCode::SUCCESS;
91 std::ostringstream ssPassedThresholds;
92 std::unordered_map<TrigCompositeUtils::DecisionID, size_t> tobThresholdCounts;
93 std::unordered_set<std::string> overflowThresholdTypes;
97 if (!decisions.isValid()) {
98 ATH_MSG_DEBUG(
"No DecisionContainer " << decisionsKey <<
" for threshold type " << thrType <<
" found in this event");
105 std::vector<TrigCompositeUtils::DecisionID> passedThresholdIDs;
106 static const std::string thresholdsStr{
"thresholds"};
107 const bool hasDetail = d->getDetail(thresholdsStr, passedThresholdIDs);
109 ATH_MSG_ERROR(
"Detail \"thresholds\" missing from Decision in the container " << decisionsKey);
110 return StatusCode::FAILURE;
112 bool overflow{
false};
113 if (d->hasDetail<
char>(
"overflow")) {
114 overflow =
static_cast<bool>(d->getDetail<
char>(
"overflow"));
116 if (
doDebug()) {ssPassedThresholds.str(
"");}
121 if (tobThresholdCounts.find(thrNameHash)==tobThresholdCounts.end()) {
122 tobThresholdCounts[thrNameHash] = 1;
125 tobThresholdCounts[thrNameHash] += 1;
128 if (!ssPassedThresholds.str().empty()) ssPassedThresholds <<
", ";
135 if (optTob.has_value()) {
136 const RoIDefs::AnyRoIPointer& tob = optTob.value();
137 ATH_MSG_DEBUG(
"Decision " << decisionsKey <<
"[" << idec <<
"] corresponds to TOB with word / et / eta / phi = 0x"
138 << MSG::hex << RoIDefs::roiWord(tob) << MSG::dec <<
" / " << RoIDefs::roiTobEt(tob)
139 <<
" / " << RoIDefs::roiEta(tob) <<
" / " << RoIDefs::roiPhi(tob));
141 ATH_MSG_DEBUG(
"Decision " << decisionsKey <<
"[" << idec <<
"] TOB type not supported by template code for "
142 <<
"debug printout of word / et / eta / phi");
144 ATH_MSG_DEBUG(
"Decision " << decisionsKey <<
"[" << idec <<
"] TOB passes " << passedThresholdIDs.size()
145 <<
" thresholds: " << ssPassedThresholds.str());
154 std::unordered_map<TrigCompositeUtils::DecisionID, size_t> ctpThresholdCounts;
164 for (
const auto& [thrNameHash, multiplicity] : thresholds) {
165 if (ctpThresholdCounts.find(thrNameHash)==ctpThresholdCounts.end()) {
166 ctpThresholdCounts[thrNameHash] = multiplicity;
168 else if (multiplicity > ctpThresholdCounts[thrNameHash]) {
169 ctpThresholdCounts[thrNameHash] = multiplicity;
177 for (
const auto& [thrNameHash, ctpCount] : ctpThresholdCounts) {
182 ATH_MSG_ERROR(
"Threshold with hash " << thrNameHash <<
" not found in the hash->name map");
183 return StatusCode::FAILURE;
185 const std::string& thrName = it->second;
189 bool overflow{overflowThresholdTypes.find(thrType)!=overflowThresholdTypes.end()};
191 ATH_MSG_DEBUG(
"Threshold " << thrName <<
" accepted by the CTP with multiplicity " << ctpCount
192 <<
" is flagged as overflow and thus may be missing TOBs");
196 bool missing = (tobThresholdCounts.find(thrNameHash)==tobThresholdCounts.end());
201 <<
" accepted by the CTP with multiplicity " << ctpCount
202 << (overflow ?
", likely due to overflow" :
""));
205 ATH_MSG_ERROR(
"No TOBs found passing the threshold " << thrName
206 <<
" accepted by the CTP with multiplicity " << ctpCount);
207 sc = StatusCode::FAILURE;
211 tobCount = tobThresholdCounts.at(thrNameHash);
213 tooFew = (tobCount < ctpCount);
218 ATH_MSG_WARNING(
"Too few (" << tobCount <<
") TOBs found passing the threshold " << thrName
219 <<
" accepted by the CTP with multiplicity " << ctpCount
220 << (overflow ?
", likely due to overflow" :
""));
222 ATH_MSG_ERROR(
"Too few (" << tobCount <<
") TOBs found passing the threshold " << thrName
223 <<
" accepted by the CTP with multiplicity " << ctpCount);
224 sc = StatusCode::FAILURE;
228 if (missing || tooFew) {
230 Monitored::Scalar monMissingTOBsIncludingOverflow{
"MissingTOBsIncludingOverflow", thrName};
240 ATH_MSG_DEBUG(
"Check passed. Found " << tobCount <<
" TOBs passing the threshold " << thrName
241 <<
" accepted by the CTP with multiplicity " << ctpCount);
247 const auto ctpIt = ctpThresholdCounts.find(thrNameHash);
248 size_t ctpCount = (ctpIt==ctpThresholdCounts.cend()) ? 0 : ctpIt->second;
249 const auto tobIt = tobThresholdCounts.find(thrNameHash);
250 size_t tobCount = (tobIt==tobThresholdCounts.cend()) ? 0 : tobIt->second;
251 int tobMinusCtpCount =
static_cast<int>(ctpCount) -
static_cast<int>(tobCount);