ATLAS Offline Software
Loading...
Searching...
No Matches
EFTrackingDataStreamLoaderAlgorithm.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
5#ifndef EFTRACKING_DATA_STREAM_LOADER_ALGORITHM
6#define EFTRACKING_DATA_STREAM_LOADER_ALGORITHM
7
8#include <mutex>
9
13
14namespace {
15struct FileState {
16 int32_t countDown{0};
17 enum DataFormatState {
18 HEADER = 0,
19 HITS = 1,
20 FOOTER = 2,
21 } dataFormatState{FOOTER};
22};
23
24enum DataFormatAction {
25 NEW_EVENT = 0,
26 KEEP = 1,
27 DISCARD = 2,
28 ERROR = 3,
29};
30}
31
33{
34 Gaudi::Property<std::size_t> m_bufferSize {
35 this,
36 "bufferSize",
37 8192,
38 };
39
40 Gaudi::Property<std::vector<std::string>> m_GHITZTxtInputPaths{
41 this,
42 "GHITZTxtInputPaths",
43 {},
44 };
45
47 this,
48 "GHITZTxtInputKeys",
49 {},
50 };
51
52 Gaudi::Property<std::vector<std::string>> m_GHITZTxtOutputPaths{
53 this,
54 "GHITZTxtOutputPaths",
55 {},
56 };
57
59 this,
60 "GHITZTxtOutputKeys",
61 {},
62 };
63
64 Gaudi::Property<std::vector<std::string>> m_GHITZBinInputPaths{
65 this,
66 "GHITZBinInputPaths",
67 {},
68 };
69
71 this,
72 "GHITZBinInputKeys",
73 {},
74 };
75
76 Gaudi::Property<std::vector<std::string>> m_GHITZBinOutputPaths{
77 this,
78 "GHITZBinOutputPaths",
79 {},
80 };
81
83 this,
84 "GHITZBinOutputKeys",
85 {},
86 };
87
88 Gaudi::Property<std::vector<std::string>> m_CLUSTERTxtInputPaths{
89 this,
90 "CLUSTERTxtInputPaths",
91 {},
92 };
93
95 this,
96 "CLUSTERTxtInputKeys",
97 {},
98 };
99
100 Gaudi::Property<std::vector<std::string>> m_CLUSTERTxtOutputPaths{
101 this,
102 "CLUSTERTxtOutputPaths",
103 {},
104 };
105
107 this,
108 "CLUSTERTxtOutputKeys",
109 {},
110 };
111
112 Gaudi::Property<std::vector<std::string>> m_CLUSTERBinInputPaths{
113 this,
114 "CLUSTERBinInputPaths",
115 {},
116 };
117
119 this,
120 "CLUSTERBinInputKeys",
121 {},
122 };
123
124 Gaudi::Property<std::vector<std::string>> m_CLUSTERBinOutputPaths{
125 this,
126 "CLUSTERBinOutputPaths",
127 {},
128 };
129
131 this,
132 "CLUSTERBinOutputKeys",
133 {},
134 };
135
136 std::vector<std::vector<std::vector<uint64_t>>> m_GHITZTxtInputEvents{};
137 mutable std::vector<std::vector<std::vector<uint64_t>>> m_GHITZTxtOutputEvents ATLAS_THREAD_SAFE {};
138
139 std::vector<std::vector<std::vector<uint64_t>>> m_GHITZBinInputEvents{};
140 mutable std::vector<std::vector<std::vector<uint64_t>>> m_GHITZBinOutputEvents ATLAS_THREAD_SAFE {};
141
142 std::vector<std::vector<std::vector<uint64_t>>> m_CLUSTERTxtInputEvents{};
143 mutable std::vector<std::vector<std::vector<uint64_t>>> m_CLUSTERTxtOutputEvents ATLAS_THREAD_SAFE {};
144
145 std::vector<std::vector<std::vector<uint64_t>>> m_CLUSTERBinInputEvents{};
146 mutable std::vector<std::vector<std::vector<uint64_t>>> m_CLUSTERBinOutputEvents ATLAS_THREAD_SAFE {};
147
148 mutable std::mutex m_mutex ATLAS_THREAD_SAFE;
149
150 StatusCode readFile(
151 const std::string& path,
152 const auto& fileReadFunction,
153 const auto& endOfBlockCondition,
154 const int32_t hitCountDown,
155 std::vector<std::vector<uint64_t>>& events
156 );
157
158 StatusCode writeFile(
159 const std::string& path,
160 const auto& fileWriteFunction,
161 const auto& endOfBlockCondition,
162 const int32_t hitCountDown,
163 const std::vector<std::vector<uint64_t>>& events
164 );
165
166 DataFormatAction dataFormatStateMachine(
167 const uint64_t word,
168 const auto& endOfBlockCondition,
169 const int32_t hitCountDown,
170 FileState& fileState
171 );
172
173 public:
174 EFTrackingDataStreamLoaderAlgorithm(const std::string& name, ISvcLocator* pSvcLocator);
175 virtual StatusCode initialize() override final;
176 virtual StatusCode execute(const EventContext& ctx) const override final;
177 virtual StatusCode finalize() override final;
178};
179
180#endif
181
An algorithm that can be simultaneously executed in multiple threads.
DataFormatAction dataFormatStateMachine(const uint64_t word, const auto &endOfBlockCondition, const int32_t hitCountDown, FileState &fileState)
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_GHITZTxtInputKeys
EFTrackingDataStreamLoaderAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_GHITZBinInputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_CLUSTERTxtOutputKeys
std::vector< std::vector< std::vector< uint64_t > > > m_CLUSTERBinInputEvents
Gaudi::Property< std::vector< std::string > > m_GHITZBinInputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZBinOutputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZTxtOutputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERBinInputPaths
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_CLUSTERBinOutputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_GHITZBinOutputKeys
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_CLUSTERBinInputKeys
std::vector< std::vector< std::vector< uint64_t > > > m_CLUSTERTxtInputEvents
virtual StatusCode execute(const EventContext &ctx) const override final
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZTxtOutputEvents ATLAS_THREAD_SAFE
StatusCode readFile(const std::string &path, const auto &fileReadFunction, const auto &endOfBlockCondition, const int32_t hitCountDown, std::vector< std::vector< uint64_t > > &events)
StatusCode writeFile(const std::string &path, const auto &fileWriteFunction, const auto &endOfBlockCondition, const int32_t hitCountDown, const std::vector< std::vector< uint64_t > > &events)
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_CLUSTERTxtInputKeys
Gaudi::Property< std::vector< std::string > > m_GHITZTxtInputPaths
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZBinInputEvents
Gaudi::Property< std::vector< std::string > > m_CLUSTERTxtInputPaths
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZTxtInputEvents
Gaudi::Property< std::vector< std::string > > m_CLUSTERBinOutputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERTxtOutputPaths
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_GHITZTxtOutputKeys
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
HandleKeyArray< WriteHandle< T >, WriteHandleKey< T >, Gaudi::DataHandle::Writer > WriteHandleKeyArray