26 #include <boost/dynamic_bitset.hpp>
38 bool resultObjectIsUsed =
true;
39 if (!m_bitsMakerTool.empty()) {
40 ATH_MSG_INFO(
"TrigDecisionMakerMT is setting up to run after the Trigger in a job with POOL output. "
41 "The TriggerBitsMakerTool will be used directly to create the xAOD::TrigDecision.");
43 resultObjectIsUsed =
false;
45 ATH_MSG_INFO(
"TrigDecisionMakerMT is setting up to read the trigger bits from trigger bytestream. "
46 "The HLTResultMT object will be used as the source of the trigger bits.");
48 ATH_CHECK( m_hltResultKeyIn.initialize(resultObjectIsUsed) );
53 ATH_CHECK( m_ROIBResultKeyIn.initialize() );
54 ATH_CHECK( m_EventInfoKeyIn.initialize() );
56 ATH_CHECK( m_trigDecisionKeyOut.initialize() );
60 return StatusCode::SUCCESS;
67 ATH_MSG_DEBUG (
"=============================================");
72 ATH_MSG_DEBUG (
"=============================================");
74 return StatusCode::SUCCESS;
85 std::unique_ptr<xAOD::TrigDecision> trigDec = std::make_unique<xAOD::TrigDecision>();
86 std::unique_ptr<xAOD::TrigDecisionAuxInfo> trigDecAux = std::make_unique<xAOD::TrigDecisionAuxInfo>();
95 ATH_CHECK(getL1Result(l1Result, context));
108 boost::dynamic_bitset<uint32_t> passRawBitset, prescaledBitset;
110 if (m_bitsMakerTool.isSet()) {
112 ATH_MSG_DEBUG (
"MC Mode: Creating bits with TriggerBitsMakerTool");
113 ATH_CHECK(m_bitsMakerTool->getBits(passRawBitset, prescaledBitset, context));
125 const std::vector<HLT::OnlineErrorCode> errorCodes = hltResult->
getErrorCodes();
126 bool truncated =
false;
128 for (
size_t i = 0;
i < errorCodes.size(); ++
i) {
143 std::set<uint16_t> allModuleIds;
144 for (
const auto& itr : hltResult->
getSerialisedData()) allModuleIds.insert(itr.first);
146 for (
uint16_t moduleId : allModuleIds) {
152 if (moduleId==0)
break;
160 ATH_MSG_DEBUG (
"Number of HLT chains passed raw: " << passRawBitset.count());
161 ATH_MSG_DEBUG (
"Number of HLT chains prescaled out: " << prescaledBitset.count());
163 if (passRawBitset.any()) {
167 std::vector<uint32_t> passRaw, prescaled;
169 passRaw.resize(passRawBitset.num_blocks());
170 prescaled.resize(prescaledBitset.num_blocks());
172 boost::to_block_range(passRawBitset, passRaw.begin());
173 boost::to_block_range(prescaledBitset, prescaled.begin());
178 static const std::set<unsigned> buggyPrescaleBitRuns = {429603, 429606, 429612, 429658, 429697, 429716};
179 const bool isBuggyPrescaleBitsRun = (
std::find(buggyPrescaleBitRuns.begin(), buggyPrescaleBitRuns.end(), context.eventID().run_number()) != buggyPrescaleBitRuns.end());
180 if (isBuggyPrescaleBitsRun) {
181 ATH_MSG_DEBUG(
"T0 Trigger fix for 429603-429716 is deleting incorrect isPrescaled trigger bits decoded from the bytestream.");
182 for (
size_t i = 0;
i < prescaled.size(); ++
i) {
187 if (passRaw.size() != prescaled.size()) {
188 ATH_MSG_ERROR(
"Trigger bitsets are not all the same size! passRaw:"
189 << passRaw.size() <<
" prescaled:" << prescaled.size() );
190 return StatusCode::FAILURE;
215 <<
"'; Event '" << eventInfo->eventNumber()
216 <<
"'; BCID '" << eventInfo->bcid()
217 <<
"'; BG Code '" << trigDec->
bgCode() <<
"'" ) ;
219 ATH_MSG_DEBUG (
"Decision object dump: " << *(trigDec.get()));
220 auto trigDecWriteHandle =
SG::makeHandle( m_trigDecisionKeyOut, context );
221 ATH_CHECK( trigDecWriteHandle.record( std::move( trigDec ), std::move( trigDecAux ) ) );
222 ATH_MSG_DEBUG (
"Recorded xAOD::TrigDecision to StoreGate with key = " << m_trigDecisionKeyOut.key());
224 return StatusCode::SUCCESS;
233 std::vector< std::unique_ptr<LVL1CTP::Lvl1Item> > itemConfig = m_lvl1Tool->makeLvl1ItemConfig(context);
236 m_lvl1Tool->createL1Items(itemConfig, *roIBResult, &
result);
237 ATH_MSG_DEBUG (
"Built LVL1CTP::Lvl1Result from valid CTPResult.");
241 ATH_MSG_ERROR (
"Could not construct L1 result from roIBResult");
242 return StatusCode::FAILURE;
245 return StatusCode::SUCCESS;