9 #define MAX_CLUSTER_NUM \
10 500000 // A large enough number for the current development, should be
13 #define MAX_SPACEPOINT_NUM \
14 500000 // A large enough number for the current development, should be
23 return StatusCode::SUCCESS;
29 const EventContext &ctx)
const
38 if (!inputStripClusters.
isValid())
41 return StatusCode::FAILURE;
45 if (!inputPixelClusters.
isValid())
48 return StatusCode::FAILURE;
61 std::vector<EFTrackingDataFormats::StripCluster> ef_stripClusters;
62 std::vector<EFTrackingDataFormats::PixelCluster> ef_pixelClusters;
70 for (
int i = 0;
i < 3;
i++)
73 <<
i <<
"]: " << ef_stripClusters.at(
i).localPosition
74 <<
", " << ef_stripClusters.at(
i).localCovariance <<
", "
75 << ef_stripClusters.at(
i).idHash <<
", "
76 << ef_stripClusters.at(
i).id <<
", "
77 << ef_stripClusters.at(
i).globalPosition[0] <<
", "
78 << ef_stripClusters.at(
i).globalPosition[1] <<
", "
79 << ef_stripClusters.at(
i).globalPosition[2] <<
", "
80 << ef_stripClusters.at(
i).rdoList[0] <<
", "
81 << ef_stripClusters.at(
i).channelsInPhi);
84 for (
int i = 0;
i < 3;
i++)
87 <<
i <<
"]: " << ef_pixelClusters.at(
i).id <<
", "
88 << ef_pixelClusters.at(
i).idHash <<
", "
89 << ef_pixelClusters.at(
i).localPosition[0] <<
", "
90 << ef_pixelClusters.at(
i).localPosition[1] <<
", "
91 << ef_pixelClusters.at(
i).localCovariance[0] <<
", "
92 << ef_pixelClusters.at(
i).localCovariance[1] <<
", "
93 << ef_pixelClusters.at(
i).globalPosition[0] <<
", "
94 << ef_pixelClusters.at(
i).globalPosition[1] <<
", "
95 << ef_pixelClusters.at(
i).globalPosition[2] <<
", "
96 << ef_pixelClusters.at(
i).rdoList[0] <<
", "
97 << ef_pixelClusters.at(
i).channelsInPhi <<
", "
98 << ef_pixelClusters.at(
i).channelsInEta <<
", "
99 << ef_pixelClusters.at(
i).widthInEta <<
", "
100 << ef_pixelClusters.at(
i).omegaX <<
", "
101 << ef_pixelClusters.at(
i).omegaY <<
", "
102 << ef_pixelClusters.at(
i).totList[0] <<
", "
103 << ef_pixelClusters.at(
i).totalToT <<
", "
104 << ef_pixelClusters.at(
i).chargeList[0] <<
", "
105 << ef_pixelClusters.at(
i).totalCharge <<
", "
106 << ef_pixelClusters.at(
i).energyLoss <<
", "
107 << ef_pixelClusters.at(
i).isSplit <<
", "
108 << ef_pixelClusters.at(
i).splitProbability1 <<
", "
109 << ef_pixelClusters.at(
i).splitProbability2 <<
", "
110 << ef_pixelClusters.at(
i).lvl1a);
117 ATH_MSG_INFO(
"Running the sw ver of the pass-through kernel");
119 std::vector<float> scLocalPosition((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)));
120 std::vector<float> scLocalCovariance((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)));
121 std::vector<unsigned int> scIdHash((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)));
122 std::vector<long unsigned int> scId((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)));
123 std::vector<float> scGlobalPosition((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)) * 3);
124 std::vector<unsigned long long> scRdoList((
static_cast<unsigned long>(
MAX_CLUSTER_NUM)) * 5000);
125 std::vector<int> scChannelsInPhi(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
131 ef_scOutput.
scIdHash = scIdHash.data();
132 ef_scOutput.
scId = scId.data();
134 ef_scOutput.
scRdoList = scRdoList.data();
138 std::vector<float> pcLocalPosition(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 2);
139 std::vector<float> pcLocalCovariance(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 2);
140 std::vector<unsigned int> pcIdHash(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
141 std::vector<long unsigned int> pcId(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
142 std::vector<float> pcGlobalPosition(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 3);
143 std::vector<unsigned long long> pcRdoList(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 5000);
144 std::vector<int> pcChannelsInPhi(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
145 std::vector<int> pcChannelsInEta(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
146 std::vector<float> pcWidthInEta(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
147 std::vector<float> pcOmegaX(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
148 std::vector<float> pcOmegaY(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
149 std::vector<int> pcTotList(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 5000);
150 std::vector<int> pcTotalToT(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
151 std::vector<float> pcChargeList(
static_cast<unsigned long>(
MAX_CLUSTER_NUM) * 5000);
152 std::vector<float> pcTotalCharge(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
153 std::vector<float> pcEnergyLoss(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
154 std::vector<char> pcIsSplit(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
155 std::vector<float> pcSplitProbability1(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
156 std::vector<float> pcSplitProbability2(
static_cast<unsigned long>(
MAX_CLUSTER_NUM));
163 ef_pcOutput.
pcIdHash = pcIdHash.data();
164 ef_pcOutput.
pcId = pcId.data();
166 ef_pcOutput.
pcRdoList = pcRdoList.data();
170 ef_pcOutput.
pcOmegaX = pcOmegaX.data();
171 ef_pcOutput.
pcOmegaY = pcOmegaY.data();
172 ef_pcOutput.
pcTotList = pcTotList.data();
177 ef_pcOutput.
pcIsSplit = pcIsSplit.data();
180 ef_pcOutput.
pcLvl1a = pcLvl1a.data();
188 ATH_MSG_ERROR(
"Full pass-through kernel is not implemented yet");
189 return StatusCode::FAILURE;
193 scLocalPosition.resize(
metadata->numOfStripClusters);
194 scLocalCovariance.resize(
metadata->numOfStripClusters);
195 scIdHash.resize(
metadata->numOfStripClusters);
196 scId.resize(
metadata->numOfStripClusters);
197 scGlobalPosition.resize(
metadata->numOfStripClusters * 3);
198 scRdoList.resize(
metadata->scRdoIndexSize);
199 scChannelsInPhi.resize(
metadata->numOfStripClusters);
201 pcLocalPosition.resize(
metadata->numOfPixelClusters * 2);
202 pcLocalCovariance.resize(
metadata->numOfPixelClusters * 2);
203 pcIdHash.resize(
metadata->numOfPixelClusters);
204 pcId.resize(
metadata->numOfPixelClusters);
205 pcGlobalPosition.resize(
metadata->numOfPixelClusters * 3);
206 pcRdoList.resize(
metadata->pcRdoIndexSize);
207 pcChannelsInPhi.resize(
metadata->numOfPixelClusters);
208 pcChannelsInEta.resize(
metadata->numOfPixelClusters);
209 pcWidthInEta.resize(
metadata->numOfPixelClusters);
210 pcOmegaX.resize(
metadata->numOfPixelClusters);
211 pcOmegaY.resize(
metadata->numOfPixelClusters);
212 pcTotList.resize(
metadata->pcTotIndexSize);
213 pcTotalToT.resize(
metadata->numOfPixelClusters);
214 pcChargeList.resize(
metadata->pcChargeIndexSize);
215 pcTotalCharge.resize(
metadata->numOfPixelClusters);
216 pcEnergyLoss.resize(
metadata->numOfPixelClusters);
217 pcIsSplit.resize(
metadata->numOfPixelClusters);
218 pcSplitProbability1.resize(
metadata->numOfPixelClusters);
219 pcSplitProbability2.resize(
metadata->numOfPixelClusters);
220 pcLvl1a.resize(
metadata->numOfPixelClusters);
225 for (
unsigned i = 0;
i < 3;
i++)
242 for (
unsigned i = 0;
i < 3;
i++)
312 pxAux.
lvl1a = pcLvl1a;
317 return StatusCode::SUCCESS;
320 return StatusCode::SUCCESS;
325 std::vector<EFTrackingDataFormats::StripCluster> &ef_sc,
326 unsigned long N)
const
331 <<
N <<
"th strip cluster, but there are only " <<
sc->size()
332 <<
" strip clusters in the container.");
333 return StatusCode::FAILURE;
336 for (
unsigned long i = 0;
i <
N;
i++)
343 cache.
idHash =
sc->at(
i)->identifierHash();
344 cache.
id =
sc->at(
i)->identifier();
349 for (
unsigned long j = 0; j <
sc->at(
i)->rdoList().size(); j++)
351 cache.
rdoList[j] =
sc->at(
i)->rdoList().at(j).get_compact();
357 ef_sc.push_back(cache);
360 ATH_MSG_DEBUG(
"Made " << ef_sc.size() <<
" strip clusters in the vector");
361 return StatusCode::SUCCESS;
366 std::vector<EFTrackingDataFormats::PixelCluster> &ef_pc,
367 unsigned long N)
const
372 <<
N <<
"th pixel cluster, but there are only " <<
pc->size()
373 <<
" pixel clusters in the container.");
374 return StatusCode::FAILURE;
377 for (
unsigned long i = 0;
i <
N;
i++)
382 cache.
id =
pc->at(
i)->identifier();
383 cache.
idHash =
pc->at(
i)->identifierHash();
392 for (
long unsigned int j = 0; j <
pc->at(
i)->rdoList().size(); j++)
394 cache.
rdoList[j] =
pc->at(
i)->rdoList().at(j).get_compact();
403 for (
long unsigned int j = 0; j <
pc->at(
i)->totList().size(); j++)
405 cache.
totList[j] =
pc->at(
i)->totList().at(j);
410 for (
long unsigned int j = 0; j <
pc->at(
i)->chargeList().size(); j++)
425 ef_pc.push_back(cache);
428 ATH_MSG_DEBUG(
"Made " << ef_pc.size() <<
" pixel clusters in the vector");
429 return StatusCode::SUCCESS;
434 std::vector<EFTrackingDataFormats::SpacePoint> &ef_sp,
435 std::vector<std::vector<const xAOD::UncalibratedMeasurement *>> &sp_meas,
436 unsigned long N,
bool isStrip)
const
441 <<
N <<
"th space point, but there are only " << sp->
size()
442 <<
" SpacePoint in the container.");
443 return StatusCode::FAILURE;
446 for (
unsigned long i = 0;
i <
N;
i++)
451 cache.
idHash[0] = sp->
at(
i)->elementIdList()[0];
456 cache.
cov_r = sp->
at(
i)->varianceR();
457 cache.
cov_z = sp->
at(
i)->varianceZ();
461 std::vector<const xAOD::UncalibratedMeasurement *> temp_vec(
462 sp->
at(
i)->measurements().size());
464 sp->
at(
i)->measurements().end(), temp_vec.begin());
466 sp_meas.push_back(temp_vec);
470 cache.
idHash[1] = sp->
at(
i)->elementIdList()[1];
474 sp->
at(
i)->topStripDirection().data() +
475 sp->
at(
i)->topStripDirection().size(),
478 sp->
at(
i)->bottomStripDirection().data() +
479 sp->
at(
i)->bottomStripDirection().size(),
482 sp->
at(
i)->stripCenterDistance().data() +
483 sp->
at(
i)->stripCenterDistance().size(),
486 sp->
at(
i)->topStripCenter().data() +
487 sp->
at(
i)->topStripCenter().size(),
490 ef_sp.push_back(cache);
493 ATH_MSG_DEBUG(
"Made " << ef_sp.size() <<
" space points in the vector");
494 return StatusCode::SUCCESS;
500 const std::vector<EFTrackingDataFormats::StripCluster> &inputSC,
503 const std::vector<EFTrackingDataFormats::PixelCluster> &inputPC,
506 const std::vector<EFTrackingDataFormats::SpacePoint> &inputSSP,
509 const std::vector<EFTrackingDataFormats::SpacePoint> &inputPSP,
515 int rdoIndex_counter = 0;
517 unsigned int inputscRdoIndexSize = 0;
518 unsigned int inputpcRdoIndexSize = 0;
522 for (
size_t i = 0;
i < inputSC.size();
i++)
527 ef_scOutput.
scId[
i] = inputSC[
i].id;
532 inputscRdoIndexSize += inputSC[
i].sizeOfRDOList;
534 for (
int j = 0; j < inputSC[
i].sizeOfRDOList; j++)
536 ef_scOutput.
scRdoList[rdoIndex_counter + j] = inputSC[
i].rdoList[j];
540 rdoIndex_counter += inputSC[
i].sizeOfRDOList;
541 metadata[0].scRdoIndex[
i] = inputSC[
i].sizeOfRDOList;
545 rdoIndex_counter = 0;
546 int totIndex_counter = 0;
547 int chargeIndex_counter = 0;
549 unsigned int inputpcTotListsize = 0;
550 unsigned int inputpcChargeListsize = 0;
553 for (
size_t i = 0;
i < inputPC.size();
i++)
560 ef_pcOutput.
pcId[
i] = inputPC[
i].id;
565 inputpcRdoIndexSize += inputPC[
i].sizeOfRDOList;
567 for (
int j = 0; j < inputPC[
i].sizeOfRDOList; j++)
569 ef_pcOutput.
pcRdoList[rdoIndex_counter + j] = inputPC[
i].rdoList[j];
577 inputpcTotListsize += inputPC[
i].sizeOfTotList;
579 for (
int j = 0; j < inputPC[
i].sizeOfTotList; j++)
581 ef_pcOutput.
pcTotList[totIndex_counter + j] = inputPC[
i].totList[j];
585 inputpcChargeListsize += inputPC[
i].sizeOfChargeList;
587 for (
int j = 0; j < inputPC[
i].sizeOfChargeList; j++)
590 inputPC[
i].chargeList[j];
597 ef_pcOutput.
pcLvl1a[
i] = inputPC[
i].lvl1a;
600 rdoIndex_counter += inputPC[
i].sizeOfRDOList;
601 totIndex_counter += inputPC[
i].sizeOfTotList;
602 chargeIndex_counter += inputPC[
i].sizeOfChargeList;
603 metadata[0].pcRdoIndex[
i] = inputPC[
i].sizeOfRDOList;
604 metadata[0].pcTotIndex[
i] = inputPC[
i].sizeOfTotList;
605 metadata[0].pcChargeIndex[
i] = inputPC[
i].sizeOfChargeList;
609 for (
size_t i = 0;
i < inputSSP.size();
i++)
611 ef_sspOutput.
spIdHash[
i * 2] = inputSSP[
i].idHash[0];
612 ef_sspOutput.
spIdHash[
i * 2 + 1] = inputSSP[
i].idHash[1];
616 ef_sspOutput.
spRadius[
i] = inputSSP[
i].radius;
623 inputSSP[
i].topStripDirection[1];
625 inputSSP[
i].topStripDirection[2];
627 inputSSP[
i].bottomStripDirection[0];
629 inputSSP[
i].bottomStripDirection[1];
631 inputSSP[
i].bottomStripDirection[2];
633 inputSSP[
i].stripCenterDistance[0];
635 inputSSP[
i].stripCenterDistance[1];
637 inputSSP[
i].stripCenterDistance[2];
644 for (
size_t i = 0;
i < inputPSP.size();
i++)
646 ef_pspOutput.
spIdHash[
i] = inputPSP[
i].idHash[0];
650 ef_pspOutput.
spRadius[
i] = inputPSP[
i].radius;
656 metadata[0].numOfStripClusters = inputSC.size();
657 metadata[0].numOfPixelClusters = inputPC.size();
658 metadata[0].numOfStripSpacePoints = inputSSP.size();
659 metadata[0].numOfPixelSpacePoints = inputPSP.size();
660 metadata[0].scRdoIndexSize = inputscRdoIndexSize;
661 metadata[0].pcRdoIndexSize = inputpcRdoIndexSize;
662 metadata[0].pcTotIndexSize = inputpcTotListsize;
663 metadata[0].pcChargeIndexSize = inputpcChargeListsize;
665 return StatusCode::SUCCESS;
670 const std::vector<EFTrackingDataFormats::StripCluster> &inputSC,
673 const std::vector<EFTrackingDataFormats::PixelCluster> &inputPC,
679 int rdoIndex_counter = 0;
681 unsigned int inputscRdoIndexSize = 0;
685 for (
size_t i = 0;
i < inputSC.size();
i++)
690 ef_scOutput.
scId[
i] = inputSC[
i].id;
695 inputscRdoIndexSize += inputSC[
i].sizeOfRDOList;
697 for (
int j = 0; j < inputSC[
i].sizeOfRDOList; j++)
699 ef_scOutput.
scRdoList[rdoIndex_counter + j] = inputSC[
i].rdoList[j];
703 rdoIndex_counter += inputSC[
i].sizeOfRDOList;
704 metadata[0].scRdoIndex[
i] = inputSC[
i].sizeOfRDOList;
708 rdoIndex_counter = 0;
709 int totIndex_counter = 0;
710 int chargeIndex_counter = 0;
712 unsigned int inputpcRdoIndexSize = 0;
713 unsigned int inputpcTotListsize = 0;
714 unsigned int inputpcChargeListsize = 0;
718 for (
size_t i = 0;
i < inputPC.size();
i++)
725 ef_pcOutput.
pcId[
i] = inputPC[
i].id;
730 inputpcRdoIndexSize += inputPC[
i].sizeOfRDOList;
732 for (
int j = 0; j < inputPC[
i].sizeOfRDOList; j++)
734 ef_pcOutput.
pcRdoList[rdoIndex_counter + j] = inputPC[
i].rdoList[j];
742 inputpcTotListsize += inputPC[
i].sizeOfTotList;
744 for (
int j = 0; j < inputPC[
i].sizeOfTotList; j++)
746 ef_pcOutput.
pcTotList[totIndex_counter + j] = inputPC[
i].totList[j];
750 inputpcChargeListsize += inputPC[
i].sizeOfChargeList;
752 for (
int j = 0; j < inputPC[
i].sizeOfChargeList; j++)
755 inputPC[
i].chargeList[j];
762 ef_pcOutput.
pcLvl1a[
i] = inputPC[
i].lvl1a;
765 rdoIndex_counter += inputPC[
i].sizeOfRDOList;
766 totIndex_counter += inputPC[
i].sizeOfTotList;
767 chargeIndex_counter += inputPC[
i].sizeOfChargeList;
768 metadata[0].pcRdoIndex[
i] = inputPC[
i].sizeOfRDOList;
769 metadata[0].pcTotIndex[
i] = inputPC[
i].sizeOfTotList;
770 metadata[0].pcChargeIndex[
i] = inputPC[
i].sizeOfChargeList;
773 metadata[0].numOfStripClusters = inputSC.size();
774 metadata[0].numOfPixelClusters = inputPC.size();
775 metadata[0].scRdoIndexSize = inputscRdoIndexSize;
776 metadata[0].pcRdoIndexSize = inputpcRdoIndexSize;
777 metadata[0].pcTotIndexSize = inputpcTotListsize;
778 metadata[0].pcChargeIndexSize = inputpcChargeListsize;
779 return StatusCode::SUCCESS;