45 return this->buildGeometry(fview, muonConstants);
55 return this->buildGeometry(fview, muonConstants);
62 std::unique_ptr<RPCGeometry>
geometry = std::make_unique<RPCGeometry>();
63 edm::LogVerbatim(
"RPCGeometryBuilder") <<
"About to run through the RPC structure\n" 76 edm::LogVerbatim(
"RPCGeometryBuilder") <<
"Getting the RPC det Id " << detid;
81 DDValue numbOfStrips(
"nStrips");
85 for (
auto& spec :
specs) {
86 if (
DDfetch(spec, numbOfStrips)) {
99 <<
"detid: " << detid <<
" name: " <<
name <<
" number of Strips: " <<
nStrips;
111 rota.GetComponents(
x, y, z);
125 if (dpar.size() == 3) {
132 <<
"(3) Box, width: " <<
width <<
" length: " << length <<
" thickness: " <<
thickness;
135 const std::vector<float> pars = {
width, length,
float(numbOfStrips.
doubles()[0])};
143 const float ti = 0.4;
147 const std::vector<float> pars = {
be, te, ap,
float(numbOfStrips.
doubles()[0])};
149 edm::LogVerbatim(
"RPCGeometryBuilder") <<
"(4) be: " <<
be <<
" te: " << te <<
" ap: " << ap <<
" ti: " << ti
150 <<
" strips " << numbOfStrips.
doubles()[0];
158 rot.rotateAxes(newX, newY, newZ);
167 auto rls = chids.find(chid);
168 if (rls == chids.end())
169 rls = chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
170 rls->second.emplace_back(r);
174 for (
auto& ich : chids) {
176 const auto& rls = ich.second;
180 const auto& refSurf = (*rls.begin())->surface();
182 float corners[6] = {0, 0, 0, 0, 0, 0};
183 for (
auto rl : rls) {
184 const double h2 = rl->surface().bounds().length() / 2;
185 const double w2 = rl->surface().bounds().width() / 2;
186 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
187 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
188 corners[0] =
std::min(corners[0], x1y1AtRef.x());
189 corners[1] =
std::min(corners[1], x1y1AtRef.y());
190 corners[2] =
std::max(corners[2], x2y2AtRef.x());
191 corners[3] =
std::max(corners[3], x2y2AtRef.y());
192 corners[4] =
std::min(corners[4], x1y1AtRef.z());
193 corners[5] =
std::max(corners[5], x1y1AtRef.z());
195 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
196 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
198 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
201 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
202 float cornersZ[2] = {0, 0};
203 for (
auto rl : rls) {
205 const double w2 = rl->surface().bounds().width() / 2;
207 const double r = topo.radius();
208 const double wAtLo =
w2 / r * (r - h2);
209 const double wAtHi =
w2 / r * (r + h2);
211 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
212 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
213 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
214 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
216 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
217 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
218 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
220 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
221 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
222 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
224 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
225 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
227 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
228 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
230 (cornersHi[1] - cornersHi[0]) / 2,
231 (cornersHi[2] - cornersLo[2]) / 2,
232 (cornersZ[1] - cornersZ[0]) + 0.5);
252 std::unique_ptr<RPCGeometry>
geometry = std::make_unique<RPCGeometry>();
261 edm::LogVerbatim(
"RPCGeometryBuilder") <<
"Getting the RPC det Id " << rawidCh;
269 std::vector<double> dpar = fview.
parameters();
271 std::string_view
name = fview.
name();
276 const Double_t* tran = fview.
trans();
283 <<
"(2) tran.x(): " << tran[0] / dd4hep::cm <<
" tran.y(): " << tran[1] / dd4hep::cm
284 <<
" tran.z(): " << tran[2] / dd4hep::cm;
286 rota.GetComponents(
x, y, z);
300 if (dd4hep::isA<dd4hep::Box>(fview.
solid())) {
301 const float width = dpar[0] / dd4hep::cm;
302 const float length = dpar[1] / dd4hep::cm;
303 const float thickness = dpar[2] / dd4hep::cm;
305 <<
"(3) Box, width: " << dpar[0] / dd4hep::cm <<
" length: " << dpar[1] / dd4hep::cm
306 <<
" thickness: " << dpar[2] / dd4hep::cm;
314 const float be = dpar[0] / dd4hep::cm;
315 const float te = dpar[1] / dd4hep::cm;
316 const float ap = dpar[3] / dd4hep::cm;
317 const float ti = 0.4;
322 <<
"(4) be: " <<
be <<
" te: " << te <<
" ap: " << ap <<
" ti: " << ti <<
" strips " <<
nStrips;
329 rot.rotateAxes(newX, newY, newZ);
338 auto rls = chids.find(chid);
339 if (rls == chids.end())
340 rls = chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
341 rls->second.emplace_back(r);
344 for (
auto& ich : chids) {
346 const auto& rls = ich.second;
350 const auto& refSurf = (*rls.begin())->surface();
352 float corners[6] = {0, 0, 0, 0, 0, 0};
353 for (
auto rl : rls) {
354 const double h2 = rl->surface().bounds().length() / 2;
355 const double w2 = rl->surface().bounds().width() / 2;
356 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
357 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
358 corners[0] =
std::min(corners[0], x1y1AtRef.x());
359 corners[1] =
std::min(corners[1], x1y1AtRef.y());
360 corners[2] =
std::max(corners[2], x2y2AtRef.x());
361 corners[3] =
std::max(corners[3], x2y2AtRef.y());
363 corners[4] =
std::min(corners[4], x1y1AtRef.z());
364 corners[5] =
std::max(corners[5], x1y1AtRef.z());
366 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
367 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
369 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
373 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
374 float cornersZ[2] = {0, 0};
375 for (
auto rl : rls) {
377 const double w2 = rl->surface().bounds().width() / 2;
379 const double r = topo.radius();
380 const double wAtLo =
w2 / r * (r - h2);
381 const double wAtHi =
w2 / r * (r + h2);
382 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
383 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
384 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
385 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
387 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
388 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
389 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
391 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
392 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
393 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
395 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
396 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
398 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
399 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
401 (cornersHi[1] - cornersHi[0]) / 2,
402 (cornersHi[2] - cornersLo[2]) / 2,
403 (cornersZ[1] - cornersZ[0]) + 0.5);
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Log< level::Info, true > LogVerbatim
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
virtual float length() const =0
common ppss p3p6s2 common epss epspn46 common const1 w2
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
bool nextSibling()
set the current node to the next sibling ...
int baseNumberToUnitNumber(const MuonBaseNumber &) const override
const Double_t * rot() const
The absolute rotation of the current node.
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Compact representation of the geometrical detector hierarchy.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::string_view name() const
const Double_t * trans() const
The absolute translation of the current node.
const std::string & name() const
Returns the name.
std::unique_ptr< RPCGeometry > buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const ExpandedNodes & history()
The numbering history of the current node.
bool firstChild()
set the current node to the first child
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
T get(const std::string &)
extract attribute value
std::vector< const DDsvalues_type * > specifics() const
constexpr NumType convertMmToCm(NumType millimeters)
std::unique_ptr< RPCGeometry > build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
dd4hep::Solid solid() const
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
bool firstChild()
set the current node to the first child ...
const DDTranslation & translation() const
The absolute translation of the current node.
const std::vector< double > parameters() const
extract shape parameters
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
const Bounds & bounds() const