33 std::vector<StripSP>& spacePoints,
34 std::vector<StripSP>& overlapSpacePoints,
36 const std::vector<IdentifierHash>& hashesToProcess,
45 const auto hashesProc = (hashesToProcess.size() > 0 ? hashesToProcess : stripAccessor.
allIdentifiers());
53 for (
auto& idHash : hashesProc) {
57 const std::vector<IdentifierHash>* others(properties.neighbours(idHash));
58 if (others==
nullptr || others->empty() )
66 while (not
search and neighbour<others->
size() ) {
74 std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,
nNeighbours> neighbourClusters{};
75 std::array<const InDetDD::SiDetectorElement*, nNeighbours> neighbourElements{};
77 auto groupStart = clusterContainer.
begin();
79 neighbourElements[0] = thisElement;
81 for (
auto start=this_range.first; start!=this_range.second; start++) {
82 size_t position = std::distance(groupStart, start);
83 neighbourClusters[0].push_back(std::make_pair(*start, position));
90 std::array<double, 14> overlapExtents{};
100 if(not processOverlaps) Nmax = 2;
102 double hwidth(
static_cast<double>(properties.halfWidth(idHash)));
112 for (
const auto& otherHash : *others) {
121 neighbourElements[neigbourIndices[n]] = otherElement;
123 for (
auto start=this_range.first; start!=this_range.second; start++) {
124 size_t position = std::distance(groupStart, start);
125 neighbourClusters[neigbourIndices[n]].push_back(std::make_pair(*start, position));
131 overlapExtents[ 0] = -overlapLimitOpposite;
132 overlapExtents[ 1] = overlapLimitOpposite;
136 overlapExtents[ 6] =-hwidth;
137 overlapExtents[ 7] =-hwidth+overlapLimitPhi;
138 overlapExtents[ 8] = hwidth-overlapLimitPhi;
139 overlapExtents[ 9] = hwidth;
143 overlapExtents[10] = hwidth-overlapLimitPhi;
144 overlapExtents[11] = hwidth;
145 overlapExtents[12] =-hwidth;
146 overlapExtents[13] =-hwidth+overlapLimitPhi;
150 overlapExtents[ 2] = overlapLimitEtaMin;
151 overlapExtents[ 3] = overlapLimitEtaMax;
153 overlapExtents[ 2] =-overlapLimitEtaMax;
154 overlapExtents[ 3] =-overlapLimitEtaMin;
159 overlapExtents[ 4] = overlapLimitEtaMin;
160 overlapExtents[ 5] = overlapLimitEtaMax;
162 overlapExtents[ 4] = -overlapLimitEtaMax;
163 overlapExtents[ 5] = -overlapLimitEtaMin;
172 spacePoints, overlapSpacePoints) );
175 return StatusCode::SUCCESS;
180 const std::array<const InDetDD::SiDetectorElement*, nNeighbours>& elements,
181 const std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,
nNeighbours>& clusters,
182 const std::array<double, 14>& overlapExtents,
184 std::vector<StripSP>& spacePoints,
185 std::vector<StripSP>& overlapSpacePoints )
const
193 constexpr int otherSideIndex{1};
194 constexpr int maxEtaIndex{3};
202 elementIndex[nElements++] = n;
206 if(!nElements)
return StatusCode::SUCCESS;
210 bool isEndcap = element->
isEndcap();
212 std::vector<StripInformationHelper> stripInfos;
213 stripInfos.reserve(clusters[0].
size());
216 for (
auto& cluster_index : clusters[0]) {
217 size_t stripIndex = -1;
218 auto ends =
getStripEnds(cluster_index.first, element, stripIndex);
219 const auto& localPos = cluster_index.first->localPosition<1>();
220 StripInformationHelper stripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, localPos(0, 0), cluster_index.second, stripIndex);
221 stripInfos.push_back( std::move(stripInfo) );
230 for(; n < nElements; ++n) {
231 int currentIndex = elementIndex[n];
232 if(currentIndex > maxEtaIndex)
break;
238 double min = overlapExtents[currentIndex*2-2];
239 double max = overlapExtents[currentIndex*2-1];
241 size_t minStrip, maxStrip = 0;
249 for (
auto& cluster_index : clusters[currentIndex]) {
250 bool processed =
false;
251 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
253 for(
auto& stripInfo : stripInfos) {
254 double diff = currentLocalPos(0, 0)-stripInfo.locX();
263 size_t currentStripIndex = 0;
264 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
265 currentStripInfo.
set(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
269 if (currentIndex==otherSideIndex) {
279 for(; n < nElements; ++n) {
280 int currentIndex = elementIndex[n];
283 double min = overlapExtents[4*currentIndex-10];
284 double max = overlapExtents[4*currentIndex- 9];
286 std::size_t minStrip = 0;
287 std::size_t maxStrip = 0;
294 std::vector<StripInformationHelper*> stripPhiInfos;
295 stripPhiInfos.reserve(stripInfos.size());
297 for(
auto& stripInfo : stripInfos) {
298 auto stripIndex = stripInfo.stripIndex();
299 auto localPosition = stripInfo.locX();
300 auto centralValue = localPosition;
304 centralValue = stripIndex;
310 stripPhiInfos.push_back(&stripInfo);
314 if(stripPhiInfos.empty())
continue;
316 min = overlapExtents[4*currentIndex-8];
317 max = overlapExtents[4*currentIndex-7];
324 for (
auto& cluster_index : clusters[currentIndex]) {
325 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
327 size_t currentStripIndex = 0;
328 auto ends =
getStripEnds(cluster_index.first, currentElement, currentStripIndex);
329 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
330 auto centralValue = currentLocalPos(0, 0);
334 centralValue = currentStripIndex;
339 if (centralValue < minValue or centralValue >
maxValue)
342 for(
auto& stripInfo : stripPhiInfos) {
347 return StatusCode::SUCCESS;
350 for(
int n=0; n!=nElements; ++n) {
352 int currentIndex = elementIndex[n];
356 offset(element, currentElement, slimit);
359 for (
auto& cluster_index : clusters[currentIndex]) {
360 size_t currentStripIndex = 0;
361 auto ends =
getStripEnds(cluster_index.first, element, currentStripIndex);
362 const auto& currentLocalPos = cluster_index.first->localPosition<1>();
363 StripInformationHelper currentStripInfo(cluster_index.first->identifierHash(), ends.first, ends.second, beamSpotVertex, currentLocalPos(0, 0), cluster_index.second, currentStripIndex);
365 for(
auto& stripInfo : stripInfos) {
367 if (currentIndex==otherSideIndex) {
375 return StatusCode::SUCCESS;
385 constexpr float deltaY = 0.0004;
386 constexpr float covTerm = 1600.*deltaY;
388 Eigen::Matrix<float, 2, 1> variance(0.1f, 8.f*covTerm);
391 std::swap( variance(0, 0), variance(1, 0) );
394 double topHalfStripLength = 0.5*firstInfo.
stripDirection().norm();
395 Eigen::Matrix<double, 3, 1> topStripDirection = -firstInfo.
stripDirection()/(2.*topHalfStripLength);
396 Eigen::Matrix<double, 3, 1> topStripCenter = 0.5*firstInfo.
trajDirection();
398 double bottomHalfStripLength = 0.5*secondInfo.
stripDirection().norm();
399 Eigen::Matrix<double, 3, 1> bottomStripDirection = -secondInfo.
stripDirection()/(2.*bottomHalfStripLength);
404 toAdd.idHashes = {firstInfo.
idHash(), secondInfo.
idHash()};
405 toAdd.globPos = globalPosition.cast<
float>();
406 toAdd.cov_r = variance(0,0);
407 toAdd.cov_z = variance(1,0);
409 toAdd.topHalfStripLength =
static_cast<float>(topHalfStripLength);
410 toAdd.bottomHalfStripLength =
static_cast<float>(bottomHalfStripLength);
411 toAdd.topStripDirection = topStripDirection.cast<
float>();
412 toAdd.bottomStripDirection = bottomStripDirection.cast<
float>();
413 toAdd.stripCenterDistance = stripCenterDistance.cast<
float>();
414 toAdd.topStripCenter = topStripCenter.cast<
float>();