From b96bc26668d032f5124ea540bc9b60ea7149dcaa Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Sun, 16 Mar 2025 16:44:00 -0400 Subject: [PATCH 1/8] re-introduce the doDataScouting method into muCalStreamerTool --- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 49 ++++++++++++++++++- .../TrigL2MuonSA/src/MuCalStreamerTool.h | 2 +- .../TrigL2MuonSA/src/MuFastSteering.cxx | 4 +- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 7d2c1685bbbe..1f70093148f4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -113,7 +113,7 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - // int calBufferSize, + int calBufferSize, // Add calBufferSize parameter bool doDataScouting, bool &updateTriggerElement, const EventContext& ctx) const { @@ -232,6 +232,53 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} m_circ->dumpToCirc (event); } + + if (doDataScouting) { + // Perform data scouting specific operations + uint16_t eventSize_ds = event.size(); + if (eventSize_ds>1000) return StatusCode::SUCCESS; + + std::unique_ptr<uint8_t[]> buff_ds = std::make_unique<uint8_t[]>(eventSize_ds); + + // encode the event + uint16_t eventSize8bits = eventSize_ds; + uint16_t eventSize32bits = eventSize8bits/4; + event.dumpWords(buff_ds.get(),eventSize_ds); + + // fill the local buffer + // dump the words also in the local buffer + // dump the encoded event to the screen + ATH_MSG_DEBUG("Size of the DATASCOUTING buffer in 32 bits words: " << eventSize32bits); + for ( uint16_t words = 0 ; words != eventSize32bits ; words++) { + uint32_t byte1 = buff_ds[words*4]; + uint32_t byte2 = buff_ds[words*4 + 1]; + uint32_t byte3 = buff_ds[words*4 + 2]; + uint32_t byte4 = buff_ds[words*4 + 3]; + + // encoding in big-endian for now ( revert order for little-endian ) + uint32_t dataWord = (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1 ; + // std::cout << "Number of data words: " << words << std::endl; + ATH_MSG_DEBUG("Data word " << words << " = " << std::hex << "0x" << dataWord << std::dec); + + const_cast<MuCalStreamerTool*>(this)->m_localBuffer.push_back(dataWord); + } + const_cast<MuCalStreamerTool*>(this)->m_localBufferSize += eventSize32bits; + + if ( m_localBufferSize< calBufferSize ) { + ATH_MSG_DEBUG("Local buffer size = " << m_localBufferSize); + ATH_MSG_DEBUG("Trigger element not to be updated yet "); + updateTriggerElement = false; + } + else { + ATH_MSG_DEBUG("Local buffer size = " << m_localBufferSize); + ATH_MSG_DEBUG("Attach the buffer to the trigger element "); + + updateTriggerElement = true; + } + + //delete [] buff_ds; + + } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index fb615f289c74..8226ee35aee5 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -88,7 +88,7 @@ namespace TrigL2MuonSA { TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - //int calBufferSize, + int calBufferSize, bool doDataScouting, bool& updateTriggerElement, const EventContext& ctx) const; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index c8ac2c04a734..f8017c2f469b 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1107,12 +1107,12 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc if (m_doCalStream && trackPatterns.size()>0 ) { TrigL2MuonSA::TrackPattern tp = trackPatterns[0]; bool updateTriggerElement = false; - //int calBS = m_calBufferSize; + int calBS = m_calBufferSize; bool calDS = m_calDataScouting; sc = m_calStreamer->createRoiFragment(*p_roi,tp,mdtHits_normal, rpcHits, tgcHits, - //calBS, + calBS, calDS, updateTriggerElement,ctx); if (sc != StatusCode::SUCCESS ) { -- GitLab From 13e8581827cb275bd6532647a03fd4e618bff905 Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Sun, 16 Mar 2025 17:27:21 -0400 Subject: [PATCH 2/8] re-introduce the doDataScouting method into muCalStreamerTool, change const_cast access of m_localBuff and m_localBuffSize to define it as mutable type, m_localBuffSize from int to uint32 --- .../TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx | 8 +++++--- .../TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h | 6 +++--- .../TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 1f70093148f4..ad155d935aca 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -113,7 +113,7 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - int calBufferSize, // Add calBufferSize parameter + uint32_t calBufferSize, // Add calBufferSize parameter bool doDataScouting, bool &updateTriggerElement, const EventContext& ctx) const { @@ -260,9 +260,11 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} // std::cout << "Number of data words: " << words << std::endl; ATH_MSG_DEBUG("Data word " << words << " = " << std::hex << "0x" << dataWord << std::dec); - const_cast<MuCalStreamerTool*>(this)->m_localBuffer.push_back(dataWord); + m_localBuffer.push_back(dataWord); + //const_cast<MuCalStreamerTool*>(this)->m_localBuffer.push_back(dataWord); } - const_cast<MuCalStreamerTool*>(this)->m_localBufferSize += eventSize32bits; + m_localBufferSize += eventSize32bits; + //const_cast<MuCalStreamerTool*>(this)->m_localBufferSize += eventSize32bits; if ( m_localBufferSize< calBufferSize ) { ATH_MSG_DEBUG("Local buffer size = " << m_localBufferSize); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index 8226ee35aee5..4b558be0cc20 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -88,7 +88,7 @@ namespace TrigL2MuonSA { TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - int calBufferSize, + uint32_t calBufferSize, bool doDataScouting, bool& updateTriggerElement, const EventContext& ctx) const; @@ -121,8 +121,8 @@ namespace TrigL2MuonSA { // local buffer for the TrigComposite object - int m_localBufferSize = 0; - std::vector<int> m_localBuffer; + mutable uint32_t m_localBufferSize = 0; + mutable std::vector<int> m_localBuffer; // // create the MDT fragment diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index f8017c2f469b..7a6ca3de07ec 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1107,7 +1107,7 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc if (m_doCalStream && trackPatterns.size()>0 ) { TrigL2MuonSA::TrackPattern tp = trackPatterns[0]; bool updateTriggerElement = false; - int calBS = m_calBufferSize; + uint32_t calBS = m_calBufferSize; bool calDS = m_calDataScouting; sc = m_calStreamer->createRoiFragment(*p_roi,tp,mdtHits_normal, rpcHits, -- GitLab From 1e84f37fbaa4b52b7374caddaeb3c24a8b5a1c03 Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Wed, 26 Mar 2025 08:22:28 -0400 Subject: [PATCH 3/8] move m_localBuffer to function argument. reuse muCompositeContainer to store dataScouting localBuffer --- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 23 +++++++------- .../TrigL2MuonSA/src/MuCalStreamerTool.h | 16 +++++----- .../TrigL2MuonSA/src/MuFastSteering.cxx | 30 ++++++++++++++++++- .../TrigL2MuonSA/src/MuFastSteering.h | 1 + 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index ad155d935aca..3fc0dad1d0fb 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -34,9 +34,9 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::initialize () ATH_CHECK( m_regSel_TGC.retrieve() ); - m_localBuffer.clear(); + // m_localBuffer.clear(); - m_localBufferSize = 0; + // m_localBufferSize = 0; ATH_CHECK(m_tgcRdoKey.initialize()); ATH_CHECK(m_readKey.initialize()); @@ -113,9 +113,11 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - uint32_t calBufferSize, // Add calBufferSize parameter - bool doDataScouting, - bool &updateTriggerElement, const EventContext& ctx) const + std::vector<uint32_t>& localBuffer, // Add localBuffer parameter + uint32_t &localBufferSize, // Add localBufferSize parameter + uint32_t calBufferSize, // Add calBufferSize parameter + bool doDataScouting, + bool &updateTriggerElement, const EventContext& ctx) const { // create the fragment @@ -260,19 +262,20 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} // std::cout << "Number of data words: " << words << std::endl; ATH_MSG_DEBUG("Data word " << words << " = " << std::hex << "0x" << dataWord << std::dec); - m_localBuffer.push_back(dataWord); + localBuffer.push_back(dataWord); //const_cast<MuCalStreamerTool*>(this)->m_localBuffer.push_back(dataWord); } - m_localBufferSize += eventSize32bits; + + localBufferSize += eventSize32bits; //const_cast<MuCalStreamerTool*>(this)->m_localBufferSize += eventSize32bits; - if ( m_localBufferSize< calBufferSize ) { - ATH_MSG_DEBUG("Local buffer size = " << m_localBufferSize); + if ( localBufferSize< calBufferSize ) { + ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); ATH_MSG_DEBUG("Trigger element not to be updated yet "); updateTriggerElement = false; } else { - ATH_MSG_DEBUG("Local buffer size = " << m_localBufferSize); + ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); ATH_MSG_DEBUG("Attach the buffer to the trigger element "); updateTriggerElement = true; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index 4b558be0cc20..5b94927cea08 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -67,8 +67,8 @@ namespace TrigL2MuonSA { // set the properties void setBufferName(const std::string& buffName) {m_calBufferName=buffName;} - std::vector<int>* getLocalBuffer() {return &m_localBuffer;} - int getLocalBufferSize() const {return m_localBuffer.size();} + // std::vector<int>* getLocalBuffer() {return &m_localBuffer;} + // int getLocalBufferSize() const {return m_localBuffer.size();} /* void clearLocalBuffer(); */ // @@ -88,9 +88,11 @@ namespace TrigL2MuonSA { TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, + std::vector<uint32_t>& localBuffer, // Add localBuffer parameter + uint32_t &localBufferSize, // Add localBufferSize parameter uint32_t calBufferSize, bool doDataScouting, - bool& updateTriggerElement, const EventContext& ctx) const; + bool& updateTriggerElement, const EventContext& ctx) const; private: @@ -120,9 +122,9 @@ namespace TrigL2MuonSA { - // local buffer for the TrigComposite object - mutable uint32_t m_localBufferSize = 0; - mutable std::vector<int> m_localBuffer; + // change the local buffer for the TrigComposite object to an argument of the createRoiFragment method + // mutable uint32_t m_localBufferSize = 0; + // mutable std::vector<int> m_localBuffer; // // create the MDT fragment @@ -132,7 +134,7 @@ namespace TrigL2MuonSA { // // create the RPC fragment StatusCode createRpcFragment(const xAOD::MuonRoI* roi, - LVL2_MUON_CALIBRATION::RpcCalibFragment& rpcFragment, const EventContext& ctx) const; + LVL2_MUON_CALIBRATION::RpcCalibFragment& rpcFragment, const EventContext& ctx) const; // // create the TGC fragment diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index 7a6ca3de07ec..5ff0da1342f5 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -353,7 +353,7 @@ StatusCode MuFastSteering::execute(const EventContext& ctx) const else { // to StatusCode findMuonSignature() ATH_CHECK(findMuonSignature(internalRoI, recRoIVector, - *muFastContainer, *muIdContainer, *muMsContainer, dynamicDeltaRpc, ctx)); + *muFastContainer, *muCompositeContainer, *muIdContainer, *muMsContainer, dynamicDeltaRpc, ctx)); } if (msgLvl(MSG::DEBUG)) { @@ -820,6 +820,7 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDescriptor*>& roids, const std::vector<const xAOD::MuonRoI*>& muonRoIs, DataVector<xAOD::L2StandAloneMuon>& outputTracks, + xAOD::TrigCompositeContainer& outputMuonCal, TrigRoiDescriptorCollection& outputID, TrigRoiDescriptorCollection& outputMS, const bool dynamicDeltaRpc, @@ -1109,15 +1110,42 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc bool updateTriggerElement = false; uint32_t calBS = m_calBufferSize; bool calDS = m_calDataScouting; + std::vector<uint32_t> localBuffer; // init localBuffer parameter + uint32_t localBufferSize = 0 ; // init localBufferSize parameter sc = m_calStreamer->createRoiFragment(*p_roi,tp,mdtHits_normal, rpcHits, tgcHits, + localBuffer, + localBufferSize, calBS, calDS, updateTriggerElement,ctx); if (sc != StatusCode::SUCCESS ) { ATH_MSG_WARNING("Calibration streamer: create Roi Fragment failed"); } + // if it's a data scouting chain check the buffer length + if ( m_calDataScouting && updateTriggerElement ) { + + ATH_MSG_DEBUG("Updating the trigger element"); + ATH_MSG_DEBUG(">> Retrieved the buffer, with size: " << localBufferSize); + // create the TrigCompositeContainer to store the calibration buffer + // at StatusCode execute() and hltExecute(). + + // add the trigcomposite object to the container + xAOD::TrigComposite* tc = new xAOD::TrigComposite(); + outputMuonCal.push_back(tc); + + ATH_MSG_DEBUG("The size of the TrigCompositeContainer is: " << outputMuonCal.size() ); + + // set the detail of the trigcomposite object + // xAOD::TrigComposite* tc = m_trigCompositeContainer->at(0); + tc->setDetail("MuonCalibrationStream", localBuffer ); + + //m_calStreamer->clearLocalBuffer(); + + } + + } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h index 0cee20fa6a67..65a2c4954c16 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h @@ -79,6 +79,7 @@ class MuFastSteering : public AthReentrantAlgorithm , public IIncidentListener StatusCode findMuonSignature(const std::vector<const TrigRoiDescriptor*>& roi, const std::vector<const xAOD::MuonRoI*>& muonRoIs, DataVector<xAOD::L2StandAloneMuon>& outputTracks, + xAOD::TrigCompositeContainer& outputMuonCal, TrigRoiDescriptorCollection& outputID, TrigRoiDescriptorCollection& outputMS, const bool dynamicDeltaRpc, -- GitLab From 77363104e538847fc1bfee100c0e709982480959 Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Wed, 26 Mar 2025 09:03:25 -0400 Subject: [PATCH 4/8] clean up the unnecessary comments --- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 4 ---- .../TrigL2MuonSA/src/MuCalStreamerTool.h | 22 +------------------ .../TrigL2MuonSA/src/MuFastSteering.cxx | 8 ++----- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 3fc0dad1d0fb..0738f6c66066 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -263,11 +263,9 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} ATH_MSG_DEBUG("Data word " << words << " = " << std::hex << "0x" << dataWord << std::dec); localBuffer.push_back(dataWord); - //const_cast<MuCalStreamerTool*>(this)->m_localBuffer.push_back(dataWord); } localBufferSize += eventSize32bits; - //const_cast<MuCalStreamerTool*>(this)->m_localBufferSize += eventSize32bits; if ( localBufferSize< calBufferSize ) { ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); @@ -281,8 +279,6 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} updateTriggerElement = true; } - //delete [] buff_ds; - } return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index 5b94927cea08..1f19646d1a18 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -67,11 +67,6 @@ namespace TrigL2MuonSA { // set the properties void setBufferName(const std::string& buffName) {m_calBufferName=buffName;} - // std::vector<int>* getLocalBuffer() {return &m_localBuffer;} - // int getLocalBufferSize() const {return m_localBuffer.size();} - /* void clearLocalBuffer(); */ - - // // initialize the stream StatusCode openStream(int calBufferSize); @@ -82,7 +77,7 @@ namespace TrigL2MuonSA { bool isStreamOpen(); // - // create the fragment corresponding to an roi + // create the fragment corresponding to an roi, add localBuffer and localBufferSize parameters for dataScouting method StatusCode createRoiFragment(const xAOD::MuonRoI* roi, TrigL2MuonSA::TrackPattern& trackPattern, TrigL2MuonSA::MdtHits& mdtHits, @@ -109,40 +104,25 @@ namespace TrigL2MuonSA { // output file std::ofstream m_outputFile; - - // the region selector ToolHandle<IRegSelTool> m_regSel_MDT{this, "RegSel_MDT", "RegSelTool/RegSelTool_MDT", "MDT Region Selector Tool"}; ToolHandle<IRegSelTool> m_regSel_TGC{this, "RegSel_TGC", "RegSelTool/RegSelTool_TGC", "TGC Region Selector Tool"}; - - SG::ReadCondHandleKey<RpcCablingCondData> m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - - - // change the local buffer for the TrigComposite object to an argument of the createRoiFragment method - // mutable uint32_t m_localBufferSize = 0; - // mutable std::vector<int> m_localBuffer; - - // // create the MDT fragment StatusCode createMdtFragment(TrigL2MuonSA::MdtHits& mdtHits, LVL2_MUON_CALIBRATION::MdtCalibFragment& mdtFragment, float phi) const; - // // create the RPC fragment StatusCode createRpcFragment(const xAOD::MuonRoI* roi, LVL2_MUON_CALIBRATION::RpcCalibFragment& rpcFragment, const EventContext& ctx) const; - // // create the TGC fragment StatusCode createTgcFragment(std::vector<uint32_t>& tgcRobIdList, LVL2_MUON_CALIBRATION::TgcCalibFragment& tgcFragment) const; - - TrigL2MuonSA::MuCalCircClient *m_circ = nullptr; }; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index 5ff0da1342f5..12730cf56854 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1128,20 +1128,16 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc ATH_MSG_DEBUG("Updating the trigger element"); ATH_MSG_DEBUG(">> Retrieved the buffer, with size: " << localBufferSize); - // create the TrigCompositeContainer to store the calibration buffer - // at StatusCode execute() and hltExecute(). - // add the trigcomposite object to the container + // create the TrigCompositeContainer to store the calibration buffer + // add the trigcomposite object to the container outputMuonCal xAOD::TrigComposite* tc = new xAOD::TrigComposite(); outputMuonCal.push_back(tc); ATH_MSG_DEBUG("The size of the TrigCompositeContainer is: " << outputMuonCal.size() ); // set the detail of the trigcomposite object - // xAOD::TrigComposite* tc = m_trigCompositeContainer->at(0); tc->setDetail("MuonCalibrationStream", localBuffer ); - - //m_calStreamer->clearLocalBuffer(); } -- GitLab From 36226106176c3c6e074f6e037e2c040cfbd56c3c Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Wed, 26 Mar 2025 09:18:46 -0400 Subject: [PATCH 5/8] drop the code is related to calBS and updateTriggerElement variable --- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 25 +++---------------- .../TrigL2MuonSA/src/MuCalStreamerTool.h | 5 ++-- .../TrigL2MuonSA/src/MuFastSteering.cxx | 24 ++++++++---------- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 0738f6c66066..fe2496c96fd8 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -33,11 +33,6 @@ StatusCode TrigL2MuonSA::MuCalStreamerTool::initialize () ATH_CHECK( m_regSel_MDT.retrieve() ); ATH_CHECK( m_regSel_TGC.retrieve() ); - - // m_localBuffer.clear(); - - // m_localBufferSize = 0; - ATH_CHECK(m_tgcRdoKey.initialize()); ATH_CHECK(m_readKey.initialize()); ATH_CHECK(m_eventInfoKey.initialize()); @@ -115,21 +110,16 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::TgcHits& tgcHits, std::vector<uint32_t>& localBuffer, // Add localBuffer parameter uint32_t &localBufferSize, // Add localBufferSize parameter - uint32_t calBufferSize, // Add calBufferSize parameter bool doDataScouting, - bool &updateTriggerElement, const EventContext& ctx) const + const EventContext& ctx) const { - // create the fragment - // ( dummy input for now ) - ATH_MSG_DEBUG("Data scouting is set to"<<doDataScouting); // skip the event if it's a noise burst unsigned int totalHits = mdtHits.size()+rpcHits.size()+tgcHits.size(); if ( totalHits > 500 ) { ATH_MSG_DEBUG("Too many hits: skip the RoI"); - updateTriggerElement=false; return StatusCode::SUCCESS; } @@ -267,17 +257,8 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} localBufferSize += eventSize32bits; - if ( localBufferSize< calBufferSize ) { - ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); - ATH_MSG_DEBUG("Trigger element not to be updated yet "); - updateTriggerElement = false; - } - else { - ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); - ATH_MSG_DEBUG("Attach the buffer to the trigger element "); - - updateTriggerElement = true; - } + ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); + ATH_MSG_DEBUG("Attach the buffer to the trigger element "); } return StatusCode::SUCCESS; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index 1f19646d1a18..ecfe4f49fb57 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -77,7 +77,7 @@ namespace TrigL2MuonSA { bool isStreamOpen(); // - // create the fragment corresponding to an roi, add localBuffer and localBufferSize parameters for dataScouting method + // create the fragment corresponding to an roi, add localBuffer and localBufferSize parameters for dataScouting method, remove updateTriggerElement StatusCode createRoiFragment(const xAOD::MuonRoI* roi, TrigL2MuonSA::TrackPattern& trackPattern, TrigL2MuonSA::MdtHits& mdtHits, @@ -85,9 +85,8 @@ namespace TrigL2MuonSA { TrigL2MuonSA::TgcHits& tgcHits, std::vector<uint32_t>& localBuffer, // Add localBuffer parameter uint32_t &localBufferSize, // Add localBufferSize parameter - uint32_t calBufferSize, bool doDataScouting, - bool& updateTriggerElement, const EventContext& ctx) const; + const EventContext& ctx) const; private: diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index 12730cf56854..ed9aeb4ae605 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1108,7 +1108,6 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc if (m_doCalStream && trackPatterns.size()>0 ) { TrigL2MuonSA::TrackPattern tp = trackPatterns[0]; bool updateTriggerElement = false; - uint32_t calBS = m_calBufferSize; bool calDS = m_calDataScouting; std::vector<uint32_t> localBuffer; // init localBuffer parameter uint32_t localBufferSize = 0 ; // init localBufferSize parameter @@ -1117,29 +1116,28 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc tgcHits, localBuffer, localBufferSize, - calBS, calDS, - updateTriggerElement,ctx); + ctx); if (sc != StatusCode::SUCCESS ) { ATH_MSG_WARNING("Calibration streamer: create Roi Fragment failed"); } // if it's a data scouting chain check the buffer length - if ( m_calDataScouting && updateTriggerElement ) { + if ( m_calDataScouting ) { ATH_MSG_DEBUG("Updating the trigger element"); ATH_MSG_DEBUG(">> Retrieved the buffer, with size: " << localBufferSize); - // create the TrigCompositeContainer to store the calibration buffer - // add the trigcomposite object to the container outputMuonCal - xAOD::TrigComposite* tc = new xAOD::TrigComposite(); - outputMuonCal.push_back(tc); + // create the TrigCompositeContainer to store the calibration buffer + // add the trigcomposite object to the container outputMuonCal + xAOD::TrigComposite* tc = new xAOD::TrigComposite(); + outputMuonCal.push_back(tc); - ATH_MSG_DEBUG("The size of the TrigCompositeContainer is: " << outputMuonCal.size() ); - - // set the detail of the trigcomposite object - tc->setDetail("MuonCalibrationStream", localBuffer ); + ATH_MSG_DEBUG("The size of the TrigCompositeContainer is: " << outputMuonCal.size() ); + + // set the detail of the trigcomposite object + tc->setDetail("MuonCalibrationStream", localBuffer ); - } + } } -- GitLab From d00d80acd5c58f7f96b16bc6018249098c0a6926 Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Wed, 26 Mar 2025 09:20:00 -0400 Subject: [PATCH 6/8] drop the code is related to calBS and updateTriggerElement variable, comment out one more unused line --- Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index ed9aeb4ae605..65e35d7566e4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1107,7 +1107,6 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc //--------------------------- if (m_doCalStream && trackPatterns.size()>0 ) { TrigL2MuonSA::TrackPattern tp = trackPatterns[0]; - bool updateTriggerElement = false; bool calDS = m_calDataScouting; std::vector<uint32_t> localBuffer; // init localBuffer parameter uint32_t localBufferSize = 0 ; // init localBufferSize parameter -- GitLab From a7ad56d850978a4e52020d0e3654162cd35ab97a Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Wed, 26 Mar 2025 16:18:45 -0400 Subject: [PATCH 7/8] fixed the indentations and removed localBufferSize --- .../TrigL2MuonSA/src/MuCalStreamerTool.cxx | 6 +----- .../TrigL2MuonSA/src/MuCalStreamerTool.h | 3 +-- .../TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx | 10 +++------- .../TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h | 4 ++-- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index fe2496c96fd8..816ad059b905 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -109,7 +109,6 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, std::vector<uint32_t>& localBuffer, // Add localBuffer parameter - uint32_t &localBufferSize, // Add localBufferSize parameter bool doDataScouting, const EventContext& ctx) const { @@ -255,10 +254,7 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} localBuffer.push_back(dataWord); } - localBufferSize += eventSize32bits; - - ATH_MSG_DEBUG("Local buffer size = " << localBufferSize); - ATH_MSG_DEBUG("Attach the buffer to the trigger element "); + ATH_MSG_DEBUG("Local buffer size = " << localBuffer.size()); } return StatusCode::SUCCESS; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index ecfe4f49fb57..fd3646223172 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -77,14 +77,13 @@ namespace TrigL2MuonSA { bool isStreamOpen(); // - // create the fragment corresponding to an roi, add localBuffer and localBufferSize parameters for dataScouting method, remove updateTriggerElement + // create the fragment corresponding to an roi StatusCode createRoiFragment(const xAOD::MuonRoI* roi, TrigL2MuonSA::TrackPattern& trackPattern, TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, std::vector<uint32_t>& localBuffer, // Add localBuffer parameter - uint32_t &localBufferSize, // Add localBufferSize parameter bool doDataScouting, const EventContext& ctx) const; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index 65e35d7566e4..ae230ca04e2f 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1107,24 +1107,20 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc //--------------------------- if (m_doCalStream && trackPatterns.size()>0 ) { TrigL2MuonSA::TrackPattern tp = trackPatterns[0]; - bool calDS = m_calDataScouting; std::vector<uint32_t> localBuffer; // init localBuffer parameter - uint32_t localBufferSize = 0 ; // init localBufferSize parameter sc = m_calStreamer->createRoiFragment(*p_roi,tp,mdtHits_normal, rpcHits, tgcHits, localBuffer, - localBufferSize, - calDS, + m_calDataScouting, ctx); if (sc != StatusCode::SUCCESS ) { ATH_MSG_WARNING("Calibration streamer: create Roi Fragment failed"); } - // if it's a data scouting chain check the buffer length + // if it's a data scouting chain if ( m_calDataScouting ) { - ATH_MSG_DEBUG("Updating the trigger element"); - ATH_MSG_DEBUG(">> Retrieved the buffer, with size: " << localBufferSize); + ATH_MSG_DEBUG("Retrieved the buffer, with size: " << localBuffer.size()); // create the TrigCompositeContainer to store the calibration buffer // add the trigcomposite object to the container outputMuonCal diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h index 65a2c4954c16..c03832eb7005 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h @@ -78,8 +78,8 @@ class MuFastSteering : public AthReentrantAlgorithm , public IIncidentListener StatusCode findMuonSignature(const std::vector<const TrigRoiDescriptor*>& roi, const std::vector<const xAOD::MuonRoI*>& muonRoIs, - DataVector<xAOD::L2StandAloneMuon>& outputTracks, - xAOD::TrigCompositeContainer& outputMuonCal, + DataVector<xAOD::L2StandAloneMuon>& outputTracks, + xAOD::TrigCompositeContainer& outputMuonCal, TrigRoiDescriptorCollection& outputID, TrigRoiDescriptorCollection& outputMS, const bool dynamicDeltaRpc, -- GitLab From 9882b5640f74d17f8bac13377759dd473deb79e2 Mon Sep 17 00:00:00 2001 From: Zhen Yan <Zhen.Yan@cern.ch> Date: Thu, 27 Mar 2025 04:51:02 -0400 Subject: [PATCH 8/8] fixed the indentations only for modified lines --- Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx | 2 +- Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h | 2 +- Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx | 4 ++-- Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx index 816ad059b905..dc9e83e0c8a5 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.cxx @@ -108,7 +108,7 @@ bool TrigL2MuonSA::MuCalStreamerTool::isStreamOpen() {return m_circ!=nullptr;} TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - std::vector<uint32_t>& localBuffer, // Add localBuffer parameter + std::vector<uint32_t>& localBuffer, // Add localBuffer parameter bool doDataScouting, const EventContext& ctx) const { diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h index fd3646223172..201d6e554bda 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuCalStreamerTool.h @@ -83,7 +83,7 @@ namespace TrigL2MuonSA { TrigL2MuonSA::MdtHits& mdtHits, TrigL2MuonSA::RpcHits& rpcHits, TrigL2MuonSA::TgcHits& tgcHits, - std::vector<uint32_t>& localBuffer, // Add localBuffer parameter + std::vector<uint32_t>& localBuffer, // Add localBuffer parameter bool doDataScouting, const EventContext& ctx) const; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index ae230ca04e2f..48331d764a4a 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -1111,8 +1111,8 @@ StatusCode MuFastSteering::findMuonSignature(const std::vector<const TrigRoiDesc sc = m_calStreamer->createRoiFragment(*p_roi,tp,mdtHits_normal, rpcHits, tgcHits, - localBuffer, - m_calDataScouting, + localBuffer, + m_calDataScouting, ctx); if (sc != StatusCode::SUCCESS ) { ATH_MSG_WARNING("Calibration streamer: create Roi Fragment failed"); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h index c03832eb7005..587381095925 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.h @@ -78,8 +78,8 @@ class MuFastSteering : public AthReentrantAlgorithm , public IIncidentListener StatusCode findMuonSignature(const std::vector<const TrigRoiDescriptor*>& roi, const std::vector<const xAOD::MuonRoI*>& muonRoIs, - DataVector<xAOD::L2StandAloneMuon>& outputTracks, - xAOD::TrigCompositeContainer& outputMuonCal, + DataVector<xAOD::L2StandAloneMuon>& outputTracks, + xAOD::TrigCompositeContainer& outputMuonCal, TrigRoiDescriptorCollection& outputID, TrigRoiDescriptorCollection& outputMS, const bool dynamicDeltaRpc, -- GitLab