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
ME0GeometryBuilder Class Reference

#include <ME0GeometryBuilder.h>

Public Member Functions

ME0Geometrybuild (const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
ME0Geometrybuild (const cms::DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
 ME0GeometryBuilder ()
 
 ~ME0GeometryBuilder ()
 

Private Types

typedef
ReferenceCountingPointer
< BoundPlane
ME0BoundPlane
 

Private Member Functions

ME0BoundPlane boundPlane (const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
ME0BoundPlane boundPlane (const cms::DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
 
ME0ChamberbuildChamber (DDFilteredView &fv, ME0DetId detId) const
 
ME0ChamberbuildChamber (cms::DDFilteredView &fv, ME0DetId detId) const
 
ME0EtaPartitionbuildEtaPartition (DDFilteredView &fv, ME0DetId detId) const
 
ME0EtaPartitionbuildEtaPartition (cms::DDFilteredView &fv, ME0DetId detId) const
 
ME0GeometrybuildGeometry (DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
 
ME0GeometrybuildGeometry (cms::DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
 
ME0LayerbuildLayer (DDFilteredView &fv, ME0DetId detId) const
 
ME0LayerbuildLayer (cms::DDFilteredView &fv, ME0DetId detId) const
 

Private Attributes

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

Static Private Attributes

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

Detailed Description

Definition at line 32 of file ME0GeometryBuilder.h.

Member Typedef Documentation

Definition at line 46 of file ME0GeometryBuilder.h.

Constructor & Destructor Documentation

ME0GeometryBuilder::ME0GeometryBuilder ( )

Definition at line 37 of file ME0GeometryBuilder.cc.

37 {}
ME0GeometryBuilder::~ME0GeometryBuilder ( )

Definition at line 39 of file ME0GeometryBuilder.cc.

39 {}

Member Function Documentation

ME0GeometryBuilder::ME0BoundPlane ME0GeometryBuilder::boundPlane ( const DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 335 of file ME0GeometryBuilder.cc.

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

337  {
338  // extract the position
339  const DDTranslation& trans(fv.translation());
340  const Surface::PositionType posResult(
341  float(convertMmToCm(trans.x())), float(convertMmToCm(trans.y())), float(convertMmToCm(trans.z())));
342 
343  const DDRotationMatrix& rotation = fv.rotation();
344  DD3Vector x, y, z;
345  rotation.GetComponents(x, y, z);
346 
347  Surface::RotationType rotResult(float(x.X()),
348  float(x.Y()),
349  float(x.Z()),
350  float(y.X()),
351  float(y.Y()),
352  float(y.Z()),
353  float(z.X()),
354  float(z.Y()),
355  float(z.Z()));
356 
357  //Change of axes for the forward
358  Basic3DVector<float> newX(1., 0., 0.);
359  Basic3DVector<float> newY(0., 0., 1.);
360  Basic3DVector<float> newZ(0., 1., 0.);
361  newY *= -1;
362 
363  rotResult.rotateAxes(newX, newY, newZ);
364 
365  return ME0BoundPlane(new BoundPlane(posResult, rotResult, bounds));
366 }
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 > ME0BoundPlane
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
ME0GeometryBuilder::ME0BoundPlane ME0GeometryBuilder::boundPlane ( const cms::DDFilteredView fv,
Bounds bounds,
bool  isOddChamber 
) const
private

Definition at line 490 of file ME0GeometryBuilder.cc.

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

492  {
493  // extract the position
494  const Double_t* trans = fv.trans();
495  Surface::PositionType posResult(
496  k_ScaleFromDD4hep * trans[0], k_ScaleFromDD4hep * trans[1], k_ScaleFromDD4hep * trans[2]);
497 
498  // now the rotation
500  fv.rot(rotation);
501  DD3Vector x, y, z;
502  rotation.GetComponents(x, y, z);
503  Surface::RotationType rotResult(float(x.X()),
504  float(x.Y()),
505  float(x.Z()),
506  float(y.X()),
507  float(y.Y()),
508  float(y.Z()),
509  float(z.X()),
510  float(z.Y()),
511  float(z.Z()));
512 
513  //Change of axes for the forward
514  Basic3DVector<float> newX(1., 0., 0.);
515  Basic3DVector<float> newY(0., 0., 1.);
516  Basic3DVector<float> newZ(0., 1., 0.);
517  newY *= -1;
518 
519  rotResult.rotateAxes(newX, newY, newZ);
520 
521  return ME0BoundPlane(new BoundPlane(posResult, rotResult, bounds));
522 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
static constexpr double k_ScaleFromDD4hep
Plane BoundPlane
Definition: Plane.h:94
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
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.
ME0Geometry * ME0GeometryBuilder::build ( const DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 41 of file ME0GeometryBuilder.cc.

References alcazmumu_cfi::filter, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by ME0GeometryESModule::produce().

41  {
42  std::string attribute = "MuStructure";
43  std::string value = "MuonEndCapME0";
44  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
45  DDFilteredView fview(*cview, filter);
46  return this->buildGeometry(fview, muonConstants);
47 }
ME0Geometry * buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
ME0Geometry * ME0GeometryBuilder::build ( const cms::DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 50 of file ME0GeometryBuilder.cc.

References alcazmumu_cfi::filter, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

50  {
51  std::string attribute = "MuStructure";
52  std::string value = "MuonEndCapME0";
53  const cms::DDFilter filter(attribute, value);
54  cms::DDFilteredView fview(*cview, filter);
55  return this->buildGeometry(fview, muonConstants);
56 }
ME0Geometry * buildGeometry(DDFilteredView &fview, const MuonGeometryConstants &muonConstants)
ME0Chamber * ME0GeometryBuilder::buildChamber ( DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 229 of file ME0GeometryBuilder.cc.

References B, b, ME0DetId::chamberId(), angle_units::operators::convertMmToCm(), mps_fire::i, dttmaxenums::L, DDFilteredView::logicalPart(), LogTrace, DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), and DDLogicalPart::solid().

229  {
230  LogTrace("ME0Geometry") << "buildChamber " << fv.logicalPart().name().name() << " " << detId << std::endl;
232 
233  std::vector<double> dpar = solid.parameters();
234 
235  double L = convertMmToCm(dpar[0]); // length is along local Y
236  double T = convertMmToCm(dpar[3]); // thickness is long local Z
237  double b = convertMmToCm(dpar[4]); // bottom width is along local X
238  double B = convertMmToCm(dpar[8]); // top width is along local X
239 
240 #ifdef EDM_ML_DEBUG
241  LogTrace("ME0Geometry") << " name of logical part = " << fv.logicalPart().name().name() << std::endl;
242  LogTrace("ME0Geometry") << " dpar is vector with size = " << dpar.size() << std::endl;
243  for (unsigned int i = 0; i < dpar.size(); ++i) {
244  LogTrace("ME0Geometry") << " dpar [" << i << "] = " << convertMmToCm(dpar[i]) << " cm " << std::endl;
245  }
246  LogTrace("ME0Geometry") << "size b: " << b << "cm, B: " << B << "cm, L: " << L << "cm, T: " << T << "cm "
247  << std::endl;
248 #endif
249 
250  bool isOdd = false; // detId.chamber()%2;
251  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, T), isOdd));
252  ME0Chamber* chamber = new ME0Chamber(detId.chamberId(), surf);
253  return chamber;
254 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
Definition: APVGainStruct.h:7
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
#define LogTrace(id)
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
double b
Definition: hdecay.h:118
long double T
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
ME0Chamber * ME0GeometryBuilder::buildChamber ( cms::DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 434 of file ME0GeometryBuilder.cc.

References B, b, ME0DetId::chamberId(), dttmaxenums::L, and cms::DDFilteredView::parameters().

434  {
435  std::vector<double> dpar = fv.parameters();
436 
437  double L = k_ScaleFromDD4hep * dpar[3];
438  double T = k_ScaleFromDD4hep * dpar[2];
439  double b = k_ScaleFromDD4hep * dpar[0];
440  double B = k_ScaleFromDD4hep * dpar[1];
441  bool isOdd = false;
442  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, T), isOdd));
443  ME0Chamber* chamber = new ME0Chamber(detId.chamberId(), surf);
444 
445  return chamber;
446 }
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
Definition: APVGainStruct.h:7
static constexpr double k_ScaleFromDD4hep
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
double b
Definition: hdecay.h:118
const std::vector< double > parameters() const
extract shape parameters
long double T
ME0EtaPartition * ME0GeometryBuilder::buildEtaPartition ( DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 283 of file ME0GeometryBuilder.cc.

References B, b, angle_units::operators::convertMmToCm(), DDfetch(), DDValue::doubles(), mps_fire::i, dttmaxenums::L, DDFilteredView::logicalPart(), LogTrace, GeomDetEnumerators::ME0, DDName::name(), DDBase< N, C >::name(), mergeVDriftHistosByStation::name, me0TriggerPseudoDigis_cff::nStrips, DDSolid::parameters(), DDLogicalPart::solid(), DDFilteredView::specifics(), AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, and cond::impl::to_string().

283  {
284  LogTrace("ME0Geometry") << "buildEtaPartition " << fv.logicalPart().name().name() << " " << detId << std::endl;
285 
286  // EtaPartition specific parameter (nstrips and npads)
287  DDValue numbOfStrips("nStrips");
288  DDValue numbOfPads("nPads");
289  std::vector<const DDsvalues_type*> specs(fv.specifics());
290  double nStrips = 0., nPads = 0.;
291  for (const auto& is : specs) {
292  if (DDfetch(is, numbOfStrips))
293  nStrips = numbOfStrips.doubles()[0];
294  if (DDfetch(is, numbOfPads))
295  nPads = numbOfPads.doubles()[0];
296  }
297 
298  LogTrace("ME0Geometry") << ((nStrips == 0.) ? ("No nStrips found!!")
299  : ("Number of strips: " + std::to_string(nStrips)));
300  LogTrace("ME0Geometry") << ((nPads == 0.) ? ("No nPads found!!") : ("Number of pads: " + std::to_string(nPads)));
301 
302  // EtaPartition specific parameter (size)
303  std::vector<double> dpar = fv.logicalPart().solid().parameters();
304  double b = convertMmToCm(dpar[4]); // half bottom edge
305  double B = convertMmToCm(dpar[8]); // half top edge
306  double L = convertMmToCm(dpar[0]); // half apothem
307  double t = convertMmToCm(dpar[3]); // half thickness
308 
309 #ifdef EDM_ML_DEBUG
310  LogTrace("ME0Geometry") << " name of logical part = " << fv.logicalPart().name().name() << std::endl;
311  LogTrace("ME0Geometry") << " dpar is vector with size = " << dpar.size() << std::endl;
312  for (unsigned int i = 0; i < dpar.size(); ++i) {
313  LogTrace("ME0Geometry") << " dpar [" << i << "] = " << convertMmToCm(dpar[i]) << " cm " << std::endl;
314  }
315  LogTrace("ME0Geometry") << "size b: " << b << "cm, B: " << B << "cm, L: " << L << "cm, t: " << t << "cm "
316  << std::endl;
317 #endif
318 
319  std::vector<float> pars;
320  pars.emplace_back(b);
321  pars.emplace_back(B);
322  pars.emplace_back(L);
323  pars.emplace_back(nStrips);
324  pars.emplace_back(nPads);
325 
326  bool isOdd = false; // detId.chamber()%2;
327  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, t), isOdd));
328  std::string name = fv.logicalPart().name().name();
330 
331  ME0EtaPartition* etaPartition = new ME0EtaPartition(detId, surf, e_p_specs);
332  return etaPartition;
333 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
Definition: APVGainStruct.h:7
std::string to_string(const V &value)
Definition: OMSAccess.h:71
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...
#define LogTrace(id)
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
double b
Definition: hdecay.h:118
std::vector< const DDsvalues_type * > specifics() const
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
ME0EtaPartition * ME0GeometryBuilder::buildEtaPartition ( cms::DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 462 of file ME0GeometryBuilder.cc.

References B, b, dttmaxenums::L, GeomDetEnumerators::ME0, mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), me0TriggerPseudoDigis_cff::nStrips, cms::DDFilteredView::parameters(), AlCaHLTBitMon_QueryRunRegistry::string, and submitPVValidationJobs::t.

462  {
463  // auto nStrips = fv.get<double>("nStrips"); //it doesn't work
464  // auto nPads = fv.get<double>("nPads"); //it doesn't work
465 
466  auto nStrips = 384; // from GEMSpecs
467  auto nPads = 192; // from GEMSpecs
468 
469  std::vector<double> dpar = fv.parameters();
470 
471  double b = k_ScaleFromDD4hep * dpar[0];
472  double B = k_ScaleFromDD4hep * dpar[1];
473  double L = k_ScaleFromDD4hep * dpar[3];
474  double t = k_ScaleFromDD4hep * dpar[2];
475 
476  const std::vector<float> pars{float(dpar[0]), float(dpar[1]), float(dpar[3]), float(nStrips), float(nPads)};
477 
478  bool isOdd = false;
479  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, t), isOdd));
480 
481  std::string_view name = fv.name();
482 
484 
485  ME0EtaPartition* etaPartition = new ME0EtaPartition(detId, surf, e_p_specs);
486 
487  return etaPartition;
488 }
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
Definition: APVGainStruct.h:7
static constexpr double k_ScaleFromDD4hep
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 > ME0BoundPlane
std::string_view name() const
double b
Definition: hdecay.h:118
const std::vector< double > parameters() const
extract shape parameters
ME0Geometry * ME0GeometryBuilder::buildGeometry ( DDFilteredView fview,
const MuonGeometryConstants muonConstants 
)
private

Definition at line 58 of file ME0GeometryBuilder.cc.

References ME0Layer::add(), ME0Chamber::add(), ME0Geometry::add(), ME0NumberingScheme::baseNumberToUnitNumber(), ME0DetId::chamberId(), angle_units::operators::convertMmToCm(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), relativeConstraints::geometry, mps_fire::i, ME0DetId::layerId(), DDFilteredView::logicalPart(), LogTrace, DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDSolid::parameters(), DDFilteredView::parent(), DetId::rawId(), and DDLogicalPart::solid().

58  {
60  MuonGeometryNumbering mdddnum(muonConstants);
61  ME0NumberingScheme me0Num(muonConstants);
62 
63  LogTrace("ME0Geometry") << "Building the geometry service";
64  LogTrace("ME0Geometry") << "About to run through the ME0 structure\n"
65  << "Top level logical part: " << fv.logicalPart().name().name();
66 
67 // ==========================================
68 // === Test to understand the structure ===
69 // ==========================================
70 #ifdef EDM_ML_DEBUG
71  bool testChambers = fv.firstChild();
72  LogTrace("ME0Geometry") << "doChamber = fv.firstChild() = " << testChambers;
73 
74  while (testChambers) {
75  // to etapartitions
76  LogTrace("ME0Geometry") << "to layer " << fv.firstChild();
77  LogTrace("ME0Geometry") << "to etapt " << fv.firstChild();
78  int rawId = me0Num.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
79  ME0DetId detId = ME0DetId(rawId);
80  ME0DetId detIdCh = detId.chamberId();
81  // back to chambers
82  LogTrace("ME0Geometry") << "back to layer " << fv.parent();
83  LogTrace("ME0Geometry") << "back to chamb " << fv.parent();
84 
85  LogTrace("ME0Geometry") << "In DoChambers Loop :: ME0DetId " << detId << " = " << detId.rawId()
86  << " (which belongs to ME0Chamber " << detIdCh << " = " << detIdCh.rawId() << ")";
87  LogTrace("ME0Geometry") << "Second level logical part: " << fv.logicalPart().name().name();
88  DDBooleanSolid solid2 = (DDBooleanSolid)(fv.logicalPart().solid());
89  std::vector<double> dpar2 = solid2.parameters();
90  std::stringstream parameters2;
91  for (unsigned int i = 0; i < dpar2.size(); ++i) {
92  parameters2 << " dpar[" << i << "]=" << convertMmToCm(dpar2[i]) << "cm ";
93  }
94  LogTrace("ME0Geometry") << "Second level parameters: vector with size = " << dpar2.size() << " and elements "
95  << parameters2.str();
96 
97  bool doLayers = fv.firstChild();
98 
99  LogTrace("ME0Geometry") << "doLayer = fv.firstChild() = " << doLayers;
100  while (doLayers) {
101  // to etapartitions
102  LogTrace("ME0Geometry") << "to etapt " << fv.firstChild();
103  int rawId = me0Num.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
104  ME0DetId detId = ME0DetId(rawId);
105  ME0DetId detIdLa = detId.layerId();
106  // back to layers
107  LogTrace("ME0Geometry") << "back to layer " << fv.parent();
108  LogTrace("ME0Geometry") << "In DoLayers Loop :: ME0DetId " << detId << " = " << detId.rawId()
109  << " (which belongs to ME0Layer " << detIdLa << " = " << detIdLa.rawId() << ")";
110  LogTrace("ME0Geometry") << "Third level logical part: " << fv.logicalPart().name().name();
111  DDBooleanSolid solid3 = (DDBooleanSolid)(fv.logicalPart().solid());
112  std::vector<double> dpar3 = solid3.parameters();
113  std::stringstream parameters3;
114  for (unsigned int i = 0; i < dpar3.size(); ++i) {
115  parameters3 << " dpar[" << i << "]=" << convertMmToCm(dpar3[i]) << "cm ";
116  }
117  LogTrace("ME0Geometry") << "Third level parameters: vector with size = " << dpar3.size() << " and elements "
118  << parameters3.str();
119  bool doEtaParts = fv.firstChild();
120 
121  LogTrace("ME0Geometry") << "doEtaPart = fv.firstChild() = " << doEtaParts;
122  while (doEtaParts) {
123  LogTrace("ME0Geometry") << "In DoEtaParts Loop :: ME0DetId " << detId << " = " << detId.rawId();
124  LogTrace("ME0Geometry") << "Fourth level logical part: " << fv.logicalPart().name().name();
125  DDBooleanSolid solid4 = (DDBooleanSolid)(fv.logicalPart().solid());
126  std::vector<double> dpar4 = solid4.parameters();
127  std::stringstream parameters4;
128  for (unsigned int i = 0; i < dpar4.size(); ++i) {
129  parameters4 << " dpar[" << i << "]=" << convertMmToCm(dpar4[i]) << "cm ";
130  }
131  LogTrace("ME0Geometry") << "Fourth level parameters: vector with size = " << dpar4.size() << " and elements "
132  << parameters4.str();
133 
134  doEtaParts = fv.nextSibling();
135  LogTrace("ME0Geometry") << "doEtaPart = fv.nextSibling() = " << doEtaParts;
136  }
137  fv.parent();
138  LogTrace("ME0Geometry") << "went back to parent :: name = " << fv.logicalPart().name().name()
139  << " will now ask for nextSibling";
140  doLayers = fv.nextSibling();
141  LogTrace("ME0Geometry") << "doLayer = fv.nextSibling() = " << doLayers;
142  }
143  fv.parent();
144  LogTrace("ME0Geometry") << "went back to parent :: name = " << fv.logicalPart().name().name()
145  << " will now ask for nextSibling";
146  testChambers = fv.nextSibling();
147  LogTrace("ME0Geometry") << "doChamber = fv.nextSibling() = " << testChambers;
148  }
149  fv.parent();
150 #endif
151 
152  // ==========================================
153  // === Here the Real ME0 Geometry Builder ===
154  // ==========================================
155  bool doChambers = fv.firstChild();
156 
157  while (doChambers) {
158  // to etapartitions and back again to pick up DetId
159  fv.firstChild();
160  fv.firstChild();
161 
162 #ifdef EDM_ML_DEBUG
163  edm::LogVerbatim("ME0Geometry") << "MuonGeometry 1 " << fv.geoHistory() << " Levels "
164  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
165 #endif
166  int rawId = me0Num.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
167  ME0DetId detId = ME0DetId(rawId);
168  ME0DetId detIdCh = detId.chamberId();
169 
170  fv.parent();
171  fv.parent();
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("ME0Geometry") << "MuonGeometry 2 " << fv.geoHistory() << " Levels "
174  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
175 #endif
176  // build chamber
177  ME0Chamber* me0Chamber = buildChamber(fv, detIdCh);
178  geometry->add(me0Chamber);
179 
180  // loop over layers of the chamber
181  bool doLayers = fv.firstChild();
182 
183  while (doLayers) {
184  // to etapartitions and back again to pick up DetId
185  fv.firstChild();
186  int rawId = me0Num.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
187  ME0DetId detId = ME0DetId(rawId);
188  ME0DetId detIdLa = detId.layerId();
189  fv.parent();
190 #ifdef EDM_ML_DEBUG
191  edm::LogVerbatim("ME0Geometry") << "MuonGeometry 3 " << fv.geoHistory() << " Levels "
192  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
193 #endif
194  // build layer
195  ME0Layer* me0Layer = buildLayer(fv, detIdLa);
196  me0Chamber->add(me0Layer);
197  geometry->add(me0Layer);
198 
199  // loop over etapartitions of the layer
200  bool doEtaParts = fv.firstChild();
201 
202  while (doEtaParts) {
203  // pick up DetId
204 #ifdef EDM_ML_DEBUG
205  edm::LogVerbatim("ME0Geometry") << "MuonGeometry 4 " << fv.geoHistory() << " Levels "
206  << mdddnum.geoHistoryToBaseNumber(fv.geoHistory()).getLevels();
207 #endif
208  int rawId = me0Num.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
209  ME0DetId detId = ME0DetId(rawId);
210 
211  // build etapartition
212  ME0EtaPartition* etaPart = buildEtaPartition(fv, detId);
213  me0Layer->add(etaPart);
214  geometry->add(etaPart);
215 
216  doEtaParts = fv.nextSibling();
217  }
218  fv.parent();
219 
220  doLayers = fv.nextSibling();
221  }
222  fv.parent();
223 
224  doChambers = fv.nextSibling();
225  }
226  return geometry;
227 }
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void add(ME0Layer *layer)
Add Layer to the chamber which takes ownership.
Definition: ME0Chamber.cc:16
#define LogTrace(id)
void add(const ME0EtaPartition *roll)
Add EtaPartition to the layer which takes ownership.
Definition: ME0Layer.cc:15
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
void add(ME0EtaPartition *etaPartition)
Add a ME0 etaPartition to the Geometry.
Definition: ME0Geometry.cc:47
ME0Layer * buildLayer(DDFilteredView &fv, ME0DetId detId) const
ME0Chamber * buildChamber(DDFilteredView &fv, ME0DetId detId) const
ME0EtaPartition * buildEtaPartition(DDFilteredView &fv, ME0DetId detId) const
ME0Geometry * ME0GeometryBuilder::buildGeometry ( cms::DDFilteredView fview,
const MuonGeometryConstants muonConstants 
)
private

Definition at line 370 of file ME0GeometryBuilder.cc.

References ME0Geometry::add(), ME0NumberingScheme::baseNumberToUnitNumber(), ME0DetId::chamberIdMask_, chambers, TauDecayModes::dec, ME0Geometry::etaPartitions(), cms::DDFilteredView::firstChild(), MuonGeometryNumbering::geoHistoryToBaseNumber(), relativeConstraints::geometry, MuonGeometryConstants::getValue(), cms::DDFilteredView::history(), isotrackTrainRegressor::history, isotrackApplyRegressor::k, phase1PixelTopology::layer, ME0DetId::layerIdMask_, LayerTriplets::layers(), cms::DDFilteredView::level(), cms::DDFilteredView::name(), and pileupDistInMC::num.

370  {
372  MuonGeometryNumbering mdddnum(muonConstants);
373  ME0NumberingScheme me0Num(muonConstants);
374 
375  static constexpr uint32_t levelChamber = 7;
376  static constexpr uint32_t levelLayer = 8;
377  uint32_t theLevelPart = muonConstants.getValue("level");
378  uint32_t theSectorLevel = muonConstants.getValue("m0_sector") / theLevelPart;
379  std::vector<ME0Chamber*> chambers;
380  std::vector<ME0Layer*> layers;
381 
382  while (fv.firstChild()) {
383  const auto& history = fv.history();
384  MuonBaseNumber num(mdddnum.geoHistoryToBaseNumber(history));
385  ME0DetId detId(me0Num.baseNumberToUnitNumber(num));
386 #ifdef EDM_ML_DEBUG
387  edm::LogVerbatim("ME0Geometry") << fv.name() << " with " << history.tags.size() << " Levels and ID " << detId
388  << " Mask " << std::hex << ME0DetId::chamberIdMask_ << ":" << ME0DetId::layerIdMask_
389  << std::dec << " and " << ME0DetId(((detId.rawId()) & ME0DetId::chamberIdMask_))
390  << ":" << ME0DetId(((detId.rawId()) & ME0DetId::layerIdMask_)) << " Sector Level "
391  << theSectorLevel << ":" << history.tags.size() << ":" << fv.level();
392  for (unsigned int k = 0; k < history.tags.size(); ++k)
393  edm::LogVerbatim("ME0Geometry") << "[" << k << "] Tag " << history.tags[k] << " Offset " << history.offsets[k]
394  << " copy " << history.copyNos[k];
395 #endif
396 
397  if (fv.level() == levelChamber) {
398  // build chamber
399  ME0Chamber* me0Chamber = buildChamber(fv, detId);
400  chambers.emplace_back(me0Chamber);
401  } else if (fv.level() == levelLayer) {
402  // build layer
403  ME0Layer* me0Layer = buildLayer(fv, detId);
404  layers.emplace_back(me0Layer);
405  } else if (history.tags.size() > theSectorLevel) {
406  // build first eta partition
407  ME0EtaPartition* etaPart = buildEtaPartition(fv, detId);
408  geometry->add(etaPart);
409  }
410  }
411 
412  auto const& partitions = geometry->etaPartitions();
413  for (auto& layer : layers) {
414  uint32_t id0 = ((layer->id().rawId()) & ME0DetId::layerIdMask_);
415  for (auto& etaPart : partitions) {
416  if (((etaPart->id().rawId()) & ME0DetId::layerIdMask_) == id0) {
417  layer->add(etaPart);
418  }
419  }
420  geometry->add(layer);
421  }
422  for (auto& chamber : chambers) {
423  uint32_t id0 = ((chamber->id().rawId()) & ME0DetId::chamberIdMask_);
424  for (auto& layer : layers) {
425  if (((layer->id().rawId()) & ME0DetId::chamberIdMask_) == id0) {
426  chamber->add(layer);
427  }
428  }
429  geometry->add(chamber);
430  }
431  return geometry;
432 }
Log< level::Info, true > LogVerbatim
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
int getValue(const std::string &name) const
static constexpr uint32_t chamberIdMask_
Definition: ME0DetId.h:93
constexpr std::array< uint8_t, layerIndexSize > layer
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:33
static constexpr uint32_t layerIdMask_
Definition: ME0DetId.h:94
void add(ME0EtaPartition *etaPartition)
Add a ME0 etaPartition to the Geometry.
Definition: ME0Geometry.cc:47
ME0Layer * buildLayer(DDFilteredView &fv, ME0DetId detId) const
ME0Chamber * buildChamber(DDFilteredView &fv, ME0DetId detId) const
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
ME0EtaPartition * buildEtaPartition(DDFilteredView &fv, ME0DetId detId) const
ME0Layer * ME0GeometryBuilder::buildLayer ( DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 256 of file ME0GeometryBuilder.cc.

References B, b, angle_units::operators::convertMmToCm(), mps_fire::i, dttmaxenums::L, phase1PixelTopology::layer, ME0DetId::layerId(), DDFilteredView::logicalPart(), LogTrace, DDName::name(), DDBase< N, C >::name(), DDSolid::parameters(), DDLogicalPart::solid(), and submitPVValidationJobs::t.

256  {
257  LogTrace("ME0Geometry") << "buildLayer " << fv.logicalPart().name().name() << " " << detId << std::endl;
258 
260 
261  std::vector<double> dpar = solid.parameters();
262  double L = convertMmToCm(dpar[0]); // length is along local Y
263  double t = convertMmToCm(dpar[3]); // thickness is long local Z
264  double b = convertMmToCm(dpar[4]); // bottom width is along local X
265  double B = convertMmToCm(dpar[8]); // top width is along local X
266 
267 #ifdef EDM_ML_DEBUG
268  LogTrace("ME0Geometry") << " name of logical part = " << fv.logicalPart().name().name() << std::endl;
269  LogTrace("ME0Geometry") << " dpar is vector with size = " << dpar.size() << std::endl;
270  for (unsigned int i = 0; i < dpar.size(); ++i) {
271  LogTrace("ME0Geometry") << " dpar [" << i << "] = " << convertMmToCm(dpar[i]) << " cm " << std::endl;
272  }
273  LogTrace("ME0Geometry") << "size b: " << b << "cm, B: " << B << "cm, L: " << L << "cm, t: " << t << "cm "
274  << std::endl;
275 #endif
276 
277  bool isOdd = false; // detId.chamber()%2;
278  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, t), isOdd));
279  ME0Layer* layer = new ME0Layer(detId.layerId(), surf);
280  return layer;
281 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
Definition: APVGainStruct.h:7
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
double b
Definition: hdecay.h:118
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
ME0Layer * ME0GeometryBuilder::buildLayer ( cms::DDFilteredView fv,
ME0DetId  detId 
) const
private

Definition at line 448 of file ME0GeometryBuilder.cc.

References B, b, dttmaxenums::L, phase1PixelTopology::layer, ME0DetId::layerId(), cms::DDFilteredView::parameters(), and submitPVValidationJobs::t.

448  {
449  std::vector<double> dpar = fv.parameters();
450 
451  double L = k_ScaleFromDD4hep * dpar[3];
452  double t = k_ScaleFromDD4hep * dpar[2];
453  double b = k_ScaleFromDD4hep * dpar[0];
454  double B = k_ScaleFromDD4hep * dpar[1];
455  bool isOdd = false;
456  ME0BoundPlane surf(boundPlane(fv, new TrapezoidalPlaneBounds(b, B, L, t), isOdd));
457  ME0Layer* layer = new ME0Layer(detId.layerId(), surf);
458 
459  return layer;
460 }
ME0BoundPlane boundPlane(const DDFilteredView &fv, Bounds *bounds, bool isOddChamber) const
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
Definition: APVGainStruct.h:7
static constexpr double k_ScaleFromDD4hep
constexpr std::array< uint8_t, layerIndexSize > layer
ReferenceCountingPointer< BoundPlane > ME0BoundPlane
double b
Definition: hdecay.h:118
const std::vector< double > parameters() const
extract shape parameters

Member Data Documentation

std::map<ME0DetId, std::vector<ME0DetId> > ME0GeometryBuilder::chids
private

Definition at line 44 of file ME0GeometryBuilder.h.

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

Definition at line 66 of file ME0GeometryBuilder.h.