ATLAS Offline Software
TestVectorGenerator.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3  */
4 
7 
8 #include <random>
9 
10 namespace EFTrackingFPGAUtility{
12  const std::string& name,
13  ISvcLocator* pSvcLocator
14 ) : AthReentrantAlgorithm(name, pSvcLocator)
15 {}
16 
18  ATH_MSG_INFO("Initializing " << name());
20 
21  return StatusCode::SUCCESS;
22 }
23 
24 StatusCode TestVectorGenerator::execute(const EventContext& ctx) const {
27  ctx
28  );
29 
30  ATH_CHECK(inputDataStream.record(std::make_unique<std::vector<unsigned long>>()));
31  inputDataStream->reserve(m_bufferSize);
32 
33  std::random_device randomDevice;
34  std::mt19937 randomNumberGenerator(randomDevice());
35  std::uniform_int_distribution<uint64_t> uniformDistribution(0, std::numeric_limits<uint64_t>::max());
36 
37  for (std::size_t index = 0; index < m_bufferSize - 3; index++) {
38  // Create random input with module header (0x55) at each end to avoid alignment issues within each word.
39  // Module headers have total length 64bits therefore easiest to get proper alignment across multiple word.
40  inputDataStream->push_back(((uniformDistribution(randomNumberGenerator) << 16) >> 8) ^ 0x5500000000000055);
41  }
42 
43  // Repeat flag to avoid possible alingment issues.
44  inputDataStream->push_back(0xcdcdcdcdcdcdcdcd);
45  inputDataStream->push_back(0x0000000000000000);
47  .word_count = m_bufferSize - 3,
48  .crc = 0,
49  }));
50 
52 
53  return StatusCode::SUCCESS;
54 }
55 }
56 
EFTrackingFPGAUtility::TestVectorGenerator::m_inputDataStreamKey
SG::WriteHandleKey< std::vector< unsigned long > > m_inputDataStreamKey
Definition: TestVectorGenerator.h:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PathfinderHlsConfig.inputDataStream
inputDataStream
Definition: PathfinderHlsConfig.py:66
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
EFTrackingFPGAUtility::TestVectorGenerator::initialize
StatusCode initialize() override final
Definition: TestVectorGenerator.cxx:17
TestVectorGenerator.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3
uint64_t get_dataformat_EVT_FTR_w3(const EVT_FTR_w3 &in)
Definition: FPGADataFormatUtilities.h:255
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
FPGADataFormatUtilities.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EFTrackingFPGAUtility::TestVectorGenerator::TestVectorGenerator
TestVectorGenerator(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TestVectorGenerator.cxx:11
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
EFTrackingFPGAUtility
Definition: TestVectorChecker.h:11
EFTrackingFPGAUtility::TestVectorGenerator::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: TestVectorGenerator.cxx:24
EFTrackingFPGAUtility::TestVectorGenerator::m_bufferSize
Gaudi::Property< std::size_t > m_bufferSize
Definition: TestVectorGenerator.h:21