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 42 of file GEMGeometryBuilder.cc.

42 {}

◆ ~GEMGeometryBuilder()

GEMGeometryBuilder::~GEMGeometryBuilder ( )

Definition at line 44 of file GEMGeometryBuilder.cc.

44 {}

Member Function Documentation

◆ boundPlane() [1/2]

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

Definition at line 307 of file GEMGeometryBuilder.cc.

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

309  {
310  // extract the position
311  const DDTranslation& trans(fv.translation());
312  const Surface::PositionType posResult(convertMmToCm(trans.x()), convertMmToCm(trans.y()), convertMmToCm(trans.z()));
313 
314  // now the rotation
315  const DDRotationMatrix& rotation = fv.rotation();
316  DD3Vector x, y, z;
317  rotation.GetComponents(x, y, z);
318 
319  Surface::RotationType rotResult(float(x.X()),
320  float(x.Y()),
321  float(x.Z()),
322  float(y.X()),
323  float(y.Y()),
324  float(y.Z()),
325  float(z.X()),
326  float(z.Y()),
327  float(z.Z()));
328 
329  //Change of axes for the forward
330  Basic3DVector<float> newX(1., 0., 0.);
331  Basic3DVector<float> newY(0., 0., -1.);
332  Basic3DVector<float> newZ(0., 1., 0.);
333 
334  rotResult.rotateAxes(newX, newY, newZ);
335 
336  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
337 }
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 525 of file GEMGeometryBuilder.cc.

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

527  {
528  // extract the position
529  const Double_t* tran = fv.trans();
530  Surface::PositionType posResult(
531  k_ScaleFromDD4hep * tran[0], k_ScaleFromDD4hep * tran[1], k_ScaleFromDD4hep * tran[2]);
532 
533  // now the rotation
534  DDRotationMatrix rota;
535  fv.rot(rota);
536  DD3Vector x, y, z;
537  rota.GetComponents(x, y, z);
538  Surface::RotationType rotResult(float(x.X()),
539  float(x.Y()),
540  float(x.Z()),
541  float(y.X()),
542  float(y.Y()),
543  float(y.Z()),
544  float(z.X()),
545  float(z.Y()),
546  float(z.Z()));
547 
548  //Change of axes for the forward
549  Basic3DVector<float> newX(1., 0., 0.);
550  Basic3DVector<float> newY(0., 0., -1.);
551  Basic3DVector<float> newZ(0., 1., 0.);
552 
553  rotResult.rotateAxes(newX, newY, newZ);
554 
555  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
556 }
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 47 of file GEMGeometryBuilder.cc.

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().

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

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_2022v15_cff::region, and AlCaHLTBitMon_QueryRunRegistry::string.

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

References relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), angle_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().

226  {
227 #ifdef EDM_ML_DEBUG
228  edm::LogVerbatim("Geometry") << "buildChamber " << fv.logicalPart().name().name() << " " << detId;
229 #endif
231  bool ge0Station = detId.station() == GEMDetId::minStationId0;
232  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
233 
234  double dy = convertMmToCm(dpar[0]); //length is along local Y
235  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
236  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
237  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
238 
239  if (!ge0Station) {
240  dpar = solid.solidB().parameters();
241  dz += convertMmToCm(dpar[3]); // chamber thickness
242  }
243 
244  bool isOdd = ge0Station ? false : detId.chamber() % 2;
245 
246  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
247 
248 #ifdef EDM_ML_DEBUG
249  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
250 #endif
251  GEMChamber* chamber = new GEMChamber(detId.chamberId(), surf);
252  return chamber;
253 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
constexpr int station() const
Definition: GEMDetId.h:179
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
constexpr int chamber() const
Definition: GEMDetId.h:183
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.
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204

◆ buildChamber() [2/2]

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

Definition at line 469 of file GEMGeometryBuilder.cc.

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

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

◆ buildEtaPartition() [1/2]

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

Definition at line 255 of file GEMGeometryBuilder.cc.

References cms::cuda::be, GEMDetId::chamber(), angle_units::operators::convertMmToCm(), DDfetch(), delPhi(), 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 cond::impl::to_string().

255  {
256 #ifdef EDM_ML_DEBUG
257  edm::LogVerbatim("Geometry") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId;
258 #endif
259  // EtaPartition specific parameter (nstrips and npads)
260  DDValue numbOfStrips("nStrips");
261  DDValue numbOfPads("nPads");
262  DDValue delPhi("dPhi");
263  std::vector<const DDsvalues_type*> specs(fv.specifics());
264  std::vector<const DDsvalues_type*>::iterator is = specs.begin();
265  double nStrips = 0., nPads = 0., dPhi = 0.;
266  for (; is != specs.end(); is++) {
267  if (DDfetch(*is, numbOfStrips))
268  nStrips = numbOfStrips.doubles()[0];
269  if (DDfetch(*is, numbOfPads))
270  nPads = numbOfPads.doubles()[0];
271  if (DDfetch(*is, delPhi))
272  dPhi = delPhi.doubles()[0];
273  }
274 #ifdef EDM_ML_DEBUG
275  edm::LogVerbatim("Geometry") << ((nStrips == 0.) ? ("No nStrips found!!")
276  : ("Number of strips: " + std::to_string(nStrips)));
277  edm::LogVerbatim("Geometry") << ((nPads == 0.) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
278 #endif
279  // EtaPartition specific parameter (size)
280  std::vector<double> dpar = fv.logicalPart().solid().parameters();
281 
282  double be = convertMmToCm(dpar[4]); // half bottom edge
283  double te = convertMmToCm(dpar[8]); // half top edge
284  double ap = convertMmToCm(dpar[0]); // half apothem
285  double ti = 0.4; // half thickness
286 
287  std::vector<float> pars;
288  pars.emplace_back(be);
289  pars.emplace_back(te);
290  pars.emplace_back(ap);
291  pars.emplace_back(nStrips);
292  pars.emplace_back(nPads);
293  pars.emplace_back(dPhi);
294 
295  bool isOdd = detId.chamber() % 2;
296  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(be, te, ap, ti), isOdd));
297  std::string name = fv.logicalPart().name().name();
299 
300 #ifdef EDM_ML_DEBUG
301  edm::LogVerbatim("Geometry") << "size " << be << " " << te << " " << ap << " " << ti;
302 #endif
303  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
304  return etaPartition;
305 }
Log< level::Info, true > LogVerbatim
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
std::string to_string(const V &value)
Definition: OMSAccess.h:71
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
constexpr int chamber() const
Definition: GEMDetId.h:183
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 491 of file GEMGeometryBuilder.cc.

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

491  {
492  // EtaPartition specific parameter (nstrips and npads)
493 
494  auto nStrips = fv.get<double>("nStrips");
495  auto nPads = fv.get<double>("nPads");
496  auto dPhi = fv.get<double>("dPhi");
497  // EtaPartition specific parameter (size)
498 
499  std::vector<double> dpar = fv.parameters();
500 
501  double ti = 0.4; // half thickness
502 
503  const std::vector<float> pars{float(k_ScaleFromDD4hep * dpar[0]),
504  float(k_ScaleFromDD4hep * dpar[1]),
505  float(k_ScaleFromDD4hep * dpar[3]),
506  float(nStrips),
507  float(nPads),
508  float(dPhi)};
509 
510  bool isOdd = detId.chamber() % 2;
511  RCPBoundPlane surf(
512  boundPlane(fv,
514  k_ScaleFromDD4hep * dpar[0], k_ScaleFromDD4hep * dpar[1], k_ScaleFromDD4hep * dpar[3], ti),
515  isOdd));
516 
517  std::string_view name = fv.name();
518 
520 
521  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
522  return etaPartition;
523 }
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
constexpr int chamber() const
Definition: GEMDetId.h:183
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 558 of file GEMGeometryBuilder.cc.

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

560  {
561  // construct the regions, stations and rings.
562  for (int re = -1; re <= 1; re = re + 2) {
563  GEMRegion* region = new GEMRegion(re);
564  for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
565  bool ge0Station = st == GEMDetId::minStationId0;
566  GEMStation* station = new GEMStation(re, st);
567  std::string sign(re == -1 ? "-" : "");
568  std::string suffix = ge0Station ? "" : "/1";
569  std::string name = "GE" + sign + std::to_string(st) + suffix;
570  station->setName(name);
571  bool foundSuperChamber = false;
572  for (int ri = 1; ri <= 1; ++ri) {
573  GEMRing* ring = new GEMRing(re, st, ri);
574  for (auto superChamber : superChambers) {
575  const GEMDetId detId(superChamber->id());
576  if (detId.region() != re || detId.station() != st || detId.ring() != ri)
577  continue;
578 
579  foundSuperChamber = true;
581 
582  // GEMDetId::minLayerId is to id the superchamber, so minLayerId+1 is the first layer
583  for (int la = GEMDetId::minLayerId + 1; la <= nlayers; ++la) {
584  GEMDetId chId(detId.region(), detId.ring(), detId.station(), la, detId.chamber(), 0);
585  auto chamber = theGeometry.chamber(chId);
586  if (!chamber) {
587  // this particular layer 1 chamber *should* be missing in the demonstrator geometry (we only have layer 2)
588  if (!demonstratorGeometry or
589  not(chId.region() == 1 and chId.station() == 2 and chId.chamber() == 16 and chId.layer() == 1)) {
590  edm::LogWarning("GEMGeometryBuilder") << "Missing chamber " << chId;
591  }
592  } else {
593  superChamber->add(chamber);
594  }
595  }
596  ring->add(superChamber);
597  theGeometry.add(superChamber);
598 #ifdef EDM_ML_DEBUG
599  edm::LogVerbatim("Geometry") << "Adding super chamber " << detId << " to ring: "
600  << "re " << re << " st " << st << " ri " << ri;
601 #endif
602  }
603 #ifdef EDM_ML_DEBUG
604  edm::LogVerbatim("Geometry") << "Adding ring " << ri << " to station "
605  << "re " << re << " st " << st;
606 #endif
607  if (foundSuperChamber) {
608  station->add(ring);
609  theGeometry.add(ring);
610  }
611  }
612  if (!foundSuperChamber) {
613 #ifdef EDM_ML_DEBUG
614  edm::LogVerbatim("Geometry") << "No superchamber found: re:" << re << " st:" << st;
615 #endif
616  delete station;
617  } else {
618 #ifdef EDM_ML_DEBUG
619  edm::LogVerbatim("Geometry") << "Adding station " << st << " to region " << re;
620 #endif
621  region->add(station);
622  theGeometry.add(station);
623  }
624  }
625 #ifdef EDM_ML_DEBUG
626  edm::LogVerbatim("Geometry") << "Adding region " << re << " to the geometry ";
627 #endif
628  theGeometry.add(region);
629  }
630 }
Log< level::Info, true > LogVerbatim
std::string to_string(const V &value)
Definition: OMSAccess.h:71
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
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 192 of file GEMGeometryBuilder.cc.

References GEMDetId::chamber(), angle_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().

192  {
193 #ifdef EDM_ML_DEBUG
194  edm::LogVerbatim("Geometry") << "buildSuperChamber " << fv.logicalPart().name().name() << " " << detId;
195 #endif
197  bool ge0Station = detId.station() == GEMDetId::minStationId0;
198  std::vector<double> dpar = ge0Station ? solid.parameters() : solid.solidA().parameters();
199 
200  double dy = convertMmToCm(dpar[0]); //length is along local Y
201  double dz = convertMmToCm(dpar[3]); // thickness is long local Z
202  double dx1 = convertMmToCm(dpar[4]); // bottom width is along local X
203  double dx2 = convertMmToCm(dpar[8]); // top width is along local X
204 
205  if (!ge0Station) {
206  const int nch = 2;
207  const double chgap = 2.105;
208 
209  dpar = solid.solidB().parameters();
210 
211  dz += convertMmToCm(dpar[3]); // chamber thickness
212  dz *= nch; // 2 chambers in superchamber
213  dz += chgap; // gap between chambers
214  }
215 
216  bool isOdd = detId.chamber() % 2;
217  RCPBoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(dx1, dx2, dy, dz), isOdd));
218 
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("Geometry") << "size " << dx1 << " " << dx2 << " " << dy << " " << dz;
221 #endif
222  GEMSuperChamber* superChamber = new GEMSuperChamber(detId.superChamberId(), surf);
223  return superChamber;
224 }
Log< level::Info, true > LogVerbatim
DDSolid solidA(void) const
Definition: DDSolid.cc:470
constexpr int station() const
Definition: GEMDetId.h:179
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
constexpr int chamber() const
Definition: GEMDetId.h:183
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.
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:207

◆ buildSuperChamber() [2/2]

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

Definition at line 443 of file GEMGeometryBuilder.cc.

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

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