CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RPCGeometryBuilderFromCondDB Class Reference

#include <RPCGeometryBuilderFromCondDB.h>

Public Member Functions

RPCGeometrybuild (const RecoIdealGeometry &rgeo)
 
 RPCGeometryBuilderFromCondDB ()
 
 ~RPCGeometryBuilderFromCondDB ()
 

Private Attributes

std::map< RPCDetId, std::list< RPCRoll * > > chids
 

Detailed Description

Build the RPCGeometry from the DDD description stored in Condition DB

Author
M. Maggi - INFN Bari

Definition at line 20 of file RPCGeometryBuilderFromCondDB.h.

Constructor & Destructor Documentation

◆ RPCGeometryBuilderFromCondDB()

RPCGeometryBuilderFromCondDB::RPCGeometryBuilderFromCondDB ( )

Implementation of the RPC Geometry Builder from DDD stored in CondDB

Author
M. Maggi - INFN Bari

Definition at line 28 of file RPCGeometryBuilderFromCondDB.cc.

28 {}

◆ ~RPCGeometryBuilderFromCondDB()

RPCGeometryBuilderFromCondDB::~RPCGeometryBuilderFromCondDB ( )

Definition at line 30 of file RPCGeometryBuilderFromCondDB.cc.

30 {}

Member Function Documentation

◆ build()

RPCGeometry * RPCGeometryBuilderFromCondDB::build ( const RecoIdealGeometry rgeo)

Definition at line 32 of file RPCGeometryBuilderFromCondDB.cc.

32  {
33  const std::vector<DetId>& detids(rgeo.detIds());
35 
36  for (unsigned int id = 0; id < detids.size(); ++id) {
37  RPCDetId rpcid(detids[id]);
38  RPCDetId chid(rpcid.region(), rpcid.ring(), rpcid.station(), rpcid.sector(), rpcid.layer(), rpcid.subsector(), 0);
39 
40  const auto tranStart = rgeo.tranStart(id);
41  const auto shapeStart = rgeo.shapeStart(id);
42  const auto rotStart = rgeo.rotStart(id);
43  const std::string& name = *rgeo.strStart(id);
44 
45  Surface::PositionType pos(*(tranStart) / cm, *(tranStart + 1) / cm, *(tranStart + 2) / cm);
46  // CLHEP way
47  Surface::RotationType rot(*(rotStart + 0),
48  *(rotStart + 1),
49  *(rotStart + 2),
50  *(rotStart + 3),
51  *(rotStart + 4),
52  *(rotStart + 5),
53  *(rotStart + 6),
54  *(rotStart + 7),
55  *(rotStart + 8));
56 
57  RPCRollSpecs* rollspecs = nullptr;
58  Bounds* bounds = nullptr;
59 
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);
65 
66  bounds = new RectangularPlaneBounds(width, length, thickness);
67  const std::vector<float> pars = {width, length, nstrip};
68 
69  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCBarrel, name, pars);
70 
71  } else {
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);
77 
78  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
79  const std::vector<float> pars = {be, te, ap, nstrip};
80 
81  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCEndcap, name, pars);
82 
83  //Change of axes for the forward
84  Basic3DVector<float> newX(1., 0., 0.);
85  Basic3DVector<float> newY(0., 0., 1.);
86 
87  newY *= -1;
88  Basic3DVector<float> newZ(0., 1., 0.);
89  rot.rotateAxes(newX, newY, newZ);
90  }
91 
92  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
94  RPCRoll* r = new RPCRoll(rpcid, surf, rollspecs);
95  geometry->add(r);
96 
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);
101  }
102 
103  // Create the RPCChambers and store them on the Geometry
104  for (auto& ich : chids) {
105  const RPCDetId& chid = ich.first;
106  const auto& rls = ich.second;
107 
108  // compute the overall boundplane.
109  BoundPlane* bp = nullptr;
110  if (!rls.empty()) {
111  // First set the baseline plane to calculate relative poisions
112  const auto& refSurf = (*rls.begin())->surface();
113  if (chid.region() == 0) {
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());
124 
125  corners[4] = std::min(corners[4], x1y1AtRef.z());
126  corners[5] = std::max(corners[5], x1y1AtRef.z());
127  }
128  const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
129  const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
130  auto bounds = new RectangularPlaneBounds(
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);
133  } else {
134  float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
135  float cornersZ[2] = {0, 0};
136  for (auto rl : rls) {
137  const double h2 = rl->surface().bounds().length() / 2;
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);
143 
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)));
148 
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());
152 
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());
156 
157  cornersZ[0] = std::min(cornersZ[0], x1y1AtRef.z());
158  cornersZ[1] = std::max(cornersZ[1], x1y1AtRef.z());
159  }
160  const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
161  const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
162  auto bounds = new TrapezoidalPlaneBounds((cornersLo[1] - cornersLo[0]) / 2,
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);
167  }
168  }
169 
171  // Create the chamber
172  RPCChamber* ch = new RPCChamber(chid, surf);
173  // Add the rolls to rhe chamber
174  for (auto rl : rls)
175  ch->add(rl);
176  // Add the chamber to the geometry
177  geometry->add(ch);
178  }
179  return geometry;
180 }

References RPCChamber::add(), cms::cuda::be, Surface::bounds(), chids, RecoIdealGeometry::detIds(), relativeConstraints::geometry, triggerObjects_cff::id, RPCDetId::layer(), Bounds::length(), SiStripPI::max, min(), Skims_PA_cff::name, alignCSCRings::r, RPCDetId::region(), RPCDetId::ring(), makeMuonMisalignmentScenario::rot, RecoIdealGeometry::rotStart(), GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, RPCDetId::sector(), RecoIdealGeometry::shapeEnd(), RecoIdealGeometry::shapeStart(), RPCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, RecoIdealGeometry::strStart(), RPCDetId::subsector(), Calorimetry_cff::thickness, RecoIdealGeometry::tranStart(), w2, and ApeEstimator_cff::width.

Referenced by RPCGeometryESModule::produce().

Member Data Documentation

◆ chids

std::map<RPCDetId, std::list<RPCRoll*> > RPCGeometryBuilderFromCondDB::chids
private

Definition at line 29 of file RPCGeometryBuilderFromCondDB.h.

Referenced by build().

RPCRoll
Definition: RPCRoll.h:12
TkRotation< float >
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
w2
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
GeomDetEnumerators::RPCEndcap
Definition: GeomDetEnumerators.h:20
RPCRollSpecs
Definition: RPCRollSpecs.h:18
min
T min(T a, T b)
Definition: MathUtil.h:58
RPCDetId
Definition: RPCDetId.h:16
geometry
Definition: geometry.py:1
pos
Definition: PixelAliasList.h:18
Bounds
Definition: Bounds.h:18
relativeConstraints.geometry
geometry
Definition: relativeConstraints.py:39
RPCGeometryBuilderFromCondDB::chids
std::map< RPCDetId, std::list< RPCRoll * > > chids
Definition: RPCGeometryBuilderFromCondDB.h:29
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
RPCChamber
Definition: RPCChamber.h:19
Bounds::length
virtual float length() const =0
RecoIdealGeometry::shapeEnd
std::vector< double >::const_iterator shapeEnd(size_t ind) const
Definition: RecoIdealGeometry.h:97
RecoIdealGeometry::rotStart
std::vector< double >::const_iterator rotStart(size_t ind) const
Definition: RecoIdealGeometry.h:91
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
Point3DBase< float, GlobalTag >
RPCChamber::add
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
Definition: RPCChamber.cc:32
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
RecoIdealGeometry::detIds
const std::vector< DetId > & detIds() const
Definition: RecoIdealGeometry.h:85
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RecoIdealGeometry::tranStart
std::vector< double >::const_iterator tranStart(size_t ind) const
Definition: RecoIdealGeometry.h:87
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
BoundPlane
Plane BoundPlane
Definition: Plane.h:94
RecoIdealGeometry::strStart
std::vector< std::string >::const_iterator strStart(size_t ind) const
Definition: RecoIdealGeometry.h:101
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
BoundPlane
RecoIdealGeometry::shapeStart
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: RecoIdealGeometry.h:95
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
GeomDetEnumerators::RPCBarrel
Definition: GeomDetEnumerators.h:19
RPCGeometry
Definition: RPCGeometry.h:20
cms::cuda::be
int be
Definition: HistoContainer.h:75
Basic3DVector< float >