ATLAS Offline Software
F100DataEncodingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "AthenaKernel/Chrono.h"
7 
9 {
11  {
12  ATH_MSG_INFO("Running on the FPGA accelerator");
13 
18 
19  ATH_CHECK(m_FPGADataFormatTool.retrieve());
20 
22  ATH_CHECK(m_regionPixelSelector.retrieve(EnableTool{m_roiSeeded}));
23  ATH_CHECK(m_regionStripSelector.retrieve(EnableTool{m_roiSeeded}));
24  ATH_MSG_DEBUG("Running in ROI mode: "<<m_roiSeeded);
25 
26 
27  return StatusCode::SUCCESS;
28  }
29 
30  StatusCode F100DataEncodingAlg::execute(const EventContext &ctx) const
31  {
32  ATH_MSG_DEBUG("Executing F100DataEncodingAlg");
33 
34  // Get the RDOs from the SG
35  auto pixelRDOHandle = SG::makeHandle(m_pixelRDOKey, ctx);
36  auto stripRDOHandle = SG::makeHandle(m_stripRDOKey, ctx);
37  ATH_CHECK(pixelRDOHandle.isValid());
38  ATH_CHECK(stripRDOHandle.isValid());
39 
40 
41 
42  // Encode RDO into byte stream
44  ATH_CHECK(FPGAPixelRDO.record(std::make_unique<std::vector<uint64_t> >()));
45 
47  ATH_CHECK(FPGAStripRDO.record(std::make_unique<std::vector<uint64_t> >()));
48 
49  std::vector<IdentifierHash> listOfPixelIds;
50  std::vector<IdentifierHash> listOfStripIds;
51 
52  if (m_roiSeeded) {//enter RoI-seeded mode
54  ATH_CHECK(roiCollection.isValid());
55 
56 
57  for (const auto* roi : *roiCollection) {
58  m_regionPixelSelector->lookup(ctx)->HashIDList( *roi, listOfPixelIds );
59  m_regionStripSelector->lookup(ctx)->HashIDList( *roi, listOfStripIds );
60  }
61  }
62 
63 
64  // Encode RDOs into byte stream
65  ATH_CHECK(m_FPGADataFormatTool->convertPixelHitsToFPGADataFormat(*pixelRDOHandle, *FPGAPixelRDO, listOfPixelIds, ctx));
66  ATH_CHECK(m_FPGADataFormatTool->convertStripHitsToFPGADataFormat(*stripRDOHandle, *FPGAStripRDO, listOfStripIds, ctx));
67 
68  if (msgLvl(MSG::DEBUG)){
69  for (unsigned int i = 0; i < FPGAPixelRDO->size(); i++)
70  {
71  ATH_MSG_DEBUG("Pixel RDO[" << i << "]: " << std::hex << FPGAPixelRDO->at(i) << std::dec);
72  }
73  for (unsigned int i = 0; i < FPGAStripRDO->size(); i++)
74  {
75  ATH_MSG_DEBUG("Strip RDO[" << i << "]: " << std::hex << FPGAStripRDO->at(i) << std::dec);
76  }
77  }
78 
79 
80 
81  return StatusCode::SUCCESS;
82  }
83 
84 } // namespace EFTrackingFPGAIntegration
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_regionStripSelector
ToolHandle< IRegSelTool > m_regionStripSelector
Definition: F100DataEncodingAlg.h:45
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_roiCollectionKey
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
Definition: F100DataEncodingAlg.h:47
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
EFTrackingFPGAIntegration::F100DataEncodingAlg::initialize
virtual StatusCode initialize() override
Definition: F100DataEncodingAlg.cxx:10
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
Chrono.h
Exception-safe IChronoSvc caller.
EFTrackingFPGAIntegration::F100DataEncodingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition: F100DataEncodingAlg.cxx:30
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
F100DataEncodingAlg.h
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_FPGAPixelRDO
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAPixelRDO
Definition: F100DataEncodingAlg.h:50
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_roiSeeded
Gaudi::Property< bool > m_roiSeeded
Definition: F100DataEncodingAlg.h:48
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_regionPixelSelector
ToolHandle< IRegSelTool > m_regionPixelSelector
Definition: F100DataEncodingAlg.h:44
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
EFTrackingFPGAIntegration
The class for enconding RDO to FPGA format.
Definition: BenchmarkAlg.h:28
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_FPGADataFormatTool
ToolHandle< FPGADataFormatTool > m_FPGADataFormatTool
Tool for formatting FPGA data.
Definition: F100DataEncodingAlg.h:39
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_stripRDOKey
SG::ReadHandleKey< SCT_RDO_Container > m_stripRDOKey
Definition: F100DataEncodingAlg.h:41
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_pixelRDOKey
SG::ReadHandleKey< PixelRDO_Container > m_pixelRDOKey
Definition: F100DataEncodingAlg.h:40
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
DEBUG
#define DEBUG
Definition: page_access.h:11
EFTrackingFPGAIntegration::F100DataEncodingAlg::m_FPGAStripRDO
SG::WriteHandleKey< std::vector< uint64_t > > m_FPGAStripRDO
Definition: F100DataEncodingAlg.h:51