38 inline void mergeOutward(
std::array<vector<DetGroup>, 3>& groups, std::vector<DetGroup>&
result) {
41 if (!groups[2].
empty()) {
42 std::vector<DetGroup>
tmp;
48 inline void mergeInward(
std::array<vector<DetGroup>, 3>& groups, std::vector<DetGroup>&
result) {
51 if (!groups[0].
empty()) {
52 std::vector<DetGroup>
tmp;
61 std::vector<DetGroup>&
result) {
65 mergeOutward(groups,
result);
67 mergeInward(groups,
result);
70 mergeOutward(groups,
result);
72 mergeInward(groups,
result);
80 if (not theComponents) {
81 auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
83 for (
auto c : theComps)
85 std::vector<const GeometricSearchDet*>* expected =
nullptr;
86 if (theComponents.compare_exchange_strong(expected,
temp.get())) {
92 return *theComponents;
96 const BoundDisk& ringDisk = static_cast<const BoundDisk&>(theComps[
i]->surface());
97 float ringMinZ =
std::abs(ringDisk.position().z()) - ringDisk.bounds().thickness() / 2.;
98 float ringMaxZ =
std::abs(ringDisk.position().z()) + ringDisk.bounds().thickness() / 2.;
99 ringPars[
i].thetaRingMin = ringDisk.innerRadius() / ringMaxZ;
100 ringPars[
i].thetaRingMax = ringDisk.outerRadius() / ringMinZ;
101 ringPars[
i].theRingR = (ringDisk.innerRadius() + ringDisk.outerRadius()) / 2.;
108 if (rings.size() != 3)
110 setSurface(computeDisk(rings));
112 for (
int i = 0;
i != 3; ++
i) {
113 theComps[
i] = rings[
i];
115 theBasicComps.insert(
116 theBasicComps.end(), (*rings[
i]).basicComponents().begin(), (*rings[
i]).basicComponents().end());
119 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIDLayer =====";
120 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: " << this->
position().perp() <<
" , "
121 << this->
position().z() <<
" , " << this->specificSurface().bounds().thickness() <<
" , "
122 << this->specificSurface().innerRadius() <<
" , " << this->specificSurface().outerRadius();
126 float theRmin = rings.front()->specificSurface().innerRadius();
127 float theRmax = rings.front()->specificSurface().outerRadius();
128 float theZmin = rings.front()->position().z() - rings.front()->surface().bounds().thickness() / 2;
129 float theZmax = rings.front()->position().z() + rings.front()->surface().bounds().thickness() / 2;
131 for (vector<const TIDRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
132 float rmin = (**i).specificSurface().innerRadius();
133 float rmax = (**i).specificSurface().outerRadius();
134 float zmin = (**i).position().z() - (**i).surface().bounds().thickness() / 2.;
135 float zmax = (**i).position().z() + (**i).surface().bounds().thickness() / 2.;
136 theRmin =
min(theRmin, rmin);
137 theRmax =
max(theRmax, rmax);
142 float zPos = (theZmax + theZmin) / 2.;
159 std::vector<DetGroup>&
result)
const {
161 if (ringIndices[0] == -1) {
162 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
166 std::array<vector<DetGroup>, 3> groupsAtRingLevel;
169 static constexpr
int ringOrder[3]{1, 2, 0};
170 auto index = [&ringIndices](
int i) {
return ringOrder[ringIndices[
i]]; };
172 auto& closestResult = groupsAtRingLevel[
index(0)];
174 if (closestResult.empty()) {
180 float rWindow =
computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
182 if (!
overlapInR(closestGel.trajectoryState(), ringIndices[1], rWindow)) {
183 result.swap(closestResult);
187 auto& nextResult = groupsAtRingLevel[
index(1)];
189 if (nextResult.empty()) {
190 result.swap(closestResult);
194 if (!
overlapInR(closestGel.trajectoryState(), ringIndices[2], rWindow)) {
196 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
200 auto& nextNextResult = groupsAtRingLevel[
index(2)];
202 if (nextNextResult.empty()) {
204 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
209 orderAndMergeLevels(closestGel.trajectoryState(), prop, groupsAtRingLevel,
result);
225 Crossing myXing(startPos, startDir,
rho, propDir);
230 for (
int i = 0;
i < 3;
i++) {
232 pair<bool, double> pathlen = myXing.pathLength(theRing);
234 ringCrossings[
i] =
GlobalPoint(myXing.position(pathlen.second));
246 if (closestIndex < 0 || nextIndex < 0)
247 return std::array<int, 3>{{-1, -1, -1}};
248 int nextNextIndex = -1;
249 for (
int i = 0;
i < 3;
i++) {
250 if (
i != closestIndex &&
i != nextIndex) {
256 std::array<int, 3>
indices{{closestIndex, nextIndex, nextNextIndex}};
271 float rDiff =
std::abs(ringCrossing[0].
perp() - initialR);
272 for (
int i = 1;
i < 3;
i++) {
275 if (testDiff < rDiff) {
284 int firstIndexToCheck = (closest != 0) ? 0 : 1;
286 float rDiff =
std::abs(ringCrossing[firstIndexToCheck].
perp() - initialR);
287 int theBin = firstIndexToCheck;
288 for (
int i = firstIndexToCheck + 1;
i < 3;
i++) {
292 if (testDiff < rDiff) {