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.

184  {
185  cms::Volume top = det->worldVolume();
186  cms::DDFilteredView fview(det, top);
187  fview.mergedSpecifics(refs);
188  buildGeometry(fview, geom, num);
189 }

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

Referenced by DTGeometryESModule::setupDD4hepGeometry().

◆ buildChamber()

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

Definition at line 94 of file DTGeometryBuilderFromDD4Hep.cc.

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 }

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

◆ buildGeometry()

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

Definition at line 50 of file DTGeometryBuilderFromDD4Hep.cc.

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 }

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

◆ buildLayer()

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

Definition at line 138 of file DTGeometryBuilderFromDD4Hep.cc.

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 }

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

◆ buildSuperLayer()

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

Definition at line 114 of file DTGeometryBuilderFromDD4Hep.cc.

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 }

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

◆ plane()

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

Definition at line 83 of file DTGeometryBuilderFromDD4Hep.cc.

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 }

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

cms::DDFilteredView::rot
const Double_t * rot() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:120
cms::DDFilteredView::volume
const PlacedVolume volume() const
The physical volume of the current node.
Definition: DDFilteredView.cc:68
DTGeometryBuilderFromDD4Hep::RCPPlane
ReferenceCountingPointer< Plane > RCPPlane
Definition: DTGeometryBuilderFromDD4Hep.h:57
TkRotation< float >
DTSuperLayerId
Definition: DTSuperLayerId.h:12
cms::DDFilteredView::parameters
const std::vector< double > parameters() const
extract shape parameters
Definition: DDFilteredView.cc:536
cms::DDFilteredView::sibling
bool sibling()
set the current node to the next sub sibling
Definition: DDFilteredView.cc:450
DTGeometryBuilderFromDD4Hep::buildLayer
DTLayer * buildLayer(cms::DDFilteredView &, DTSuperLayer *, const MuonGeometryConstants &) const
Definition: DTGeometryBuilderFromDD4Hep.cc:138
DTChamber
Definition: DTChamber.h:24
cms::DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:481
DTSuperLayer
Definition: DTSuperLayer.h:24
cms::DDFilteredView
Definition: DDFilteredView.h:70
DTGeometryBuilderFromDD4Hep::buildSuperLayer
DTSuperLayer * buildSuperLayer(cms::DDFilteredView &, DTChamber *, const MuonGeometryConstants &) const
Definition: DTGeometryBuilderFromDD4Hep.cc:114
DTGeometryBuilderFromDD4Hep::buildGeometry
void buildGeometry(cms::DDFilteredView &, DTGeometry &, const MuonGeometryConstants &) const
Definition: DTGeometryBuilderFromDD4Hep.cc:50
cms::DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling
Definition: DDFilteredView.cc:427
DTTopology
Definition: DTTopology.h:28
cms::DDFilteredView::trans
const Double_t * trans() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:101
cms::DDFilteredView::firstChild
bool firstChild()
set the current node to the first child
Definition: DDFilteredView.cc:268
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
cms::DDFilteredView::down
void down()
set current node to the child node in the filtered tree
Definition: DDFilteredView.cc:505
Point3DBase< float, GlobalTag >
DTLayerId
Definition: DTLayerId.h:12
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
DTSuperLayer::add
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
cms::DDDetector::worldVolume
dd4hep::Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:48
cms::DDFilteredView::history
const ExpandedNodes & history()
The numbering history of the current node.
Definition: DDFilteredView.cc:683
cms::DDFilteredView::up
void up()
set current node to the parent node in the filtered tree
Definition: DDFilteredView.cc:516
DTLayer
Definition: DTLayer.h:25
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
DTGeometryBuilderFromDD4Hep::plane
RCPPlane plane(const cms::DDFilteredView &, Bounds *bounds) const
Definition: DTGeometryBuilderFromDD4Hep.cc:83
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
cms::DDFilteredView::checkChild
bool checkChild()
count the number of children matching selection
Definition: DDFilteredView.cc:466
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DTLayerType
Definition: DTLayerType.h:15
Plane
Definition: Plane.h:16
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
MuonGeometryNumbering
Definition: MuonGeometryNumbering.h:24
DTGeometryBuilderFromDD4Hep::buildChamber
DTChamber * buildChamber(cms::DDFilteredView &, const MuonGeometryConstants &) const
Definition: DTGeometryBuilderFromDD4Hep.cc:94
DTChamberId
Definition: DTChamberId.h:14
DTNumberingScheme
Definition: DTNumberingScheme.h:20