ATLAS Offline Software
Loading...
Searching...
No Matches
TestVectorTool Class Reference

#include <TestVectorTool.h>

Inheritance diagram for TestVectorTool:
Collaboration diagram for TestVectorTool:

Public Member Functions

StatusCode initialize () override
StatusCode prepareTV (const std::string &inputFile, std::vector< uint64_t > &testVector) const
 Prepare test vector in the form of std::vector<uint64_t>, can be either .txt or .bin.
StatusCode compare (const std::vector< uint64_t > &tv_1, const std::vector< uint64_t > &tv_2) const
 Compare two TV in the form of std::vector<uint64_t>
StatusCode compare (const EFTrackingFPGAIntegration::TVHolder &tvHolder, const std::vector< uint64_t > &tv_comp) const
 Compare two TV in the form of TVHolder and std::vector<uint64_t>
StatusCode encodePixelL2G (const xAOD::PixelClusterContainer *pixelClusters, std::vector< uint64_t > &encodedData) const
 Encode xAOD pixel cluster to L2G EDM TV.
StatusCode encodeStripL2G (const xAOD::StripClusterContainer *stripClusters, std::vector< uint64_t > &encodedData) const
 Encode xAOD strip cluster to L2G EDM TV.

Detailed Description

Definition at line 46 of file TestVectorTool.h.

Member Function Documentation

◆ compare() [1/2]

StatusCode TestVectorTool::compare ( const EFTrackingFPGAIntegration::TVHolder & tvHolder,
const std::vector< uint64_t > & tv_comp ) const

Compare two TV in the form of TVHolder and std::vector<uint64_t>

Parameters
tvHolderThe TVHolder object, the refTV in the TVHolder will be compared to the output
tv_compThe vector to be compared to the refTV

Definition at line 121 of file TestVectorTool.cxx.

122{
123 ATH_MSG_DEBUG("Comparing the FPGA output to the reference vector for " << tvHolder.name);
124
125 std::vector<uint64_t>::size_type size = -1;
126
127 if (tvHolder.refTV.size() != tv_comp.size())
128 {
129 ATH_MSG_WARNING("The two test vectors have different sizes: " << tvHolder.refTV.size() << " and " << tv_comp.size());
130 // Use the shorter one for comparison
131 size = tvHolder.refTV.size() < tv_comp.size() ? tvHolder.refTV.size() : tv_comp.size();
132 }
133 else
134 {
135 ATH_MSG_DEBUG("The two test vectors have the same size: " << tvHolder.refTV.size());
136 size = tvHolder.refTV.size();
137 }
138
139 bool pass = true;
140 for (std::vector<uint64_t>::size_type i = 0; i < size; i++)
141 {
142 if (tvHolder.refTV[i] != tv_comp[i])
143 {
144 ATH_MSG_DEBUG("The two test vectors are different at index " << i);
145 pass = false;
146 }
147 }
148
149 if (pass)
150 {
151 ATH_MSG_DEBUG(tvHolder.name << " FPGA output matches the reference vector");
152 }
153 else
154 {
155 ATH_MSG_WARNING(tvHolder.name << " FPGA output does not match the reference vector");
156 }
157
158 return StatusCode::SUCCESS;
159}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)

◆ compare() [2/2]

StatusCode TestVectorTool::compare ( const std::vector< uint64_t > & tv_1,
const std::vector< uint64_t > & tv_2 ) const

Compare two TV in the form of std::vector<uint64_t>

Definition at line 81 of file TestVectorTool.cxx.

82{
83 ATH_MSG_DEBUG("Comparing two test vectors");
84
85 std::vector<uint64_t>::size_type size = -1;
86
87 if (tv_1.size() != tv_2.size())
88 {
89 ATH_MSG_WARNING("The two test vectors have different sizes: " << tv_1.size() << " and " << tv_2.size());
90 // Use the shorter one for comparison
91 size = tv_1.size() < tv_2.size() ? tv_1.size() : tv_2.size();
92 }
93 else
94 {
95 ATH_MSG_DEBUG("The two test vectors have the same size: " << tv_1.size());
96 size = tv_1.size();
97 }
98
99 bool pass = true;
100 for (std::vector<uint64_t>::size_type i = 0; i < size; i++)
101 {
102 if (tv_1[i] != tv_2[i])
103 {
104 ATH_MSG_DEBUG("The two test vectors are different at index " << i);
105 pass = false;
106 }
107 }
108
109 if (pass)
110 {
111 ATH_MSG_DEBUG("The two test vectors are the same");
112 }
113 else
114 {
115 ATH_MSG_WARNING("The two test vectors are different!");
116 }
117
118 return StatusCode::SUCCESS;
119}

◆ encodePixelL2G()

StatusCode TestVectorTool::encodePixelL2G ( const xAOD::PixelClusterContainer * pixelClusters,
std::vector< uint64_t > & encodedData ) const

Encode xAOD pixel cluster to L2G EDM TV.

Parameters
pixelClustersThe xAOD::PixelClusterContainer object
encodedDataThe encoded data in the form of std::vector<uint64_t>

Definition at line 161 of file TestVectorTool.cxx.

162{
163 ATH_MSG_DEBUG("Encoding xAOD pixel clusters to L2G EDM TV");
164
165 // Fill the event header
166 // Event header w1
168 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w1(header_w1));
169
170 // Event header w2
171 auto header_w2 = FPGADataFormatUtilities::fill_EVT_HDR_w2(242000, 0);
172 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w2(header_w2));
173
174 // Event header w3
175 auto header_w3 = FPGADataFormatUtilities::fill_EVT_HDR_w3(0, 0);
176 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w3(header_w3));
177
178 // L2G conetent
179 // Loop over the pixel clusters
180 unsigned int isLast = 0;
181 for (unsigned int i = 0; i < pixelClusters->size(); i++)
182 {
183 // Pixel cluster w1
185 pixelClusters->at(i)->identifierHash(),
186 0);
187 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w1(pixelCluster_w1));
188
189
190
191 // Determine the size of rdo list and retrieve accordingly
192 uint64_t rdoList[4] = {0, 0, 0, 0}; // Current dataformat only supports 4 RDOs
193
194 unsigned int rdoListSize = pixelClusters->at(i)->rdoList().size();
195 rdoListSize = rdoListSize > 4 ? 4 : rdoListSize; // restrict to 4 RDOs if more
196 for (unsigned int j = 0; j < rdoListSize; j++)
197 {
198 rdoList[j] = pixelClusters->at(i)->rdoList().at(j).get_compact();
199 }
200
201 // Pixel cluster w2
202 auto pixelCluster_w2 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w2(rdoList[0]);
203 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w2(pixelCluster_w2));
204
205 // Pixel cluster w3
206 auto pixelCluster_w3 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w3(rdoList[1]);
207 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w3(pixelCluster_w3));
208
209 // Pixel cluster w4
210 auto pixelCluster_w4 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w4(rdoList[2]);
211 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w4(pixelCluster_w4));
212
213 // Pixel cluster w5
214 auto pixelCluster_w5 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w5(rdoList[3]);
215 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w5(pixelCluster_w5));
216
217 // Pixel cluster w6
218 auto pixelCluster_w6 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w6(pixelClusters->at(i)->localPosition<2>()(0, 0),
219 pixelClusters->at(i)->localPosition<2>()(1, 0),
220 pixelClusters->at(i)->channelsInPhi(),
221 pixelClusters->at(i)->channelsInEta(),
222 pixelClusters->at(i)->widthInEta()
223 );
224 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w6(pixelCluster_w6));
225
226 // Pixel cluster w7
227 auto pixelCluster_w7 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w7(pixelClusters->at(i)->localCovariance<2>()(0, 0),
228 pixelClusters->at(i)->localCovariance<2>()(1, 1),
229 0,
230 0
231 );
232 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w7(pixelCluster_w7));
233
234 // Pixel cluster w8
235 auto pixelCluster_w8 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w8(pixelClusters->at(i)->globalPosition()[0],
236 pixelClusters->at(i)->globalPosition()[1],
237 0);
238 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w8(pixelCluster_w8));
239
240 // Pixel cluster w9
241 auto pixelCluster_w9 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w9(pixelClusters->at(i)->identifier());
242 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w9(pixelCluster_w9));
243
244 // Pixel cluster w10
245 isLast = i == (pixelClusters->size() - 1) ? 1 : 0;
246 auto pixelCluster_w10 = FPGADataFormatUtilities::fill_EDM_PIXELCLUSTER_w10(pixelClusters->at(i)->globalPosition()[2],
248 isLast,
249 0);
250 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_PIXELCLUSTER_w10(pixelCluster_w10));
251 }
252
253 // Fill the event footer
254 // Event footer w1
256 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w1(footer_w1));
257
258 // Event footer w2
260 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w2(footer_w2));
261
262 // Event footer w3
263 auto footer_w3 = FPGADataFormatUtilities::fill_EVT_FTR_w3(encodedData.size(), 44939973);
264 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3(footer_w3));
265
266 return StatusCode::SUCCESS;
267}
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions,...
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
int channelsInEta() const
float widthInEta() const
Returns the width of the cluster in phi (x) and eta (y) directions, respectively.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash)
DetectorIdentType identifier() const
Returns the full Identifier of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
EDM_PIXELCLUSTER_w6 fill_EDM_PIXELCLUSTER_w6(const double &localposition_x, const double &localposition_y, const uint64_t &channels_in_phi, const uint64_t &channels_in_eta, const uint64_t &width_in_eta)
EVT_HDR_w2 fill_EVT_HDR_w2(const uint64_t &runnumber, const uint64_t &time)
EVT_HDR_w1 fill_EVT_HDR_w1(const uint64_t &flag, const uint64_t &l0id, const uint64_t &bcid, const uint64_t &spare)
EDM_PIXELCLUSTER_w9 fill_EDM_PIXELCLUSTER_w9(const uint64_t &identifier)
EDM_PIXELCLUSTER_w3 fill_EDM_PIXELCLUSTER_w3(const uint64_t &rdo_list_w2)
uint64_t get_dataformat_EVT_FTR_w3(const EVT_FTR_w3 &in)
EDM_PIXELCLUSTER_w8 fill_EDM_PIXELCLUSTER_w8(const double &globalposition_x, const double &globalposition_y, const uint64_t &spare)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w8(const EDM_PIXELCLUSTER_w8 &in)
EDM_PIXELCLUSTER_w5 fill_EDM_PIXELCLUSTER_w5(const uint64_t &rdo_list_w4)
EVT_FTR_w2 fill_EVT_FTR_w2(const uint64_t &error_flags)
uint64_t get_dataformat_EVT_FTR_w1(const EVT_FTR_w1 &in)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w2(const EDM_PIXELCLUSTER_w2 &in)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w9(const EDM_PIXELCLUSTER_w9 &in)
EDM_PIXELCLUSTER_w2 fill_EDM_PIXELCLUSTER_w2(const uint64_t &rdo_list_w1)
uint64_t get_dataformat_EVT_HDR_w3(const EVT_HDR_w3 &in)
uint64_t get_dataformat_EVT_HDR_w2(const EVT_HDR_w2 &in)
EDM_PIXELCLUSTER_w10 fill_EDM_PIXELCLUSTER_w10(const double &globalposition_z, const uint64_t &total_tot, const uint64_t &lastword, const uint64_t &index)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w3(const EDM_PIXELCLUSTER_w3 &in)
EDM_PIXELCLUSTER_w1 fill_EDM_PIXELCLUSTER_w1(const uint64_t &flag, const uint64_t &id_hash, const uint64_t &spare)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w7(const EDM_PIXELCLUSTER_w7 &in)
EVT_FTR_w1 fill_EVT_FTR_w1(const uint64_t &flag, const uint64_t &spare, const uint64_t &hdr_crc)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w10(const EDM_PIXELCLUSTER_w10 &in)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w5(const EDM_PIXELCLUSTER_w5 &in)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w4(const EDM_PIXELCLUSTER_w4 &in)
EDM_PIXELCLUSTER_w4 fill_EDM_PIXELCLUSTER_w4(const uint64_t &rdo_list_w3)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w6(const EDM_PIXELCLUSTER_w6 &in)
EVT_HDR_w3 fill_EVT_HDR_w3(const uint64_t &status, const uint64_t &crc)
EDM_PIXELCLUSTER_w7 fill_EDM_PIXELCLUSTER_w7(const double &localcovariance_xx, const double &localcovariance_yy, const double &omega_x, const double &omega_y)
uint64_t get_dataformat_EVT_FTR_w2(const EVT_FTR_w2 &in)
uint64_t get_dataformat_EVT_HDR_w1(const EVT_HDR_w1 &in)
uint64_t get_dataformat_EDM_PIXELCLUSTER_w1(const EDM_PIXELCLUSTER_w1 &in)
EVT_FTR_w3 fill_EVT_FTR_w3(const uint64_t &word_count, const uint64_t &crc)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ encodeStripL2G()

StatusCode TestVectorTool::encodeStripL2G ( const xAOD::StripClusterContainer * stripClusters,
std::vector< uint64_t > & encodedData ) const

Encode xAOD strip cluster to L2G EDM TV.

Parameters
stripClustersThe xAOD::StripClusterContainer object
encodedDataThe encoded data in the form of std::vector<uint64_t>

Definition at line 269 of file TestVectorTool.cxx.

270{
271 ATH_MSG_DEBUG("Encoding xAOD strip clusters to L2G EDM TV");
272
273 // Fill the event header
274 // Event header w1
276 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w1(header_w1));
277
278 // Event header w2
279 auto header_w2 = FPGADataFormatUtilities::fill_EVT_HDR_w2(242000, 0);
280 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w2(header_w2));
281
282 // Event header w3
283 auto header_w3 = FPGADataFormatUtilities::fill_EVT_HDR_w3(0, 0);
284 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_HDR_w3(header_w3));
285
286 // L2G conetent
287 // Loop over the strip clusters
288 unsigned int isLast = 0;
289 for (unsigned int i = 0; i < stripClusters->size(); i++)
290 {
291 // Strip cluster w1
293 stripClusters->at(i)->identifierHash(),
294 0);
295 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w1(stripCluster_w1));
296
297
298
299 // Determine the size of rdo list and retrieve accordingly
300 uint64_t rdoList[4] = {0, 0, 0, 0}; // Current dataformat only supports 4 RDOs
301
302 unsigned int rdoListSize = stripClusters->at(i)->rdoList().size();
303 rdoListSize = rdoListSize > 4 ? 4 : rdoListSize; // restrict to 4 RDOs if more
304 for (unsigned int j = 0; j < rdoListSize; j++)
305 {
306 rdoList[j] = stripClusters->at(i)->rdoList().at(j).get_compact();
307 }
308
309 // Strip cluster w3
310 auto stripCluster_w2 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w2(rdoList[0]);
311 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w2(stripCluster_w2));
312
313 // Strip cluster w3
314 auto stripCluster_w3 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w3(rdoList[1]);
315 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w3(stripCluster_w3));
316
317 // Strip cluster w4
318 auto stripCluster_w4 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w4(rdoList[2]);
319 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w4(stripCluster_w4));
320
321 // Strip cluster w5
322 auto stripCluster_w5 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w5(rdoList[3]);
323 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w5(stripCluster_w5));
324
325 // Strip cluster w6
326 auto stripCluster_w6 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w6(stripClusters->at(i)->localPosition<1>()(0, 0),
327 0, // Strip cluster has no local position y
328 stripClusters->at(i)->localCovariance<1>()(0, 0),
329 0);
330 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w6(stripCluster_w6));
331
332 // Strip cluster w7
333 auto stripCluster_w7 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w7(stripClusters->at(i)->globalPosition()[0],
334 stripClusters->at(i)->globalPosition()[1],
335 stripClusters->at(i)->channelsInPhi(),
336 0);
337 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w7(stripCluster_w7));
338
339 // Strip cluster w8
340 auto stripCluster_w8 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w8(stripClusters->at(i)->identifier());
341 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w8(stripCluster_w8));
342
343 // Strip cluster w9
344 isLast = i == (stripClusters->size() - 1) ? 1 : 0;
345 auto stripCluster_w9 = FPGADataFormatUtilities::fill_EDM_STRIPCLUSTER_w9(stripClusters->at(i)->globalPosition()[2],
346 isLast, i, 0);
347 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EDM_STRIPCLUSTER_w9(stripCluster_w9));
348 }
349
350 // Fill the event footer
351 // Event footer w1
353 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w1(footer_w1));
354
355 // Event footer w2
357 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w2(footer_w2));
358
359 // Event footer w3
360 // 44939973 in the crc field is a dummy value for now
361 auto footer_w3 = FPGADataFormatUtilities::fill_EVT_FTR_w3(encodedData.size(), 44939973);
362 encodedData.push_back(FPGADataFormatUtilities::get_dataformat_EVT_FTR_w3(footer_w3));
363
364 return StatusCode::SUCCESS;
365}
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the strip cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x), respectively.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
EDM_STRIPCLUSTER_w2 fill_EDM_STRIPCLUSTER_w2(const uint64_t &rdo_list_w1)
EDM_STRIPCLUSTER_w6 fill_EDM_STRIPCLUSTER_w6(const double &localposition_x, const double &localposition_y, const double &localcovariance_xx, const uint64_t &spare)
EDM_STRIPCLUSTER_w9 fill_EDM_STRIPCLUSTER_w9(const double &globalposition_z, const uint64_t &lastword, const uint64_t &index, const uint64_t &spare)
EDM_STRIPCLUSTER_w8 fill_EDM_STRIPCLUSTER_w8(const uint64_t &identifier)
EDM_STRIPCLUSTER_w1 fill_EDM_STRIPCLUSTER_w1(const uint64_t &flag, const uint64_t &id_hash, const uint64_t &spare)
EDM_STRIPCLUSTER_w4 fill_EDM_STRIPCLUSTER_w4(const uint64_t &rdo_list_w3)
EDM_STRIPCLUSTER_w7 fill_EDM_STRIPCLUSTER_w7(const double &globalposition_x, const double &globalposition_y, const uint64_t &channels_in_phi, const uint64_t &spare)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w3(const EDM_STRIPCLUSTER_w3 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w5(const EDM_STRIPCLUSTER_w5 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w6(const EDM_STRIPCLUSTER_w6 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w1(const EDM_STRIPCLUSTER_w1 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w7(const EDM_STRIPCLUSTER_w7 &in)
EDM_STRIPCLUSTER_w5 fill_EDM_STRIPCLUSTER_w5(const uint64_t &rdo_list_w4)
EDM_STRIPCLUSTER_w3 fill_EDM_STRIPCLUSTER_w3(const uint64_t &rdo_list_w2)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w9(const EDM_STRIPCLUSTER_w9 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w4(const EDM_STRIPCLUSTER_w4 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w8(const EDM_STRIPCLUSTER_w8 &in)
uint64_t get_dataformat_EDM_STRIPCLUSTER_w2(const EDM_STRIPCLUSTER_w2 &in)

◆ initialize()

StatusCode TestVectorTool::initialize ( )
override

Definition at line 17 of file TestVectorTool.cxx.

18{
19 ATH_MSG_INFO("Initializing TestVectorTool tool");
20
21 return StatusCode::SUCCESS;
22}
#define ATH_MSG_INFO(x)

◆ prepareTV()

StatusCode TestVectorTool::prepareTV ( const std::string & inputFile,
std::vector< uint64_t > & testVector ) const

Prepare test vector in the form of std::vector<uint64_t>, can be either .txt or .bin.

Parameters
inputFileThe input file name to be opened
testVectorThe vector of uint64_t to be filled

Definition at line 24 of file TestVectorTool.cxx.

25{
26 ATH_MSG_DEBUG("Preparing input test vector from " << inputFile);
27
28 // Check if the input file ends with .txt or .bin
29 if (inputFile.find(".txt") == std::string::npos && inputFile.find(".bin") == std::string::npos)
30 {
31 ATH_MSG_ERROR("Input TV file must be either .txt or .bin");
32 return StatusCode::FAILURE;
33 }
34
35 // clear the test vector before reading
36 testVector.clear();
37
38 // if .txt
39 if (inputFile.find(".txt") != std::string::npos)
40 {
41 std::ifstream file(inputFile, std::ios::in);
42 if (!file.is_open())
43 {
44 ATH_MSG_ERROR("Cannot open file " << inputFile);
45 return StatusCode::FAILURE;
46 }
47
48 uint64_t cache;
49 while (file >> std::hex >> cache)
50 {
51 testVector.push_back(cache);
52 }
53
54 // close the file
55 file.close();
56 }
57 else
58 {
59 std::ifstream file(inputFile, std::ios::binary);
60 if (!file.is_open())
61 {
62 ATH_MSG_ERROR("Cannot open input TV file " << inputFile);
63 return StatusCode::FAILURE;
64 }
65
66 uint64_t cache;
67 while (file.read(reinterpret_cast<char *>(&cache), sizeof(uint64_t)))
68 {
69 // Reverse the byte order
70 cache = __builtin_bswap64(cache);
71 testVector.push_back(cache);
72 }
73
74 // close the file
75 file.close();
76 }
77
78 return StatusCode::SUCCESS;
79}
#define ATH_MSG_ERROR(x)
TFile * file

The documentation for this class was generated from the following files: