CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
GEMGeometryBuilder Class Reference

#include <GEMGeometryBuilder.h>

Public Member Functions

void build (GEMGeometry &theGeometry, const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
void build (GEMGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
 GEMGeometryBuilder ()
 
 ~GEMGeometryBuilder ()
 

Private Types

typedef ReferenceCountingPointer< BoundPlaneRCPBoundPlane
 

Private Member Functions

RCPBoundPlane boundPlane (const cms::DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
RCPBoundPlane boundPlane (const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
GEMChamberbuildChamber (cms::DDFilteredView &fv, GEMDetId detId) const
 
GEMChamberbuildChamber (DDFilteredView &fv, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (cms::DDFilteredView &fv, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (DDFilteredView &fv, GEMDetId detId) const
 
void buildRegions (GEMGeometry &, const std::vector< GEMSuperChamber * > &)
 
GEMSuperChamberbuildSuperChamber (cms::DDFilteredView &fv, GEMDetId detId) const
 
GEMSuperChamberbuildSuperChamber (DDFilteredView &fv, GEMDetId detId) const
 

Private Attributes

std::map< GEMDetId, std::vector< GEMDetId > > chids
 

Static Private Attributes

static constexpr double k_ScaleFromDD4Hep = (1.0 / dd4hep::cm)
 

Detailed Description

Definition at line 33 of file GEMGeometryBuilder.h.

Member Typedef Documentation

◆ RCPBoundPlane

Definition at line 48 of file GEMGeometryBuilder.h.

Constructor & Destructor Documentation

◆ GEMGeometryBuilder()

GEMGeometryBuilder::GEMGeometryBuilder ( )

Definition at line 40 of file GEMGeometryBuilder.cc.

40 {}

◆ ~GEMGeometryBuilder()

GEMGeometryBuilder::~GEMGeometryBuilder ( )

Definition at line 42 of file GEMGeometryBuilder.cc.

42 {}

Member Function Documentation

◆ boundPlane() [1/2]

GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane ( const cms::DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 466 of file GEMGeometryBuilder.cc.

468  {
469  // extract the position
470  const Double_t* tran = fv.trans();
471  Surface::PositionType posResult(
472  k_ScaleFromDD4Hep * tran[0], k_ScaleFromDD4Hep * tran[1], k_ScaleFromDD4Hep * tran[2]);
473 
474  // now the rotation
475  DDRotationMatrix rota;
476  fv.rot(rota);
477  DD3Vector x, y, z;
478  rota.GetComponents(x, y, z);
479  Surface::RotationType rotResult(float(x.X()),
480  float(x.Y()),
481  float(x.Z()),
482  float(y.X()),
483  float(y.Y()),
484  float(y.Z()),
485  float(z.X()),
486  float(z.Y()),
487  float(z.Z()));
488 
489  //Change of axes for the forward
490  Basic3DVector<float> newX(1., 0., 0.);
491  Basic3DVector<float> newY(0., 0., -1.);
492  Basic3DVector<float> newZ(0., 1., 0.);
493 
494  rotResult.rotateAxes(newX, newY, newZ);
495 
496  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
497 }

References cms::DDFilteredView::rot(), TkRotation< T >::rotateAxes(), and cms::DDFilteredView::trans().

◆ boundPlane() [2/2]

GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane ( const DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 272 of file GEMGeometryBuilder.cc.

274  {
275  // extract the position
276  const DDTranslation& trans(fv.translation());
277  const Surface::PositionType posResult(convertMmToCm(trans.x()), convertMmToCm(trans.y()), convertMmToCm(trans.z()));
278 
279  // now the rotation
280  const DDRotationMatrix& rotation = fv.rotation();
281  DD3Vector x, y, z;
282  rotation.GetComponents(x, y, z);
283 
284  Surface::RotationType rotResult(float(x.X()),
285  float(x.Y()),
286  float(x.Z()),
287  float(y.X()),
288  float(y.Y()),
289  float(y.Z()),
290  float(z.X()),
291  float(z.Y()),
292  float(z.Z()));
293 
294  //Change of axes for the forward
295  Basic3DVector<float> newX(1., 0., 0.);
296  Basic3DVector<float> newY(0., 0., -1.);
297  Basic3DVector<float> newZ(0., 1., 0.);
298 
299  rotResult.rotateAxes(newX, newY, newZ);
300 
301  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
302 }

References geant_units::operators::convertMmToCm(), TkRotation< T >::rotateAxes(), idealTransformation::rotation, DDFilteredView::rotation(), and DDFilteredView::translation().

◆ build() [1/2]

void GEMGeometryBuilder::build ( GEMGeometry theGeometry,
const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 306 of file GEMGeometryBuilder.cc.

308  {
309  std::string attribute = "MuStructure";
310  std::string value = "MuonEndCapGEM";
311  const cms::DDFilter filter(attribute, value);
312  cms::DDFilteredView fv(*cview, filter);
313 
314  MuonGeometryNumbering mdddnum(muonConstants);
315  GEMNumberingScheme gemNum(muonConstants);
316  static constexpr uint32_t levelChamb = 7;
317  int chamb(0), region(0);
318  int theLevelPart = muonConstants.getValue("level");
319  int theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
320  int theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;
321  std::vector<GEMSuperChamber*> superChambers;
322  std::vector<GEMChamber*> chambers;
323 
324  while (fv.firstChild()) {
325  const auto& history = fv.history();
326  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
327  GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
328 #ifdef EDM_ML_DEBUG
329  edm::LogVerbatim("Geometry") << fv.name() << " with " << history.tags.size() << " Levels and ID " << detId
330  << " Mask " << std::hex << GEMDetId::chamberIdMask << std::dec << " and "
331  << GEMDetId(((detId.rawId()) & GEMDetId::chamberIdMask)) << " Levels " << theRingLevel
332  << ":" << theSectorLevel << ":" << history.tags.size() << ":" << fv.level();
333  for (unsigned int k = 0; k < history.tags.size(); ++k)
334  edm::LogVerbatim("Geometry") << "[" << k << "] Tag " << history.tags[k] << " Offset " << history.offsets[k]
335  << " copy " << history.copyNos[k];
336 #endif
337 
338  if (detId.station() == GEMDetId::minStationId0) {
339  if (num.getLevels() == theRingLevel) {
340  if (detId.region() != region) {
341  region = detId.region();
342  chamb = 0;
343  }
344  ++chamb;
345  detId = GEMDetId(detId.region(), detId.ring(), detId.station(), detId.layer(), chamb, 0);
346  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
347  superChambers.emplace_back(gemSuperChamber);
348  } else if (num.getLevels() == theSectorLevel) {
349  GEMChamber* gemChamber = buildChamber(fv, detId);
350  chambers.emplace_back(gemChamber);
351  } else {
352  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
353  theGeometry.add(etaPart);
354  }
355  } else {
356  if (fv.level() == levelChamb) {
357  if (detId.layer() == 1) {
358  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
359  superChambers.emplace_back(gemSuperChamber);
360  }
361  GEMChamber* gemChamber = buildChamber(fv, detId);
362  chambers.emplace_back(gemChamber);
363  } else if (num.getLevels() > theSectorLevel) {
364  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
365  theGeometry.add(etaPart);
366  }
367  }
368  }
369 
370  auto& partitions = theGeometry.etaPartitions();
371  for (auto& gemChamber : chambers) {
372  uint32_t id0 = ((gemChamber->id().rawId()) & GEMDetId::chamberIdMask);
373  for (auto& etaPart : partitions) {
374  if (((etaPart->id().rawId()) & GEMDetId::chamberIdMask) == id0) {
375  gemChamber->add(etaPart);
376  }
377  }
378  theGeometry.add(gemChamber);
379  }
380 
381  buildRegions(theGeometry, superChambers);
382 }

References GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), GEMDetId::chamberIdMask, chambers, TauDecayModes::dec, GEMGeometry::etaPartitions(), ALCARECOTkAlBeamHalo_cff::filter, cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), MuonGeometryConstants::getValue(), cms::DDFilteredView::history(), dqmdumpme::k, cms::DDFilteredView::level(), GEMDetId::minStationId0, cms::DDFilteredView::name(), EgammaValidation_cff::num, HLT_FULL_cff::region, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ build() [2/2]

void GEMGeometryBuilder::build ( GEMGeometry theGeometry,
const DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 45 of file GEMGeometryBuilder.cc.

47  {
48  std::string attribute = "MuStructure";
49  std::string value = "MuonEndCapGEM";
50 
51  // Asking only for the MuonGEM's
53  DDFilteredView fv(*cview, filter);
54 
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("Geometry") << "Building the geometry service";
57  edm::LogVerbatim("Geometry") << "About to run through the GEM structure\n"
58  << " First logical part " << fv.logicalPart().name().name();
59 #endif
60  bool doSuper = fv.firstChild();
61 
62  MuonGeometryNumbering mdddnum(muonConstants);
63  GEMNumberingScheme gemNum(muonConstants);
64 
65 #ifdef EDM_ML_DEBUG
66  edm::LogVerbatim("Geometry") << "doSuperChamber = " << doSuper << " with " << fv.geoHistory() << " Levels "
67  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
68  ;
69 #endif
70  // loop over superchambers
71  std::vector<GEMSuperChamber*> superChambers;
72  while (doSuper) {
73  // getting chamber id from eta partitions
74  fv.firstChild();
75  fv.firstChild();
76 
77 #ifdef EDM_ML_DEBUG
78  edm::LogVerbatim("Geometry") << "MuonGeometry 1 " << fv.geoHistory() << " Levels "
79  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
80 #endif
81  int rawidCh = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
82  GEMDetId detIdCh = GEMDetId(rawidCh);
83 
84  // back to chambers
85 
86  fv.parent();
87  fv.parent();
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("Geometry") << "MuonGeometry 2 " << fv.geoHistory() << " Levels "
90  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
91  gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
92 #endif
93  // currently there is no superchamber in the geometry
94  // only 2 chambers are present separated by a gap.
95  // making superchamber out of the first chamber layer including the gap between chambers
96  if (detIdCh.layer() == 1) { // only make superChambers when doing layer 1
97  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detIdCh);
98  superChambers.push_back(gemSuperChamber);
99  }
100  GEMChamber* gemChamber = ((detIdCh.station() == GEMDetId::minStationId0) ? nullptr : buildChamber(fv, detIdCh));
101 
102  // loop over chambers
103  // only 1 chamber
104  bool doChambers = fv.firstChild();
105  bool loopExecuted = false;
106 
107  while (doChambers) {
108  loopExecuted = true;
109 
110  if (detIdCh.station() == GEMDetId::minStationId0) {
111  fv.firstChild();
112  int rawId = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
113  GEMDetId detId = GEMDetId(rawId);
114  fv.parent();
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("Geometry") << "MuonGeometry 3 " << fv.geoHistory() << " Levels "
117  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
118  gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
119 #endif
120  gemChamber = buildChamber(fv, detId);
121  }
122 
123  // loop over GEMEtaPartitions
124  bool doEtaPart = fv.firstChild();
125 
126  while (doEtaPart) {
127 #ifdef EDM_ML_DEBUG
128  edm::LogVerbatim("Geometry") << "MuonGeometry 4 " << fv.geoHistory() << " Levels "
129  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
130 #endif
131  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
132  GEMDetId detId = GEMDetId(rawid);
133  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
134  gemChamber->add(etaPart);
135  theGeometry.add(etaPart);
136  doEtaPart = fv.nextSibling();
137  }
138 
139  fv.parent();
140 
141  theGeometry.add(gemChamber);
142 
143  doChambers = fv.nextSibling();
144  }
145  fv.parent();
146 
147  doSuper = fv.nextSibling();
148 
149  if (!loopExecuted) {
150  delete gemChamber;
151  }
152  }
153 
154  buildRegions(theGeometry, superChambers);
155 }

References GEMChamber::add(), GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), GEMDetId::layer(), DDFilteredView::logicalPart(), GEMDetId::minStationId0, DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDFilteredView::parent(), GEMDetId::station(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMGeometryESModule::produce().

◆ buildChamber() [1/2]

GEMChamber * GEMGeometryBuilder::buildChamber ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 410 of file GEMGeometryBuilder.cc.

410  {
411  cms::DDSolid solid(fv.solid());
412  auto solidA = solid.solidA();
413  std::vector<double> dpar = solidA.dimensions();
414 
415  double dy = k_ScaleFromDD4Hep * dpar[3]; //length is along local Y
416  double dz = k_ScaleFromDD4Hep * dpar[2]; // thickness is long local Z
417  double dx1 = k_ScaleFromDD4Hep * dpar[0]; // bottom width is along local X
418  double dx2 = k_ScaleFromDD4Hep * dpar[1]; // top width is along local X
419 
420  auto solidB = solid.solidB();
421  dpar = solidB.dimensions();
422 
423  dz += (k_ScaleFromDD4Hep * dpar[2]); // chamber thickness
424 
425  bool isOdd = detId.chamber() % 2;
426  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
427 
428  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
429  return chamber;
430 }

References relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), PVValHelper::dy, PVValHelper::dz, cms::DDFilteredView::solid(), and cms::DDSolid::solidA().

◆ buildChamber() [2/2]

GEMChamber * GEMGeometryBuilder::buildChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 191 of file GEMGeometryBuilder.cc.

191  {
192 #ifdef EDM_ML_DEBUG
193  edm::LogVerbatim("Geometry") << "buildChamber " << fv.logicalPart().name().name() << " " << detId;
194 #endif
196  bool ge0Station = detId.station() == GEMDetId::minStationId0;
197  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
198 
199  double dy = convertMmToCm(dpar[0]); //length is along local Y
200  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
201  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
202  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
203 
204  if (!ge0Station) {
205  dpar = solid.solidB().parameters();
206  dz += convertMmToCm(dpar[3]); // chamber thickness
207  }
208 
209  bool isOdd = ge0Station ? false : detId.chamber() % 2;
210 
211  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
212 
213 #ifdef EDM_ML_DEBUG
214  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
215 #endif
216  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
217  return chamber;
218 }

References relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), geant_units::operators::convertMmToCm(), PVValHelper::dy, PVValHelper::dz, funct::false, DDFilteredView::logicalPart(), GEMDetId::minStationId0, DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), and GEMDetId::station().

◆ buildEtaPartition() [1/2]

GEMEtaPartition * GEMGeometryBuilder::buildEtaPartition ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 432 of file GEMGeometryBuilder.cc.

432  {
433  // EtaPartition specific parameter (nstrips and npads)
434 
435  auto nStrips = fv.get<double>("nStrips");
436  auto nPads = fv.get<double>("nPads");
437  auto dPhi = fv.get<double>("dPhi");
438  // EtaPartition specific parameter (size)
439 
440  std::vector<double> dpar = fv.parameters();
441 
442  double ti = 0.4; // half thickness
443 
444  const std::vector<float> pars{float(k_ScaleFromDD4Hep * dpar[0]),
445  float(k_ScaleFromDD4Hep * dpar[1]),
446  float(k_ScaleFromDD4Hep * dpar[3]),
447  float(nStrips),
448  float(nPads),
449  float(dPhi)};
450 
451  bool isOdd = detId.chamber() % 2;
452  RCPBoundPlane surf(
453  boundPlane(fv,
455  k_ScaleFromDD4Hep * dpar[0], k_ScaleFromDD4Hep * dpar[1], k_ScaleFromDD4Hep * dpar[3], ti),
456  isOdd));
457 
458  std::string_view name = fv.name();
459 
461 
462  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
463  return etaPartition;
464 }

References GEMDetId::chamber(), HLT_FULL_cff::dPhi, dqmMemoryStats::float, GeomDetEnumerators::GEM, cms::DDFilteredView::get(), Skims_PA_cff::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ buildEtaPartition() [2/2]

GEMEtaPartition * GEMGeometryBuilder::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 220 of file GEMGeometryBuilder.cc.

220  {
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("Geometry") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId;
223 #endif
224  // EtaPartition specific parameter (nstrips and npads)
225  DDValue numbOfStrips("nStrips");
226  DDValue numbOfPads("nPads");
227  DDValue delPhi("dPhi");
228  std::vector<const DDsvalues_type*> specs(fv.specifics());
229  std::vector<const DDsvalues_type*>::iterator is = specs.begin();
230  double nStrips = 0., nPads = 0., dPhi = 0.;
231  for (; is != specs.end(); is++) {
232  if (DDfetch(*is, numbOfStrips))
233  nStrips = numbOfStrips.doubles()[0];
234  if (DDfetch(*is, numbOfPads))
235  nPads = numbOfPads.doubles()[0];
236  if (DDfetch(*is, delPhi))
237  dPhi = delPhi.doubles()[0];
238  }
239 #ifdef EDM_ML_DEBUG
240  edm::LogVerbatim("Geometry") << ((nStrips == 0.) ? ("No nStrips found!!")
241  : ("Number of strips: " + std::to_string(nStrips)));
242  edm::LogVerbatim("Geometry") << ((nPads == 0.) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
243 #endif
244  // EtaPartition specific parameter (size)
245  std::vector<double> dpar = fv.logicalPart().solid().parameters();
246 
247  double be = convertMmToCm(dpar[4]); // half bottom edge
248  double te = convertMmToCm(dpar[8]); // half top edge
249  double ap = convertMmToCm(dpar[0]); // half apothem
250  double ti = 0.4; // half thickness
251 
252  std::vector<float> pars;
253  pars.emplace_back(be);
254  pars.emplace_back(te);
255  pars.emplace_back(ap);
256  pars.emplace_back(nStrips);
257  pars.emplace_back(nPads);
258  pars.emplace_back(dPhi);
259 
260  bool isOdd = detId.chamber() % 2;
261  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd));
262  std::string name = fv.logicalPart().name().name();
264 
265 #ifdef EDM_ML_DEBUG
266  edm::LogVerbatim("Geometry") << "size " << be << " " << te << " " << ap << " " << ti;
267 #endif
268  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
269  return etaPartition;
270 }

References cms::cuda::be, GEMDetId::chamber(), geant_units::operators::convertMmToCm(), DDfetch(), delPhi(), DDValue::doubles(), HLT_FULL_cff::dPhi, GeomDetEnumerators::GEM, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), me0TriggerPseudoDigis_cff::nStrips, DDSolid::parameters(), DDLogicalPart::solid(), DDFilteredView::specifics(), HistogramManager_cfi::specs, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ buildRegions()

void GEMGeometryBuilder::buildRegions ( GEMGeometry theGeometry,
const std::vector< GEMSuperChamber * > &  superChambers 
)
private

Definition at line 499 of file GEMGeometryBuilder.cc.

499  {
500  // construct the regions, stations and rings.
501  for (int re = -1; re <= 1; re = re + 2) {
502  GEMRegion* region = new GEMRegion(re);
503  for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
504  bool ge0Station = st == GEMDetId::minStationId0;
505  GEMStation* station = new GEMStation(re, st);
506  std::string sign(re == -1 ? "-" : "");
507  std::string suffix = ge0Station ? "" : "/1";
508  std::string name = "GE" + sign + std::to_string(st) + suffix;
509  station->setName(name);
510  bool foundSuperChamber = false;
511  for (int ri = 1; ri <= 1; ++ri) {
512  GEMRing* ring = new GEMRing(re, st, ri);
513  for (auto superChamber : superChambers) {
514  const GEMDetId detId(superChamber->id());
515  if (detId.region() != re || detId.station() != st || detId.ring() != ri)
516  continue;
517 
518  foundSuperChamber = true;
520 
521  // GEMDetId::minLayerId is to id the superchamber, so minLayerId+1 is the first layer
522  for (int la = GEMDetId::minLayerId + 1; la <= nlayers; ++la) {
523  GEMDetId chId(detId.region(), detId.ring(), detId.station(), la, detId.chamber(), 0);
524  auto chamber = theGeometry.chamber(chId);
525  if (!chamber) {
526  edm::LogWarning("GEMGeometryBuilder") << "Missing chamber " << chId;
527  }
528  superChamber->add(chamber);
529  }
530  ring->add(superChamber);
531  theGeometry.add(superChamber);
532 #ifdef EDM_ML_DEBUG
533  edm::LogVerbatim("Geometry") << "Adding super chamber " << detId << " to ring: "
534  << "re " << re << " st " << st << " ri " << ri;
535 #endif
536  }
537 #ifdef EDM_ML_DEBUG
538  edm::LogVerbatim("Geometry") << "Adding ring " << ri << " to station "
539  << "re " << re << " st " << st;
540 #endif
541  if (foundSuperChamber) {
542  station->add(ring);
543  theGeometry.add(ring);
544  }
545  }
546  if (!foundSuperChamber) {
547 #ifdef EDM_ML_DEBUG
548  edm::LogVerbatim("Geometry") << "No superchamber found: re:" << re << " st:" << st;
549 #endif
550  delete station;
551  } else {
552 #ifdef EDM_ML_DEBUG
553  edm::LogVerbatim("Geometry") << "Adding station " << st << " to region " << re;
554 #endif
555  region->add(station);
556  theGeometry.add(station);
557  }
558  }
559 #ifdef EDM_ML_DEBUG
560  edm::LogVerbatim("Geometry") << "Adding region " << re << " to the geometry ";
561 #endif
562  theGeometry.add(region);
563  }
564 }

References GEMGeometry::add(), relativeConstraints::chamber, GEMGeometry::chamber(), GEMDetId::maxLayerId, GEMDetId::maxLayerId0, GEMDetId::maxStationId, GEMDetId::minLayerId, GEMDetId::minStationId0, Skims_PA_cff::name, nlayers, HLT_FULL_cff::region, relativeConstraints::ring, Validation_hcalonly_cfi::sign, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and createPayload::suffix.

◆ buildSuperChamber() [1/2]

GEMSuperChamber * GEMGeometryBuilder::buildSuperChamber ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 384 of file GEMGeometryBuilder.cc.

384  {
385  cms::DDSolid solid(fv.solid());
386  auto solidA = solid.solidA();
387  std::vector<double> dpar = solidA.dimensions();
388 
389  double dy = k_ScaleFromDD4Hep * dpar[3]; //length is along local Y
390  double dz = k_ScaleFromDD4Hep * dpar[2]; // thickness is long local Z
391  double dx1 = k_ScaleFromDD4Hep * dpar[0]; // bottom width is along local X
392  double dx2 = k_ScaleFromDD4Hep * dpar[1]; // top width is along loc
393 
394  auto solidB = solid.solidB();
395  dpar = solidB.dimensions();
396  const int nch = 2;
397  const double chgap = 2.105;
398 
399  dz += (k_ScaleFromDD4Hep * dpar[2]); // chamber thickness
400  dz *= nch; // 2 chambers in superchamber
401  dz += chgap; // gap between chambers
402 
403  bool isOdd = detId.chamber() % 2;
404  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
405 
406  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
407  return superChamber;
408 }

References GEMDetId::chamber(), PVValHelper::dy, PVValHelper::dz, cms::DDFilteredView::solid(), cms::DDSolid::solidA(), and GEMDetId::superChamberId().

◆ buildSuperChamber() [2/2]

GEMSuperChamber * GEMGeometryBuilder::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 157 of file GEMGeometryBuilder.cc.

157  {
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("Geometry") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId;
160 #endif
162  bool ge0Station = detId.station() == GEMDetId::minStationId0;
163  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
164 
165  double dy = convertMmToCm(dpar[0]); //length is along local Y
166  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
167  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
168  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
169 
170  if (!ge0Station) {
171  const int nch = 2;
172  const double chgap = 2.105;
173 
174  dpar = solid.solidB().parameters();
175 
176  dz += convertMmToCm(dpar[3]); // chamber thickness
177  dz *= nch; // 2 chambers in superchamber
178  dz += chgap; // gap between chambers
179  }
180 
181  bool isOdd = detId.chamber() % 2;
182  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
183 
184 #ifdef EDM_ML_DEBUG
185  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
186 #endif
187  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
188  return superChamber;
189 }

References GEMDetId::chamber(), geant_units::operators::convertMmToCm(), PVValHelper::dy, PVValHelper::dz, DDFilteredView::logicalPart(), GEMDetId::minStationId0, DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DDLogicalPart::solid(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), GEMDetId::station(), and GEMDetId::superChamberId().

Member Data Documentation

◆ chids

std::map<GEMDetId, std::vector<GEMDetId> > GEMGeometryBuilder::chids
private

Definition at line 45 of file GEMGeometryBuilder.h.

◆ k_ScaleFromDD4Hep

constexpr double GEMGeometryBuilder::k_ScaleFromDD4Hep = (1.0 / dd4hep::cm)
staticconstexprprivate

Definition at line 71 of file GEMGeometryBuilder.h.

cms::DDSolid
Definition: DDFilteredView.h:33
GEMGeometryBuilder::boundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
Definition: GEMGeometryBuilder.cc:272
cms::DDFilteredView::rot
const Double_t * rot() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:120
DDBooleanSolid::solidB
DDSolid solidB(void) const
Definition: DDSolid.cc:468
TkRotation< float >
DDAxes::y
GEMNumberingScheme
Definition: GEMNumberingScheme.h:9
GEMGeometry::add
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
GEMGeometryBuilder::buildRegions
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber * > &)
Definition: GEMGeometryBuilder.cc:499
cms::DDFilteredView::parameters
const std::vector< double > parameters() const
extract shape parameters
Definition: DDFilteredView.cc:536
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
funct::false
false
Definition: Factorize.h:29
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:190
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
HistogramManager_cfi.specs
specs
Definition: HistogramManager_cfi.py:83
GEMEtaPartition
Definition: GEMEtaPartition.h:12
GEMDetId::superChamberId
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:207
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
GEMDetId::maxStationId
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
DDAxes::x
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
GEMDetId::minLayerId
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
cms::DDFilteredView
Definition: DDFilteredView.h:70
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13703
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
cms::DDSolid::solidA
dd4hep::Solid solidA() const
Definition: DDFilteredView.cc:17
createPayload.suffix
suffix
Definition: createPayload.py:281
cms::DDFilteredView::name
std::string_view name() const
Definition: DDFilteredView.cc:854
DDBooleanSolid
Definition: DDSolid.h:173
cms::DDFilteredView::get
T get(const std::string &)
extract attribute value
cms::DDFilteredView::solid
dd4hep::Solid solid() const
Definition: DDFilteredView.cc:862
GEMGeometryBuilder::buildChamber
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
Definition: GEMGeometryBuilder.cc:191
cms::DDFilteredView::trans
const Double_t * trans() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:101
GEMChamber::add
void add(const GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:21
cms::DDFilter
Definition: DDFilteredView.h:59
GEMGeometryBuilder::buildEtaPartition
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
Definition: GEMGeometryBuilder.cc:220
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
GEMDetId::minStationId0
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
GEMStation
Definition: GEMStation.h:19
DDBase::name
const N & name() const
Definition: DDBase.h:59
DDAxes::z
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMRing
Definition: GEMRing.h:18
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:19
GEMDetId::chamberIdMask
static constexpr uint32_t chamberIdMask
Definition: GEMDetId.h:70
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
GEMDetId::maxLayerId0
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
delPhi
static double delPhi(const double phi1, const double phi2)
Definition: FFTGenericScaleCalculator.cc:20
GEMDetId
Definition: GEMDetId.h:18
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88267
GEMGeometryBuilder::RCPBoundPlane
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
Definition: GEMGeometryBuilder.h:48
value
Definition: value.py:1
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition: MuonGeometryConstants.cc:8
PVValHelper::dy
Definition: PVValidationHelpers.h:50
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
GEMGeometryBuilder::buildSuperChamber
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
Definition: GEMGeometryBuilder.cc:157
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
DDFilteredView::specifics
std::vector< const DDsvalues_type * > specifics() const
Definition: DDFilteredView.cc:32
me0TriggerPseudoDigis_cff.nStrips
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Definition: me0TriggerPseudoDigis_cff.py:26
GEMChamber
Definition: GEMChamber.h:19
MuonBaseNumber
Definition: MuonBaseNumber.h:21
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
BoundPlane
Plane BoundPlane
Definition: Plane.h:94
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
PVValHelper::dz
Definition: PVValidationHelpers.h:51
DDValue
Definition: DDValue.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
GEMDetId::maxLayerId
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
GEMDetId::chamberId
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204
GEMGeometryBuilder::k_ScaleFromDD4Hep
static constexpr double k_ScaleFromDD4Hep
Definition: GEMGeometryBuilder.h:71
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
GeomDetEnumerators::GEM
Definition: GeomDetEnumerators.h:21
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
MuonGeometryNumbering
Definition: MuonGeometryNumbering.h:24
GEMGeometry::etaPartitions
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
DDBooleanSolid::solidA
DDSolid solidA(void) const
Definition: DDSolid.cc:466
DDFilteredView
Definition: DDFilteredView.h:20
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
GEMChamber::id
GEMDetId id() const
Return the GEMDetId of this chamber.
Definition: GEMChamber.cc:17
cms::cuda::be
int be
Definition: HistoContainer.h:126
GEMRegion
Definition: GEMRegion.h:19
GEMGeometry::chamber
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
edm::Log
Definition: MessageLogger.h:70
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
GEMEtaPartitionSpecs
Definition: GEMEtaPartitionSpecs.h:18
Basic3DVector< float >
nlayers
Definition: HIMultiTrackSelector.h:48