39 std::vector<StripSP>& spacePoints,
40 std::vector<StripSP>& overlapSpacePoints,
42 const std::vector<IdentifierHash>& hashesToProcess,
87 const auto hashesProc = (hashesToProcess.size() > 0 ? hashesToProcess : stripAccessor.
allIdentifiers());
95 for (
auto& idHash : hashesProc) {
99 const std::vector<IdentifierHash>* others(properties.neighbours(idHash));
100 if (others==
nullptr || others->empty() )
107 size_t neighbour = 0;
108 while (not
search and neighbour<others->size() ) {
116 std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,
nNeighbours> neighbourClusters{};
117 std::array<const InDetDD::SiDetectorElement*, nNeighbours> neighbourElements{};
119 auto groupStart = clusterContainer.
begin();
121 neighbourElements[0] = thisElement;
123 for (
auto start=this_range.first; start!=this_range.second; start++) {
124 size_t position = std::distance(groupStart, start);
125 neighbourClusters[0].push_back(std::make_pair(*start, position));
132 std::array<double, 14> overlapExtents{};
142 if(not processOverlaps) Nmax = 2;
144 double hwidth(
static_cast<double>(properties.halfWidth(idHash)));
154 for (
const auto& otherHash : *others) {
163 neighbourElements[neigbourIndices[n]] = otherElement;
165 for (
auto start=this_range.first; start!=this_range.second; start++) {
166 size_t position = std::distance(groupStart, start);
167 neighbourClusters[neigbourIndices[n]].push_back(std::make_pair(*start, position));
173 overlapExtents[ 0] = -overlapLimitOpposite;
174 overlapExtents[ 1] = overlapLimitOpposite;
178 overlapExtents[ 6] =-hwidth;
179 overlapExtents[ 7] =-hwidth+overlapLimitPhi;
180 overlapExtents[ 8] = hwidth-overlapLimitPhi;
181 overlapExtents[ 9] = hwidth;
185 overlapExtents[10] = hwidth-overlapLimitPhi;
186 overlapExtents[11] = hwidth;
187 overlapExtents[12] =-hwidth;
188 overlapExtents[13] =-hwidth+overlapLimitPhi;
192 overlapExtents[ 2] = overlapLimitEtaMin;
193 overlapExtents[ 3] = overlapLimitEtaMax;
195 overlapExtents[ 2] =-overlapLimitEtaMax;
196 overlapExtents[ 3] =-overlapLimitEtaMin;
201 overlapExtents[ 4] = overlapLimitEtaMin;
202 overlapExtents[ 5] = overlapLimitEtaMax;
204 overlapExtents[ 4] = -overlapLimitEtaMax;
205 overlapExtents[ 5] = -overlapLimitEtaMin;
214 spacePoints, overlapSpacePoints) );
217 return StatusCode::SUCCESS;
222 const std::array<const InDetDD::SiDetectorElement*, nNeighbours>& elements,
223 const std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,
nNeighbours>& clusters,
224 const std::array<double, 14>& overlapExtents,
226 std::vector<StripSP>& spacePoints,
227 std::vector<StripSP>& overlapSpacePoints )
const
251 constexpr int otherSideIndex{1};
252 constexpr int maxEtaIndex{3};
260 elementIndex[nElements++] = n;
264 if(!nElements)
return StatusCode::SUCCESS;
268 bool isEndcap = element->
isEndcap();
270 std::vector<StripInformationHelper> stripInfos;
271 stripInfos.reserve(clusters[0].size());
274 for (
auto& cluster_index : clusters[0]) {
275 size_t stripIndex = -1;
276 auto ends =
getStripEnds(cluster_index.first, element, stripIndex);
277 const auto& localPos = cluster_index.first->localPosition<1>();
278 StripInformationHelper stripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, localPos(0, 0), cluster_index.second, stripIndex);
279 stripInfos.push_back( std::move(stripInfo) );
288 for(; n < nElements; ++n) {
289 int currentIndex = elementIndex[n];
290 if(currentIndex > maxEtaIndex)
break;
296 double min = overlapExtents[currentIndex*2-2];
297 double max = overlapExtents[currentIndex*2-1];
299 size_t minStrip, maxStrip = 0;
307 for (
auto& cluster_index : clusters[currentIndex]) {
308 bool processed =
false;
309 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
311 for(
auto& stripInfo : stripInfos) {
312 double diff = currentLocalPos(0, 0)-stripInfo.locX();
321 size_t currentStripIndex = 0;
322 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
323 currentStripInfo.
set(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
327 if (currentIndex==otherSideIndex) {
337 for(; n < nElements; ++n) {
338 int currentIndex = elementIndex[n];
341 double min = overlapExtents[4*currentIndex-10];
342 double max = overlapExtents[4*currentIndex- 9];
344 std::size_t minStrip = 0;
345 std::size_t maxStrip = 0;
352 std::vector<StripInformationHelper*> stripPhiInfos;
353 stripPhiInfos.reserve(stripInfos.size());
355 for(
auto& stripInfo : stripInfos) {
356 auto stripIndex = stripInfo.stripIndex();
357 auto localPosition = stripInfo.locX();
358 auto centralValue = localPosition;
362 centralValue = stripIndex;
368 stripPhiInfos.push_back(&stripInfo);
372 if(stripPhiInfos.empty())
continue;
374 min = overlapExtents[4*currentIndex-8];
375 max = overlapExtents[4*currentIndex-7];
382 for (
auto& cluster_index : clusters[currentIndex]) {
383 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
385 size_t currentStripIndex = 0;
386 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
387 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
388 auto centralValue = currentLocalPos(0, 0);
392 centralValue = currentStripIndex;
397 if (centralValue < minValue or centralValue >
maxValue)
400 for(
auto& stripInfo : stripPhiInfos) {
405 return StatusCode::SUCCESS;
408 for(
int n=0; n!=nElements; ++n) {
410 int currentIndex = elementIndex[n];
414 offset(element, currentElement, slimit);
417 for (
auto& cluster_index : clusters[currentIndex]) {
418 size_t currentStripIndex = 0;
419 auto ends =
getStripEnds(cluster_index.first, element, currentStripIndex);
420 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
421 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
423 for(
auto& stripInfo : stripInfos) {
425 if (currentIndex==otherSideIndex) {
433 return StatusCode::SUCCESS;
437 std::vector<StripSP>& collection,
448 if(std::abs(
a) > (std::abs(b)*l0)) {
451 return StatusCode::SUCCESS;
459 if(std::abs(c) > (std::abs(d)*l1)) {
462 return StatusCode::SUCCESS;
470 if (m > limit || n > limit) {
473 double dmn = (n-1.)*cs;
474 if(dmn > dm) dm = dmn;
476 if(std::abs(m) > limit || std::abs(n) > limit) {
479 return StatusCode::SUCCESS;
482 }
else if (m < -limit || n < -limit) {
485 double dmn = -(1.+n)*cs;
486 if(dmn > dm) dm = dmn;
488 if(std::abs(m) > limit || std::abs(n) > limit) {
491 return StatusCode::SUCCESS;
501 constexpr float deltaY = 0.0004;
502 constexpr float covTerm = 1600.*deltaY;
504 Eigen::Matrix<float, 2, 1> variance(0.1f, 8.f*covTerm);
507 std::swap( variance(0, 0), variance(1, 0) );
510 double topHalfStripLength = 0.5*firstInfo.
stripDirection().norm();
511 Eigen::Matrix<double, 3, 1> topStripDirection = -firstInfo.
stripDirection()/(2.*topHalfStripLength);
512 Eigen::Matrix<double, 3, 1> topStripCenter = 0.5*firstInfo.
trajDirection();
514 double bottomHalfStripLength = 0.5*secondInfo.
stripDirection().norm();
515 Eigen::Matrix<double, 3, 1> bottomStripDirection = -secondInfo.
stripDirection()/(2.*bottomHalfStripLength);
522 toAdd.idHashes = {firstInfo.
idHash(), secondInfo.
idHash()};
523 toAdd.globPos = globalPosition.cast<
float>();
524 toAdd.cov_r = variance(0,0);
525 toAdd.cov_z = variance(1,0);
527 toAdd.topHalfStripLength =
static_cast<float>(topHalfStripLength);
528 toAdd.bottomHalfStripLength =
static_cast<float>(bottomHalfStripLength);
529 toAdd.topStripDirection = topStripDirection.cast<
float>();
530 toAdd.bottomStripDirection = bottomStripDirection.cast<
float>();
531 toAdd.stripCenterDistance = stripCenterDistance.cast<
float>();
532 toAdd.topStripCenter = topStripCenter.cast<
float>();
534 collection.push_back(std::move(toAdd));
536 return StatusCode::SUCCESS;