ATLAS Offline Software
FPGADataFormatAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 
6 
7 #include "FPGADataFormatAlg.h"
8 #include <fstream>
9 
11 {
13  ATH_CHECK(m_stripRDOKey.initialize());
14 
15  ATH_CHECK(m_FPGADataFormatTool.retrieve());
16 
17 
18  return StatusCode::SUCCESS;
19 }
20 
21 StatusCode FPGADataFormatAlg::execute(const EventContext &ctx) const
22 {
23  auto pixelRDOHandle = SG::makeHandle(m_pixelRDOKey, ctx);
24  auto stripRDOHandle = SG::makeHandle(m_stripRDOKey, ctx);
25 
26  std::vector<uint64_t> outputData;
27 
28  if(!m_FPGADataFormatTool->convertPixelHitsToFPGADataFormat(*pixelRDOHandle, outputData, ctx))
29  {
30  return StatusCode::FAILURE;
31  }
32 
33 
34  // Report the output
35  ATH_MSG_DEBUG("ITK pixel encoded data");
36  int line = 0;
37  for(const auto& var: outputData)
38  {
39  ATH_MSG_DEBUG("Line: "<<line<<" data: "<<std::hex<<var);
40  line++;
41  }
42 
43  outputData.clear();
44 
45  if(!m_FPGADataFormatTool->convertStripHitsToFPGADataFormat( *stripRDOHandle, outputData, ctx))
46  {
47  return StatusCode::FAILURE;
48  }
49 
50  // Report the output
51  ATH_MSG_DEBUG("ITK Strip encoded data");
52  line = 0;
53  for(const auto& var: outputData)
54  {
55  ATH_MSG_DEBUG("Line: "<<line<<" data: "<<std::hex<<var);
56  line++;
57  }
58 
59  return StatusCode::SUCCESS;
60 }
FPGADataFormatAlg::m_stripRDOKey
SG::ReadHandleKey< SCT_RDO_Container > m_stripRDOKey
Definition: FPGADataFormatAlg.h:37
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
checkFileSG.line
line
Definition: checkFileSG.py:75
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
FPGADataFormatAlg::m_pixelRDOKey
SG::ReadHandleKey< PixelRDO_Container > m_pixelRDOKey
Definition: FPGADataFormatAlg.h:36
FPGADataFormatAlg::initialize
virtual StatusCode initialize() override
Definition: FPGADataFormatAlg.cxx:10
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
FPGADataFormatAlg::m_FPGADataFormatTool
ToolHandle< FPGADataFormatTool > m_FPGADataFormatTool
Definition: FPGADataFormatAlg.h:41
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
FPGADataFormatAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Performs the data convertsion.
Definition: FPGADataFormatAlg.cxx:21
FPGADataFormatAlg.h