33 const std::vector<DetId>& detids(rgeo.
detIds());
36 for (
unsigned int id = 0;
id < detids.size(); ++
id) {
38 RPCDetId chid(rpcid.region(), rpcid.ring(), rpcid.station(), rpcid.sector(), rpcid.layer(), rpcid.subsector(), 0);
40 const auto tranStart = rgeo.
tranStart(
id);
42 const auto rotStart = rgeo.
rotStart(
id);
60 if (rgeo.
shapeEnd(
id) - shapeStart == 4) {
61 const float width = *(shapeStart + 0) / cm;
62 const float length = *(shapeStart + 1) / cm;
63 const float thickness = *(shapeStart + 2) / cm;
64 const float nstrip = *(shapeStart + 3);
67 const std::vector<float> pars = {
width, length, nstrip};
72 const float be = *(shapeStart + 0) / cm;
73 const float te = *(shapeStart + 1) / cm;
74 const float ap = *(shapeStart + 2) / cm;
75 const float ti = *(shapeStart + 3) / cm;
76 const float nstrip = *(shapeStart + 4);
79 const std::vector<float> pars = {
be, te, ap, nstrip};
89 rot.rotateAxes(newX, newY, newZ);
97 auto rls =
chids.find(chid);
98 if (rls ==
chids.end())
99 rls =
chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
100 rls->second.emplace_back(
r);
104 for (
auto& ich :
chids) {
106 const auto& rls = ich.second;
112 const auto& refSurf = (*rls.begin())->surface();
114 float corners[6] = {0, 0, 0, 0, 0, 0};
115 for (
auto rl : rls) {
116 const double h2 = rl->surface().bounds().length() / 2;
117 const double w2 = rl->surface().bounds().width() / 2;
118 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
119 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
120 corners[0] =
std::min(corners[0], x1y1AtRef.x());
121 corners[1] =
std::min(corners[1], x1y1AtRef.y());
122 corners[2] =
std::max(corners[2], x2y2AtRef.x());
123 corners[3] =
std::max(corners[3], x2y2AtRef.y());
125 corners[4] =
std::min(corners[4], x1y1AtRef.z());
126 corners[5] =
std::max(corners[5], x1y1AtRef.z());
128 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
129 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
131 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
132 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
134 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
135 float cornersZ[2] = {0, 0};
136 for (
auto rl : rls) {
138 const double w2 = rl->surface().bounds().width() / 2;
139 const auto& topo = dynamic_cast<const TrapezoidalStripTopology&>(rl->specificTopology());
140 const double r = topo.radius();
141 const double wAtLo =
w2 /
r * (
r - h2);
142 const double wAtHi =
w2 /
r * (
r + h2);
144 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
145 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
146 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
147 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
149 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
150 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
151 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
153 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
154 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
155 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
157 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
158 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
160 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
161 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
163 (cornersHi[1] - cornersHi[0]) / 2,
164 (cornersHi[2] - cornersLo[2]) / 2,
165 (cornersZ[1] - cornersZ[0]) + 0.5);
166 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);