17 const std::string&
name,
28 return StatusCode::SUCCESS;
36 std::vector<StripSP>& spacePoints,
37 std::vector<StripSP>& overlapSpacePoints,
39 const std::vector<IdentifierHash>& hashesToProcess,
84 const auto hashesProc = (hashesToProcess.size() > 0 ? hashesToProcess : stripAccessor.
allIdentifiers());
85 for (
auto& idHash : hashesProc) {
89 const std::vector<IdentifierHash>* others(
properties.neighbours(idHash));
90 if (others==
nullptr || others->empty() )
98 while (not
search and neighbour<others->
size() ) {
106 std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,
nNeighbours> neighbourClusters{};
107 std::array<const InDetDD::SiDetectorElement*, nNeighbours> neighbourElements{};
109 auto groupStart = clusterContainer.
begin();
111 neighbourElements[0] = thisElement;
115 neighbourClusters[0].push_back(std::make_pair(*
start, position));
122 std::array<double, 14> overlapExtents{};
132 if(not processOverlaps) Nmax = 2;
144 for (
const auto& otherHash : *others) {
153 neighbourElements[neigbourIndices[
n]] = otherElement;
157 neighbourClusters[neigbourIndices[
n]].push_back(std::make_pair(*
start, position));
168 overlapExtents[ 6] =-hwidth;
171 overlapExtents[ 9] = hwidth;
176 overlapExtents[11] = hwidth;
177 overlapExtents[12] =-hwidth;
206 spacePoints, overlapSpacePoints) );
209 return StatusCode::SUCCESS;
214 const std::array<const InDetDD::SiDetectorElement*, nNeighbours>& elements,
216 const std::array<double, 14>& overlapExtents,
218 std::vector<StripSP>& spacePoints,
219 std::vector<StripSP>& overlapSpacePoints )
const
243 constexpr
int otherSideIndex{1};
244 constexpr
int maxEtaIndex{3};
252 elementIndex[nElements++] =
n;
256 if(!nElements)
return StatusCode::SUCCESS;
260 bool isEndcap = element->
isEndcap();
262 std::vector<StripInformationHelper> stripInfos;
266 for (
auto& cluster_index :
clusters[0]) {
267 size_t stripIndex = -1;
268 auto ends =
getStripEnds(cluster_index.first, element, stripIndex);
269 const auto& localPos = cluster_index.first->localPosition<1>();
270 StripInformationHelper stripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, localPos(0, 0), cluster_index.second, stripIndex);
271 stripInfos.push_back( std::move(stripInfo) );
280 for(;
n < nElements; ++
n) {
281 int currentIndex = elementIndex[
n];
282 if(currentIndex > maxEtaIndex)
break;
288 double min = overlapExtents[currentIndex*2-2];
289 double max = overlapExtents[currentIndex*2-1];
299 for (
auto& cluster_index :
clusters[currentIndex]) {
300 bool processed =
false;
301 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
303 for(
auto& stripInfo : stripInfos) {
304 double diff = currentLocalPos(0, 0)-stripInfo.locX();
306 if(diff < min || diff >
max)
continue;
310 size_t currentStripIndex = 0;
311 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
312 currentStripInfo.
set(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
316 if (currentIndex==otherSideIndex) {
326 for(;
n < nElements; ++
n) {
327 int currentIndex = elementIndex[
n];
330 double min = overlapExtents[4*currentIndex-10];
331 double max = overlapExtents[4*currentIndex- 9];
341 std::vector<StripInformationHelper*> stripPhiInfos;
342 stripPhiInfos.reserve(stripInfos.size());
344 for(
auto& stripInfo : stripInfos) {
345 auto stripIndex = stripInfo.stripIndex();
346 auto localPosition = stripInfo.locX();
347 auto centralValue = localPosition;
351 centralValue = stripIndex;
357 stripPhiInfos.push_back(&stripInfo);
361 if(stripPhiInfos.empty())
continue;
363 min = overlapExtents[4*currentIndex-8];
364 max = overlapExtents[4*currentIndex-7];
371 for (
auto& cluster_index :
clusters[currentIndex]) {
372 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
374 size_t currentStripIndex = 0;
375 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
376 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
377 auto centralValue = currentLocalPos(0, 0);
381 centralValue = currentStripIndex;
386 if (centralValue < minValue or centralValue >
maxValue)
389 for(
auto& stripInfo : stripPhiInfos) {
394 return StatusCode::SUCCESS;
397 for(
int n=0;
n!=nElements; ++
n) {
399 int currentIndex = elementIndex[
n];
403 offset(element, currentElement, slimit);
406 for (
auto& cluster_index :
clusters[currentIndex]) {
407 size_t currentStripIndex = 0;
408 auto ends =
getStripEnds(cluster_index.first, element, currentStripIndex);
409 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
410 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
412 for(
auto& stripInfo : stripInfos) {
414 if (currentIndex==otherSideIndex) {
422 return StatusCode::SUCCESS;
426 std::vector<StripSP>& collection,
437 if(std::abs(
a) > (std::abs(
b)*
l0)) {
438 return StatusCode::SUCCESS;
445 if(std::abs(
c) > (std::abs(
d)*
l1)) {
446 return StatusCode::SUCCESS;
456 double dmn = (
n-1.)*cs;
457 if(dmn >
dm)
dm = dmn;
460 return StatusCode::SUCCESS;
465 double dmn = -(1.+
n)*cs;
466 if(dmn >
dm)
dm = dmn;
469 return StatusCode::SUCCESS;
479 float covTerm = 1600.*
deltaY;
481 Eigen::Matrix<float, 2, 1> variance(0.1, 8.*covTerm);
484 std::swap( variance(0, 0), variance(1, 0) );
488 Eigen::Matrix<double, 3, 1> topStripDirection = -firstInfo.
stripDirection()/(2.*topHalfStripLength);
489 Eigen::Matrix<double, 3, 1> topStripCenter = 0.5*firstInfo.
trajDirection();
491 float bottomHalfStripLength = 0.5*secondInfo.
stripDirection().norm();
492 Eigen::Matrix<double, 3, 1> bottomStripDirection = -secondInfo.
stripDirection()/(2.*bottomHalfStripLength);
501 toAdd.globPos = globalPosition.cast<
float>();
502 toAdd.cov_r = variance(0,0);
503 toAdd.cov_z = variance(1,0);
504 toAdd.measurementIndexes = measIndexes;
505 toAdd.topHalfStripLength = topHalfStripLength;
506 toAdd.bottomHalfStripLength = bottomHalfStripLength;
507 toAdd.topStripDirection = topStripDirection.cast<
float>();
508 toAdd.bottomStripDirection = bottomStripDirection.cast<
float>();
509 toAdd.stripCenterDistance = stripCenterDistance.cast<
float>();
510 toAdd.topStripCenter = topStripCenter.cast<
float>();
512 collection.push_back(
toAdd);
514 return StatusCode::SUCCESS;
519 double& stripLengthGapTolerance)
const
526 double x12 = T1(0,0)*T2(0,0)+T1(1,0)*T2(1,0)+T1(2,0)*T2(2,0);
527 double r = isAnnulus ? std::sqrt(C[0]*C[0]+C[1]*C[1]) : std::sqrt(T1(0,3)*T1(0,3)+T1(1,3)*T1(1,3));
528 double s = (T1(0,3)-T2(0,3))*T1(0,2)+(T1(1,3)-T2(1,3))*T1(1,2)+(T1(2,3)-T2(2,3))*T1(2,2);
531 double d = isAnnulus ?
dm/.04 :
dm/std::sqrt((1.-x12)*(1.+x12));
533 if (std::abs(T1(2,2)) > 0.7)
d*=(
r/std::abs(T1(2,3)));
535 stripLengthGapTolerance =
d;
542 double& stripLengthGapTolerance,
543 double&
min,
double&
max)
const
545 double dm =
offset(element1, element2, stripLengthGapTolerance);
562 if ( design==
nullptr ) {
571 double radius = firstPosition.xEta();
592 std::pair<Amg::Vector3D, Amg::Vector3D >
595 size_t& stripIndex)
const
597 const Eigen::Matrix<float,1,1>& localPos = cluster->
localPosition<1>();
603 if ( design==
nullptr ) {
605 return std::pair<Amg::Vector3D, Amg::Vector3D >();
610 stripIndex = -std::floor(localPos(0, 0) / phiPitchPhi) + design->
diodesInRow(0) *0.5 - 0.5;
612 std::pair<Amg::Vector3D, Amg::Vector3D > ends = {
621 std::pair<Amg::Vector3D, Amg::Vector3D > ends(element->
endsOfStrip(localPosition));