|
ATLAS Offline Software
|
Go to the documentation of this file.
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;
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;
void setSMK(uint32_t value)
Set the Super Master Key describing this object.
void setEFPassedPhysics(const std::vector< uint32_t > &value)
Set the EF physics decision bits.
std::string find(const std::string &s)
return a remapped string
uint64_t eventNumber() const
The current event's event number.
virtual StatusCode execute(const EventContext &context) const override
Re-entrant execute to create the xAOD::TrigDecision.
void setEFTruncated(bool value)
Set whether the EF result is truncated.
uint32_t runNumber() const
The current event's run number.
const std::vector< uint32_t > & itemsBeforePrescale() const
An algorithm that can be simultaneously executed in multiple threads.
const std::vector< uint32_t > & itemsAfterVeto() const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
~TrigDecisionMakerMT()
std deconstructor
bool isAccepted() const
final LVL1 decision && isConfigured
const std::vector< uint32_t > & getRobStatus(uint16_t moduleId) const
Status words for ROB with given moduleId.
const std::vector< HLT::OnlineErrorCode > getErrorCodes() const
Error codes getter (by value) - strips off the first bit-mask status word.
virtual StatusCode finalize() override
std Gaudi finalize method -> print out statistics
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
void setTAP(const std::vector< uint32_t > &value)
Set the Trigger After Prescale bits.
::StatusCode StatusCode
StatusCode definition for legacy code.
void setTBP(const std::vector< uint32_t > &value)
Set the Trigger Before Prescale bits.
void setTAV(const std::vector< uint32_t > &value)
Set the Trigger After Veto bits.
StatusCode getL1Result(const LVL1CTP::Lvl1Result *&result, const EventContext &context) const
retrieve LVL1 result (called in execute)
bgPattern_t bgPattern(size_t bcid) const
Return word with bit-pattern of fired bunchgroups for given bcid.
void setEFErrorBits(uint32_t value)
Set a summary of all errors that happened during the EF execution.
virtual StatusCode initialize() override
std Gaudi initialize method -> read-in trigger configuration
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const CTPResult & cTPResult() const
Gets the CTP part of the L1 RDO.
const std::unordered_map< uint16_t, std::vector< uint32_t > > & getSerialisedData() const
Serialised data getter.
Class describing the basic event information.
void setEFPrescaled(const std::vector< uint32_t > &value)
Set the EF prescaled bits.
char bgCode() const
Get the bunch group code of the current event.
#define ATH_MSG_WARNING(x)
void setEFPassedRaw(const std::vector< uint32_t > &value)
Set the EF passed-raw bits.
const boost::dynamic_bitset< uint32_t > & getHltPrescaledBits() const
Const-getter for HLT prescaled bits.
void setBGCode(char value)
Set the bunch group code of the current event.
TrigDecisionMakerMT(const std::string &name, ISvcLocator *pSvcLocator)
std Gaudi Algorithm constructor
uint32_t bcid() const
The bunch crossing ID of the event.
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
const std::vector< uint32_t > & itemsAfterPrescale() const
bool isComplete() const
returns true if object isValid() and data has the expected length
const boost::dynamic_bitset< uint32_t > & getHltPassRawBits() const
Const-getter for HLT pass raw bits.