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 (bool comp11)
 
 ~RPCGeometryBuilderFromCondDB ()
 

Private Attributes

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

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 ( bool  comp11)

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 : theComp11Flag(comp11) {}

◆ ~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 (dpar.size()==4){
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);
66  //RectangularPlaneBounds*
67  bounds = new RectangularPlaneBounds(width, length, thickness);
68  const std::vector<float> pars = {width, length, nstrip};
69 
70  if (!theComp11Flag) {
71  //Correction of the orientation to get the REAL geometry.
72  //Change of axes for the +z part only.
73  //Including the 0 whell
74  if (*(tranStart + 2) > -1500.) { //tran[2] >-1500. ){
75  Basic3DVector<float> newX(-1., 0., 0.);
76  Basic3DVector<float> newY(0., -1., 0.);
77  Basic3DVector<float> newZ(0., 0., 1.);
78  rot.rotateAxes(newX, newY, newZ);
79  }
80  }
81 
82  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCBarrel, name, pars);
83 
84  } else {
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);
90  // TrapezoidalPlaneBounds*
91  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
92  const std::vector<float> pars = {be /*b/2*/, te /*B/2*/, ap /*h/2*/, nstrip};
93 
94  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCEndcap, name, pars);
95 
96  //Change of axes for the forward
97  Basic3DVector<float> newX(1., 0., 0.);
98  Basic3DVector<float> newY(0., 0., 1.);
99  // if (tran[2] > 0. )
100  newY *= -1;
101  Basic3DVector<float> newZ(0., 1., 0.);
102  rot.rotateAxes(newX, newY, newZ);
103  }
104 
105  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
107  RPCRoll* r = new RPCRoll(rpcid, surf, rollspecs);
108  geometry->add(r);
109 
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);
114  }
115 
116  // Create the RPCChambers and store them on the Geometry
117  for (auto& ich : chids) {
118  const RPCDetId& chid = ich.first;
119  const auto& rls = ich.second;
120 
121  // compute the overall boundplane.
122  BoundPlane* bp = nullptr;
123  if (!rls.empty()) {
124  // First set the baseline plane to calculate relative poisions
125  const auto& refSurf = (*rls.begin())->surface();
126  if (chid.region() == 0) {
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());
137 
138  corners[4] = std::min(corners[4], x1y1AtRef.z());
139  corners[5] = std::max(corners[5], x1y1AtRef.z());
140  }
141  const LocalPoint lpOfCentre((corners[0] + corners[2]) / 2, (corners[1] + corners[3]) / 2, 0);
142  const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
143  auto bounds = new RectangularPlaneBounds(
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);
146  } else {
147  float cornersLo[3] = {0, 0, 0}, cornersHi[3] = {0, 0, 0};
148  float cornersZ[2] = {0, 0};
149  for (auto rl : rls) {
150  const double h2 = rl->surface().bounds().length() / 2;
151  const double w2 = rl->surface().bounds().width() / 2;
152  const auto& topo = dynamic_cast<const TrapezoidalStripTopology&>(rl->specificTopology());
153  const double r = topo.radius();
154  const double wAtLo = w2 / r * (r - h2); // tan(theta/2) = (w/2)/r = x/(r-h/2)
155  const double wAtHi = w2 / r * (r + h2);
156 
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)));
161 
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());
165 
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());
169 
170  cornersZ[0] = std::min(cornersZ[0], x1y1AtRef.z());
171  cornersZ[1] = std::max(cornersZ[1], x1y1AtRef.z());
172  }
173  const LocalPoint lpOfCentre((cornersHi[0] + cornersHi[1]) / 2, (cornersLo[2] + cornersHi[2]) / 2, 0);
174  const auto gpOfCentre = refSurf.toGlobal(lpOfCentre);
175  auto bounds = new TrapezoidalPlaneBounds((cornersLo[1] - cornersLo[0]) / 2,
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);
180  }
181  }
182 
184  // Create the chamber
185  RPCChamber* ch = new RPCChamber(chid, surf);
186  // Add the rolls to rhe chamber
187  for (auto rl : rls)
188  ch->add(rl);
189  // Add the chamber to the geometry
190  geometry->add(ch);
191  }
192  return geometry;
193 }

References RPCChamber::add(), cms::cuda::be, Surface::bounds(), chids, RecoIdealGeometry::detIds(), 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(), theComp11Flag, 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().

◆ theComp11Flag

bool RPCGeometryBuilderFromCondDB::theComp11Flag
private

Definition at line 30 of file RPCGeometryBuilderFromCondDB.h.

Referenced by build().

RPCRoll
Definition: RPCRoll.h:12
TkRotation< float >
RPCGeometryBuilderFromCondDB::theComp11Flag
bool theComp11Flag
Definition: RPCGeometryBuilderFromCondDB.h:30
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
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
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:114
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
RecoIdealGeometry::detIds
const std::vector< DetId > & detIds() const
Definition: RecoIdealGeometry.h:85
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
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:31
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:126
Basic3DVector< float >