23 #include "CLHEP/Units/GlobalSystemOfUnits.h" 33 const std::vector<DetId>& detids(rgeo.
detIds());
36 for (
unsigned int id = 0;
id < detids.size(); ++
id) {
40 const auto tranStart = rgeo.
tranStart(
id);
42 const auto rotStart = rgeo.
rotStart(
id);
61 if (rgeo.
shapeEnd(
id) - shapeStart == 4) {
62 const float width = *(shapeStart + 0) / cm;
63 const float length = *(shapeStart + 1) / cm;
64 const float thickness = *(shapeStart + 2) / cm;
65 const float nstrip = *(shapeStart + 3);
68 const std::vector<float> pars = {
width, length, nstrip};
74 if (*(tranStart + 2) > -1500.) {
85 const float be = *(shapeStart + 0) / cm;
86 const float te = *(shapeStart + 1) / cm;
87 const float ap = *(shapeStart + 2) / cm;
88 const float ti = *(shapeStart + 3) / cm;
89 const float nstrip = *(shapeStart + 4);
92 const std::vector<float> pars = {be , te , ap , nstrip};
110 auto rls =
chids.find(chid);
111 if (rls ==
chids.end())
112 rls =
chids.insert(std::make_pair(chid, std::list<RPCRoll*>())).first;
113 rls->second.emplace_back(r);
117 for (
auto& ich :
chids) {
119 const auto& rls = ich.second;
125 const auto& refSurf = (*rls.begin())->surface();
127 float corners[6] = {0, 0, 0, 0, 0, 0};
128 for (
auto rl : rls) {
129 const double h2 = rl->surface().bounds().length() / 2;
130 const double w2 = rl->surface().bounds().width() / 2;
131 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-w2, -h2, 0)));
132 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+w2, +h2, 0)));
133 corners[0] =
std::min(corners[0], x1y1AtRef.x());
134 corners[1] =
std::min(corners[1], x1y1AtRef.y());
135 corners[2] =
std::max(corners[2], x2y2AtRef.x());
136 corners[3] =
std::max(corners[3], x2y2AtRef.y());
138 corners[4] =
std::min(corners[4], x1y1AtRef.z());
139 corners[5] =
std::max(corners[5], x1y1AtRef.z());
141 const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
142 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
144 (corners[2] - corners[0]) / 2, (corners[3] - corners[1]) / 2, (corners[5] - corners[4]) + 0.5);
145 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
147 float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
148 float cornersZ[2] = {0, 0};
149 for (
auto rl : rls) {
151 const double w2 = rl->surface().bounds().width() / 2;
153 const double r = topo.radius();
154 const double wAtLo = w2 / r * (r - h2);
155 const double wAtHi = w2 / r * (r + h2);
157 const auto x1y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtLo, -h2, 0)));
158 const auto x2y1AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtLo, -h2, 0)));
159 const auto x1y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(-wAtHi, +h2, 0)));
160 const auto x2y2AtRef = refSurf.toLocal(rl->toGlobal(
LocalPoint(+wAtHi, +h2, 0)));
162 cornersLo[0] =
std::min(cornersLo[0], x1y1AtRef.x());
163 cornersLo[1] =
std::max(cornersLo[1], x2y1AtRef.x());
164 cornersLo[2] =
std::min(cornersLo[2], x1y1AtRef.y());
166 cornersHi[0] =
std::min(cornersHi[0], x1y2AtRef.x());
167 cornersHi[1] =
std::max(cornersHi[1], x2y2AtRef.x());
168 cornersHi[2] =
std::max(cornersHi[2], x1y2AtRef.y());
170 cornersZ[0] =
std::min(cornersZ[0], x1y1AtRef.z());
171 cornersZ[1] =
std::max(cornersZ[1], x1y1AtRef.z());
173 const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
174 const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
176 (cornersHi[1] - cornersHi[0]) / 2,
177 (cornersHi[2] - cornersLo[2]) / 2,
178 (cornersZ[1] - cornersZ[0]) + 0.5);
179 bp =
new BoundPlane(gpOfCentre, refSurf.rotation(), bounds);
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
virtual float length() const =0
RPCGeometry * build(const RecoIdealGeometry &rgeo)
common ppss p3p6s2 common epss epspn46 common const1 w2
std::vector< double >::const_iterator rotStart(size_t ind) const
RPCGeometryBuilderFromCondDB(bool comp11)
const Bounds & bounds() const
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
std::vector< std::string >::const_iterator strStart(size_t ind) const
std::map< RPCDetId, std::list< RPCRoll * > > chids
std::vector< double >::const_iterator tranStart(size_t ind) const
const std::vector< DetId > & detIds() const
~RPCGeometryBuilderFromCondDB()
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
std::vector< double >::const_iterator shapeEnd(size_t ind) const
ESHandle< TrackerGeometry > geometry
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
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.