CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
DTGeometryBuilderFromDD4hep Class Reference

#include <DTGeometryBuilderFromDD4hep.h>

Public Member Functions

void build (DTGeometry &, const cms::DDDetector *, const MuonGeometryConstants &, const dd4hep::SpecParRefs &)
 
 DTGeometryBuilderFromDD4hep ()
 

Private Types

using RCPPlane = ReferenceCountingPointer< Plane >
 

Private Member Functions

DTChamberbuildChamber (cms::DDFilteredView &, const MuonGeometryConstants &) const
 
void buildGeometry (cms::DDFilteredView &, DTGeometry &, const MuonGeometryConstants &) const
 
DTLayerbuildLayer (cms::DDFilteredView &, DTSuperLayer *, const MuonGeometryConstants &) const
 
DTSuperLayerbuildSuperLayer (cms::DDFilteredView &, DTChamber *, const MuonGeometryConstants &) const
 
RCPPlane plane (const cms::DDFilteredView &, Bounds *bounds) const
 

Detailed Description

Description: DT Geometry builder from DD4hep

Implementation: DT Geometry Builder iterates over a Detector Tree and retrvieves DT chambers, super layers, layers and wires.

Definition at line 42 of file DTGeometryBuilderFromDD4hep.h.

Member Typedef Documentation

◆ RCPPlane

Definition at line 57 of file DTGeometryBuilderFromDD4hep.h.

Constructor & Destructor Documentation

◆ DTGeometryBuilderFromDD4hep()

DTGeometryBuilderFromDD4hep::DTGeometryBuilderFromDD4hep ( )
inline

Definition at line 44 of file DTGeometryBuilderFromDD4hep.h.

44 {}

Member Function Documentation

◆ build()

void DTGeometryBuilderFromDD4hep::build ( DTGeometry geom,
const cms::DDDetector det,
const MuonGeometryConstants num,
const dd4hep::SpecParRefs &  refs 
)

Definition at line 181 of file DTGeometryBuilderFromDD4hep.cc.

References relativeConstraints::geom, cms::DDFilteredView::mergedSpecifics(), EgammaValidation_cff::num, and cms::DDDetector::worldVolume().

Referenced by DTGeometryESModule::setupDD4hepGeometry().

184  {
185  cms::Volume top = det->worldVolume();
186  cms::DDFilteredView fview(det, top);
187  fview.mergedSpecifics(refs);
188  buildGeometry(fview, geom, num);
189 }
void buildGeometry(cms::DDFilteredView &, DTGeometry &, const MuonGeometryConstants &) const
dd4hep::Volume Volume
dd4hep::Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:67

◆ buildChamber()

DTChamber * DTGeometryBuilderFromDD4hep::buildChamber ( cms::DDFilteredView fview,
const MuonGeometryConstants muonConstants 
) const
private

Definition at line 94 of file DTGeometryBuilderFromDD4hep.cc.

References DTNumberingScheme::baseNumberToUnitNumber(), relativeConstraints::chamber, hcalRecHitTable_cff::detId, MuonGeometryNumbering::geoHistoryToBaseNumber(), cms::DDFilteredView::history(), and cms::DDFilteredView::parameters().

95  {
96  MuonGeometryNumbering mdddnum(muonConstants);
97  DTNumberingScheme dtnum(muonConstants);
98  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
99 
100  DTChamberId detId(rawid);
101  auto const& par = fview.parameters();
102 
103  RCPPlane surf(
104  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
105 
106  edm::LogVerbatim("DTGeometryBuilder") << "(1) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
107  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
108 
109  DTChamber* chamber = new DTChamber(detId, surf);
110 
111  return chamber;
112 }
Log< level::Info, true > LogVerbatim
ReferenceCountingPointer< Plane > RCPPlane
const ExpandedNodes & history()
The numbering history of the current node.
const std::vector< double > parameters() const
extract shape parameters
RCPPlane plane(const cms::DDFilteredView &, Bounds *bounds) const

◆ buildGeometry()

void DTGeometryBuilderFromDD4hep::buildGeometry ( cms::DDFilteredView fview,
DTGeometry geom,
const MuonGeometryConstants num 
) const
private

Definition at line 50 of file DTGeometryBuilderFromDD4hep.cc.

References relativeConstraints::chamber, cms::DDFilteredView::down(), cms::DDFilteredView::firstChild(), relativeConstraints::geom, MainPageGenerator::l, cms::DDFilteredView::nextSibling(), EgammaValidation_cff::num, cms::DDFilteredView::parent(), and cms::DDFilteredView::sibling().

52  {
53  edm::LogVerbatim("DTGeometryBuilder") << "(0) DTGeometryBuilder - DD4hep ";
54 
55  bool doChamber = fview.firstChild();
56 
57  while (doChamber) {
58  DTChamber* chamber = buildChamber(fview, num);
59 
60  bool doSL = fview.nextSibling();
61  while (doSL) {
62  DTSuperLayer* sl = buildSuperLayer(fview, chamber, num);
63 
64  fview.down();
65  bool doLayers = fview.sibling();
66  while (doLayers) {
67  DTLayer* l = buildLayer(fview, sl, num);
68  geom.add(l);
69 
70  doLayers = fview.sibling();
71  }
72 
73  geom.add(sl);
74  doSL = fview.nextSibling();
75  }
76  geom.add(chamber);
77 
78  fview.parent();
79  doChamber = fview.firstChild();
80  }
81 }
Log< level::Info, true > LogVerbatim
bool sibling()
set the current node to the next sub sibling
DTChamber * buildChamber(cms::DDFilteredView &, const MuonGeometryConstants &) const
void down()
set current node to the child node in the filtered tree
bool nextSibling()
set the current node to the next sibling
DTLayer * buildLayer(cms::DDFilteredView &, DTSuperLayer *, const MuonGeometryConstants &) const
DTSuperLayer * buildSuperLayer(cms::DDFilteredView &, DTChamber *, const MuonGeometryConstants &) const
bool parent()
set the current node to the parent node ...
bool firstChild()
set the current node to the first child

◆ buildLayer()

DTLayer * DTGeometryBuilderFromDD4hep::buildLayer ( cms::DDFilteredView fview,
DTSuperLayer sl,
const MuonGeometryConstants muonConstants 
) const
private

Definition at line 138 of file DTGeometryBuilderFromDD4hep.cc.

References DTSuperLayer::add(), DTNumberingScheme::baseNumberToUnitNumber(), cms::DDFilteredView::checkChild(), cms::DDFilteredView::down(), MuonGeometryNumbering::geoHistoryToBaseNumber(), cms::DDFilteredView::history(), cms::DDFilteredView::parameters(), cms::DDFilteredView::sibling(), HLT_2024v10_cff::topology, cms::DDFilteredView::up(), and cms::DDFilteredView::volume().

140  {
141  MuonGeometryNumbering mdddnum(muonConstants);
142  DTNumberingScheme dtnum(muonConstants);
143  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
144 
145  DTLayerId layId(rawid);
146 
147  auto const& par = fview.parameters();
148 
149  RCPPlane surf(
150  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
151 
152  edm::LogVerbatim("DTGeometryBuilder") << "(3) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
153  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
154 
155  fview.down();
156  bool doWire = fview.sibling();
157  int firstWire = fview.volume()->GetNumber();
158  auto const& wpar = fview.parameters();
159  float wireLength = wpar[1] / dd4hep::cm;
160 
161  edm::LogVerbatim("DTGeometryBuilder") << "(4) detId: " << rawid << " wpar[1]: " << wpar[1] / dd4hep::cm
162  << " firstWire: " << firstWire;
163 
164  int WCounter = 0;
165  while (doWire) {
166  doWire = fview.checkChild();
167  WCounter++;
168  }
169  fview.up();
170 
171  DTTopology topology(firstWire, WCounter, wireLength);
172 
173  DTLayerType layerType;
174 
175  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
176 
177  sl->add(layer);
178  return layer;
179 }
Log< level::Info, true > LogVerbatim
void up()
set current node to the parent node in the filtered tree
ReferenceCountingPointer< Plane > RCPPlane
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
bool sibling()
set the current node to the next sub sibling
void down()
set current node to the child node in the filtered tree
const ExpandedNodes & history()
The numbering history of the current node.
const PlacedVolume volume() const
The physical volume of the current node.
bool checkChild()
count the number of children matching selection
const std::vector< double > parameters() const
extract shape parameters
RCPPlane plane(const cms::DDFilteredView &, Bounds *bounds) const

◆ buildSuperLayer()

DTSuperLayer * DTGeometryBuilderFromDD4hep::buildSuperLayer ( cms::DDFilteredView fview,
DTChamber chamber,
const MuonGeometryConstants muonConstants 
) const
private

Definition at line 114 of file DTGeometryBuilderFromDD4hep.cc.

References DTNumberingScheme::baseNumberToUnitNumber(), relativeConstraints::chamber, MuonGeometryNumbering::geoHistoryToBaseNumber(), cms::DDFilteredView::history(), and cms::DDFilteredView::parameters().

116  {
117  MuonGeometryNumbering mdddnum(muonConstants);
118  DTNumberingScheme dtnum(muonConstants);
119  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
120 
121  DTSuperLayerId slId(rawid);
122 
123  auto const& par = fview.parameters();
124 
125  RCPPlane surf(
126  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
127 
128  edm::LogVerbatim("DTGeometryBuilder") << "(2) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
129  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
130 
131  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
132 
133  chamber->add(slayer);
134 
135  return slayer;
136 }
Log< level::Info, true > LogVerbatim
ReferenceCountingPointer< Plane > RCPPlane
const ExpandedNodes & history()
The numbering history of the current node.
const std::vector< double > parameters() const
extract shape parameters
RCPPlane plane(const cms::DDFilteredView &, Bounds *bounds) const

◆ plane()

DTGeometryBuilderFromDD4hep::RCPPlane DTGeometryBuilderFromDD4hep::plane ( const cms::DDFilteredView fview,
Bounds bounds 
) const
private

Definition at line 83 of file DTGeometryBuilderFromDD4hep.cc.

References cms::DDFilteredView::rot(), makeMuonMisalignmentScenario::rot, and cms::DDFilteredView::trans().

84  {
85  const Double_t* tr = fview.trans();
86  const Double_t* rot = fview.rot();
87 
88  return RCPPlane(
89  new Plane(Surface::PositionType(tr[0] / dd4hep::cm, tr[1] / dd4hep::cm, tr[2] / dd4hep::cm),
90  Surface::RotationType(rot[0], rot[3], rot[6], rot[1], rot[4], rot[7], rot[2], rot[5], rot[8]),
91  bounds));
92 }
ReferenceCountingPointer< Plane > RCPPlane
const Double_t * rot() const
The absolute rotation of the current node.
Definition: Plane.h:16
const Double_t * trans() const
The absolute translation of the current node.