CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
GEMGeometryBuilderFromCondDB Class Reference

#include <GEMGeometryBuilderFromCondDB.h>

Public Member Functions

void build (GEMGeometry &theGeometry, const RecoIdealGeometry &rgeo)
 
 GEMGeometryBuilderFromCondDB ()
 
 ~GEMGeometryBuilderFromCondDB ()
 

Private Types

typedef ReferenceCountingPointer< BoundPlaneRCPBoundPlane
 

Private Member Functions

RCPBoundPlane boundPlane (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMChamberbuildChamber (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMSuperChamberbuildSuperChamber (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 

Detailed Description

Build the GEMGeometry from the RecoIdealGeometry description stored in Condition DB

Author
M. Maggi - INFN Bari

Definition at line 14 of file GEMGeometryBuilderFromCondDB.h.

Member Typedef Documentation

◆ RCPBoundPlane

Definition at line 23 of file GEMGeometryBuilderFromCondDB.h.

Constructor & Destructor Documentation

◆ GEMGeometryBuilderFromCondDB()

GEMGeometryBuilderFromCondDB::GEMGeometryBuilderFromCondDB ( )

Definition at line 17 of file GEMGeometryBuilderFromCondDB.cc.

17 {}

◆ ~GEMGeometryBuilderFromCondDB()

GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 19 of file GEMGeometryBuilderFromCondDB.cc.

19 {}

Member Function Documentation

◆ boundPlane()

GEMGeometryBuilderFromCondDB::RCPBoundPlane GEMGeometryBuilderFromCondDB::boundPlane ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 187 of file GEMGeometryBuilderFromCondDB.cc.

References cms::cuda::be, angle_units::operators::convertMmToCm(), TkRotation< T >::rotateAxes(), RecoIdealGeometry::rotStart(), RecoIdealGeometry::shapeStart(), and RecoIdealGeometry::tranStart().

189  {
190  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
191  float be = convertMmToCm(*(shapeStart + 0));
192  float te = convertMmToCm(*(shapeStart + 1));
193  float ap = convertMmToCm(*(shapeStart + 2));
194  float ti = convertMmToCm(*(shapeStart + 3));
195  Bounds* bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
196 
197  std::vector<double>::const_iterator tranStart = rgeo.tranStart(gid);
198  Surface::PositionType posResult(
199  convertMmToCm(*(tranStart)), convertMmToCm(*(tranStart + 1)), convertMmToCm(*(tranStart + 2)));
200 
201  std::vector<double>::const_iterator rotStart = rgeo.rotStart(gid);
202  Surface::RotationType rotResult(*(rotStart + 0),
203  *(rotStart + 1),
204  *(rotStart + 2),
205  *(rotStart + 3),
206  *(rotStart + 4),
207  *(rotStart + 5),
208  *(rotStart + 6),
209  *(rotStart + 7),
210  *(rotStart + 8));
211 
212  //Change of axes for the forward
213  Basic3DVector<float> newX(1., 0., 0.);
214  Basic3DVector<float> newY(0., 0., -1.);
215  Basic3DVector<float> newZ(0., 1., 0.);
216 
217  rotResult.rotateAxes(newX, newY, newZ);
218 
219  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
220 }
std::vector< double >::const_iterator rotStart(size_t ind) const
Plane BoundPlane
Definition: Plane.h:94
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
std::vector< double >::const_iterator shapeStart(size_t ind) const
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
Definition: Bounds.h:18
std::vector< double >::const_iterator tranStart(size_t ind) const

◆ build()

void GEMGeometryBuilderFromCondDB::build ( GEMGeometry theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 21 of file GEMGeometryBuilderFromCondDB.cc.

References GEMGeometry::add(), relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), chambers, RecoIdealGeometry::detIds(), l1ctLayer2EG_cff::id, GEMDetId::layer(), LogDebug, GEMDetId::maxLayerId, GEMDetId::maxRollId, GEMDetId::maxStationId, Skims_PA_cff::name, DetId::rawId(), nano_mu_digi_cff::region, relativeConstraints::ring, nano_mu_digi_cff::roll, GEMDetId::roll(), Validation_hcalonly_cfi::sign, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, GEMDetId::superChamberId(), and to_string().

Referenced by GEMGeometryESModule::produce().

21  {
22  const std::vector<DetId>& detids(rgeo.detIds());
23  std::unordered_map<uint32_t, GEMSuperChamber*> superChambers;
24  std::unordered_map<uint32_t, GEMChamber*> chambers;
25  std::unordered_map<uint32_t, GEMEtaPartition*> partitions;
26 
27  for (unsigned int id = 0; id < detids.size(); ++id) {
28  GEMDetId gemid(detids[id]);
29  LogDebug("GEMGeometryBuilder") << "GEMGeometryBuilder adding " << gemid;
30  if (gemid.roll() == 0) {
31  if (gemid.layer() == 0) {
32  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid);
33  superChambers.emplace(gemid.rawId(), gsc);
34  } else {
35  GEMChamber* gch = buildChamber(rgeo, id, gemid);
36  chambers.emplace(gemid.rawId(), gch);
37  }
38  } else {
39  GEMEtaPartition* gep = buildEtaPartition(rgeo, id, gemid);
40  partitions.emplace(gemid.rawId(), gep);
41  }
42  }
43 
45  // TEMP - for backward compatability with old geometry
46  // no superchambers or chambers in old geometry, using etpartitions
47  if (superChambers.empty()) {
48  for (unsigned int id = 0; id < detids.size(); ++id) {
49  GEMDetId gemid(detids[id]);
50  if (gemid.roll() == 1) {
51  GEMChamber* gch = buildChamber(rgeo, id, gemid.chamberId());
52  chambers.emplace(gemid.chamberId().rawId(), gch);
53  if (gemid.layer() == 1) {
54  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid.superChamberId());
55  superChambers.emplace(gemid.superChamberId().rawId(), gsc);
56  }
57  }
58  }
59  }
61 
62  // construct the regions, stations and rings.
63  for (int re = -1; re <= 1; re = re + 2) {
64  GEMRegion* region = new GEMRegion(re);
65 
66  for (int st = 0; st <= GEMDetId::maxStationId; ++st) {
67  GEMStation* station = new GEMStation(re, st);
68  std::string sign(re == -1 ? "-" : "");
69  std::string name("GE" + sign + std::to_string(st) + "/1");
70  station->setName(name);
71 
72  for (int ri = 1; ri <= 1; ++ri) {
73  GEMRing* ring = new GEMRing(re, st, ri);
74 
75  for (auto sch : superChambers) {
76  auto superChamber = sch.second;
77  const GEMDetId scId(superChamber->id());
78  if (scId.region() != re || scId.station() != st || scId.ring() != ri)
79  continue;
80  int ch = scId.chamber();
81 
82  for (int ly = 1; ly <= GEMDetId::maxLayerId; ++ly) {
83  const GEMDetId chId(re, ri, st, ly, ch, 0);
84  auto chamberIt = chambers.find(chId.rawId());
85  if (chamberIt == chambers.end())
86  continue;
87  auto chamber = chamberIt->second;
88 
89  for (int roll = 1; roll <= GEMDetId::maxRollId; ++roll) {
90  const GEMDetId rollId(re, ri, st, ly, ch, roll);
91  auto gepIt = partitions.find(rollId.rawId());
92  if (gepIt == partitions.end())
93  continue;
94  auto gep = gepIt->second;
95 
96  chamber->add(gep);
97  theGeometry.add(gep);
98  }
99 
100  superChamber->add(chamber);
101  theGeometry.add(chamber);
102  }
103 
104  LogDebug("GEMGeometryBuilder") << "Adding super chamber " << scId << " to ring:";
105  ring->add(superChamber);
106  theGeometry.add(superChamber);
107  } // end superChambers
108 
109  if (ring->nSuperChambers()) {
110  LogDebug("GEMGeometryBuilder") << "Adding ring " << ri << " to station "
111  << "re " << re << " st " << st;
112  station->add(ring);
113  theGeometry.add(ring);
114  } else {
115  delete ring;
116  }
117  } // end ring
118 
119  if (station->nRings()) {
120  LogDebug("GEMGeometryBuilder") << "Adding station " << st << " to region " << re;
121  region->add(station);
122  theGeometry.add(station);
123  } else {
124  delete station;
125  }
126  } // end station
127 
128  LogDebug("GEMGeometryBuilder") << "Adding region " << re << " to the geometry";
129  theGeometry.add(region);
130  }
131 }
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
constexpr int chamber() const
Definition: GEMDetId.h:183
static std::string to_string(const XMLCh *ch)
const std::vector< DetId > & detIds() const
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
GEMChamber * buildChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
GEMEtaPartition * buildEtaPartition(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
static constexpr int32_t maxRollId
Definition: GEMDetId.h:36
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
#define LogDebug(id)

◆ buildChamber()

GEMChamber * GEMGeometryBuilderFromCondDB::buildChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 144 of file GEMGeometryBuilderFromCondDB.cc.

References relativeConstraints::chamber, hcalRecHitTable_cff::detId, and LogDebug.

146  {
147  LogDebug("GEMGeometryBuilderFromCondDB") << "buildChamber " << detId;
148 
149  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
150 
151  GEMChamber* chamber = new GEMChamber(detId, surf);
152  return chamber;
153 }
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
#define LogDebug(id)

◆ buildEtaPartition()

GEMEtaPartition * GEMGeometryBuilderFromCondDB::buildEtaPartition ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 155 of file GEMGeometryBuilderFromCondDB.cc.

References cms::cuda::be, angle_units::operators::convertMmToCm(), hcalRecHitTable_cff::detId, GeomDetEnumerators::GEM, LogDebug, Skims_PA_cff::name, gen::npad, RecoIdealGeometry::shapeEnd(), RecoIdealGeometry::shapeStart(), AlCaHLTBitMon_QueryRunRegistry::string, and RecoIdealGeometry::strStart().

157  {
158  std::vector<std::string>::const_iterator strStart = rgeo.strStart(gid);
159  const std::string& name = *(strStart);
160  LogDebug("GEMGeometryBuilderFromCondDB") << "buildEtaPartition " << name << " " << detId;
161 
162  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
163  float be = convertMmToCm(*(shapeStart + 0));
164  float te = convertMmToCm(*(shapeStart + 1));
165  float ap = convertMmToCm(*(shapeStart + 2));
166  float ti = convertMmToCm(*(shapeStart + 3));
167  float nstrip = *(shapeStart + 4);
168  float npad = *(shapeStart + 5);
169  float dphi = (shapeStart + 6 < rgeo.shapeEnd(gid)) ? *(shapeStart + 6) : 0.17715;
170 
171  std::vector<float> pars;
172  pars.emplace_back(be);
173  pars.emplace_back(te);
174  pars.emplace_back(ap);
175  pars.emplace_back(nstrip);
176  pars.emplace_back(npad);
177  pars.emplace_back(dphi);
178 
179  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
181 
182  LogDebug("GEMGeometryBuilderFromCondDB") << "size " << be << " " << te << " " << ap << " " << ti;
183  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
184  return etaPartition;
185 }
std::vector< std::string >::const_iterator strStart(size_t ind) const
std::vector< double >::const_iterator shapeEnd(size_t ind) const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
std::vector< double >::const_iterator shapeStart(size_t ind) const
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
#define LogDebug(id)

◆ buildSuperChamber()

GEMSuperChamber * GEMGeometryBuilderFromCondDB::buildSuperChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 133 of file GEMGeometryBuilderFromCondDB.cc.

References hcalRecHitTable_cff::detId, and LogDebug.

135  {
136  LogDebug("GEMGeometryBuilderFromCondDB") << "buildSuperChamber " << detId;
137 
138  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
139 
140  GEMSuperChamber* superChamber = new GEMSuperChamber(detId, surf);
141  return superChamber;
142 }
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
#define LogDebug(id)