ATLAS Offline Software
Trigger
EFTracking
EFTrackingFPGAIntegration
src
EFTrackingDataStreamUnloaderAlgorithm.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 <fstream>
// For Csv.
6
#include <sstream>
7
#include <iomanip>
8
#include <string>
9
#include <vector>
10
11
#include "
EFTrackingDataStreamUnloaderAlgorithm.h
"
12
13
namespace
{
14
std::string toHex(
const
unsigned
long
src
) {
15
std::stringstream stringStream{};
16
stringStream << std::hex <<
src
;
17
18
return
stringStream.str();
19
}
20
21
std::string padString(
const
std::string&
src
, std::size_t
width
) {
22
std::string dst =
src
;
23
dst.insert(dst.begin(),
width
-
src
.size(),
'0'
);
24
25
return
dst;
26
}
27
}
28
29
EFTrackingDataStreamUnloaderAlgorithm::EFTrackingDataStreamUnloaderAlgorithm
(
30
const
std::string&
name
,
31
ISvcLocator* pSvcLocator
32
) :
AthReentrantAlgorithm
(
name
, pSvcLocator)
33
{}
34
35
StatusCode
EFTrackingDataStreamUnloaderAlgorithm::initialize
() {
36
ATH_MSG_INFO
(
"Initializing "
<<
name
());
37
ATH_CHECK
(
m_outputDataStreamKey
.
initialize
());
38
39
return
StatusCode::SUCCESS;
40
}
41
42
StatusCode
EFTrackingDataStreamUnloaderAlgorithm::execute
(
const
EventContext& ctx)
const
{
43
SG::ReadHandle<std::vector<unsigned long>
>
outputDataStream
(
44
m_outputDataStreamKey
,
45
ctx
46
);
47
48
std::ofstream
outputFile
(
m_outputCsvPath
);
49
50
if
(!
outputFile
.is_open()) {
51
ATH_MSG_ERROR
(
"Failed to write "
<<
m_outputCsvPath
);
52
53
return
StatusCode::FAILURE;
54
}
55
56
for
(
const
unsigned
long
word : *
outputDataStream
) {
57
outputFile
<< padString(toHex(word), 16) << std::endl;
58
}
59
60
return
StatusCode::SUCCESS;
61
}
62
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
EFTrackingDataStreamUnloaderAlgorithm::m_outputCsvPath
Gaudi::Property< std::string > m_outputCsvPath
Definition:
EFTrackingDataStreamUnloaderAlgorithm.h:13
WriteCellNoiseToCool.src
src
Definition:
WriteCellNoiseToCool.py:513
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
EFTrackingDataStreamUnloaderAlgorithm::m_outputDataStreamKey
SG::ReadHandleKey< std::vector< unsigned long > > m_outputDataStreamKey
Definition:
EFTrackingDataStreamUnloaderAlgorithm.h:20
EFTrackingDataStreamUnloaderAlgorithm.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:83
compareGeometries.outputFile
string outputFile
Definition:
compareGeometries.py:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EFTrackingDataStreamUnloaderAlgorithm::EFTrackingDataStreamUnloaderAlgorithm
EFTrackingDataStreamUnloaderAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
EFTrackingDataStreamUnloaderAlgorithm.cxx:29
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
EFTrackingDataStreamUnloaderAlgorithm::execute
StatusCode execute(const EventContext &ctx) const override final
Definition:
EFTrackingDataStreamUnloaderAlgorithm.cxx:42
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
EFTrackingXrtAlgorithmConfig.outputDataStream
outputDataStream
Definition:
EFTrackingXrtAlgorithmConfig.py:66
EFTrackingDataStreamUnloaderAlgorithm::initialize
StatusCode initialize() override final
Definition:
EFTrackingDataStreamUnloaderAlgorithm.cxx:35
Base_Fragment.width
width
Definition:
Sherpa_i/share/common/Base_Fragment.py:59
Generated on Wed Jan 8 2025 21:09:18 for ATLAS Offline Software by
1.8.18