44 return this->buildGeometry(fview, muonConstants);
54 return this->buildGeometry(fview, muonConstants);
60 LogDebug(
"RPCGeometryBuilder") <<
"Building the geometry service";
61 std::unique_ptr<RPCGeometry>
geometry = std::make_unique<RPCGeometry>();
62 LogDebug(
"RPCGeometryBuilder") <<
"About to run through the RPC structure\n"
65 LogDebug(
"RPCGeometryBuilder") <<
"doSubDets = " << doSubDets;
67 LogDebug(
"RPCGeometryBuilder") <<
"start the loop";
69 LogDebug(
"RPCGeometryBuilder") <<
"Getting the Muon base Number";
71 LogDebug(
"RPCGeometryBuilder") <<
"Start the Rpc Numbering Schema";
73 LogDebug(
"RPCGeometryBuilder") <<
"Getting the Unit Number";
75 LogDebug(
"RPCGeometryBuilder") <<
"Getting the RPC det Id " << detid;
78 LogDebug(
"RPCGeometryBuilder") <<
"The RPCDetid is " << rpcid;
80 DDValue numbOfStrips(
"nStrips");
84 for (
auto& spec :
specs) {
85 if (
DDfetch(spec, numbOfStrips)) {
90 LogDebug(
"RPCGeometryBuilder") << ((
nStrips == 0) ? (
"No strip found!!") : (
""));
101 rota.GetComponents(x, y, z);
115 if (dpar.size() == 3) {
120 const std::vector<float> pars = {
width, length,
float(numbOfStrips.
doubles()[0])};
129 const float ti = 0.4;
137 LogDebug(
"RPCGeometryBuilder") <<
"Forward " <<
name <<
" par " << dpar[4] <<
" " << dpar[8] <<
" " << dpar[3]
146 rot.rotateAxes(newX, newY, newZ);
155 auto rls = chids.find(chid);
156 if (rls == chids.end())
157 rls = chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
158 rls->second.emplace_back(
r);
162 for (
auto& ich : chids) {
164 const auto& rls = ich.second;
168 const auto& refSurf = (*rls.begin())->surface();
170 float corners[6] = {0, 0, 0, 0, 0, 0};
171 for (
auto rl : rls) {
172 const double h2 = rl->surface().bounds().length() / 2;
173 const double w2 = rl->surface().bounds().width() / 2;
174 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
175 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
176 corners[0] =
std::min(corners[0], x1y1AtRef.x());
177 corners[1] =
std::min(corners[1], x1y1AtRef.y());
178 corners[2] =
std::max(corners[2], x2y2AtRef.x());
179 corners[3] =
std::max(corners[3], x2y2AtRef.y());
180 corners[4] =
std::min(corners[4], x1y1AtRef.z());
181 corners[5] =
std::max(corners[5], x1y1AtRef.z());
183 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
184 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
186 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
187 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
189 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
190 float cornersZ[2] = {0, 0};
191 for (
auto rl : rls) {
193 const double w2 = rl->surface().bounds().width() / 2;
194 const auto& topo = dynamic_cast<const TrapezoidalStripTopology&>(rl->specificTopology());
195 const double r = topo.radius();
196 const double wAtLo =
w2 /
r * (
r - h2);
197 const double wAtHi =
w2 /
r * (
r + h2);
199 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
200 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
201 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
202 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
204 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
205 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
206 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
208 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
209 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
210 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
212 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
213 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
215 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
216 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
218 (cornersHi[1] - cornersHi[0]) / 2,
219 (cornersHi[2] - cornersLo[2]) / 2,
220 (cornersZ[1] - cornersZ[0]) + 0.5);
221 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
239 std::unique_ptr<RPCGeometry>
geometry = std::make_unique<RPCGeometry>();
251 std::vector<double> dpar = fview.
parameters();
253 std::string_view
name = fview.
name();
255 const Double_t* tran = fview.
trans();
263 rota.GetComponents(x, y, z);
277 if (dd4hep::isA<dd4hep::Box>(fview.
solid())) {
278 const float width = dpar[0];
279 const float length = dpar[1];
289 const float be = dpar[0];
290 const float te = dpar[1];
291 const float ap = dpar[3];
292 const float ti = 0.4;
303 rot.rotateAxes(newX, newY, newZ);
311 auto rls = chids.find(chid);
312 if (rls == chids.end())
313 rls = chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
314 rls->second.emplace_back(
r);
317 for (
auto& ich : chids) {
319 const auto& rls = ich.second;
323 const auto& refSurf = (*rls.begin())->surface();
325 float corners[6] = {0, 0, 0, 0, 0, 0};
326 for (
auto rl : rls) {
327 const double h2 = rl->surface().bounds().length() / 2;
328 const double w2 = rl->surface().bounds().width() / 2;
329 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
330 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
331 corners[0] =
std::min(corners[0], x1y1AtRef.x());
332 corners[1] =
std::min(corners[1], x1y1AtRef.y());
333 corners[2] =
std::max(corners[2], x2y2AtRef.x());
334 corners[3] =
std::max(corners[3], x2y2AtRef.y());
336 corners[4] =
std::min(corners[4], x1y1AtRef.z());
337 corners[5] =
std::max(corners[5], x1y1AtRef.z());
339 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
340 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
342 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
343 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
346 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
347 float cornersZ[2] = {0, 0};
348 for (
auto rl : rls) {
350 const double w2 = rl->surface().bounds().width() / 2;
351 const auto& topo = dynamic_cast<const TrapezoidalStripTopology&>(rl->specificTopology());
352 const double r = topo.radius();
353 const double wAtLo =
w2 /
r * (
r - h2);
354 const double wAtHi =
w2 /
r * (
r + h2);
355 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
356 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
357 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
358 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
360 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
361 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
362 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
364 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
365 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
366 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
368 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
369 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
371 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
372 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
374 (cornersHi[1] - cornersHi[0]) / 2,
375 (cornersHi[2] - cornersLo[2]) / 2,
376 (cornersZ[1] - cornersZ[0]) + 0.5);
377 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);