ATLAS Offline Software
Loading...
Searching...
No Matches
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
10namespace EFTrackingFPGAUtility{
12 const std::string& name,
13 ISvcLocator* pSvcLocator
14) : AthReentrantAlgorithm(name, pSvcLocator)
15{}
16
18 ATH_MSG_INFO("Initializing " << name());
19 ATH_CHECK(m_inputDataStreamKey.initialize());
20
21 return StatusCode::SUCCESS;
22}
23
24StatusCode 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
51 ATH_CHECK(inputDataStream->size() == m_bufferSize);
52
53 return StatusCode::SUCCESS;
54}
55}
56
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteHandleKey< std::vector< unsigned long > > m_inputDataStreamKey
Gaudi::Property< std::size_t > m_bufferSize
TestVectorGenerator(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute(const EventContext &ctx) const override final
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
uint64_t get_dataformat_EVT_FTR_w3(const EVT_FTR_w3 &in)
Definition index.py:1