ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
EFTrackingFPGAIntegration
EFTrackingFPGAUtility
src
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
5
#include "
EFTrackingFPGAUtility/TestVectorGenerator.h
"
6
#include "
EFTrackingFPGAUtility/FPGADataFormatUtilities.h
"
7
8
#include <random>
9
10
namespace
EFTrackingFPGAUtility
{
11
TestVectorGenerator::TestVectorGenerator
(
12
const
std::string& name,
13
ISvcLocator* pSvcLocator
14
) :
AthReentrantAlgorithm
(name, pSvcLocator)
15
{}
16
17
StatusCode
TestVectorGenerator::initialize
() {
18
ATH_MSG_INFO
(
"Initializing "
<< name());
19
ATH_CHECK
(
m_inputDataStreamKey
.initialize());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
TestVectorGenerator::execute
(
const
EventContext& ctx)
const
{
25
SG::WriteHandle<std::vector<unsigned long>
>inputDataStream(
26
m_inputDataStreamKey
,
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);
46
inputDataStream->push_back(
FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3
({
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
FPGADataFormatUtilities.h
TestVectorGenerator.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
EFTrackingFPGAUtility::TestVectorGenerator::m_inputDataStreamKey
SG::WriteHandleKey< std::vector< unsigned long > > m_inputDataStreamKey
Definition
TestVectorGenerator.h:14
EFTrackingFPGAUtility::TestVectorGenerator::m_bufferSize
Gaudi::Property< std::size_t > m_bufferSize
Definition
TestVectorGenerator.h:21
EFTrackingFPGAUtility::TestVectorGenerator::TestVectorGenerator
TestVectorGenerator(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TestVectorGenerator.cxx:11
EFTrackingFPGAUtility::TestVectorGenerator::execute
StatusCode execute(const EventContext &ctx) const override final
Definition
TestVectorGenerator.cxx:24
EFTrackingFPGAUtility::TestVectorGenerator::initialize
StatusCode initialize() override final
Definition
TestVectorGenerator.cxx:17
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.
EFTrackingFPGAUtility
Definition
TestVectorChecker.h:11
FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3
uint64_t get_dataformat_EVT_FTR_w3(const EVT_FTR_w3 &in)
Definition
FPGADataFormatUtilities.h:255
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0