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 180 of file DTGeometryBuilderFromDD4hep.cc.

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

Referenced by DTGeometryESModule::setupDD4hepGeometry().

183  {
184  cms::Volume top = det->worldVolume();
185  cms::DDFilteredView fview(det, top);
186  fview.mergedSpecifics(refs);
187  buildGeometry(fview, geom, num);
188 }
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 93 of file DTGeometryBuilderFromDD4hep.cc.

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

94  {
95  MuonGeometryNumbering mdddnum(muonConstants);
96  DTNumberingScheme dtnum(muonConstants);
97  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
98 
99  DTChamberId detId(rawid);
100  auto const& par = fview.parameters();
101 
102  RCPPlane surf(
103  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
104 
105  edm::LogVerbatim("DTGeometryBuilder") << "(1) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
106  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
107 
108  DTChamber* chamber = new DTChamber(detId, surf);
109 
110  return chamber;
111 }
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 49 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().

51  {
52  edm::LogVerbatim("DTGeometryBuilder") << "(0) DTGeometryBuilder - DD4hep ";
53 
54  bool doChamber = fview.firstChild();
55 
56  while (doChamber) {
57  DTChamber* chamber = buildChamber(fview, num);
58 
59  bool doSL = fview.nextSibling();
60  while (doSL) {
61  DTSuperLayer* sl = buildSuperLayer(fview, chamber, num);
62 
63  fview.down();
64  bool doLayers = fview.sibling();
65  while (doLayers) {
66  DTLayer* l = buildLayer(fview, sl, num);
67  geom.add(l);
68 
69  doLayers = fview.sibling();
70  }
71 
72  geom.add(sl);
73  doSL = fview.nextSibling();
74  }
75  geom.add(chamber);
76 
77  fview.parent();
78  doChamber = fview.firstChild();
79  }
80 }
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 137 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_2024v14_cff::topology, cms::DDFilteredView::up(), and cms::DDFilteredView::volume().

139  {
140  MuonGeometryNumbering mdddnum(muonConstants);
141  DTNumberingScheme dtnum(muonConstants);
142  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
143 
144  DTLayerId layId(rawid);
145 
146  auto const& par = fview.parameters();
147 
148  RCPPlane surf(
149  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
150 
151  edm::LogVerbatim("DTGeometryBuilder") << "(3) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
152  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
153 
154  fview.down();
155  bool doWire = fview.sibling();
156  int firstWire = fview.volume()->GetNumber();
157  auto const& wpar = fview.parameters();
158  float wireLength = wpar[1] / dd4hep::cm;
159 
160  edm::LogVerbatim("DTGeometryBuilder") << "(4) detId: " << rawid << " wpar[1]: " << wpar[1] / dd4hep::cm
161  << " firstWire: " << firstWire;
162 
163  int WCounter = 0;
164  while (doWire) {
165  doWire = fview.checkChild();
166  WCounter++;
167  }
168  fview.up();
169 
170  DTTopology topology(firstWire, WCounter, wireLength);
171 
172  DTLayerType layerType;
173 
174  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
175 
176  sl->add(layer);
177  return layer;
178 }
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 113 of file DTGeometryBuilderFromDD4hep.cc.

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

115  {
116  MuonGeometryNumbering mdddnum(muonConstants);
117  DTNumberingScheme dtnum(muonConstants);
118  int rawid = dtnum.baseNumberToUnitNumber(mdddnum.geoHistoryToBaseNumber(fview.history()));
119 
120  DTSuperLayerId slId(rawid);
121 
122  auto const& par = fview.parameters();
123 
124  RCPPlane surf(
125  plane(fview, new RectangularPlaneBounds(par[0] / dd4hep::cm, par[1] / dd4hep::cm, par[2] / dd4hep::cm)));
126 
127  edm::LogVerbatim("DTGeometryBuilder") << "(2) detId: " << rawid << " par[0]: " << par[0] / dd4hep::cm
128  << " par[1]: " << par[1] / dd4hep::cm << " par[2]: " << par[2] / dd4hep::cm;
129 
130  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
131 
132  chamber->add(slayer);
133 
134  return slayer;
135 }
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 82 of file DTGeometryBuilderFromDD4hep.cc.

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

83  {
84  const Double_t* tr = fview.trans();
85  const Double_t* rot = fview.rot();
86 
87  return RCPPlane(
88  new Plane(Surface::PositionType(tr[0] / dd4hep::cm, tr[1] / dd4hep::cm, tr[2] / dd4hep::cm),
89  Surface::RotationType(rot[0], rot[3], rot[6], rot[1], rot[4], rot[7], rot[2], rot[5], rot[8]),
90  bounds));
91 }
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.