ATLAS Offline Software
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 
14 namespace {
15 struct FileState {
16  int32_t countDown{0};
17  enum DataFormatState {
18  HEADER = 0,
19  HITS = 1,
20  FOOTER = 2,
21  } dataFormatState{FOOTER};
22 };
23 
24 enum 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 
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 
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 
ReadHandleKeyArray.h
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERBinOutputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERBinOutputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:124
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
EFTrackingDataStreamLoaderAlgorithm
Definition: EFTrackingDataStreamLoaderAlgorithm.h:33
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERTxtOutputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_CLUSTERTxtOutputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:106
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
EFTrackingDataStreamLoaderAlgorithm::m_GHITZBinOutputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZBinOutputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:76
EFTrackingDataStreamLoaderAlgorithm::dataFormatStateMachine
DataFormatAction dataFormatStateMachine(const uint64_t word, const auto &endOfBlockCondition, const int32_t hitCountDown, FileState &fileState)
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:406
EFTrackingDataStreamLoaderAlgorithm::finalize
virtual StatusCode finalize() override final
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:198
python.Constants.ERROR
int ERROR
Definition: Control/AthenaCommon/python/Constants.py:17
EFTrackingDataStreamLoaderAlgorithm::ATLAS_THREAD_SAFE
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZTxtOutputEvents ATLAS_THREAD_SAFE
Definition: EFTrackingDataStreamLoaderAlgorithm.h:137
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:45
EFTrackingDataStreamLoaderAlgorithm::m_GHITZBinInputEvents
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZBinInputEvents
Definition: EFTrackingDataStreamLoaderAlgorithm.h:139
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
EFTrackingDataStreamLoaderAlgorithm::EFTrackingDataStreamLoaderAlgorithm
EFTrackingDataStreamLoaderAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:13
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
EFTrackingDataStreamLoaderAlgorithm::m_GHITZTxtInputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZTxtInputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:40
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
EFTrackingDataStreamLoaderAlgorithm::m_GHITZBinInputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZBinInputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:64
EFTrackingDataStreamLoaderAlgorithm::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:115
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERBinInputEvents
std::vector< std::vector< std::vector< uint64_t > > > m_CLUSTERBinInputEvents
Definition: EFTrackingDataStreamLoaderAlgorithm.h:145
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERBinInputKeys
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_CLUSTERBinInputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:118
EFTrackingDataStreamLoaderAlgorithm::m_GHITZTxtInputKeys
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_GHITZTxtInputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:46
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
EFTrackingDataStreamLoaderAlgorithm::initialize
virtual StatusCode initialize() override final
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:19
columnar::final
CM final
Definition: ColumnAccessor.h:106
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERTxtInputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERTxtInputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:88
AthReentrantAlgorithm.h
WriteHandleKeyArray.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERTxtInputKeys
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_CLUSTERTxtInputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:94
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERTxtInputEvents
std::vector< std::vector< std::vector< uint64_t > > > m_CLUSTERTxtInputEvents
Definition: EFTrackingDataStreamLoaderAlgorithm.h:142
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERBinInputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERBinInputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:112
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERTxtOutputPaths
Gaudi::Property< std::vector< std::string > > m_CLUSTERTxtOutputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:100
EFTrackingDataStreamLoaderAlgorithm::ATLAS_THREAD_SAFE
std::mutex m_mutex ATLAS_THREAD_SAFE
Definition: EFTrackingDataStreamLoaderAlgorithm.h:148
L1Topo::BlockTypes::HEADER
@ HEADER
EFTrackingDataStreamLoaderAlgorithm::writeFile
StatusCode writeFile(const std::string &path, const auto &fileWriteFunction, const auto &endOfBlockCondition, const int32_t hitCountDown, const std::vector< std::vector< uint64_t >> &events)
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:351
EFTrackingDataStreamLoaderAlgorithm::m_GHITZTxtInputEvents
std::vector< std::vector< std::vector< uint64_t > > > m_GHITZTxtInputEvents
Definition: EFTrackingDataStreamLoaderAlgorithm.h:136
EFTrackingDataStreamLoaderAlgorithm::m_GHITZTxtOutputPaths
Gaudi::Property< std::vector< std::string > > m_GHITZTxtOutputPaths
Definition: EFTrackingDataStreamLoaderAlgorithm.h:52
EFTrackingDataStreamLoaderAlgorithm::m_GHITZTxtOutputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_GHITZTxtOutputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:58
EFTrackingDataStreamLoaderAlgorithm::m_bufferSize
Gaudi::Property< std::size_t > m_bufferSize
Definition: EFTrackingDataStreamLoaderAlgorithm.h:34
EFTrackingDataStreamLoaderAlgorithm::readFile
StatusCode readFile(const std::string &path, const auto &fileReadFunction, const auto &endOfBlockCondition, const int32_t hitCountDown, std::vector< std::vector< uint64_t >> &events)
Definition: EFTrackingDataStreamLoaderAlgorithm.cxx:307
EFTrackingDataStreamLoaderAlgorithm::m_GHITZBinOutputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_GHITZBinOutputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:82
EFTrackingDataStreamLoaderAlgorithm::m_CLUSTERBinOutputKeys
SG::ReadHandleKeyArray< std::vector< uint64_t > > m_CLUSTERBinOutputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:130
EFTrackingDataStreamLoaderAlgorithm::m_GHITZBinInputKeys
SG::WriteHandleKeyArray< std::vector< uint64_t > > m_GHITZBinInputKeys
Definition: EFTrackingDataStreamLoaderAlgorithm.h:70