23 #include <CLHEP/Units/SystemOfUnits.h> 35 const std::vector<DetId>& detids(rgeo.
detIds());
38 for (
unsigned int id = 0;
id < detids.size(); ++
id) {
42 const auto tranStart = rgeo.
tranStart(
id);
44 const auto rotStart = rgeo.
rotStart(
id);
62 if (rgeo.
shapeEnd(
id) - shapeStart == 4) {
63 const float width = *(shapeStart + 0) / cm;
64 const float length = *(shapeStart + 1) / cm;
65 const float thickness = *(shapeStart + 2) / cm;
66 const float nstrip = *(shapeStart + 3);
69 const std::vector<float> pars = {
width, length, nstrip};
74 const float be = *(shapeStart + 0) / cm;
75 const float te = *(shapeStart + 1) / cm;
76 const float ap = *(shapeStart + 2) / cm;
77 const float ti = *(shapeStart + 3) / cm;
78 const float nstrip = *(shapeStart + 4);
81 const std::vector<float> pars = {
be, te, ap, nstrip};
91 rot.rotateAxes(newX, newY, newZ);
99 auto rls =
chids.find(chid);
100 if (rls ==
chids.end())
101 rls =
chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
102 rls->second.emplace_back(
r);
106 for (
auto& ich :
chids) {
108 const auto& rls = ich.second;
114 const auto& refSurf = (*rls.begin())->surface();
116 float corners[6] = {0, 0, 0, 0, 0, 0};
117 for (
auto rl : rls) {
118 const double h2 = rl->surface().bounds().length() / 2;
119 const double w2 = rl->surface().bounds().width() / 2;
120 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-
w2, -h2, 0)));
121 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+
w2, +h2, 0)));
122 corners[0] =
std::min(corners[0], x1y1AtRef.x());
123 corners[1] =
std::min(corners[1], x1y1AtRef.y());
124 corners[2] =
std::max(corners[2], x2y2AtRef.x());
125 corners[3] =
std::max(corners[3], x2y2AtRef.y());
127 corners[4] =
std::min(corners[4], x1y1AtRef.z());
128 corners[5] =
std::max(corners[5], x1y1AtRef.z());
130 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
131 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
133 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
136 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
137 float cornersZ[2] = {0, 0};
138 for (
auto rl : rls) {
140 const double w2 = rl->surface().bounds().width() / 2;
142 const double r = topo.radius();
143 const double wAtLo =
w2 /
r * (
r - h2);
144 const double wAtHi =
w2 /
r * (
r + h2);
146 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
147 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
148 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
149 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
151 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
152 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
153 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
155 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
156 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
157 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
159 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
160 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
162 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
163 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
165 (cornersHi[1] - cornersHi[0]) / 2,
166 (cornersHi[2] - cornersLo[2]) / 2,
167 (cornersZ[1] - cornersZ[0]) + 0.5);
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
std::vector< std::string >::const_iterator strStart(size_t ind) const
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
RPCGeometry * build(const RecoIdealGeometry &rgeo)
std::vector< double >::const_iterator shapeEnd(size_t ind) const
virtual float length() const =0
common ppss p3p6s2 common epss epspn46 common const1 w2
RPCGeometryBuilderFromCondDB()
std::vector< double >::const_iterator rotStart(size_t ind) const
const std::vector< DetId > & detIds() const
std::map< RPCDetId, std::list< RPCRoll * > > chids
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
std::vector< double >::const_iterator shapeStart(size_t ind) const
~RPCGeometryBuilderFromCondDB()
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
std::vector< double >::const_iterator tranStart(size_t ind) const
const Bounds & bounds() const