38 return StatusCode::SUCCESS;
49 pixelColl.reserve(
hits.size());
50 SCTColl.reserve(
hits.size());
53 std::vector<Identifier> rdoList;
56 std::unique_ptr<InDet::PixelCluster> pixelCl{};
57 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
61 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
65 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
69 ATH_MSG_DEBUG(
"pixelColl size: " << pixelColl.size() <<
" SCTColl size: " << SCTColl.size() );
71 return StatusCode::SUCCESS;
82 if (!FPGAClustersHandle.
isValid()) {
83 ATH_MSG_FATAL(
"Failed to retrieve FPGATrackSimClusterCollection");
84 return StatusCode::FAILURE;
107 std::vector<Identifier> rdoList;
110 std::unique_ptr<InDet::PixelCluster> pixelCl{};
111 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
115 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
119 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
124 ATH_MSG_DEBUG(
"pixelColl size: " << pixelColl.size() <<
" SCTColl size: " << SCTColl.size());
126 return StatusCode::SUCCESS;
140 std::vector<Identifier> rdoList;
152 if(!xaod_scl->
rdoList().size())
157 ATH_MSG_DEBUG(
"xAOD pixelCont size: " << pixelCont.
size() <<
" xAOD pixelCont size: " << SCTCont.
size());
159 return StatusCode::SUCCESS;
174 std::vector<Identifier> rdoList;
177 std::unique_ptr<InDet::PixelCluster> pixelCl{};
178 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
182 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
186 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
190 ATH_MSG_DEBUG(
"pixelColl size: " << pixelColl.size() <<
" SCTColl size: " << SCTColl.size());
192 return StatusCode::SUCCESS;
207 std::vector<Identifier> rdoList;
222 ATH_MSG_DEBUG(
"xAOD pixelCont size: " << pixelCont.
size() <<
" xAOD SCTCont size: " << SCTCont.
size());
224 return StatusCode::SUCCESS;
238 SPStripCont.
reserve(fpgaSPs.size());
247 return StatusCode::SUCCESS;
251 ATH_MSG_DEBUG(
"\tCreate InDet::PixelCluster from FPGATrackSimHit");
255 float etaWidth =
h.getEtaWidth();
258 int etaIndex =
h.getEtaIndex();
264 return StatusCode::FAILURE;
271 if(!
cell.isValid()) {
273 return StatusCode::FAILURE;
279 int colMin =
static_cast<int>(etaIndex-0.5*etaWidth);
280 int colMax = colMin+etaWidth;
298 localPos = localPosShift;
302 ATH_MSG_DEBUG(
"\t\tLocal position: x=" << localPos.x() <<
" y=" << localPos.y() );
303 ATH_MSG_DEBUG(
"\t\tGlobal position: x=" << globalPos.x() <<
" y=" << globalPos.y() <<
" z=" << globalPos.z() );
310 cov(1,1) = siWidth.
z()*siWidth.
z()/12;
314 cov(1,1) = siWidth.
z()*siWidth.
z()/(12*siWidth.
colRow().y()*siWidth.
colRow().y());
317 float dummy_omegax = 0.5;
318 float dummy_omegay = 0.5;
320 float splitProb1 = 0;
321 float splitProb2 = 0;
323 cl = std::make_unique<InDet::PixelCluster>(hit_id, localPos, std::vector<Identifier>(rdoList), siWidth, pDE,
Amg::MatrixX(
cov), dummy_omegax, dummy_omegay,
split, splitProb1, splitProb2);
325 return StatusCode::SUCCESS;
329 ATH_MSG_DEBUG(
"\tCreate xAOD::PixelCluster from FPGATrackSimHit");
337 return StatusCode::FAILURE;
344 if(!
cell.isValid()) {
346 return StatusCode::FAILURE;
351 int rowmin =
h.getMinPhiIndex();
352 int rowmax =
h.getMaxPhiIndex();
353 int colmin =
h.getMinEtaIndex();
354 int colmax =
h.getMaxEtaIndex();
360 ATH_MSG_ERROR(
"Pixel cluster indices appear uninitialized: colmin=" << colmin <<
", colmax=" << colmax
361 <<
", rowmin=" << rowmin <<
", rowmax=" << rowmax);
362 return StatusCode::FAILURE;
365 if (colmin < 0 || colmax < 0 || rowmin < 0 || rowmax < 0) {
366 ATH_MSG_ERROR(
"Pixel cluster indices out of range: colmin=" << colmin <<
", colmax=" << colmax
367 <<
", rowmin=" << rowmin <<
", rowmax=" << rowmax);
368 return StatusCode::FAILURE;
371 if (colmax < colmin || rowmax < rowmin) {
372 ATH_MSG_ERROR(
"Pixel cluster index max < min: colmin=" << colmin <<
", colmax=" << colmax
373 <<
", rowmin=" << rowmin <<
", rowmax=" << rowmax);
374 return StatusCode::FAILURE;
389 localPos(0,0) =
h.getPhiCoord();
390 localPos(1,0) =
h.getEtaCoord();
396 localPos = localPosShift;
399 ATH_MSG_DEBUG(
"\t\tLocal position: x=" << localPos.x() <<
" y=" << localPos.y() );
406 cov(1,1) = siWidth.
z()*siWidth.
z()/12;
410 cov(1,1) = siWidth.
z()*siWidth.
z()/(12*siWidth.
colRow().y()*siWidth.
colRow().y());
414 float splitProb1 = 0;
415 float splitProb2 = 0;
417 Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y());
418 Eigen::Matrix<float,2,2> localCovariance;
419 localCovariance.setZero();
420 localCovariance(0, 0) =
cov(0, 0);
421 localCovariance(1, 1) =
cov(1, 1);
423 Eigen::Matrix<float,3,1> globalPosition(
h.getX(),
h.getY(),
h.getZ());
424 ATH_MSG_DEBUG(
"\t\tGlobal position: x=" << globalPosition.x() <<
" y=" << globalPosition.y() <<
" z=" << globalPosition.z() );
426 cl.setMeasurement<2>(
hash, localPosition, localCovariance);
427 cl.setIdentifier( rdoList.front().get_compact() );
428 cl.setRDOlist(rdoList);
429 cl.globalPosition() = globalPosition;
431 cl.setWidthInEta(
static_cast<float>(siWidth.
widthPhiRZ()[1]));
433 cl.setSplitProbabilities(splitProb1, splitProb2);
436 return StatusCode::SUCCESS;
440 ATH_MSG_DEBUG(
"\t Create InDet::SCTCluster from FPGATrackSimHit ");
446 int strip =
static_cast<int>(
h.getPhiIndex());
479 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->
endsOfStrip(centre) );
480 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
487 ATH_MSG_DEBUG(
"\t\tlocal position before shift: " << localPos.x() <<
" phi: " << localPos.y());
491 localPos = localPosShift;
495 ATH_MSG_DEBUG(
"\t\tLocal position: x=" << localPos.x() <<
" y=" << localPos.y() );
496 ATH_MSG_DEBUG(
"\t\tGlobal position: x=" << globalPos.x() <<
" y=" << globalPos.y() <<
" z=" << globalPos.z() );
499 const double col_x = siWidth.
colRow().x();
500 const double col_y = siWidth.
colRow().y();
502 double scale_factor = 1.;
510 cov.fillSymmetric(0, 0, scale_factor * scale_factor * siWidth.
phiR() * siWidth.
phiR() * (1./12.));
511 cov.fillSymmetric(1, 1, siWidth.
z() * siWidth.
z() / col_y / col_y * (1./12.));
520 double v1 = (
cov)(1,1);
521 cov.fillSymmetric( 0, 0, cs2 *
v0 + sn2 * v1 );
522 cov.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (
v0 - v1) );
523 cov.fillSymmetric( 1, 1, sn2 *
v0 + cs2 * v1 );
526 cl = std::make_unique<InDet::SCT_Cluster>(strip_id, localPos, std::vector<Identifier>(rdoList), siWidth, pDE,
Amg::MatrixX(
cov));
528 return StatusCode::SUCCESS;
532 ATH_MSG_DEBUG(
"\t Create xAOD::StripCluster from FPGATrackSimHit ");
538 int strip =
static_cast<int>(
h.getPhiIndex());
566 ATH_MSG_WARNING(
"Cell ID out of range. Skip making this Strip cluster");
567 return StatusCode::SUCCESS;
574 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->
endsOfStrip(centre) );
575 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
581 localPos(0,0) =
h.getPhiCoord();
585 ATH_MSG_DEBUG(
"\t\tlocal position before shift: " << localPos.x() <<
" phi: " << localPos.y());
590 localPos = localPosShift;
593 ATH_MSG_DEBUG(
"\t\tLocal position: x=" << localPos.x() <<
" y=" << localPos.y() );
596 Eigen::Matrix<float,1,1> localPosition;
597 Eigen::Matrix<float,1,1> localCovariance;
598 localCovariance.setZero();
601 localPosition(0, 0) = localPos.x();
609 std::ostringstream
msg;
610 msg <<
"Original cellId: " << cellId <<
" (strip=" << cellId.
strip() <<
")\n";
611 msg <<
"Cell ID invalid or out of range. Resetting to the closest cell of the active area.\n";
616 msg <<
"Active area boundaries [eta,phi]: min [" << localPosMin.x() <<
", " << localPosMin.y() <<
"] , " <<
617 "max [" << localPosMax.x() <<
", " << localPosMax.y() <<
"]\n";
618 msg <<
"Compared to localPos of invalid cell: [" << localPos.x() <<
", " << localPos.y() <<
"]\n";
626 msg <<
" \\___ resetting to minCell [" << localPosMin.x() <<
", " << localPosMin.y() <<
"]";
629 msg <<
" \\___ resetting to maxCell [" << localPosMax.x() <<
", " << localPosMax.y() <<
"]";
635 localPosition(0, 0) = localInPolar.
xPhi();
639 Eigen::Matrix<float,3,1> globalPosition(
h.getX(),
h.getY(),
h.getZ());
640 ATH_MSG_DEBUG(
"\t\tGlobal position: x=" << globalPosition.x() <<
" y=" << globalPosition.y() <<
" z=" << globalPosition.z() );
642 cl.setMeasurement<1>(
hash, localPosition, localCovariance);
643 cl.setIdentifier( rdoList.front().get_compact() );
644 cl.setRDOlist(rdoList);
645 cl.globalPosition() = globalPosition;
646 cl.setChannelsInPhi(siWidth.
colRow()[0]);
648 return StatusCode::SUCCESS;
652 ATH_MSG_DEBUG(
"\t Create InDet::PixelCluster from FPGATrackSimCluster");
654 std::vector<Identifier> rdoList;
657 return StatusCode::SUCCESS;
661 ATH_MSG_DEBUG(
"\t Create xAOD::PixelCluster from FPGATrackSimCluster");
663 std::vector<Identifier> rdoList;
666 return StatusCode::SUCCESS;
670 ATH_MSG_DEBUG(
"\t Create InDet::SCT_Cluster from FPGATrackSimCluster");
672 std::vector<Identifier> rdoList;
675 return StatusCode::SUCCESS;
679 ATH_MSG_DEBUG(
"\t Create xAOD::StripCluster from FPGATrackSimCluster");
681 std::vector<Identifier> rdoList;
684 return StatusCode::SUCCESS;
695 Eigen::Matrix<float, 3, 1> globalPos(p_cl->globalPosition().x(), p_cl->globalPosition().y(), p_cl->globalPosition().z());
699 const float & cov_r = p_cl->localCovariance<2>()(0,0);
700 const float & cov_z = p_cl->localCovariance<2>()(1,0);
702 pixelSPs.
back()->setSpacePoint(
703 p_cl->identifierHash(),
707 std::vector< const xAOD::UncalibratedMeasurement* >({ p_cl })
711 return StatusCode::SUCCESS;
727 Eigen::Matrix<float,3,1> globalPos(clEq.
getX(),clEq.
getY(),clEq.
getZ());
733 float covTerm = 1600.*
deltaY;
734 Eigen::Matrix<float, 2, 1> variance(0.1, 8.*covTerm);
738 std::swap( variance(0, 0), variance(1, 0) );
739 float cov_r = variance(0,0);
740 float cov_z = variance(1,0);
745 std::vector<unsigned int> idHashList;
746 std::vector<const xAOD::UncalibratedMeasurement_v1*> measurements;
750 float topHalfStripLength, bottomHalfStripLength;
757 idHashList.push_back(
h.getIdentifierHash());
758 for (
auto orig_cl : clustersCont) {
759 if (
h.getIdentifierHash()==orig_cl->identifierHash()) {
762 measurements.push_back(orig_cl);
770 Amg::Vector3D stripCenterDistance = stripCenter1 - stripCenter2;
772 ATH_MSG_DEBUG(
"topHalfStripLength = " << topHalfStripLength <<
" bottomHalfStripLength = " << bottomHalfStripLength);
773 ATH_MSG_DEBUG(
"topStripDirection = (" << topStripDirection.x() <<
", " << topStripDirection.y() <<
", " << topStripDirection.z() <<
") " <<
"bottomStripDirection = (" << bottomStripDirection.x() <<
", " << bottomStripDirection.y() <<
", " << bottomStripDirection.z() <<
") " );
774 ATH_MSG_DEBUG(
"stripCenterDistance = (" << stripCenterDistance.x() <<
", " << stripCenterDistance.y() <<
", " << stripCenterDistance.z() <<
")" );
775 ATH_MSG_DEBUG(
"topStripCenter = (" << topStripCenter.x() <<
", " << topStripCenter.y() <<
", " << topStripCenter.z() <<
")" );
779 std::move(idHashList),
783 std::move(measurements),
785 bottomHalfStripLength,
786 topStripDirection.cast<
float>(),
787 bottomStripDirection.cast<
float>(),
788 stripCenterDistance.cast<
float>(),
789 topStripCenter.cast<
float>()
792 return StatusCode::SUCCESS;
802 int etaIndex =
h.getEtaIndex();
807 rdoList.push_back(hit_id);
812 rdoList.push_back(hit_id);
816 return StatusCode::SUCCESS;
825 int etaIndex =
h.getEtaIndex();
830 rdoList.push_back(hit_id);
835 rdoList.push_back(hit_id);
838 return StatusCode::SUCCESS;
853 std::pair<Amg::Vector3D, Amg::Vector3D>
end = (sDE->
endsOfStrip(localPos));
854 stripCenter = 0.5 * (
end.first +
end.second);
857 halfStripLength = 0.5 * stripDir.norm();
858 stripDirection = stripDir / (2. * (halfStripLength));
860 return StatusCode::SUCCESS;