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 DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
void build (GEMGeometry &theGeometry, const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
 GEMGeometryBuilder ()
 
 ~GEMGeometryBuilder ()
 

Private Types

typedef ReferenceCountingPointer< BoundPlaneRCPBoundPlane
 

Private Member Functions

RCPBoundPlane boundPlane (const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
RCPBoundPlane boundPlane (const cms::DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
GEMChamberbuildChamber (DDFilteredView &fv, GEMDetId detId) const
 
GEMChamberbuildChamber (cms::DDFilteredView &fv, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (DDFilteredView &fv, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (cms::DDFilteredView &fv, GEMDetId detId) const
 
void buildRegions (GEMGeometry &, const std::vector< GEMSuperChamber *> &, bool demonstratorGeometry)
 
GEMSuperChamberbuildSuperChamber (DDFilteredView &fv, GEMDetId detId) const
 
GEMSuperChamberbuildSuperChamber (cms::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 44 of file GEMGeometryBuilder.cc.

44 {}

◆ ~GEMGeometryBuilder()

GEMGeometryBuilder::~GEMGeometryBuilder ( )

Definition at line 46 of file GEMGeometryBuilder.cc.

46 {}

Member Function Documentation

◆ boundPlane() [1/2]

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

Definition at line 309 of file GEMGeometryBuilder.cc.

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

311  {
312  // extract the position
313  const DDTranslation& trans(fv.translation());
314  const Surface::PositionType posResult(convertMmToCm(trans.x()), convertMmToCm(trans.y()), convertMmToCm(trans.z()));
315 
316  // now the rotation
317  const DDRotationMatrix& rotation = fv.rotation();
318  DD3Vector x, y, z;
319  rotation.GetComponents(x, y, z);
320 
321  Surface::RotationType rotResult(float(x.X()),
322  float(x.Y()),
323  float(x.Z()),
324  float(y.X()),
325  float(y.Y()),
326  float(y.Z()),
327  float(z.X()),
328  float(z.Y()),
329  float(z.Z()));
330 
331  //Change of axes for the forward
332  Basic3DVector<float> newX(1., 0., 0.);
333  Basic3DVector<float> newY(0., 0., -1.);
334  Basic3DVector<float> newZ(0., 1., 0.);
335 
336  rotResult.rotateAxes(newX, newY, newZ);
337 
338  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
339 }
Plane BoundPlane
Definition: Plane.h:94
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

◆ boundPlane() [2/2]

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

Definition at line 527 of file GEMGeometryBuilder.cc.

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

529  {
530  // extract the position
531  const Double_t* tran = fv.trans();
532  Surface::PositionType posResult(
533  k_ScaleFromDD4hep * tran[0], k_ScaleFromDD4hep * tran[1], k_ScaleFromDD4hep * tran[2]);
534 
535  // now the rotation
536  DDRotationMatrix rota;
537  fv.rot(rota);
538  DD3Vector x, y, z;
539  rota.GetComponents(x, y, z);
540  Surface::RotationType rotResult(float(x.X()),
541  float(x.Y()),
542  float(x.Z()),
543  float(y.X()),
544  float(y.Y()),
545  float(y.Z()),
546  float(z.X()),
547  float(z.Y()),
548  float(z.Z()));
549 
550  //Change of axes for the forward
551  Basic3DVector<float> newX(1., 0., 0.);
552  Basic3DVector<float> newY(0., 0., -1.);
553  Basic3DVector<float> newZ(0., 1., 0.);
554 
555  rotResult.rotateAxes(newX, newY, newZ);
556 
557  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
558 }
Plane BoundPlane
Definition: Plane.h:94
const Double_t * rot() const
The absolute rotation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
const Double_t * trans() const
The absolute translation of the current node.
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
static constexpr double k_ScaleFromDD4hep

◆ build() [1/2]

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

Definition at line 49 of file GEMGeometryBuilder.cc.

References GEMChamber::add(), GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), hcalRecHitTable_cff::detId, 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(), nano_mu_digi_cff::rawId, GEMDetId::station(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMGeometryESModule::produce().

51  {
52  std::string attribute = "MuStructure";
53  std::string value = "MuonEndCapGEM";
54 
55  // Asking only for the MuonGEM's
56  DDSpecificsMatchesValueFilter filterGE2{DDValue(attribute, value, 0.0)};
57  DDFilteredView fvGE2(*cview, filterGE2);
58 
59  MuonGeometryNumbering mdddnum(muonConstants);
60  GEMNumberingScheme gemNum(muonConstants);
61 
62  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
63  int nGE21 = 0;
64  bool doSuper = fvGE2.firstChild();
65  while (doSuper) {
66  // getting chamber id from eta partitions
67  fvGE2.firstChild();
68  fvGE2.firstChild();
69  int rawidCh = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fvGE2.geoHistory()));
70  GEMDetId detIdCh = GEMDetId(rawidCh);
71  if (detIdCh.station() == 2)
72  nGE21++;
73 
74  // back to chambers
75  fvGE2.parent();
76  fvGE2.parent();
77  doSuper = fvGE2.nextSibling();
78  }
79  bool demonstratorGeometry = nGE21 % 2 == 1;
80 
81 #ifdef EDM_ML_DEBUG
82  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
83  << demonstratorGeometry;
84 #endif
85 
86  // Asking only for the MuonGEM's
88  DDFilteredView fv(*cview, filter);
89 
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("Geometry") << "Building the geometry service";
92  edm::LogVerbatim("Geometry") << "About to run through the GEM structure\n"
93  << " First logical part " << fv.logicalPart().name().name();
94 #endif
95  doSuper = fv.firstChild();
96 
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("Geometry") << "doSuperChamber = " << doSuper << " with " << fv.geoHistory() << " Levels "
99  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
100  ;
101 #endif
102  // loop over superchambers
103  std::vector<GEMSuperChamber*> superChambers;
104  while (doSuper) {
105  // getting chamber id from eta partitions
106  fv.firstChild();
107  fv.firstChild();
108 
109 #ifdef EDM_ML_DEBUG
110  edm::LogVerbatim("Geometry") << "MuonGeometry 1 " << fv.geoHistory() << " Levels "
111  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
112 #endif
113  int rawidCh = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
114  GEMDetId detIdCh = GEMDetId(rawidCh);
115 
116  // back to chambers
117 
118  fv.parent();
119  fv.parent();
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("Geometry") << "MuonGeometry 2 " << fv.geoHistory() << " Levels "
122  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
123  gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
124 #endif
125  // currently there is no superchamber in the geometry
126  // only 2 chambers are present separated by a gap.
127  // making superchamber out of the first chamber layer including the gap between chambers
128 
129  // In Run 3 we also have a GE2/1 station at layer 2. We make sure
130  // the superchamber gets built but also we build on the first
131  // layer for the other stations so the superchamber is in the
132  // right position there.
133  if ((detIdCh.layer() == 1) || (detIdCh.layer() == 2 and detIdCh.station() == 2 and demonstratorGeometry)) {
134  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detIdCh);
135  superChambers.push_back(gemSuperChamber);
136  }
137  GEMChamber* gemChamber = ((detIdCh.station() == GEMDetId::minStationId0) ? nullptr : buildChamber(fv, detIdCh));
138 
139  // loop over chambers
140  // only 1 chamber
141  bool doChambers = fv.firstChild();
142  bool loopExecuted = false;
143 
144  while (doChambers) {
145  loopExecuted = true;
146 
147  if (detIdCh.station() == GEMDetId::minStationId0) {
148  fv.firstChild();
149  int rawId = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
151  fv.parent();
152 #ifdef EDM_ML_DEBUG
153  edm::LogVerbatim("Geometry") << "MuonGeometry 3 " << fv.geoHistory() << " Levels "
154  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
155  gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
156 #endif
157  gemChamber = buildChamber(fv, detId);
158  }
159 
160  // loop over GEMEtaPartitions
161  bool doEtaPart = fv.firstChild();
162 
163  while (doEtaPart) {
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("Geometry") << "MuonGeometry 4 " << fv.geoHistory() << " Levels "
166  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
167 #endif
168  int rawid = gemNum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
169  GEMDetId detId = GEMDetId(rawid);
170  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
171  gemChamber->add(etaPart);
172  theGeometry.add(etaPart);
173  doEtaPart = fv.nextSibling();
174  }
175 
176  fv.parent();
177 
178  theGeometry.add(gemChamber);
179 
180  doChambers = fv.nextSibling();
181  }
182  fv.parent();
183 
184  doSuper = fv.nextSibling();
185 
186  if (!loopExecuted) {
187  delete gemChamber;
188  }
189  }
190 
191  buildRegions(theGeometry, superChambers, demonstratorGeometry);
192 }
Log< level::Info, true > LogVerbatim
constexpr int station() const
Definition: GEMDetId.h:179
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber *> &, bool demonstratorGeometry)
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
constexpr int layer() const
Definition: GEMDetId.h:190
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
Definition: value.py:1
void add(const GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:21
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81

◆ build() [2/2]

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

Definition at line 343 of file GEMGeometryBuilder.cc.

References GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), GEMDetId::chamberIdMask, chambers, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), TauDecayModes::dec, hcalRecHitTable_cff::detId, 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, nano_mu_digi_cff::region, and AlCaHLTBitMon_QueryRunRegistry::string.

345  {
346  std::string attribute = "MuStructure";
347  std::string value = "MuonEndCapGEM";
348  const cms::DDFilter filterGE2(attribute, value);
349  cms::DDFilteredView fvGE2(*cview, filterGE2);
350 
351  MuonGeometryNumbering mdddnum(muonConstants);
352  GEMNumberingScheme gemNum(muonConstants);
353  static constexpr uint32_t levelChamb = 7;
354  int chamb(0), region(0);
355  int theLevelPart = muonConstants.getValue("level");
356  int theRingLevel = muonConstants.getValue("mg_ring") / theLevelPart;
357  int theSectorLevel = muonConstants.getValue("mg_sector") / theLevelPart;
358 
359  // Check for the demonstrator geometry (only 1 chamber of GE2/1)
360  int nGE21 = 0;
361  while (fvGE2.firstChild()) {
362  const auto& history = fvGE2.history();
363  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
364  GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
365  if (detId.station() == GEMDetId::minStationId0) {
366  } else {
367  if (fvGE2.level() == levelChamb) {
368  if (detId.station() == 2)
369  nGE21++;
370  }
371  }
372  }
373 
374  bool demonstratorGeometry = nGE21 % 2 == 1;
375 #ifdef EDM_ML_DEBUG
376  edm::LogVerbatim("Geometry") << "Found " << nGE21 << " GE2/1 chambers. Demonstrator geometry on? "
377  << demonstratorGeometry;
378 #endif
379 
380  const cms::DDFilter filter(attribute, value);
381  cms::DDFilteredView fv(*cview, filter);
382  std::vector<GEMSuperChamber*> superChambers;
383  std::vector<GEMChamber*> chambers;
384 
385  while (fv.firstChild()) {
386  const auto& history = fv.history();
387  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
388  GEMDetId detId(gemNum.baseNumberToUnitNumber(num));
389 #ifdef EDM_ML_DEBUG
390  edm::LogVerbatim("Geometry") << fv.name() << " with " << history.tags.size() << " Levels and ID " << detId
391  << " Mask " << std::hex << GEMDetId::chamberIdMask << std::dec << " and "
392  << GEMDetId(((detId.rawId()) & GEMDetId::chamberIdMask)) << " Levels " << theRingLevel
393  << ":" << theSectorLevel << ":" << history.tags.size() << ":" << fv.level();
394  for (unsigned int k = 0; k < history.tags.size(); ++k)
395  edm::LogVerbatim("Geometry") << "[" << k << "] Tag " << history.tags[k] << " Offset " << history.offsets[k]
396  << " copy " << history.copyNos[k];
397 #endif
398 
399  if (detId.station() == GEMDetId::minStationId0) {
400  if (num.getLevels() == theRingLevel) {
401  if (detId.region() != region) {
402  region = detId.region();
403  chamb = 0;
404  }
405  ++chamb;
406  detId = GEMDetId(detId.region(), detId.ring(), detId.station(), detId.layer(), chamb, 0);
407  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
408  superChambers.emplace_back(gemSuperChamber);
409  } else if (num.getLevels() == theSectorLevel) {
410  GEMChamber* gemChamber = buildChamber(fv, detId);
411  chambers.emplace_back(gemChamber);
412  } else {
413  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
414  theGeometry.add(etaPart);
415  }
416  } else {
417  if (fv.level() == levelChamb) {
418  if ((detId.layer() == 1) || (detId.layer() == 2 and detId.station() == 2 and demonstratorGeometry)) {
419  GEMSuperChamber* gemSuperChamber = buildSuperChamber(fv, detId);
420  superChambers.emplace_back(gemSuperChamber);
421  }
422  GEMChamber* gemChamber = buildChamber(fv, detId);
423  chambers.emplace_back(gemChamber);
424  } else if (num.getLevels() > theSectorLevel) {
425  GEMEtaPartition* etaPart = buildEtaPartition(fv, detId);
426  theGeometry.add(etaPart);
427  }
428  }
429  }
430 
431  auto& partitions = theGeometry.etaPartitions();
432  for (auto& gemChamber : chambers) {
433  uint32_t id0 = ((gemChamber->id().rawId()) & GEMDetId::chamberIdMask);
434  for (auto& etaPart : partitions) {
435  if (((etaPart->id().rawId()) & GEMDetId::chamberIdMask) == id0) {
436  gemChamber->add(etaPart);
437  }
438  }
439  theGeometry.add(gemChamber);
440  }
441 
442  buildRegions(theGeometry, superChambers, demonstratorGeometry);
443 }
int getValue(const std::string &name) const
Log< level::Info, true > LogVerbatim
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber *> &, bool demonstratorGeometry)
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
GEMDetId id() const
Return the GEMDetId of this chamber.
Definition: GEMChamber.cc:17
static constexpr uint32_t chamberIdMask
Definition: GEMDetId.h:70
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
Definition: value.py:1
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void add(const GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:21
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40

◆ buildChamber() [1/2]

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

Definition at line 228 of file GEMGeometryBuilder.cc.

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

228  {
229 #ifdef EDM_ML_DEBUG
230  edm::LogVerbatim("Geometry") << "buildChamber " << fv.logicalPart().name().name() << " " << detId;
231 #endif
233  bool ge0Station = detId.station() == GEMDetId::minStationId0;
234  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
235 
236  double dy = convertMmToCm(dpar[0]); //length is along local Y
237  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
238  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
239  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
240 
241  if (!ge0Station) {
242  dpar = solid.solidB().parameters();
243  dz += convertMmToCm(dpar[3]); // chamber thickness
244  }
245 
246  bool isOdd = ge0Station ? false : detId.chamber() % 2;
247 
248  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
249 
250 #ifdef EDM_ML_DEBUG
251  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
252 #endif
253  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
254  return chamber;
255 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
DDSolid solidB(void) const
Definition: DDSolid.cc:472
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.

◆ buildChamber() [2/2]

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

Definition at line 471 of file GEMGeometryBuilder.cc.

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

471  {
472  cms::DDSolid solid(fv.solid());
473  auto solidA = solid.solidA();
474  std::vector<double> dpar = solidA.dimensions();
475 
476  double dy = k_ScaleFromDD4hep * dpar[3]; //length is along local Y
477  double dz = k_ScaleFromDD4hep * dpar[2]; // thickness is long local Z
478  double dx1 = k_ScaleFromDD4hep * dpar[0]; // bottom width is along local X
479  double dx2 = k_ScaleFromDD4hep * dpar[1]; // top width is along local X
480 
481  auto solidB = solid.solidB();
482  dpar = solidB.dimensions();
483 
484  dz += (k_ScaleFromDD4hep * dpar[2]); // chamber thickness
485 
486  bool isOdd = detId.chamber() % 2;
487  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
488 
489  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
490  return chamber;
491 }
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
dd4hep::Solid solidA() const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
dd4hep::Solid solid() const
static constexpr double k_ScaleFromDD4hep

◆ buildEtaPartition() [1/2]

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

Definition at line 257 of file GEMGeometryBuilder.cc.

References cms::cuda::be, angle_units::operators::convertMmToCm(), DDfetch(), delPhi(), hcalRecHitTable_cff::detId, DDValue::doubles(), 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, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

257  {
258 #ifdef EDM_ML_DEBUG
259  edm::LogVerbatim("Geometry") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId;
260 #endif
261  // EtaPartition specific parameter (nstrips and npads)
262  DDValue numbOfStrips("nStrips");
263  DDValue numbOfPads("nPads");
264  DDValue delPhi("dPhi");
265  std::vector<const DDsvalues_type*> specs(fv.specifics());
266  std::vector<const DDsvalues_type*>::iterator is = specs.begin();
267  double nStrips = 0., nPads = 0., dPhi = 0.;
268  for (; is != specs.end(); is++) {
269  if (DDfetch(*is, numbOfStrips))
270  nStrips = numbOfStrips.doubles()[0];
271  if (DDfetch(*is, numbOfPads))
272  nPads = numbOfPads.doubles()[0];
273  if (DDfetch(*is, delPhi))
274  dPhi = delPhi.doubles()[0];
275  }
276 #ifdef EDM_ML_DEBUG
277  edm::LogVerbatim("Geometry") << ((nStrips == 0.) ? ("No nStrips found!!")
278  : ("Number of strips: " + std::to_string(nStrips)));
279  edm::LogVerbatim("Geometry") << ((nPads == 0.) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
280 #endif
281  // EtaPartition specific parameter (size)
282  std::vector<double> dpar = fv.logicalPart().solid().parameters();
283 
284  double be = convertMmToCm(dpar[4]); // half bottom edge
285  double te = convertMmToCm(dpar[8]); // half top edge
286  double ap = convertMmToCm(dpar[0]); // half apothem
287  double ti = 0.4; // half thickness
288 
289  std::vector<float> pars;
290  pars.emplace_back(be);
291  pars.emplace_back(te);
292  pars.emplace_back(ap);
293  pars.emplace_back(nStrips);
294  pars.emplace_back(nPads);
295  pars.emplace_back(dPhi);
296 
297  bool isOdd = detId.chamber() % 2;
298  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd));
299  std::string name = fv.logicalPart().name().name();
301 
302 #ifdef EDM_ML_DEBUG
303  edm::LogVerbatim("Geometry") << "size " << be << " " << te << " " << ap << " " << ti;
304 #endif
305  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
306  return etaPartition;
307 }
Log< level::Info, true > LogVerbatim
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
static std::string to_string(const XMLCh *ch)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
static double delPhi(const double phi1, const double phi2)
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< const DDsvalues_type * > specifics() const
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.

◆ buildEtaPartition() [2/2]

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

Definition at line 493 of file GEMGeometryBuilder.cc.

References hcalRecHitTable_cff::detId, nano_mu_digi_cff::float, GeomDetEnumerators::GEM, cms::DDFilteredView::get(), Skims_PA_cff::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), and AlCaHLTBitMon_QueryRunRegistry::string.

493  {
494  // EtaPartition specific parameter (nstrips and npads)
495 
496  auto nStrips = fv.get<double>("nStrips");
497  auto nPads = fv.get<double>("nPads");
498  auto dPhi = fv.get<double>("dPhi");
499  // EtaPartition specific parameter (size)
500 
501  std::vector<double> dpar = fv.parameters();
502 
503  double ti = 0.4; // half thickness
504 
505  const std::vector<float> pars{float(k_ScaleFromDD4hep * dpar[0]),
506  float(k_ScaleFromDD4hep * dpar[1]),
507  float(k_ScaleFromDD4hep * dpar[3]),
508  float(nStrips),
509  float(nPads),
510  float(dPhi)};
511 
512  bool isOdd = detId.chamber() % 2;
513  RCPBoundPlane surf(
514  boundPlane(fv,
516  k_ScaleFromDD4hep * dpar[0], k_ScaleFromDD4hep * dpar[1], k_ScaleFromDD4hep * dpar[3], ti),
517  isOdd));
518 
519  std::string_view name = fv.name();
520 
522 
523  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
524  return etaPartition;
525 }
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
std::string_view name() const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
T get(const std::string &)
extract attribute value
static constexpr double k_ScaleFromDD4hep
const std::vector< double > parameters() const
extract shape parameters

◆ buildRegions()

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

Definition at line 560 of file GEMGeometryBuilder.cc.

References GEMGeometry::add(), relativeConstraints::chamber, GEMGeometry::chamber(), hcalRecHitTable_cff::detId, GEMDetId::maxLayerId, GEMDetId::maxLayerId0, GEMDetId::maxStationId, GEMDetId::minLayerId, GEMDetId::minStationId0, Skims_PA_cff::name, or, nano_mu_digi_cff::region, relativeConstraints::ring, Validation_hcalonly_cfi::sign, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, makePlotsFromDump::suffix, and to_string().

562  {
563  // construct the regions, stations and rings.
564  for (int re = -1; re <= 1; re = re + 2) {
565  GEMRegion* region = new GEMRegion(re);
566  for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
567  bool ge0Station = st == GEMDetId::minStationId0;
568  GEMStation* station = new GEMStation(re, st);
569  std::string sign(re == -1 ? "-" : "");
570  std::string suffix = ge0Station ? "" : "/1";
571  std::string name = "GE" + sign + std::to_string(st) + suffix;
572  station->setName(name);
573  bool foundSuperChamber = false;
574  for (int ri = 1; ri <= 1; ++ri) {
575  GEMRing* ring = new GEMRing(re, st, ri);
576  for (auto superChamber : superChambers) {
577  const GEMDetId detId(superChamber->id());
578  if (detId.region() != re || detId.station() != st || detId.ring() != ri)
579  continue;
580 
581  foundSuperChamber = true;
582  int nlayers = ge0Station ? GEMDetId::maxLayerId0 : GEMDetId::maxLayerId;
583 
584  // GEMDetId::minLayerId is to id the superchamber, so minLayerId+1 is the first layer
585  for (int la = GEMDetId::minLayerId + 1; la <= nlayers; ++la) {
586  GEMDetId chId(detId.region(), detId.ring(), detId.station(), la, detId.chamber(), 0);
587  auto chamber = theGeometry.chamber(chId);
588  if (!chamber) {
589  // this particular layer 1 chamber *should* be missing in the demonstrator geometry (we only have layer 2)
590  if (!demonstratorGeometry or not(chId.station() == 2)) {
591  edm::LogWarning("GEMGeometryBuilder") << "Missing chamber " << chId;
592  }
593  } else {
594  superChamber->add(chamber);
595  }
596  }
597  ring->add(superChamber);
598  theGeometry.add(superChamber);
599 #ifdef EDM_ML_DEBUG
600  edm::LogVerbatim("Geometry") << "Adding super chamber " << detId << " to ring: "
601  << "re " << re << " st " << st << " ri " << ri;
602 #endif
603  }
604 #ifdef EDM_ML_DEBUG
605  edm::LogVerbatim("Geometry") << "Adding ring " << ri << " to station "
606  << "re " << re << " st " << st;
607 #endif
608  if (foundSuperChamber) {
609  station->add(ring);
610  theGeometry.add(ring);
611  }
612  }
613  if (!foundSuperChamber) {
614 #ifdef EDM_ML_DEBUG
615  edm::LogVerbatim("Geometry") << "No superchamber found: re:" << re << " st:" << st;
616 #endif
617  delete station;
618  } else {
619 #ifdef EDM_ML_DEBUG
620  edm::LogVerbatim("Geometry") << "Adding station " << st << " to region " << re;
621 #endif
622  region->add(station);
623  theGeometry.add(station);
624  }
625  }
626 #ifdef EDM_ML_DEBUG
627  edm::LogVerbatim("Geometry") << "Adding region " << re << " to the geometry ";
628 #endif
629  theGeometry.add(region);
630  }
631 }
Log< level::Info, true > LogVerbatim
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
static std::string to_string(const XMLCh *ch)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
Log< level::Warning, false > LogWarning
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81

◆ buildSuperChamber() [1/2]

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

Definition at line 194 of file GEMGeometryBuilder.cc.

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

194  {
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("Geometry") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId;
197 #endif
199  bool ge0Station = detId.station() == GEMDetId::minStationId0;
200  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
201 
202  double dy = convertMmToCm(dpar[0]); //length is along local Y
203  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
204  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
205  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
206 
207  if (!ge0Station) {
208  const int nch = 2;
209  const double chgap = 2.105;
210 
211  dpar = solid.solidB().parameters();
212 
213  dz += convertMmToCm(dpar[3]); // chamber thickness
214  dz *= nch; // 2 chambers in superchamber
215  dz += chgap; // gap between chambers
216  }
217 
218  bool isOdd = detId.chamber() % 2;
219  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
220 
221 #ifdef EDM_ML_DEBUG
222  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
223 #endif
224  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
225  return superChamber;
226 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
DDSolid solidB(void) const
Definition: DDSolid.cc:472
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.

◆ buildSuperChamber() [2/2]

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

Definition at line 445 of file GEMGeometryBuilder.cc.

References hcalRecHitTable_cff::detId, PVValHelper::dy, PVValHelper::dz, cms::DDFilteredView::solid(), and cms::DDSolid::solidA().

445  {
446  cms::DDSolid solid(fv.solid());
447  auto solidA = solid.solidA();
448  std::vector<double> dpar = solidA.dimensions();
449 
450  double dy = k_ScaleFromDD4hep * dpar[3]; //length is along local Y
451  double dz = k_ScaleFromDD4hep * dpar[2]; // thickness is long local Z
452  double dx1 = k_ScaleFromDD4hep * dpar[0]; // bottom width is along local X
453  double dx2 = k_ScaleFromDD4hep * dpar[1]; // top width is along loc
454 
455  auto solidB = solid.solidB();
456  dpar = solidB.dimensions();
457  const int nch = 2;
458  const double chgap = 2.105;
459 
460  dz += (k_ScaleFromDD4hep * dpar[2]); // chamber thickness
461  dz *= nch; // 2 chambers in superchamber
462  dz += chgap; // gap between chambers
463 
464  bool isOdd = detId.chamber() % 2;
465  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
466 
467  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
468  return superChamber;
469 }
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
dd4hep::Solid solidA() const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
dd4hep::Solid solid() const
static constexpr double k_ScaleFromDD4hep

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)
staticprivate

Definition at line 71 of file GEMGeometryBuilder.h.