ATLAS Offline Software
DataPreparationPipeline.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 
14 #include <algorithm>
15 
16 #include "AthContainers/debug.h"
18 
19 #define MAX_CLUSTER_NUM \
20  500000 // A large enough number for the current development, should be
21  // further discussed
22 
23 #define MAX_SPACEPOINT_NUM \
24  500000 // A large enough number for the current development, should be
25  // further discussed
26 
28  // Check if we are running the software mode, this doesn't require an FPGA
29  // presents in the machine
30  if (m_runSW) {
32  "Running the software mode. The FPGA accelerator will not be used. "
33  "Software version of the kernel is used instead.");
34  } else {
35  ATH_MSG_INFO("Running on the FPGA accelerator");
39  }
40 
43  ATH_CHECK(m_stripSpacePointsKey.initialize());
44  ATH_CHECK(m_pixelSpacePointsKey.initialize());
45  ATH_CHECK(m_xAODContainerMaker.retrieve());
46 
47  return StatusCode::SUCCESS;
48 }
49 
50 StatusCode DataPreparationPipeline::execute(const EventContext &ctx) const {
51 
52  // Retrieve the strip and pixel cluster container from the event store
54  m_stripClustersKey, ctx);
56  m_pixelClustersKey, ctx);
57  SG::ReadHandle<xAOD::SpacePointContainer> inputStripSpacePoints(
59  SG::ReadHandle<xAOD::SpacePointContainer> inputPixelSpacePoints(
61 
62  // Check if the strip cluster container is valid
63  if (!inputStripClusters.isValid()) {
64  ATH_MSG_ERROR("Failed to retrieve: " << m_stripClustersKey);
65  return StatusCode::FAILURE;
66  }
67 
68  // Check if the pixel cluster container is valid
69  if (!inputPixelClusters.isValid()) {
70  ATH_MSG_ERROR("Failed to retrieve: " << m_pixelClustersKey);
71  return StatusCode::FAILURE;
72  }
73 
74  // Check if the Strip space point container is valid
75  if (!inputStripSpacePoints.isValid()) {
76  ATH_MSG_ERROR("Failed to retrieve: " << m_stripSpacePointsKey);
77  return StatusCode::FAILURE;
78  }
79  // Check if the Pixel space point container is valid
80  if (!inputPixelSpacePoints.isValid()) {
81  ATH_MSG_ERROR("Failed to retrieve: " << m_pixelSpacePointsKey);
82  return StatusCode::FAILURE;
83  }
84  if (msgLvl(MSG::DEBUG)) {
85 
86  ATH_MSG_DEBUG("There are " << inputStripClusters->size()
87  << " strip cluster in this event");
88  ATH_MSG_DEBUG("There are " << inputPixelClusters->size()
89  << " pixel cluster in this event");
90  ATH_MSG_DEBUG("There are " << inputStripSpacePoints->size()
91  << " Strip space point in this event");
92  ATH_MSG_DEBUG("There are " << inputPixelSpacePoints->size()
93  << " Pixel space point in this event");
94 
95  // Print auxid for data members for later assignments
96  // This is only temporary for development purpose and will be removed in the
97  // future
98  const SG::auxid_set_t &auxid_set = inputStripClusters->getAuxIDs();
99  for (auto id : auxid_set) {
100  ATH_MSG_DEBUG("StripClusterContainer" << SGdebug::aux_var_name(id)
101  << " has AuxId: " << id);
102  }
103 
104  const SG::auxid_set_t &auxid_set_pixel = inputPixelClusters->getAuxIDs();
105  for (auto id : auxid_set_pixel) {
106  ATH_MSG_DEBUG("PixelClusterContainer" << SGdebug::aux_var_name(id)
107  << " has AuxId: " << id);
108  }
109 
110  const SG::auxid_set_t &auxid_set_ssp = inputStripSpacePoints->getAuxIDs();
111  for (auto id : auxid_set_ssp) {
112  ATH_MSG_DEBUG("StripSpacePointContainer" << SGdebug::aux_var_name(id)
113  << " has AuxId: " << id);
114  }
115 
116  const SG::auxid_set_t &auxid_set_psp = inputPixelSpacePoints->getAuxIDs();
117  for (auto id : auxid_set_psp) {
118  ATH_MSG_DEBUG("PixelSpacePointContainer" << SGdebug::aux_var_name(id)
119  << " has AuxId: " << id);
120  }
121  }
122 
123  // Prepare the input data for the kernel
124  // This is to "remake" the cluster but in a kernel compatible format using
125  // the struct defined in EFTrackingDataFormats.h
126  std::vector<EFTrackingDataFormats::StripCluster>
127  ef_stripClusters; // Strip clusters as kernel input argument
128  std::vector<EFTrackingDataFormats::PixelCluster>
129  ef_pixelClusters; // Pixel clusters as kernel input argument
130  std::vector<EFTrackingDataFormats::SpacePoint>
131  ef_stripSpacePoints; // Strip Space points as kernel input argument
132  std::vector<EFTrackingDataFormats::SpacePoint>
133  ef_pixelSpacePoints; // Pixel Space points as kernel input argument
134 
135  // vector of vector of to send transit xAOD::UncalibratedMeasurement for the
136  // spacepoint
137  std::vector<std::vector<const xAOD::UncalibratedMeasurement *>> pixelsp_meas;
138  std::vector<std::vector<const xAOD::UncalibratedMeasurement *>> stripsp_meas;
139 
140  // Currently we only take the first 10 clusters for testing, this will be
141  // removed in the future
142  ATH_CHECK(
143  getInputClusterData(inputStripClusters.ptr(), ef_stripClusters, 10));
144  ATH_CHECK(
145  getInputClusterData(inputPixelClusters.ptr(), ef_pixelClusters, 10));
146  bool isStrip = true;
147  ATH_CHECK(getInputSpacePointData(inputStripSpacePoints.ptr(),
148  ef_stripSpacePoints, stripsp_meas, 10,
149  isStrip));
150  ATH_CHECK(getInputSpacePointData(inputPixelSpacePoints.ptr(),
151  ef_pixelSpacePoints, pixelsp_meas, 10,
152  !isStrip));
153 
154  if (msgLvl(MSG::DEBUG)) {
155  // print the first 3 elements for all the arrays
156  // This is to debug and make sure we are doing the right thing
157  for (int i = 0; i < 10; i++) {
158  ATH_MSG_DEBUG("StripCluster["
159  << i << "]: " << ef_stripClusters.at(i).localPosition
160  << ", " << ef_stripClusters.at(i).localCovariance << ", "
161  << ef_stripClusters.at(i).idHash << ", "
162  << ef_stripClusters.at(i).id << ", "
163  << ef_stripClusters.at(i).globalPosition[0] << ", "
164  << ef_stripClusters.at(i).globalPosition[1] << ", "
165  << ef_stripClusters.at(i).globalPosition[2] << ", "
166  << ef_stripClusters.at(i).rdoList[0] << ", "
167  << ef_stripClusters.at(i).channelsInPhi);
168  }
169  }
170 
171  if (m_runSW) {
172  ATH_CHECK(runSW(ef_stripClusters, ef_pixelClusters, ef_stripSpacePoints,
173  stripsp_meas, ef_pixelSpacePoints, pixelsp_meas, ctx));
174  } else {
175  ATH_CHECK(runHW(ef_stripClusters, ef_pixelClusters, ef_stripSpacePoints,
176  stripsp_meas, ef_pixelSpacePoints, pixelsp_meas));
177  }
178 
179  return StatusCode::SUCCESS;
180 }
181 
184  std::vector<EFTrackingDataFormats::StripCluster> &ef_sc,
185  long unsigned int N) const {
186  if (N > sc->size()) {
187  ATH_MSG_ERROR("You want to get the "
188  << N << "th strip cluster, but there are only " << sc->size()
189  << " strip clusters in the container.");
190  return StatusCode::FAILURE;
191  }
192  ATH_MSG_DEBUG("Making vector of strip clusters...");
193  for (long unsigned int i = 0; i < N; i++) {
195  // Get the data from the input xAOD::StripClusterContainer and set it to the
196  // cache
197  cache.localPosition = sc->at(i)->localPosition<1>()(0, 0);
198  cache.localCovariance = sc->at(i)->localCovariance<1>()(0, 0);
199  cache.idHash = sc->at(i)->identifierHash();
200  cache.id = sc->at(i)->identifier();
201  cache.globalPosition[0] = sc->at(i)->globalPosition()[0];
202  cache.globalPosition[1] = sc->at(i)->globalPosition()[1];
203  cache.globalPosition[2] = sc->at(i)->globalPosition()[2];
204 
205  for (long unsigned int j = 0; j < sc->at(i)->rdoList().size(); j++) {
206  cache.rdoList[j] = sc->at(i)->rdoList().at(j).get_compact();
207  }
208 
209  cache.channelsInPhi = sc->at(i)->channelsInPhi();
210  cache.sizeOfRDOList = sc->at(i)->rdoList().size();
211 
212  ef_sc.push_back(cache);
213  }
214 
215  ATH_MSG_DEBUG("Made " << ef_sc.size() << " strip clusters in the vector");
216  return StatusCode::SUCCESS;
217 }
218 
221  std::vector<EFTrackingDataFormats::PixelCluster> &ef_pc,
222  long unsigned int N) const {
223  if (N > pc->size()) {
224  ATH_MSG_ERROR("You want to get the "
225  << N << "th pixel cluster, but there are only " << pc->size()
226  << " pixel clusters in the container.");
227  return StatusCode::FAILURE;
228  }
229  ATH_MSG_DEBUG("Making vector of pixel clusters...");
230  for (long unsigned int i = 0; i < N; i++) {
232  // Get the data from the input xAOD::PixelClusterContainer and set it to the
233  // cache
234  cache.id = pc->at(i)->identifier();
235  cache.idHash = pc->at(i)->identifierHash();
236  cache.localPosition[0] = pc->at(i)->localPosition<2>()(0, 0);
237  cache.localPosition[1] = pc->at(i)->localPosition<2>()(1, 0);
238  cache.localCovariance[0] = pc->at(i)->localCovariance<2>()(0, 0);
239  cache.localCovariance[1] = pc->at(i)->localCovariance<2>()(1, 0);
240  cache.globalPosition[0] = pc->at(i)->globalPosition()[0];
241  cache.globalPosition[1] = pc->at(i)->globalPosition()[1];
242  cache.globalPosition[2] = pc->at(i)->globalPosition()[2];
243 
244  for (long unsigned int j = 0; j < pc->at(i)->rdoList().size(); j++) {
245  cache.rdoList[j] = pc->at(i)->rdoList().at(j).get_compact();
246  }
247 
248  cache.channelsInPhi = pc->at(i)->channelsInPhi();
249  cache.channelsInEta = pc->at(i)->channelsInEta();
250  cache.widthInEta = pc->at(i)->widthInEta();
251  cache.omegaX = pc->at(i)->omegaX();
252  cache.omegaY = pc->at(i)->omegaY();
253 
254  for (long unsigned int j = 0; j < pc->at(i)->totList().size(); j++) {
255  cache.totList[j] = pc->at(i)->totList().at(j);
256  }
257 
258  cache.totalToT = pc->at(i)->totalToT();
259 
260  for (long unsigned int j = 0; j < pc->at(i)->chargeList().size(); j++) {
261  cache.chargeList[j] = pc->at(i)->chargeList().at(j);
262  }
263 
264  cache.totalCharge = pc->at(i)->totalCharge();
265  cache.energyLoss = pc->at(i)->energyLoss();
266  cache.isSplit = pc->at(i)->isSplit();
267  cache.splitProbability1 = pc->at(i)->splitProbability1();
268  cache.splitProbability2 = pc->at(i)->splitProbability2();
269  cache.lvl1a = pc->at(i)->lvl1a();
270  cache.sizeOfRDOList = pc->at(i)->rdoList().size();
271  cache.sizeOfTotList = pc->at(i)->totList().size();
272  cache.sizeOfChargeList = pc->at(i)->chargeList().size();
273 
274  ef_pc.push_back(cache);
275  }
276 
277  ATH_MSG_DEBUG("Made " << ef_pc.size() << " pixel clusters in the vector");
278  return StatusCode::SUCCESS;
279 }
280 
282  const xAOD::SpacePointContainer *sp,
283  std::vector<EFTrackingDataFormats::SpacePoint> &ef_sp,
284  std::vector<std::vector<const xAOD::UncalibratedMeasurement *>> &sp_meas,
285  long unsigned int N, bool isStrip) const {
286  if (N > sp->size()) {
287  ATH_MSG_ERROR("You want to get the "
288  << N << "th space point, but there are only " << sp->size()
289  << " SpacePoint in the container.");
290  return StatusCode::FAILURE;
291  }
292  ATH_MSG_DEBUG("Making vector of space point...");
293  for (long unsigned int i = 0; i < N; i++) {
295  // Get the data from the input xAOD::SpacePointContainer and set it to the
296  // cache
297  cache.idHash[0] = sp->at(i)->elementIdList()[0];
298  cache.globalPosition[0] = sp->at(i)->x();
299  cache.globalPosition[1] = sp->at(i)->y();
300  cache.globalPosition[2] = sp->at(i)->z();
301  cache.radius = sp->at(i)->radius();
302  cache.cov_r = sp->at(i)->varianceR();
303  cache.cov_z = sp->at(i)->varianceZ();
304 
305  // Pass the uncalibrated measurement for later stage of xAOD container
306  // creation for spacepoint
307  std::vector<const xAOD::UncalibratedMeasurement *> temp_vec(
308  sp->at(i)->measurements().size());
309  std::copy(sp->at(i)->measurements().begin(),
310  sp->at(i)->measurements().end(), temp_vec.begin());
311 
312  sp_meas.push_back(temp_vec);
313 
314  if (isStrip) {
315  cache.idHash[1] = sp->at(i)->elementIdList()[1];
316  cache.topHalfStripLength = sp->at(i)->topHalfStripLength();
317  cache.bottomHalfStripLength = sp->at(i)->bottomHalfStripLength();
318  std::copy(sp->at(i)->topStripDirection().data(),
319  sp->at(i)->topStripDirection().data() +
320  sp->at(i)->topStripDirection().size(),
321  cache.topStripDirection);
322  std::copy(sp->at(i)->bottomStripDirection().data(),
323  sp->at(i)->bottomStripDirection().data() +
324  sp->at(i)->bottomStripDirection().size(),
325  cache.bottomStripDirection);
326  std::copy(sp->at(i)->stripCenterDistance().data(),
327  sp->at(i)->stripCenterDistance().data() +
328  sp->at(i)->stripCenterDistance().size(),
329  cache.stripCenterDistance);
330  std::copy(sp->at(i)->topStripCenter().data(),
331  sp->at(i)->topStripCenter().data() +
332  sp->at(i)->topStripCenter().size(),
333  cache.topStripCenter);
334  }
335  ef_sp.push_back(cache);
336  }
337 
338  ATH_MSG_DEBUG("Made " << ef_sp.size() << " space points in the vector");
339  return StatusCode::SUCCESS;
340 }
341 
343  const std::vector<EFTrackingDataFormats::StripCluster> &ef_sc,
344  const std::vector<EFTrackingDataFormats::PixelCluster> &ef_pc,
345  const std::vector<EFTrackingDataFormats::SpacePoint> &ef_ssp,
346  const std::vector<std::vector<const xAOD::UncalibratedMeasurement *>>
347  &ssp_mes,
348  const std::vector<EFTrackingDataFormats::SpacePoint> &ef_psp,
349  const std::vector<std::vector<const xAOD::UncalibratedMeasurement *>>
350  &psp_mes,
351  const EventContext &ctx) const {
352  ATH_MSG_DEBUG("Running the software version of the kernel");
353 
354  std::unique_ptr<EFTrackingDataFormats::Metadata> metadata =
355  std::make_unique<EFTrackingDataFormats::Metadata>();
356  // Strip cluster
357  std::vector<float> scLocalPosition(MAX_CLUSTER_NUM);
358  std::vector<float> scLocalCovariance(MAX_CLUSTER_NUM);
359  std::vector<unsigned int> scIdHash(MAX_CLUSTER_NUM);
360  std::vector<long unsigned int> scId(MAX_CLUSTER_NUM);
361  std::vector<float> scGlobalPosition(MAX_CLUSTER_NUM * 3);
362  std::vector<unsigned long long> scRdoList(MAX_CLUSTER_NUM * 1000);
363  std::vector<int> scChannelsInPhi(MAX_CLUSTER_NUM);
365  ef_scOutput.scLocalPosition = scLocalPosition.data();
366  ef_scOutput.scLocalCovariance = scLocalCovariance.data();
367  ef_scOutput.scIdHash = scIdHash.data();
368  ef_scOutput.scId = scId.data();
369  ef_scOutput.scGlobalPosition = scGlobalPosition.data();
370  ef_scOutput.scRdoList = scRdoList.data();
371  ef_scOutput.scChannelsInPhi = scChannelsInPhi.data();
372 
373  // Pixel cluster
374  std::vector<float> pcLocalPosition(MAX_CLUSTER_NUM * 2);
375  std::vector<float> pcLocalCovariance(MAX_CLUSTER_NUM * 2);
376  std::vector<unsigned int> pcIdHash(MAX_CLUSTER_NUM);
377  std::vector<long unsigned int> pcId(MAX_CLUSTER_NUM);
378  std::vector<float> pcGlobalPosition(MAX_CLUSTER_NUM * 3);
379  std::vector<unsigned long long> pcRdoList(MAX_CLUSTER_NUM);
380  std::vector<int> pcChannelsInPhi(MAX_CLUSTER_NUM);
381  std::vector<int> pcChannelsInEta(MAX_CLUSTER_NUM);
382  std::vector<float> pcWidthInEta(MAX_CLUSTER_NUM);
383  std::vector<float> pcOmegaX(MAX_CLUSTER_NUM);
384  std::vector<float> pcOmegaY(MAX_CLUSTER_NUM);
385  std::vector<int> pcTotList(MAX_CLUSTER_NUM);
386  std::vector<int> pcTotalToT(MAX_CLUSTER_NUM);
387  std::vector<float> pcChargeList(MAX_CLUSTER_NUM);
388  std::vector<float> pcTotalCharge(MAX_CLUSTER_NUM);
389  std::vector<float> pcEnergyLoss(MAX_CLUSTER_NUM);
390  std::vector<char> pcIsSplit(MAX_CLUSTER_NUM);
391  std::vector<float> pcSplitProbability1(MAX_CLUSTER_NUM);
392  std::vector<float> pcSplitProbability2(MAX_CLUSTER_NUM);
393  std::vector<int> pcLvl1a(MAX_CLUSTER_NUM);
395  ef_pcOutput.pcLocalPosition = pcLocalPosition.data();
396  ef_pcOutput.pcLocalCovariance = pcLocalCovariance.data();
397  ef_pcOutput.pcIdHash = pcIdHash.data();
398  ef_pcOutput.pcId = pcId.data();
399  ef_pcOutput.pcGlobalPosition = pcGlobalPosition.data();
400  ef_pcOutput.pcRdoList = pcRdoList.data();
401  ef_pcOutput.pcChannelsInPhi = pcChannelsInPhi.data();
402  ef_pcOutput.pcChannelsInEta = pcChannelsInEta.data();
403  ef_pcOutput.pcWidthInEta = pcWidthInEta.data();
404  ef_pcOutput.pcOmegaX = pcOmegaX.data();
405  ef_pcOutput.pcOmegaY = pcOmegaY.data();
406  ef_pcOutput.pcTotList = pcTotList.data();
407  ef_pcOutput.pcTotalToT = pcTotalToT.data();
408  ef_pcOutput.pcChargeList = pcChargeList.data();
409  ef_pcOutput.pcTotalCharge = pcTotalCharge.data();
410  ef_pcOutput.pcEnergyLoss = pcEnergyLoss.data();
411  ef_pcOutput.pcIsSplit = pcIsSplit.data();
412  ef_pcOutput.pcSplitProbability1 = pcSplitProbability1.data();
413  ef_pcOutput.pcSplitProbability2 = pcSplitProbability2.data();
414  ef_pcOutput.pcLvl1a = pcLvl1a.data();
415 
416  // Strip SpacePoint
417  std::vector<unsigned int> sspIdHash(MAX_SPACEPOINT_NUM * 2);
418  std::vector<float> sspGlobalPosition(MAX_SPACEPOINT_NUM * 3);
419  std::vector<float> sspRadius(MAX_SPACEPOINT_NUM);
420  std::vector<float> sspVarianceR(MAX_SPACEPOINT_NUM);
421  std::vector<float> sspVarianceZ(MAX_SPACEPOINT_NUM);
422  std::vector<int> sspMeasurementIndexes(MAX_SPACEPOINT_NUM * 100);
423  std::vector<float> sspTopHalfStripLength(MAX_SPACEPOINT_NUM);
424  std::vector<float> sspBottomHalfStripLength(MAX_SPACEPOINT_NUM);
425  std::vector<float> sspTopStripDirection(MAX_SPACEPOINT_NUM * 3);
426  std::vector<float> sspBottomStripDirection(MAX_SPACEPOINT_NUM * 3);
427  std::vector<float> sspStripCenterDistance(MAX_SPACEPOINT_NUM * 3);
428  std::vector<float> sspTopStripCenter(MAX_SPACEPOINT_NUM * 3);
430  ef_sspOutput.spIdHash = sspIdHash.data();
431  ef_sspOutput.spGlobalPosition = sspGlobalPosition.data();
432  ef_sspOutput.spRadius = sspRadius.data();
433  ef_sspOutput.spVarianceR = sspVarianceR.data();
434  ef_sspOutput.spVarianceZ = sspVarianceZ.data();
435  ef_sspOutput.spMeasurementIndexes = sspMeasurementIndexes.data();
436  ef_sspOutput.spTopHalfStripLength = sspTopHalfStripLength.data();
437  ef_sspOutput.spBottomHalfStripLength = sspBottomHalfStripLength.data();
438  ef_sspOutput.spTopStripDirection = sspTopStripDirection.data();
439  ef_sspOutput.spBottomStripDirection = sspBottomStripDirection.data();
440  ef_sspOutput.spStripCenterDistance = sspStripCenterDistance.data();
441  ef_sspOutput.spTopStripCenter = sspTopStripCenter.data();
442 
443  // Pixel SpacePoint
444  std::vector<unsigned int> pspIdHash(MAX_SPACEPOINT_NUM);
445  std::vector<float> pspGlobalPosition(MAX_SPACEPOINT_NUM * 3);
446  std::vector<float> pspRadius(MAX_SPACEPOINT_NUM);
447  std::vector<float> pspVarianceR(MAX_SPACEPOINT_NUM);
448  std::vector<float> pspVarianceZ(MAX_SPACEPOINT_NUM);
449  std::vector<int> pspMeasurementIndexes(MAX_SPACEPOINT_NUM * 100);
451  ef_pspOutput.spIdHash = pspIdHash.data();
452  ef_pspOutput.spGlobalPosition = pspGlobalPosition.data();
453  ef_pspOutput.spRadius = pspRadius.data();
454  ef_pspOutput.spVarianceR = pspVarianceR.data();
455  ef_pspOutput.spVarianceZ = pspVarianceZ.data();
456  ef_pspOutput.spMeasurementIndexes = pspMeasurementIndexes.data();
457 
458  ATH_CHECK(transferSW(ef_sc, ef_scOutput, ef_pc, ef_pcOutput, ef_ssp,
459  ef_sspOutput, ef_psp, ef_pspOutput, metadata.get()));
460 
461  // resize the vector to be the length of the cluster
462  scLocalPosition.resize(metadata->numOfStripClusters);
463  scLocalCovariance.resize(metadata->numOfStripClusters);
464  scIdHash.resize(metadata->numOfStripClusters);
465  scId.resize(metadata->numOfStripClusters);
466  scGlobalPosition.resize(metadata->numOfStripClusters * 3);
467  scRdoList.resize(metadata->scRdoIndexSize);
468  scChannelsInPhi.resize(metadata->numOfStripClusters);
469 
470  pcLocalPosition.resize(metadata->numOfPixelClusters * 2);
471  pcLocalCovariance.resize(metadata->numOfPixelClusters * 2);
472  pcIdHash.resize(metadata->numOfPixelClusters);
473  pcId.resize(metadata->numOfPixelClusters);
474  pcGlobalPosition.resize(metadata->numOfPixelClusters * 3);
475  pcRdoList.resize(metadata->pcRdoIndexSize);
476  pcChannelsInPhi.resize(metadata->numOfPixelClusters);
477  pcChannelsInEta.resize(metadata->numOfPixelClusters);
478  pcWidthInEta.resize(metadata->numOfPixelClusters);
479  pcOmegaX.resize(metadata->numOfPixelClusters);
480  pcOmegaY.resize(metadata->numOfPixelClusters);
481  pcTotList.resize(metadata->pcTotIndexSize);
482  pcTotalToT.resize(metadata->numOfPixelClusters);
483  pcChargeList.resize(metadata->pcChargeIndexSize);
484  pcTotalCharge.resize(metadata->numOfPixelClusters);
485  pcEnergyLoss.resize(metadata->numOfPixelClusters);
486  pcIsSplit.resize(metadata->numOfPixelClusters);
487  pcSplitProbability1.resize(metadata->numOfPixelClusters);
488  pcSplitProbability2.resize(metadata->numOfPixelClusters);
489  pcLvl1a.resize(metadata->numOfPixelClusters);
490 
491  // resize the vector to be the length of the space point
492  sspIdHash.resize(metadata->numOfStripSpacePoints * 2);
493  sspGlobalPosition.resize(metadata->numOfStripSpacePoints * 3);
494  sspRadius.resize(metadata->numOfStripSpacePoints);
495  sspVarianceR.resize(metadata->numOfStripSpacePoints);
496  sspVarianceZ.resize(metadata->numOfStripSpacePoints);
497  sspTopHalfStripLength.resize(metadata->numOfStripSpacePoints);
498  sspBottomHalfStripLength.resize(metadata->numOfStripSpacePoints);
499  sspTopStripDirection.resize(metadata->numOfStripSpacePoints * 3);
500  sspBottomStripDirection.resize(metadata->numOfStripSpacePoints * 3);
501  sspStripCenterDistance.resize(metadata->numOfStripSpacePoints * 3);
502  sspTopStripCenter.resize(metadata->numOfStripSpacePoints * 3);
503 
504  pspIdHash.resize(metadata->numOfPixelSpacePoints);
505  pspGlobalPosition.resize(metadata->numOfPixelSpacePoints * 3);
506  pspRadius.resize(metadata->numOfPixelSpacePoints);
507  pspVarianceR.resize(metadata->numOfPixelSpacePoints);
508  pspVarianceZ.resize(metadata->numOfPixelSpacePoints);
509 
510  // print all strip clusters
511  for (unsigned i = 0; i < metadata->numOfStripClusters; i++) {
512  ATH_MSG_DEBUG("scLocalPosition["
513  << i << "] = " << ef_scOutput.scLocalPosition[i]);
514  ATH_MSG_DEBUG("scLocalCovariance["
515  << i << "] = " << ef_scOutput.scLocalCovariance[i]);
516  ATH_MSG_DEBUG("scIdHash[" << i << "] = " << ef_scOutput.scIdHash[i]);
517  ATH_MSG_DEBUG("scId[" << i << "] = " << ef_scOutput.scId[i]);
518  ATH_MSG_DEBUG("scGlobalPosition["
519  << i << "] = " << ef_scOutput.scGlobalPosition[i * 3] << ", "
520  << ef_scOutput.scGlobalPosition[i * 3 + 1] << ", "
521  << ef_scOutput.scGlobalPosition[i * 3 + 2]);
522  ATH_MSG_DEBUG("scRdoList[" << i << "] = " << ef_scOutput.scRdoList[i]);
523  ATH_MSG_DEBUG("scChannelsInPhi["
524  << i << "] = " << ef_scOutput.scChannelsInPhi[i]);
525  }
526 
527  // print all pixel clusters
528  for (unsigned i = 0; i < metadata->numOfPixelClusters; i++) {
529 
530  ATH_MSG_DEBUG("pcLocalPosition["
531  << i << "] = " << ef_pcOutput.pcLocalPosition[i * 2] << ", "
532  << ef_pcOutput.pcLocalPosition[i * 2 + 1]);
533  ATH_MSG_DEBUG("pcLocalCovariance["
534  << i << "] = " << ef_pcOutput.pcLocalCovariance[i * 2] << ", "
535  << ef_pcOutput.pcLocalCovariance[i * 2 + 1]);
536  ATH_MSG_DEBUG("pcIdHash[" << i << "] = " << ef_pcOutput.pcIdHash[i]);
537  ATH_MSG_DEBUG("pcId[" << i << "] = " << pcId[i]);
538  ATH_MSG_DEBUG("pcGlobalPosition["
539  << i << "] = " << ef_pcOutput.pcGlobalPosition[i * 3] << ", "
540  << ef_pcOutput.pcGlobalPosition[i * 3 + 1] << ", "
541  << ef_pcOutput.pcGlobalPosition[i * 3 + 2]);
542  // ATH_MSG_DEBUG("pcRdoList[" << i << "] = " << pcRdoList[i]);
543  ATH_MSG_DEBUG("pcChannelsInPhi["
544  << i << "] = " << ef_pcOutput.pcChannelsInPhi[i]);
545  ATH_MSG_DEBUG("pcChannelsInEta["
546  << i << "] = " << ef_pcOutput.pcChannelsInEta[i]);
547  ATH_MSG_DEBUG("pcWidthInEta[" << i
548  << "] = " << ef_pcOutput.pcWidthInEta[i]);
549  ATH_MSG_DEBUG("pcOmegaX[" << i << "] = " << ef_pcOutput.pcOmegaX[i]);
550  ATH_MSG_DEBUG("pcOmegaY[" << i << "] = " << ef_pcOutput.pcOmegaY[i]);
551  // ATH_MSG_DEBUG("pcTotList[" << i << "] = " << pcTotList[i]);
552  ATH_MSG_DEBUG("pcTotalToT[" << i << "] = " << ef_pcOutput.pcTotalToT[i]);
553  // ATH_MSG_DEBUG("pcChargeList[" << i << "] = " << pcChargeList[i]);
554  ATH_MSG_DEBUG("pcTotalCharge[" << i
555  << "] = " << ef_pcOutput.pcTotalCharge[i]);
556  ATH_MSG_DEBUG("pcEnergyLoss[" << i
557  << "] = " << ef_pcOutput.pcEnergyLoss[i]);
558  ATH_MSG_DEBUG("pcIsSplit[" << i << "] = " << ef_pcOutput.pcIsSplit[i]);
559  ATH_MSG_DEBUG("pcSplitProbability1["
560  << i << "] = " << ef_pcOutput.pcSplitProbability1[i]);
561  ATH_MSG_DEBUG("pcSplitProbability2["
562  << i << "] = " << ef_pcOutput.pcSplitProbability2[i]);
563  ATH_MSG_DEBUG("pcLvl1a[" << i << "] = " << ef_pcOutput.pcLvl1a[i]);
564  }
565 
566  // print all Strip space points
567  for (unsigned i = 0; i < metadata->numOfStripSpacePoints; i++) {
568  ATH_MSG_DEBUG("sspIdHash[" << i << "] = " << ef_sspOutput.spIdHash[i * 2]
569  << ", " << ef_sspOutput.spIdHash[i * 2 + 1]);
570  ATH_MSG_DEBUG("sspGlobalPosition["
571  << i << "] = " << ef_sspOutput.spGlobalPosition[i * 3] << ", "
572  << ef_sspOutput.spGlobalPosition[i * 3 + 1] << ", "
573  << ef_sspOutput.spGlobalPosition[i * 3 + 2]);
574  ATH_MSG_DEBUG("sspRadius[" << i << "] = " << ef_sspOutput.spRadius[i]);
575  ATH_MSG_DEBUG("sspVarianceR[" << i
576  << "] = " << ef_sspOutput.spVarianceR[i]);
577  ATH_MSG_DEBUG("sspVarianceZ[" << i
578  << "] = " << ef_sspOutput.spVarianceZ[i]);
579  ATH_MSG_DEBUG("sspTopHalfStripLength["
580  << i << "] = " << ef_sspOutput.spTopHalfStripLength[i]);
581  ATH_MSG_DEBUG("sspBottomHalfStripLength["
582  << i << "] = " << ef_sspOutput.spBottomHalfStripLength[i]);
583  ATH_MSG_DEBUG("sspTopStripDirection["
584  << i << "] = " << ef_sspOutput.spTopStripDirection[i * 3]
585  << ", " << ef_sspOutput.spTopStripDirection[i * 3 + 1] << ", "
586  << ef_sspOutput.spTopStripDirection[i * 3 + 2]);
587  ATH_MSG_DEBUG("sspBottomStripDirection["
588  << i << "] = " << ef_sspOutput.spBottomStripDirection[i * 3]
589  << ", " << ef_sspOutput.spBottomStripDirection[i * 3 + 1]
590  << ", " << ef_sspOutput.spBottomStripDirection[i * 3 + 2]);
591  ATH_MSG_DEBUG("sspStripCenterDistance["
592  << i << "] = " << ef_sspOutput.spStripCenterDistance[i * 3]
593  << ", " << ef_sspOutput.spStripCenterDistance[i * 3 + 1]
594  << ", " << ef_sspOutput.spStripCenterDistance[i * 3 + 2]);
595  ATH_MSG_DEBUG("sspTopStripCenter["
596  << i << "] = " << ef_sspOutput.spTopStripCenter[i * 3] << ", "
597  << ef_sspOutput.spTopStripCenter[i * 3 + 1] << ", "
598  << ef_sspOutput.spTopStripCenter[i * 3 + 2]);
599  }
600 
601  // print all Pixel space points
602  for (unsigned i = 0; i < metadata->numOfPixelSpacePoints; i++) {
603  ATH_MSG_DEBUG("pspIdHash[" << i << "] = " << ef_pspOutput.spIdHash[i]);
604  ATH_MSG_DEBUG("pspGlobalPosition["
605  << i << "] = " << ef_pspOutput.spGlobalPosition[i * 3] << ", "
606  << ef_pspOutput.spGlobalPosition[i * 3 + 1] << ", "
607  << ef_pspOutput.spGlobalPosition[i * 3 + 2]);
608  ATH_MSG_DEBUG("pspRadius[" << i << "] = " << ef_pspOutput.spRadius[i]);
609  ATH_MSG_DEBUG("pspVarianceR[" << i
610  << "] = " << ef_pspOutput.spVarianceR[i]);
611  ATH_MSG_DEBUG("pspVarianceZ[" << i
612  << "] = " << ef_pspOutput.spVarianceZ[i]);
613  }
614 
615  // Group data to make the strip cluster container
617  scAux.localPosition = scLocalPosition;
618  scAux.localCovariance = scLocalCovariance;
619  scAux.idHash = scIdHash;
620  scAux.id = scId;
621  scAux.globalPosition = scGlobalPosition;
622  scAux.rdoList = scRdoList;
623  scAux.channelsInPhi = scChannelsInPhi;
624 
625  ATH_CHECK(m_xAODContainerMaker->makeStripClusterContainer(
626  ef_sc.size(), scAux, metadata.get(), ctx));
627 
628  // Group data to make the pixel cluster container
630  pxAux.id = pcId;
631  pxAux.idHash = pcIdHash;
632  pxAux.localPosition = pcLocalPosition;
633  pxAux.localCovariance = pcLocalCovariance;
634  pxAux.globalPosition = pcGlobalPosition;
635  pxAux.rdoList = pcRdoList;
636  pxAux.channelsInPhi = pcChannelsInPhi;
637  pxAux.channelsInEta = pcChannelsInEta;
638  pxAux.widthInEta = pcWidthInEta;
639  pxAux.omegaX = pcOmegaX;
640  pxAux.omegaY = pcOmegaY;
641  pxAux.totList = pcTotList;
642  pxAux.totalToT = pcTotalToT;
643  pxAux.chargeList = pcChargeList;
644  pxAux.totalCharge = pcTotalCharge;
645  pxAux.energyLoss = pcEnergyLoss;
646  pxAux.isSplit = pcIsSplit;
647  pxAux.splitProbability1 = pcSplitProbability1;
648  pxAux.splitProbability2 = pcSplitProbability2;
649  pxAux.lvl1a = pcLvl1a;
650 
651  ATH_CHECK(m_xAODContainerMaker->makePixelClusterContainer(
652  ef_pc.size(), pxAux, metadata.get(), ctx));
653 
654  // Group data to make the strip space point container
656  sspAux.elementIdList = sspIdHash;
657  sspAux.globalPosition = sspGlobalPosition;
658  sspAux.radius = sspRadius;
659  sspAux.varianceR = sspVarianceR;
660  sspAux.varianceZ = sspVarianceZ;
661  sspAux.measurementIndexes = sspMeasurementIndexes;
662  sspAux.topHalfStripLength = sspTopHalfStripLength;
663  sspAux.bottomHalfStripLength = sspBottomHalfStripLength;
664  sspAux.topStripDirection = sspTopStripDirection;
665  sspAux.bottomStripDirection = sspBottomStripDirection;
666  sspAux.stripCenterDistance = sspStripCenterDistance;
667  sspAux.topStripCenter = sspTopStripCenter;
668 
669  ATH_CHECK(m_xAODContainerMaker->makeStripSpacePointContainer(
670  ef_ssp.size(), sspAux, ssp_mes, ctx));
671 
672  // Group data to make the pixel space point container
674  pspAux.elementIdList = pspIdHash;
675  pspAux.globalPosition = pspGlobalPosition;
676  pspAux.radius = pspRadius;
677  pspAux.varianceR = pspVarianceR;
678  pspAux.varianceZ = pspVarianceZ;
679  pspAux.measurementIndexes = pspMeasurementIndexes;
680 
681  ATH_CHECK(m_xAODContainerMaker->makePixelSpacePointContainer(
682  ef_psp.size(), pspAux, psp_mes, ctx));
683 
684  // validate output container
686  "ITkStripClusters");
687  // print the local position
688  for (unsigned i = 0; i < metadata->numOfStripClusters; i++) {
689  ATH_MSG_DEBUG("outputStripClusters["
690  << i << "]->localPosition<1>()(0, 0) = "
691  << outputStripClusters->at(i)->localPosition<1>());
692  }
693  // validate output container
695  "ITkPixelClusters");
696  // print the local position
697  for (unsigned i = 0; i < metadata->numOfPixelClusters; i++) {
698  ATH_MSG_DEBUG("outputPixelClusters["
699  << i << "]->localPosition<2>()(0, 0) = "
700  << outputPixelClusters->at(i)->localPosition<2>()(0, 0));
701  }
702 
703  return StatusCode::SUCCESS;
704 }
705 
706 // This function is still in protoype and should be further discussed
708  const std::vector<EFTrackingDataFormats::StripCluster> &ef_sc,
709  const std::vector<EFTrackingDataFormats::PixelCluster> &ef_pc,
710  const std::vector<EFTrackingDataFormats::SpacePoint> &ef_ssp,
711  const std::vector<std::vector<const xAOD::UncalibratedMeasurement *>>
712  &ssp_mes,
713  const std::vector<EFTrackingDataFormats::SpacePoint> &ef_psp,
714  const std::vector<std::vector<const xAOD::UncalibratedMeasurement *>>
715  &psp_mes) const {
716  ATH_MSG_DEBUG("Running on the hardware");
717 
718  // Prepare host pointers for kernel output
719  float *scLocalPosition;
720  float *scLocalCovariance;
721  unsigned int *scIdHash;
722  long unsigned int *scId;
723  float *scGlobalPosition;
724  unsigned long long *scRdoList;
725  int *scChannelsInPhi;
726 
727  float *pcLocalPosition;
728  float *pcLocalCovariance;
729  unsigned int *pcIdHash;
730  long unsigned int *pcId;
731  float *pcGlobalPosition;
732  unsigned long long *pcRdoList;
733  int *pcChannelsInPhi;
734  int *pcChannelsInEta;
735  float *pcWidthInEta;
736  float *pcOmegaX;
737  float *pcOmegaY;
738  int *pcTotList;
739  int *pcTotalToT;
740  float *pcChargeList;
741  float *pcTotalCharge;
742  float *pcEnergyLoss;
743  char *pcIsSplit;
744  float *pcSplitProbability1;
745  float *pcSplitProbability2;
746  int *pcLvl1a;
747 
749 
750  // Assign memory to the pointers which is 4K aligned
751  // 4K alignment is required to avoid extra memory copy from the host to the
752  // device
753  posix_memalign((void **)&scLocalPosition, 4096,
754  sizeof(float) * MAX_CLUSTER_NUM);
755  posix_memalign((void **)&scLocalCovariance, 4096,
756  sizeof(float) * MAX_CLUSTER_NUM);
757  posix_memalign((void **)&scIdHash, 4096,
758  sizeof(unsigned int) * MAX_CLUSTER_NUM);
759  posix_memalign((void **)&scId, 4096,
760  sizeof(long unsigned int) * MAX_CLUSTER_NUM);
761  posix_memalign((void **)&scGlobalPosition, 4096,
762  sizeof(float) * MAX_CLUSTER_NUM * 3);
763  posix_memalign((void **)&scRdoList, 4096,
764  sizeof(unsigned long long) * MAX_CLUSTER_NUM);
765  posix_memalign((void **)&scChannelsInPhi, 4096,
766  sizeof(int) * MAX_CLUSTER_NUM);
767 
768  posix_memalign((void **)&pcLocalPosition, 4096,
769  sizeof(float) * MAX_CLUSTER_NUM * 2);
770  posix_memalign((void **)&pcLocalCovariance, 4096,
771  sizeof(float) * MAX_CLUSTER_NUM * 2);
772  posix_memalign((void **)&pcIdHash, 4096,
773  sizeof(unsigned int) * MAX_CLUSTER_NUM);
774  posix_memalign((void **)&pcId, 4096,
775  sizeof(long unsigned int) * MAX_CLUSTER_NUM);
776  posix_memalign((void **)&pcGlobalPosition, 4096,
777  sizeof(float) * MAX_CLUSTER_NUM * 3);
778  posix_memalign((void **)&pcRdoList, 4096,
779  sizeof(unsigned long long) * MAX_CLUSTER_NUM);
780  posix_memalign((void **)&pcChannelsInPhi, 4096,
781  sizeof(int) * MAX_CLUSTER_NUM);
782  posix_memalign((void **)&pcChannelsInEta, 4096,
783  sizeof(int) * MAX_CLUSTER_NUM);
784  posix_memalign((void **)&pcWidthInEta, 4096, sizeof(float) * MAX_CLUSTER_NUM);
785  posix_memalign((void **)&pcOmegaX, 4096, sizeof(float) * MAX_CLUSTER_NUM);
786  posix_memalign((void **)&pcOmegaY, 4096, sizeof(float) * MAX_CLUSTER_NUM);
787  posix_memalign((void **)&pcTotList, 4096, sizeof(int) * MAX_CLUSTER_NUM);
788  posix_memalign((void **)&pcTotalToT, 4096, sizeof(int) * MAX_CLUSTER_NUM);
789  posix_memalign((void **)&pcChargeList, 4096, sizeof(float) * MAX_CLUSTER_NUM);
790  posix_memalign((void **)&pcTotalCharge, 4096,
791  sizeof(float) * MAX_CLUSTER_NUM);
792  posix_memalign((void **)&pcEnergyLoss, 4096, sizeof(float) * MAX_CLUSTER_NUM);
793  posix_memalign((void **)&pcIsSplit, 4096, sizeof(char) * MAX_CLUSTER_NUM);
794  posix_memalign((void **)&pcSplitProbability1, 4096,
795  sizeof(float) * MAX_CLUSTER_NUM);
796  posix_memalign((void **)&pcSplitProbability2, 4096,
797  sizeof(float) * MAX_CLUSTER_NUM);
798  posix_memalign((void **)&pcLvl1a, 4096, sizeof(int) * MAX_CLUSTER_NUM);
799 
800  posix_memalign((void **)&metadata, 4096,
802 
803  // opencl error code
804  cl_int err = 0;
805 
806  // Prepare buffers
807  ATH_MSG_DEBUG("Preparing buffers...");
808 
809  // Input buffers
810  cl::Buffer acc_stripClusters(
811  m_context, CL_MEM_READ_ONLY,
812  sizeof(EFTrackingDataFormats::StripCluster) * ef_sc.size(), NULL, &err);
813  cl::Buffer acc_pixelClusters(
814  m_context, CL_MEM_READ_ONLY,
815  sizeof(EFTrackingDataFormats::PixelCluster) * ef_pc.size(), NULL, &err);
816 
817  // Output StripCluster buffers
818  cl::Buffer acc_scLocalPosition(
819  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
820  sizeof(float) * MAX_CLUSTER_NUM, scLocalPosition, &err);
821  cl::Buffer acc_scLocalCovariance(
822  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
823  sizeof(float) * MAX_CLUSTER_NUM, scLocalCovariance, &err);
824  cl::Buffer acc_scIdHash(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
825  sizeof(unsigned int) * MAX_CLUSTER_NUM, scIdHash,
826  &err);
827  cl::Buffer acc_scId(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
828  sizeof(long unsigned int) * MAX_CLUSTER_NUM, scId, &err);
829  cl::Buffer acc_scGlobalPosition(
830  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
831  sizeof(float) * MAX_CLUSTER_NUM * 3, scGlobalPosition, &err);
832  cl::Buffer acc_scRdoList(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
833  sizeof(unsigned long long) * MAX_CLUSTER_NUM,
834  scRdoList, &err);
835  cl::Buffer acc_scChannelsInPhi(
836  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
837  sizeof(int) * MAX_CLUSTER_NUM, scChannelsInPhi, &err);
838 
839  // Output PixelCluster buffers
840  cl::Buffer acc_pcLocalPosition(
841  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
842  sizeof(float) * MAX_CLUSTER_NUM * 2, pcLocalPosition, &err);
843  cl::Buffer acc_pcLocalCovariance(
844  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
845  sizeof(float) * MAX_CLUSTER_NUM * 2, pcLocalCovariance, &err);
846  cl::Buffer acc_pcIdHash(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
847  sizeof(unsigned int) * MAX_CLUSTER_NUM, pcIdHash,
848  &err);
849  cl::Buffer acc_pcId(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
850  sizeof(long unsigned int) * MAX_CLUSTER_NUM, pcId, &err);
851  cl::Buffer acc_pcGlobalPosition(
852  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
853  sizeof(float) * MAX_CLUSTER_NUM * 3, pcGlobalPosition, &err);
854  cl::Buffer acc_pcRdoList(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
855  sizeof(unsigned long long) * MAX_CLUSTER_NUM,
856  pcRdoList, &err);
857  cl::Buffer acc_pcChannelsInPhi(
858  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
859  sizeof(int) * MAX_CLUSTER_NUM, pcChannelsInPhi, &err);
860  cl::Buffer acc_pcChannelsInEta(
861  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
862  sizeof(int) * MAX_CLUSTER_NUM, pcChannelsInEta, &err);
863  cl::Buffer acc_pcWidthInEta(
864  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
865  sizeof(float) * MAX_CLUSTER_NUM, pcWidthInEta, &err);
866  cl::Buffer acc_pcOmegaX(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
867  sizeof(float) * MAX_CLUSTER_NUM, pcOmegaX, &err);
868  cl::Buffer acc_pcOmegaY(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
869  sizeof(float) * MAX_CLUSTER_NUM, pcOmegaY, &err);
870  cl::Buffer acc_pcTotList(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
871  sizeof(int) * MAX_CLUSTER_NUM, pcTotList, &err);
872  cl::Buffer acc_pcTotalToT(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
873  sizeof(int) * MAX_CLUSTER_NUM, pcTotalToT, &err);
874  cl::Buffer acc_pcChargeList(
875  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
876  sizeof(float) * MAX_CLUSTER_NUM, pcChargeList, &err);
877  cl::Buffer acc_pcTotalCharge(
878  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
879  sizeof(float) * MAX_CLUSTER_NUM, pcTotalCharge, &err);
880  cl::Buffer acc_pcEnergyLoss(
881  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
882  sizeof(float) * MAX_CLUSTER_NUM, pcEnergyLoss, &err);
883  cl::Buffer acc_pcIsSplit(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
884  sizeof(char) * MAX_CLUSTER_NUM, pcIsSplit, &err);
885  cl::Buffer acc_pcSplitProbability1(
886  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
887  sizeof(float) * MAX_CLUSTER_NUM, pcSplitProbability1, &err);
888  cl::Buffer acc_pcSplitProbability2(
889  m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
890  sizeof(float) * MAX_CLUSTER_NUM, pcSplitProbability2, &err);
891  cl::Buffer acc_pcLvl1a(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
892  sizeof(int) * MAX_CLUSTER_NUM, pcLvl1a, &err);
893 
894  cl::Buffer acc_metadata(m_context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR,
896  &err);
897 
898  // Prepare kernel
899  ATH_MSG_DEBUG("Preparing kernel...");
900  cl::Kernel acc_kernel(m_program, m_kernelName.value().data(), &err);
901  // check error code
902  if (err != CL_SUCCESS) {
903  ATH_MSG_ERROR("Error making cl::Kernel. Error code: " << err);
904  return StatusCode::FAILURE;
905  }
906 
907  // Set kernel arguments
908  ATH_MSG_DEBUG("Setting kernel arguments...");
909  // This should be done before any enqueue command such that buffers
910  // are link to the proper DDR bank automatically
911  acc_kernel.setArg<cl::Buffer>(0, acc_stripClusters);
912  acc_kernel.setArg<int>(1, ef_sc.size());
913  acc_kernel.setArg<cl::Buffer>(2, acc_scLocalPosition);
914  acc_kernel.setArg<cl::Buffer>(3, acc_scLocalCovariance);
915  acc_kernel.setArg<cl::Buffer>(4, acc_scIdHash);
916  acc_kernel.setArg<cl::Buffer>(5, acc_scId);
917  acc_kernel.setArg<cl::Buffer>(6, acc_scGlobalPosition);
918  acc_kernel.setArg<cl::Buffer>(7, acc_scRdoList);
919  acc_kernel.setArg<cl::Buffer>(8, acc_scChannelsInPhi);
920  acc_kernel.setArg<cl::Buffer>(9, acc_pixelClusters);
921  acc_kernel.setArg<int>(10, ef_pc.size());
922  acc_kernel.setArg<cl::Buffer>(11, acc_pcLocalPosition);
923  acc_kernel.setArg<cl::Buffer>(12, acc_pcLocalCovariance);
924  acc_kernel.setArg<cl::Buffer>(13, acc_pcIdHash);
925  acc_kernel.setArg<cl::Buffer>(14, acc_pcId);
926  acc_kernel.setArg<cl::Buffer>(15, acc_pcGlobalPosition);
927  acc_kernel.setArg<cl::Buffer>(16, acc_pcRdoList);
928  acc_kernel.setArg<cl::Buffer>(17, acc_pcChannelsInPhi);
929  acc_kernel.setArg<cl::Buffer>(18, acc_pcChannelsInEta);
930  acc_kernel.setArg<cl::Buffer>(19, acc_pcWidthInEta);
931  acc_kernel.setArg<cl::Buffer>(20, acc_pcOmegaX);
932  acc_kernel.setArg<cl::Buffer>(21, acc_pcOmegaY);
933  acc_kernel.setArg<cl::Buffer>(22, acc_pcTotList);
934  acc_kernel.setArg<cl::Buffer>(23, acc_pcTotalToT);
935  acc_kernel.setArg<cl::Buffer>(24, acc_pcChargeList);
936  acc_kernel.setArg<cl::Buffer>(25, acc_pcTotalCharge);
937  acc_kernel.setArg<cl::Buffer>(26, acc_pcEnergyLoss);
938  acc_kernel.setArg<cl::Buffer>(27, acc_pcIsSplit);
939  acc_kernel.setArg<cl::Buffer>(28, acc_pcSplitProbability1);
940  acc_kernel.setArg<cl::Buffer>(29, acc_pcSplitProbability2);
941  acc_kernel.setArg<cl::Buffer>(30, acc_pcLvl1a);
942  acc_kernel.setArg<cl::Buffer>(31, acc_metadata);
943 
944  // Make OpenCL command queue for this event
945  cl::CommandQueue acc_queue(m_context, m_accelerator);
946 
947  ATH_MSG_DEBUG("Writing buffers...");
948  // Use CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED to avoid DMA access for output
949  // buffers
950  err = acc_queue.enqueueMigrateMemObjects(
951  {acc_stripClusters, acc_pixelClusters, acc_scLocalPosition,
952  acc_scLocalCovariance, acc_scIdHash, acc_scId, acc_scGlobalPosition,
953  acc_scRdoList, acc_scChannelsInPhi,
954  // pixel
955  acc_pcId, acc_pcIdHash, acc_pcLocalPosition, acc_pcLocalCovariance,
956  acc_pcGlobalPosition, acc_pcRdoList, acc_pcChannelsInPhi,
957  acc_pcChannelsInEta, acc_pcWidthInEta, acc_pcOmegaX, acc_pcOmegaY,
958  acc_pcTotList, acc_pcTotalToT, acc_pcChargeList, acc_pcTotalCharge,
959  acc_pcEnergyLoss, acc_pcIsSplit, acc_pcSplitProbability1,
960  acc_pcSplitProbability2, acc_pcLvl1a, acc_metadata},
961  CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED);
962 
963  acc_queue.enqueueTask(acc_kernel);
964 
965  // read back data
966  acc_queue.enqueueMigrateMemObjects(
967  {acc_scLocalPosition, acc_scLocalCovariance, acc_scIdHash, acc_scId,
968  acc_scGlobalPosition, acc_scRdoList, acc_scChannelsInPhi},
969  CL_MIGRATE_MEM_OBJECT_HOST);
970  acc_queue.finish();
971  // print scLocalPosition
972  for (int i = 0; i < 10; i++) {
973  ATH_MSG_DEBUG("scLocalPosition[" << i << "] = " << scLocalPosition[i]);
974  }
975 
976  // Free memory
977  free(scLocalPosition);
978  free(scLocalCovariance);
979  free(scIdHash);
980  free(scId);
981  free(scGlobalPosition);
982  free(scRdoList);
983  free(scChannelsInPhi);
984 
985  free(pcLocalPosition);
986  free(pcLocalCovariance);
987  free(pcIdHash);
988  free(pcId);
989  free(pcGlobalPosition);
990  free(pcRdoList);
991  free(pcChannelsInPhi);
992  free(pcChannelsInEta);
993  free(pcWidthInEta);
994  free(pcOmegaX);
995  free(pcOmegaY);
996  free(pcTotList);
997  free(pcTotalToT);
998  free(pcChargeList);
999  free(pcTotalCharge);
1000  free(pcEnergyLoss);
1001  free(pcIsSplit);
1002  free(pcSplitProbability1);
1003  free(pcSplitProbability2);
1004  free(pcLvl1a);
1005 
1006  free(metadata);
1007 
1008  return StatusCode::SUCCESS;
1009 }
1010 
1012  const std::vector<EFTrackingDataFormats::StripCluster> &inputSC,
1014  // PixelCluster
1015  const std::vector<EFTrackingDataFormats::PixelCluster> &inputPC,
1017  // StripSpacePoint
1018  const std::vector<EFTrackingDataFormats::SpacePoint> &inputSSP,
1020  // PixelSpacePoint
1021  const std::vector<EFTrackingDataFormats::SpacePoint> &inputPSP,
1023  // Metadata
1025  // return input
1026  int rdoIndex_counter = 0;
1027 
1028  unsigned int inputscRdoIndexSize = 0;
1029  unsigned int inputpcRdoIndexSize = 0;
1030 
1031  // transfer inputSC
1032  // trasnsfer_sc:
1033  for (size_t i = 0; i < inputSC.size(); i++) {
1034  ef_scOutput.scLocalPosition[i] = inputSC[i].localPosition;
1035  ef_scOutput.scLocalCovariance[i] = inputSC[i].localCovariance;
1036  ef_scOutput.scIdHash[i] = inputSC[i].idHash;
1037  ef_scOutput.scId[i] = inputSC[i].id;
1038  ef_scOutput.scGlobalPosition[i * 3] = inputSC[i].globalPosition[0];
1039  ef_scOutput.scGlobalPosition[i * 3 + 1] = inputSC[i].globalPosition[1];
1040  ef_scOutput.scGlobalPosition[i * 3 + 2] = inputSC[i].globalPosition[2];
1041 
1042  inputscRdoIndexSize += inputSC[i].sizeOfRDOList;
1043 
1044  for (int j = 0; j < inputSC[i].sizeOfRDOList; j++) {
1045  ef_scOutput.scRdoList[rdoIndex_counter + j] = inputSC[i].rdoList[j];
1046  }
1047  // update the index counter
1048  ef_scOutput.scChannelsInPhi[i] = inputSC[i].channelsInPhi;
1049  rdoIndex_counter += inputSC[i].sizeOfRDOList;
1050  metadata[0].scRdoIndex[i] = inputSC[i].sizeOfRDOList;
1051  }
1052 
1053  // transfer inputPC
1054  rdoIndex_counter = 0;
1055  int totIndex_counter = 0;
1056  int chargeIndex_counter = 0;
1057 
1058  unsigned int inputpcTotListsize = 0;
1059  unsigned int inputpcChargeListsize = 0;
1060 
1061  // trasnsfer_pc:
1062  for (size_t i = 0; i < inputPC.size(); i++) {
1063  ef_pcOutput.pcLocalPosition[i * 2] = inputPC[i].localPosition[0];
1064  ef_pcOutput.pcLocalPosition[i * 2 + 1] = inputPC[i].localPosition[1];
1065  ef_pcOutput.pcLocalCovariance[i * 2] = inputPC[i].localCovariance[0];
1066  ef_pcOutput.pcLocalCovariance[i * 2 + 1] = inputPC[i].localCovariance[1];
1067  ef_pcOutput.pcIdHash[i] = inputPC[i].idHash;
1068  ef_pcOutput.pcId[i] = inputPC[i].id;
1069  ef_pcOutput.pcGlobalPosition[i * 3] = inputPC[i].globalPosition[0];
1070  ef_pcOutput.pcGlobalPosition[i * 3 + 1] = inputPC[i].globalPosition[1];
1071  ef_pcOutput.pcGlobalPosition[i * 3 + 2] = inputPC[i].globalPosition[2];
1072 
1073  inputpcRdoIndexSize += inputPC[i].sizeOfRDOList;
1074 
1075  for (int j = 0; j < inputPC[i].sizeOfRDOList; j++) {
1076  ef_pcOutput.pcRdoList[rdoIndex_counter + j] = inputPC[i].rdoList[j];
1077  }
1078  ef_pcOutput.pcChannelsInPhi[i] = inputPC[i].channelsInPhi;
1079  ef_pcOutput.pcChannelsInEta[i] = inputPC[i].channelsInEta;
1080  ef_pcOutput.pcWidthInEta[i] = inputPC[i].widthInEta;
1081  ef_pcOutput.pcOmegaX[i] = inputPC[i].omegaX;
1082  ef_pcOutput.pcOmegaY[i] = inputPC[i].omegaY;
1083 
1084  inputpcTotListsize += inputPC[i].sizeOfTotList;
1085 
1086  for (int j = 0; j < inputPC[i].sizeOfTotList; j++) {
1087  ef_pcOutput.pcTotList[totIndex_counter + j] = inputPC[i].totList[j];
1088  }
1089  ef_pcOutput.pcTotalToT[i] = inputPC[i].totalToT;
1090 
1091  inputpcChargeListsize += inputPC[i].sizeOfChargeList;
1092 
1093  for (int j = 0; j < inputPC[i].sizeOfChargeList; j++) {
1094  ef_pcOutput.pcChargeList[chargeIndex_counter + j] =
1095  inputPC[i].chargeList[j];
1096  }
1097  ef_pcOutput.pcTotalCharge[i] = inputPC[i].totalCharge;
1098  ef_pcOutput.pcEnergyLoss[i] = inputPC[i].energyLoss;
1099  ef_pcOutput.pcIsSplit[i] = inputPC[i].isSplit;
1100  ef_pcOutput.pcSplitProbability1[i] = inputPC[i].splitProbability1;
1101  ef_pcOutput.pcSplitProbability2[i] = inputPC[i].splitProbability2;
1102  ef_pcOutput.pcLvl1a[i] = inputPC[i].lvl1a;
1103 
1104  // update the index counter
1105  rdoIndex_counter += inputPC[i].sizeOfRDOList;
1106  totIndex_counter += inputPC[i].sizeOfTotList;
1107  chargeIndex_counter += inputPC[i].sizeOfChargeList;
1108  metadata[0].pcRdoIndex[i] = inputPC[i].sizeOfRDOList;
1109  metadata[0].pcTotIndex[i] = inputPC[i].sizeOfTotList;
1110  metadata[0].pcChargeIndex[i] = inputPC[i].sizeOfChargeList;
1111  }
1112 
1113  // transfer strip space points
1114  for (size_t i = 0; i < inputSSP.size(); i++) {
1115  ef_sspOutput.spIdHash[i * 2] = inputSSP[i].idHash[0];
1116  ef_sspOutput.spIdHash[i * 2 + 1] = inputSSP[i].idHash[1];
1117  ef_sspOutput.spGlobalPosition[i * 3] = inputSSP[i].globalPosition[0];
1118  ef_sspOutput.spGlobalPosition[i * 3 + 1] = inputSSP[i].globalPosition[1];
1119  ef_sspOutput.spGlobalPosition[i * 3 + 2] = inputSSP[i].globalPosition[2];
1120  ef_sspOutput.spRadius[i] = inputSSP[i].radius;
1121  ef_sspOutput.spVarianceR[i] = inputSSP[i].cov_r;
1122  ef_sspOutput.spVarianceZ[i] = inputSSP[i].cov_z;
1123  ef_sspOutput.spTopHalfStripLength[i] = inputSSP[i].topHalfStripLength;
1124  ef_sspOutput.spBottomHalfStripLength[i] = inputSSP[i].bottomHalfStripLength;
1125  ef_sspOutput.spTopStripDirection[i * 3] = inputSSP[i].topStripDirection[0];
1126  ef_sspOutput.spTopStripDirection[i * 3 + 1] =
1127  inputSSP[i].topStripDirection[1];
1128  ef_sspOutput.spTopStripDirection[i * 3 + 2] =
1129  inputSSP[i].topStripDirection[2];
1130  ef_sspOutput.spBottomStripDirection[i * 3] =
1131  inputSSP[i].bottomStripDirection[0];
1132  ef_sspOutput.spBottomStripDirection[i * 3 + 1] =
1133  inputSSP[i].bottomStripDirection[1];
1134  ef_sspOutput.spBottomStripDirection[i * 3 + 2] =
1135  inputSSP[i].bottomStripDirection[2];
1136  ef_sspOutput.spStripCenterDistance[i * 3] =
1137  inputSSP[i].stripCenterDistance[0];
1138  ef_sspOutput.spStripCenterDistance[i * 3 + 1] =
1139  inputSSP[i].stripCenterDistance[1];
1140  ef_sspOutput.spStripCenterDistance[i * 3 + 2] =
1141  inputSSP[i].stripCenterDistance[2];
1142  ef_sspOutput.spTopStripCenter[i * 3] = inputSSP[i].topStripCenter[0];
1143  ef_sspOutput.spTopStripCenter[i * 3 + 1] = inputSSP[i].topStripCenter[1];
1144  ef_sspOutput.spTopStripCenter[i * 3 + 2] = inputSSP[i].topStripCenter[2];
1145  }
1146 
1147  // transfer pixel space points
1148  for (size_t i = 0; i < inputPSP.size(); i++) {
1149  ef_pspOutput.spIdHash[i] = inputPSP[i].idHash[0];
1150  ef_pspOutput.spGlobalPosition[i * 3] = inputPSP[i].globalPosition[0];
1151  ef_pspOutput.spGlobalPosition[i * 3 + 1] = inputPSP[i].globalPosition[1];
1152  ef_pspOutput.spGlobalPosition[i * 3 + 2] = inputPSP[i].globalPosition[2];
1153  ef_pspOutput.spRadius[i] = inputPSP[i].radius;
1154  ef_pspOutput.spVarianceR[i] = inputPSP[i].cov_r;
1155  ef_pspOutput.spVarianceZ[i] = inputPSP[i].cov_z;
1156  }
1157 
1158  // transfer metadata
1159  metadata[0].numOfStripClusters = inputSC.size();
1160  metadata[0].numOfPixelClusters = inputPC.size();
1161  metadata[0].numOfStripSpacePoints = inputSSP.size();
1162  metadata[0].numOfPixelSpacePoints = inputPSP.size();
1163  metadata[0].scRdoIndexSize = inputscRdoIndexSize;
1164  metadata[0].pcRdoIndexSize = inputpcRdoIndexSize;
1165  metadata[0].pcTotIndexSize = inputpcTotListsize;
1166  metadata[0].pcChargeIndexSize = inputpcChargeListsize;
1167 
1168  return StatusCode::SUCCESS;
1169 }
EFTrackingDataFormats::PixelClusterOutput::pcTotList
int * pcTotList
Definition: EFTrackingDataFormats.h:149
EFTrackingDataFormats::PixelClusterAuxInput::localCovariance
std::vector< float > localCovariance
Definition: EFTrackingDataFormats.h:204
EFTrackingDataFormats::SpacePointOutput::spRadius
float * spRadius
Definition: EFTrackingDataFormats.h:170
EFTrackingDataFormats::StripClusterOutput::scLocalCovariance
float * scLocalCovariance
Definition: EFTrackingDataFormats.h:124
EFTrackingDataFormats::StripClusterAuxInput
The StripClusterAuxInput struct is used to simplify the creaction of the xAOD::StripClusterContainer.
Definition: EFTrackingDataFormats.h:186
IntegrationBase::m_accelerator
cl::Device m_accelerator
Device object for the accelerator card.
Definition: IntegrationBase.h:66
EFTrackingDataFormats::StripClusterAuxInput::localPosition
std::vector< float > localPosition
Definition: EFTrackingDataFormats.h:187
IntegrationBase::initialize
virtual StatusCode initialize() override
Detect the OpenCL devices and prepare OpenCL context.
Definition: IntegrationBase.cxx:14
EFTrackingDataFormats::StripClusterAuxInput::globalPosition
std::vector< float > globalPosition
Definition: EFTrackingDataFormats.h:191
MAX_CLUSTER_NUM
#define MAX_CLUSTER_NUM
Definition: DataPreparationPipeline.cxx:19
EFTrackingDataFormats::PixelCluster::totalToT
int totalToT
Definition: EFTrackingDataFormats.h:61
EFTrackingDataFormats::PixelCluster::widthInEta
float widthInEta
Definition: EFTrackingDataFormats.h:57
EFTrackingDataFormats::StripCluster::id
long unsigned int id
Definition: EFTrackingDataFormats.h:35
EFTrackingDataFormats::PixelCluster::splitProbability1
float splitProbability1
Definition: EFTrackingDataFormats.h:66
EFTrackingDataFormats::SpacePointAuxInput::varianceR
std::vector< float > varianceR
Definition: EFTrackingDataFormats.h:233
EFTrackingDataFormats::PixelClusterOutput::pcChannelsInEta
int * pcChannelsInEta
Definition: EFTrackingDataFormats.h:145
EFTrackingDataFormats::PixelClusterOutput::pcLvl1a
int * pcLvl1a
Definition: EFTrackingDataFormats.h:157
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EFTrackingDataFormats::PixelClusterOutput::pcOmegaX
float * pcOmegaX
Definition: EFTrackingDataFormats.h:147
EFTrackingDataFormats::SpacePoint::topStripCenter
float topStripCenter[3]
Definition: EFTrackingDataFormats.h:94
EFTrackingDataFormats::SpacePointOutput::spVarianceZ
float * spVarianceZ
Definition: EFTrackingDataFormats.h:172
MAX_SPACEPOINT_NUM
#define MAX_SPACEPOINT_NUM
Definition: DataPreparationPipeline.cxx:23
EFTrackingDataFormats::PixelCluster::channelsInPhi
int channelsInPhi
Definition: EFTrackingDataFormats.h:55
EFTrackingDataFormats::SpacePoint::stripCenterDistance
float stripCenterDistance[3]
Definition: EFTrackingDataFormats.h:93
EFTrackingDataFormats::PixelCluster::lvl1a
int lvl1a
Definition: EFTrackingDataFormats.h:68
EFTrackingDataFormats::SpacePointAuxInput::varianceZ
std::vector< float > varianceZ
Definition: EFTrackingDataFormats.h:234
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
EFTrackingDataFormats::PixelClusterAuxInput
The PixelClusterAuxInput struct is used to simplify the creaction of the xAOD::PixelClusterContainer.
Definition: EFTrackingDataFormats.h:200
EFTrackingDataFormats::SpacePointAuxInput
The SpacePointAuxInput struct is used to simplify the creaction of the xAOD::SpacePointContainer.
Definition: EFTrackingDataFormats.h:229
EFTrackingDataFormats::PixelCluster::totalCharge
float totalCharge
Definition: EFTrackingDataFormats.h:63
EFTrackingDataFormats::PixelClusterAuxInput::energyLoss
std::vector< float > energyLoss
Definition: EFTrackingDataFormats.h:216
IntegrationBase::m_context
cl::Context m_context
Context object for the application.
Definition: IntegrationBase.h:67
DataPreparationPipeline::getInputSpacePointData
StatusCode getInputSpacePointData(const xAOD::SpacePointContainer *sp, std::vector< EFTrackingDataFormats::SpacePoint > &ef_sp, std::vector< std::vector< const xAOD::UncalibratedMeasurement * >> &sp_meas, long unsigned int N, bool isStrip) const
Convert the space point from xAOD container to simple std::vector of EFTrackingDataFormats::SpacePoin...
Definition: DataPreparationPipeline.cxx:281
EFTrackingDataFormats::PixelClusterOutput::pcTotalToT
int * pcTotalToT
Definition: EFTrackingDataFormats.h:150
EFTrackingDataFormats::PixelClusterOutput::pcChargeList
float * pcChargeList
Definition: EFTrackingDataFormats.h:151
DataPreparationPipeline::execute
StatusCode execute(const EventContext &ctx) const override final
Should be overriden by derived classes to perform meaningful work.
Definition: DataPreparationPipeline.cxx:50
EFTrackingDataFormats::PixelCluster::isSplit
char isSplit
Definition: EFTrackingDataFormats.h:65
EFTrackingDataFormats::PixelCluster::omegaX
float omegaX
Definition: EFTrackingDataFormats.h:58
EFTrackingDataFormats::SpacePointOutput::spBottomHalfStripLength
float * spBottomHalfStripLength
Definition: EFTrackingDataFormats.h:175
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
EFTrackingDataFormats::PixelClusterAuxInput::localPosition
std::vector< float > localPosition
Definition: EFTrackingDataFormats.h:203
EFTrackingDataFormats::PixelCluster::rdoList
unsigned long long rdoList[1000]
Definition: EFTrackingDataFormats.h:54
EFTrackingDataFormats::StripCluster
The StripClusters struct contains all xAOD::StripCluster data members.
Definition: EFTrackingDataFormats.h:31
EFTrackingDataFormats::StripCluster::localPosition
float localPosition
Definition: EFTrackingDataFormats.h:32
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
EFTrackingDataFormats::PixelClusterAuxInput::idHash
std::vector< unsigned int > idHash
Definition: EFTrackingDataFormats.h:202
EFTrackingDataFormats::PixelClusterAuxInput::totalCharge
std::vector< float > totalCharge
Definition: EFTrackingDataFormats.h:215
EFTrackingDataFormats::PixelCluster::splitProbability2
float splitProbability2
Definition: EFTrackingDataFormats.h:67
EFTrackingDataFormats::SpacePoint::cov_r
float cov_r
Definition: EFTrackingDataFormats.h:85
EFTrackingDataFormats::PixelCluster::localCovariance
float localCovariance[2]
Definition: EFTrackingDataFormats.h:52
EFTrackingDataFormats::SpacePoint::cov_z
float cov_z
Definition: EFTrackingDataFormats.h:86
EFTrackingDataFormats::PixelCluster::sizeOfChargeList
int sizeOfChargeList
Definition: EFTrackingDataFormats.h:71
EFTrackingDataFormats::StripCluster::rdoList
unsigned long long rdoList[1000]
Definition: EFTrackingDataFormats.h:37
EFTrackingDataFormats::PixelClusterAuxInput::splitProbability2
std::vector< float > splitProbability2
Definition: EFTrackingDataFormats.h:219
EFTrackingDataFormats::StripClusterAuxInput::localCovariance
std::vector< float > localCovariance
Definition: EFTrackingDataFormats.h:188
EFTrackingDataFormats::SpacePointAuxInput::topHalfStripLength
std::vector< float > topHalfStripLength
Definition: EFTrackingDataFormats.h:235
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EFTrackingDataFormats::StripCluster::idHash
unsigned int idHash
Definition: EFTrackingDataFormats.h:34
EFTrackingDataFormats::PixelClusterOutput::pcEnergyLoss
float * pcEnergyLoss
Definition: EFTrackingDataFormats.h:153
EFTrackingDataFormats::PixelClusterOutput::pcRdoList
unsigned long long * pcRdoList
Definition: EFTrackingDataFormats.h:143
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
EFTrackingDataFormats::PixelClusterAuxInput::channelsInPhi
std::vector< int > channelsInPhi
Definition: EFTrackingDataFormats.h:207
DataPreparationPipeline::m_stripClustersKey
SG::ReadHandleKey< xAOD::StripClusterContainer > m_stripClustersKey
Definition: DataPreparationPipeline.h:131
EFTrackingDataFormats::StripCluster::localCovariance
float localCovariance
Definition: EFTrackingDataFormats.h:33
EFTrackingDataFormats::PixelCluster::chargeList
float chargeList[1000]
Definition: EFTrackingDataFormats.h:62
EFTrackingDataFormats::PixelClusterAuxInput::isSplit
std::vector< char > isSplit
Definition: EFTrackingDataFormats.h:217
EFTrackingDataFormats::PixelCluster::idHash
unsigned int idHash
Definition: EFTrackingDataFormats.h:50
EFTrackingDataFormats::StripClusterAuxInput::id
std::vector< long unsigned int > id
Definition: EFTrackingDataFormats.h:190
EFTrackingDataFormats::PixelCluster::localPosition
float localPosition[2]
Definition: EFTrackingDataFormats.h:51
DataPreparationPipeline.h
Class for the data preparation pipeline.
EFTrackingDataFormats::PixelCluster::channelsInEta
int channelsInEta
Definition: EFTrackingDataFormats.h:56
EFTrackingDataFormats::Metadata
The structure of the Metadata containing data after clusterization.
Definition: EFTrackingDataFormats.h:102
EFTrackingDataFormats::PixelCluster::omegaY
float omegaY
Definition: EFTrackingDataFormats.h:59
EFTrackingDataFormats::PixelClusterAuxInput::globalPosition
std::vector< float > globalPosition
Definition: EFTrackingDataFormats.h:205
EFTrackingDataFormats::PixelClusterAuxInput::rdoList
std::vector< unsigned long long > rdoList
Definition: EFTrackingDataFormats.h:206
EFTrackingDataFormats::StripClusterOutput::scRdoList
unsigned long long * scRdoList
Definition: EFTrackingDataFormats.h:128
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EFTrackingDataFormats::SpacePointOutput::spTopStripDirection
float * spTopStripDirection
Definition: EFTrackingDataFormats.h:176
EFTrackingDataFormats::PixelClusterAuxInput::omegaY
std::vector< float > omegaY
Definition: EFTrackingDataFormats.h:211
EFTrackingDataFormats::PixelClusterAuxInput::omegaX
std::vector< float > omegaX
Definition: EFTrackingDataFormats.h:210
EFTrackingDataFormats::SpacePointAuxInput::stripCenterDistance
std::vector< float > stripCenterDistance
Definition: EFTrackingDataFormats.h:239
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
lumiFormat.i
int i
Definition: lumiFormat.py:85
DataPreparationPipeline::m_pixelSpacePointsKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_pixelSpacePointsKey
Definition: DataPreparationPipeline.h:140
EFTrackingDataFormats::SpacePointOutput::spTopStripCenter
float * spTopStripCenter
Definition: EFTrackingDataFormats.h:179
EFTrackingDataFormats::PixelClusterOutput::pcSplitProbability2
float * pcSplitProbability2
Definition: EFTrackingDataFormats.h:156
EFTrackingDataFormats::PixelCluster
The PixelClusters struct contains all xAOD::PixelCluster data members.
Definition: EFTrackingDataFormats.h:48
DataPreparationPipeline::m_pixelClustersKey
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_pixelClustersKey
Definition: DataPreparationPipeline.h:134
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
EFTrackingDataFormats::PixelClusterOutput
The PixelClusters struct contains the output arrays from the FPGA.
Definition: EFTrackingDataFormats.h:136
EFTrackingDataFormats::SpacePointOutput::spBottomStripDirection
float * spBottomStripDirection
Definition: EFTrackingDataFormats.h:177
EFTrackingDataFormats::SpacePoint::globalPosition
float globalPosition[3]
Definition: EFTrackingDataFormats.h:83
EFTrackingDataFormats::SpacePointOutput::spGlobalPosition
float * spGlobalPosition
Definition: EFTrackingDataFormats.h:169
EFTrackingDataFormats::PixelCluster::sizeOfTotList
int sizeOfTotList
Definition: EFTrackingDataFormats.h:70
EFTrackingDataFormats::StripClusterOutput::scGlobalPosition
float * scGlobalPosition
Definition: EFTrackingDataFormats.h:127
EFTrackingDataFormats::SpacePointOutput::spIdHash
unsigned int * spIdHash
Definition: EFTrackingDataFormats.h:168
EFTrackingDataFormats::SpacePointAuxInput::measurementIndexes
std::vector< int > measurementIndexes
Definition: EFTrackingDataFormats.h:241
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EFTrackingDataFormats::SpacePointAuxInput::bottomHalfStripLength
std::vector< float > bottomHalfStripLength
Definition: EFTrackingDataFormats.h:236
EFTrackingDataFormats::SpacePointAuxInput::globalPosition
std::vector< float > globalPosition
Definition: EFTrackingDataFormats.h:231
EFTrackingDataFormats::PixelCluster::globalPosition
float globalPosition[3]
Definition: EFTrackingDataFormats.h:53
EFTrackingDataFormats::StripClusterOutput
The StripClusters struct contains the output arrays from the FPGA.
Definition: EFTrackingDataFormats.h:121
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
DataPreparationPipeline::runHW
StatusCode runHW(const std::vector< EFTrackingDataFormats::StripCluster > &ef_sc, const std::vector< EFTrackingDataFormats::PixelCluster > &ef_pc, const std::vector< EFTrackingDataFormats::SpacePoint > &ef_ssp, const std::vector< std::vector< const xAOD::UncalibratedMeasurement * >> &ssp_mes, const std::vector< EFTrackingDataFormats::SpacePoint > &ef_psp, const std::vector< std::vector< const xAOD::UncalibratedMeasurement * >> &psp_mes) const
Run the hardware version of the transfer kernel.
Definition: DataPreparationPipeline.cxx:707
EFTrackingDataFormats::PixelClusterAuxInput::channelsInEta
std::vector< int > channelsInEta
Definition: EFTrackingDataFormats.h:208
DataPreparationPipeline::m_xclbin
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
Definition: DataPreparationPipeline.h:143
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
EFTrackingDataFormats::PixelClusterOutput::pcLocalPosition
float * pcLocalPosition
Definition: EFTrackingDataFormats.h:138
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
EFTrackingDataFormats::SpacePoint::bottomStripDirection
float bottomStripDirection[3]
Definition: EFTrackingDataFormats.h:92
IntegrationBase::loadProgram
StatusCode loadProgram(const std::string &xclbin)
Find the xclbin file and load it into the OpenCL program object.
Definition: IntegrationBase.cxx:82
EFTrackingDataFormats::PixelClusterOutput::pcId
long unsigned int * pcId
Definition: EFTrackingDataFormats.h:141
DataPreparationPipeline::m_stripSpacePointsKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_stripSpacePointsKey
Definition: DataPreparationPipeline.h:137
IntegrationBase::precheck
StatusCode precheck(std::vector< Gaudi::Property< std::string >> inputs) const
Check if the the desired Gaudi properties are set.
Definition: IntegrationBase.cxx:121
EFTrackingDataFormats::StripClusterAuxInput::rdoList
std::vector< unsigned long long > rdoList
Definition: EFTrackingDataFormats.h:192
EFTrackingDataFormats::SpacePoint::radius
float radius
Definition: EFTrackingDataFormats.h:84
EFTrackingDataFormats::PixelClusterAuxInput::totList
std::vector< int > totList
Definition: EFTrackingDataFormats.h:212
EFTrackingDataFormats::SpacePoint::bottomHalfStripLength
float bottomHalfStripLength
Definition: EFTrackingDataFormats.h:90
EFTrackingDataFormats::SpacePointOutput::spTopHalfStripLength
float * spTopHalfStripLength
Definition: EFTrackingDataFormats.h:174
dumpTgcDigiThreshold.isStrip
list isStrip
Definition: dumpTgcDigiThreshold.py:33
EFTrackingDataFormats::PixelClusterOutput::pcSplitProbability1
float * pcSplitProbability1
Definition: EFTrackingDataFormats.h:155
EFTrackingDataFormats::SpacePointAuxInput::topStripCenter
std::vector< float > topStripCenter
Definition: EFTrackingDataFormats.h:240
EFTrackingDataFormats::StripClusterOutput::scId
long unsigned int * scId
Definition: EFTrackingDataFormats.h:126
DataPreparationPipeline::initialize
StatusCode initialize() override final
Detect the OpenCL devices and prepare OpenCL context.
Definition: DataPreparationPipeline.cxx:27
EFTrackingDataFormats::PixelClusterAuxInput::id
std::vector< long unsigned int > id
Definition: EFTrackingDataFormats.h:201
EFTrackingDataFormats::SpacePointOutput::spMeasurementIndexes
int * spMeasurementIndexes
Definition: EFTrackingDataFormats.h:173
EFTrackingDataFormats::PixelClusterOutput::pcLocalCovariance
float * pcLocalCovariance
Definition: EFTrackingDataFormats.h:139
EFTrackingDataFormats::PixelCluster::sizeOfRDOList
int sizeOfRDOList
Definition: EFTrackingDataFormats.h:69
EFTrackingDataFormats::SpacePointOutput::spVarianceR
float * spVarianceR
Definition: EFTrackingDataFormats.h:171
EFTrackingDataFormats::PixelClusterOutput::pcWidthInEta
float * pcWidthInEta
Definition: EFTrackingDataFormats.h:146
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
StripClusterAuxContainer.h
EFTrackingDataFormats::PixelClusterAuxInput::lvl1a
std::vector< int > lvl1a
Definition: EFTrackingDataFormats.h:220
EFTrackingDataFormats::StripClusterOutput::scIdHash
unsigned int * scIdHash
Definition: EFTrackingDataFormats.h:125
DataPreparationPipeline::m_kernelName
Gaudi::Property< std::string > m_kernelName
Kernel name.
Definition: DataPreparationPipeline.h:146
EFTrackingDataFormats::PixelClusterOutput::pcOmegaY
float * pcOmegaY
Definition: EFTrackingDataFormats.h:148
DataPreparationPipeline::transferSW
StatusCode transferSW(const std::vector< EFTrackingDataFormats::StripCluster > &inputSC, EFTrackingDataFormats::StripClusterOutput &outputSC, const std::vector< EFTrackingDataFormats::PixelCluster > &inputPC, EFTrackingDataFormats::PixelClusterOutput &outputPC, const std::vector< EFTrackingDataFormats::SpacePoint > &inputSSP, EFTrackingDataFormats::SpacePointOutput &outputSSP, const std::vector< EFTrackingDataFormats::SpacePoint > &inputPSP, EFTrackingDataFormats::SpacePointOutput &outputPSP, EFTrackingDataFormats::Metadata *metadata) const
Software version of the transfer kernel.
Definition: DataPreparationPipeline.cxx:1011
EFTrackingDataFormats::SpacePointAuxInput::bottomStripDirection
std::vector< float > bottomStripDirection
Definition: EFTrackingDataFormats.h:238
DataPreparationPipeline::m_runSW
Gaudi::Property< bool > m_runSW
Software mode, not running on the FPGA.
Definition: DataPreparationPipeline.h:148
EFTrackingDataFormats::SpacePointAuxInput::radius
std::vector< float > radius
Definition: EFTrackingDataFormats.h:232
DataPreparationPipeline::runSW
StatusCode runSW(const std::vector< EFTrackingDataFormats::StripCluster > &ef_sc, const std::vector< EFTrackingDataFormats::PixelCluster > &ef_pc, const std::vector< EFTrackingDataFormats::SpacePoint > &ef_ssp, const std::vector< std::vector< const xAOD::UncalibratedMeasurement * >> &ssp_mes, const std::vector< EFTrackingDataFormats::SpacePoint > &ef_psp, const std::vector< std::vector< const xAOD::UncalibratedMeasurement * >> &psp_mes, const EventContext &ctx) const
Run the software version of the transfer kernel.
Definition: DataPreparationPipeline.cxx:342
EFTrackingDataFormats::PixelClusterOutput::pcTotalCharge
float * pcTotalCharge
Definition: EFTrackingDataFormats.h:152
EFTrackingDataFormats::StripCluster::channelsInPhi
int channelsInPhi
Definition: EFTrackingDataFormats.h:38
EFTrackingDataFormats::PixelClusterOutput::pcIdHash
unsigned int * pcIdHash
Definition: EFTrackingDataFormats.h:140
EFTrackingDataFormats::SpacePointOutput::spStripCenterDistance
float * spStripCenterDistance
Definition: EFTrackingDataFormats.h:178
EFTrackingDataFormats::StripClusterAuxInput::channelsInPhi
std::vector< int > channelsInPhi
Definition: EFTrackingDataFormats.h:193
DEBUG
#define DEBUG
Definition: page_access.h:11
EFTrackingDataFormats::SpacePointAuxInput::elementIdList
std::vector< unsigned int > elementIdList
Definition: EFTrackingDataFormats.h:230
EFTrackingDataFormats::PixelClusterAuxInput::splitProbability1
std::vector< float > splitProbability1
Definition: EFTrackingDataFormats.h:218
EFTrackingDataFormats::PixelClusterOutput::pcChannelsInPhi
int * pcChannelsInPhi
Definition: EFTrackingDataFormats.h:144
EFTrackingDataFormats::SpacePoint::idHash
unsigned int idHash[2]
Definition: EFTrackingDataFormats.h:82
EFTrackingDataFormats::PixelCluster::energyLoss
float energyLoss
Definition: EFTrackingDataFormats.h:64
DataPreparationPipeline::getInputClusterData
StatusCode getInputClusterData(const xAOD::StripClusterContainer *sc, std::vector< EFTrackingDataFormats::StripCluster > &ef_sc, long unsigned int N) const
Convert the strip cluster from xAOD container to simple std::vector of EFTrackingDataFormats::StripCl...
Definition: DataPreparationPipeline.cxx:182
EFTrackingDataFormats::PixelClusterAuxInput::chargeList
std::vector< float > chargeList
Definition: EFTrackingDataFormats.h:214
EFTrackingDataFormats::SpacePoint::topStripDirection
float topStripDirection[3]
Definition: EFTrackingDataFormats.h:91
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
EFTrackingDataFormats::PixelClusterAuxInput::widthInEta
std::vector< float > widthInEta
Definition: EFTrackingDataFormats.h:209
EFTrackingDataFormats::StripCluster::sizeOfRDOList
int sizeOfRDOList
Definition: EFTrackingDataFormats.h:39
EFTrackingDataFormats::PixelClusterOutput::pcGlobalPosition
float * pcGlobalPosition
Definition: EFTrackingDataFormats.h:142
calibdata.copy
bool copy
Definition: calibdata.py:27
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
EFTrackingDataFormats::SpacePoint
The SpacePoint struct contains all xAOD::SpacePoint data members.
Definition: EFTrackingDataFormats.h:80
EFTrackingDataFormats::StripCluster::globalPosition
float globalPosition[3]
Definition: EFTrackingDataFormats.h:36
EFTrackingDataFormats::PixelCluster::totList
int totList[1000]
Definition: EFTrackingDataFormats.h:60
IntegrationBase::m_program
cl::Program m_program
Program object containing the kernel.
Definition: IntegrationBase.h:68
EFTrackingDataFormats::PixelClusterAuxInput::totalToT
std::vector< int > totalToT
Definition: EFTrackingDataFormats.h:213
SGdebug::aux_var_name
std::string aux_var_name(SG::auxid_t id)
Return the name corresponding to a given aux id.
Definition: Control/AthContainers/Root/debug.cxx:34
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
EFTrackingDataFormats::PixelClusterOutput::pcIsSplit
char * pcIsSplit
Definition: EFTrackingDataFormats.h:154
EFTrackingDataFormats::StripClusterOutput::scChannelsInPhi
int * scChannelsInPhi
Definition: EFTrackingDataFormats.h:129
EFTrackingDataFormats::PixelCluster::id
long unsigned int id
Definition: EFTrackingDataFormats.h:49
python.SystemOfUnits.pc
float pc
Definition: SystemOfUnits.py:99
EFTrackingDataFormats::SpacePointOutput
The Pixel/Strip SpacePoints struct contains the output arrays from the FPGA.
Definition: EFTrackingDataFormats.h:166
DataPreparationPipeline::m_xAODContainerMaker
ToolHandle< xAODContainerMaker > m_xAODContainerMaker
Tool handle for xAODContainerMaker.
Definition: DataPreparationPipeline.h:153
EFTrackingDataFormats::StripClusterAuxInput::idHash
std::vector< unsigned int > idHash
Definition: EFTrackingDataFormats.h:189
debug.h
Helper functions intended to be called from the debugger.
EFTrackingDataFormats::StripClusterOutput::scLocalPosition
float * scLocalPosition
Definition: EFTrackingDataFormats.h:123
EFTrackingDataFormats::SpacePoint::topHalfStripLength
float topHalfStripLength
Definition: EFTrackingDataFormats.h:89
EFTrackingDataFormats::SpacePointAuxInput::topStripDirection
std::vector< float > topStripDirection
Definition: EFTrackingDataFormats.h:237