CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< BoundPlane
RCPBoundPlane
 

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 * > &)
 
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

Definition at line 48 of file GEMGeometryBuilder.h.

Constructor & Destructor Documentation

GEMGeometryBuilder::GEMGeometryBuilder ( )

Definition at line 40 of file GEMGeometryBuilder.cc.

40 {}
GEMGeometryBuilder::~GEMGeometryBuilder ( )

Definition at line 42 of file GEMGeometryBuilder.cc.

42 {}

Member Function Documentation

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

Definition at line 272 of file GEMGeometryBuilder.cc.

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

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 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Plane BoundPlane
Definition: Plane.h:94
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane ( const cms::DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 466 of file GEMGeometryBuilder.cc.

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

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 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
Plane BoundPlane
Definition: Plane.h:94
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const Double_t * rot() const
The absolute rotation of the current node.
const Double_t * trans() const
The absolute translation of the current node.
static constexpr double k_ScaleFromDD4hep
void GEMGeometryBuilder::build ( GEMGeometry theGeometry,
const DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 45 of file GEMGeometryBuilder.cc.

References GEMChamber::add(), GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), alcazmumu_cfi::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(), AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by GEMGeometryESModule::produce().

47  {
48  std::string attribute = "MuStructure";
49  std::string value = "MuonEndCapGEM";
50 
51  // Asking only for the MuonGEM's
52  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
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 }
Log< level::Info, true > LogVerbatim
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber * > &)
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
constexpr int layer() const
Definition: GEMDetId.h:190
constexpr int station() const
Definition: GEMDetId.h:179
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
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
void GEMGeometryBuilder::build ( GEMGeometry theGeometry,
const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 306 of file GEMGeometryBuilder.cc.

References GEMGeometry::add(), GEMNumberingScheme::baseNumberToUnitNumber(), GEMDetId::chamberIdMask, chambers, TauDecayModes::dec, GEMGeometry::etaPartitions(), alcazmumu_cfi::filter, cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), MuonGeometryConstants::getValue(), cms::DDFilteredView::history(), isotrackTrainRegressor::history, isotrackApplyRegressor::k, cms::DDFilteredView::level(), GEMDetId::minStationId0, cms::DDFilteredView::name(), pileupDistInMC::num, HLT_FULL_cff::region, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

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 }
Log< level::Info, true > LogVerbatim
int getValue(const std::string &name) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
GEMEtaPartition * buildEtaPartition(DDFilteredView &fv, GEMDetId detId) const
GEMDetId id() const
Return the GEMDetId of this chamber.
Definition: GEMChamber.cc:17
void buildRegions(GEMGeometry &, const std::vector< GEMSuperChamber * > &)
static constexpr uint32_t chamberIdMask
Definition: GEMDetId.h:70
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
GEMChamber * buildChamber(DDFilteredView &fv, GEMDetId detId) const
GEMSuperChamber * buildSuperChamber(DDFilteredView &fv, GEMDetId detId) const
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
GEMChamber * GEMGeometryBuilder::buildChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 191 of file GEMGeometryBuilder.cc.

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

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 }
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
DDSolid solidB(void) const
Definition: DDSolid.cc:472
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204
DDSolid solidA(void) const
Definition: DDSolid.cc:470
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr int station() const
Definition: GEMDetId.h:179
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
GEMChamber * GEMGeometryBuilder::buildChamber ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 410 of file GEMGeometryBuilder.cc.

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

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 }
dd4hep::Solid solidA() const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:204
constexpr int chamber() const
Definition: GEMDetId.h:183
static constexpr double k_ScaleFromDD4hep
dd4hep::Solid solid() const
GEMEtaPartition * GEMGeometryBuilder::buildEtaPartition ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 220 of file GEMGeometryBuilder.cc.

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

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 }
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
tuple 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
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
std::vector< const DDsvalues_type * > specifics() const
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
GEMEtaPartition * GEMGeometryBuilder::buildEtaPartition ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 432 of file GEMGeometryBuilder.cc.

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

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 }
tuple nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
std::string_view name() const
T get(const std::string &)
extract attribute value
constexpr int chamber() const
Definition: GEMDetId.h:183
const std::vector< double > parameters() const
extract shape parameters
static constexpr double k_ScaleFromDD4hep
void GEMGeometryBuilder::buildRegions ( GEMGeometry theGeometry,
const std::vector< GEMSuperChamber * > &  superChambers 
)
private

Definition at line 499 of file GEMGeometryBuilder.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), GEMGeometry::add(), GEMGeometry::chamber(), GEMDetId::maxLayerId, GEMDetId::maxLayerId0, GEMDetId::maxStationId, GEMDetId::minLayerId, GEMDetId::minStationId0, mergeVDriftHistosByStation::name, nlayers, HLT_FULL_cff::region, relativeConstraints::ring, GEMStation::setName(), jetcorrextractor::sign(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and createPayload::suffix.

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  } else {
528  superChamber->add(chamber);
529  }
530  }
531  ring->add(superChamber);
532  theGeometry.add(superChamber);
533 #ifdef EDM_ML_DEBUG
534  edm::LogVerbatim("Geometry") << "Adding super chamber " << detId << " to ring: "
535  << "re " << re << " st " << st << " ri " << ri;
536 #endif
537  }
538 #ifdef EDM_ML_DEBUG
539  edm::LogVerbatim("Geometry") << "Adding ring " << ri << " to station "
540  << "re " << re << " st " << st;
541 #endif
542  if (foundSuperChamber) {
543  station->add(ring);
544  theGeometry.add(ring);
545  }
546  }
547  if (!foundSuperChamber) {
548 #ifdef EDM_ML_DEBUG
549  edm::LogVerbatim("Geometry") << "No superchamber found: re:" << re << " st:" << st;
550 #endif
551  delete station;
552  } else {
553 #ifdef EDM_ML_DEBUG
554  edm::LogVerbatim("Geometry") << "Adding station " << st << " to region " << re;
555 #endif
556  region->add(station);
557  theGeometry.add(station);
558  }
559  }
560 #ifdef EDM_ML_DEBUG
561  edm::LogVerbatim("Geometry") << "Adding region " << re << " to the geometry ";
562 #endif
563  theGeometry.add(region);
564  }
565 }
Log< level::Info, true > LogVerbatim
double sign(double x)
void add(GEMRing *ring)
Add ring to the station which takes ownership.
Definition: GEMStation.cc:22
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
Definition: GEMRing.cc:14
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
void setName(std::string name)
Set the station name.
Definition: GEMStation.cc:66
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:20
Log< level::Warning, false > LogWarning
static constexpr int32_t minLayerId
Definition: GEMDetId.h:30
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
GEMSuperChamber * GEMGeometryBuilder::buildSuperChamber ( DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 157 of file GEMGeometryBuilder.cc.

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

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 }
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
DDSolid solidB(void) const
Definition: DDSolid.cc:472
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
DDSolid solidA(void) const
Definition: DDSolid.cc:470
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr int station() const
Definition: GEMDetId.h:179
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:207
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
GEMSuperChamber * GEMGeometryBuilder::buildSuperChamber ( cms::DDFilteredView fv,
GEMDetId  detId 
) const
private

Definition at line 384 of file GEMGeometryBuilder.cc.

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

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 }
dd4hep::Solid solidA() const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
constexpr int chamber() const
Definition: GEMDetId.h:183
static constexpr double k_ScaleFromDD4hep
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:207
dd4hep::Solid solid() const

Member Data Documentation

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

Definition at line 45 of file GEMGeometryBuilder.h.

constexpr double GEMGeometryBuilder::k_ScaleFromDD4hep = (1.0 / dd4hep::cm)
staticprivate

Definition at line 71 of file GEMGeometryBuilder.h.