21 if (not theComponents) {
22 auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
24 for (
auto c : theComps)
26 std::vector<const GeometricSearchDet*>* expected =
nullptr;
27 if (theComponents.compare_exchange_strong(expected,
temp.get())) {
32 return *theComponents;
36 const BoundDisk& ringDisk = static_cast<const BoundDisk&>(theComps[
i]->surface());
37 float ringMinZ =
std::abs(ringDisk.position().z()) - ringDisk.bounds().thickness() / 2.;
38 float ringMaxZ =
std::abs(ringDisk.position().z()) + ringDisk.bounds().thickness() / 2.;
40 tempPar.
thetaRingMin = ringDisk.innerRadius() / ringMaxZ;
41 tempPar.
thetaRingMax = ringDisk.outerRadius() / ringMinZ;
42 tempPar.
theRingR = (ringDisk.innerRadius() + ringDisk.outerRadius()) / 2.;
43 ringPars.push_back(tempPar);
51 theRingSize = rings.size();
52 LogDebug(
"TkDetLayers") <<
"Number of rings in Phase2 OT EC layer is " << theRingSize << std::endl;
53 setSurface(computeDisk(rings));
55 for (
unsigned int i = 0;
i != rings.size(); ++
i) {
56 theComps.push_back(rings[
i]);
59 theBasicComps.end(), (*rings[
i]).basicComponents().begin(), (*rings[
i]).basicComponents().end());
62 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2EndcapLayer =====";
63 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: " << this->
position().perp() <<
" , "
64 << this->
position().z() <<
" , " << this->specificSurface().bounds().thickness() <<
" , "
65 << this->specificSurface().innerRadius() <<
" , " << this->specificSurface().outerRadius();
69 float theRmin = rings.front()->specificSurface().innerRadius();
70 float theRmax = rings.front()->specificSurface().outerRadius();
71 float theZmin = rings.front()->position().z() - rings.front()->surface().bounds().thickness() / 2;
72 float theZmax = rings.front()->position().z() + rings.front()->surface().bounds().thickness() / 2;
74 for (vector<const Phase2EndcapRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
75 float rmin = (**i).specificSurface().innerRadius();
76 float rmax = (**i).specificSurface().outerRadius();
77 float zmin = (**i).position().z() - (**i).surface().bounds().thickness() / 2.;
78 float zmax = (**i).position().z() + (**i).surface().bounds().thickness() / 2.;
79 theRmin =
min(theRmin, rmin);
80 theRmax =
max(theRmax, rmax);
85 float zPos = (theZmax + theZmin) / 2.;
102 std::vector<DetGroup>&
result)
const {
104 if (ringIndices[0] == -1 || ringIndices[1] == -1 || ringIndices[2] == -1) {
105 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
114 std::fill(ringOrder.begin(), ringOrder.end(), 1);
122 std::fill(ringOrder.begin(), ringOrder.end(), 0);
128 throw DetLayerException(
"Rings in Endcap Layer have same z position, no idea how to order them!");
132 auto index = [&ringIndices, &ringOrder](
int i) {
return ringOrder[ringIndices[
i]]; };
134 std::vector<DetGroup> closestResult;
135 theComps[ringIndices[0]]->groupedCompatibleDetsV(startingState, prop, est, closestResult);
137 if (closestResult.empty()) {
138 theComps[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est,
result);
143 float rWindow =
computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
147 bool ring1ok = ringIndices[1] != -1 &&
overlapInR(closestGel.trajectoryState(), ringIndices[1], rWindow);
148 bool ring2ok = ringIndices[2] != -1 &&
overlapInR(closestGel.trajectoryState(), ringIndices[2], rWindow);
168 edm::LogInfo(
"AllRingsInOnePlane") <<
" All rings: " << ringIndices[0] <<
" " << ringIndices[1] <<
" "
169 << ringIndices[2] <<
" in one plane. Only the first two will be considered";
175 std::vector<DetGroup> ring1res;
176 theComps[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
180 std::vector<DetGroup> ring2res;
181 theComps[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
186 result.swap(closestResult);
191 std::vector<DetGroup> ring2res;
192 theComps[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
196 std::vector<DetGroup> ring1res;
197 theComps[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
202 result.swap(closestResult);
206 std::vector<DetGroup> ring12res;
208 std::vector<DetGroup> ring1res;
209 theComps[ringIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, ring1res);
210 ring12res.swap(ring1res);
213 std::vector<DetGroup> ring2res;
214 theComps[ringIndices[2]]->groupedCompatibleDetsV(startingState, prop, est, ring2res);
217 if (!ring12res.empty()) {
222 result.swap(closestResult);
241 Crossing myXing(startPos, startDir,
rho, propDir);
243 std::vector<GlobalPoint> ringCrossings;
249 pair<bool, double> pathlen = myXing.pathLength(theRing);
251 ringCrossings.push_back(
GlobalPoint(myXing.position(pathlen.second)));
277 std::array<int, 3> theBins = {{-1, -1, -1}};
279 float initialR =
ringPars[0].theRingR;
280 float rDiff0 =
std::abs(ringCrossing[0].
perp() - initialR);
286 if (testDiff < rDiff0) {
290 theBins[2] = theBins[1];
291 theBins[1] = theBins[0];
293 }
else if (rDiff1 < 0 || testDiff < rDiff1) {
296 theBins[2] = theBins[1];
298 }
else if (rDiff2 < 0 || testDiff < rDiff2) {