CMS 3D CMS Logo

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

#include <DTGeometryBuilderFromDDD.h>

Public Member Functions

void build (DTGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
 
 DTGeometryBuilderFromDDD ()
 Constructor. More...
 
virtual ~DTGeometryBuilderFromDDD ()
 Destructor. More...
 

Private Types

typedef ReferenceCountingPointer< PlaneRCPPlane
 

Private Member Functions

DTChamberbuildChamber (DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants) const
 create the chamber More...
 
void buildGeometry (DTGeometry &theGeometry, DDFilteredView &fv, const MuonGeometryConstants &muonConstants) const
 
DTLayerbuildLayer (DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonGeometryConstants &muonConstants) const
 create the layer More...
 
DTSuperLayerbuildSuperLayer (DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
 create the SL More...
 
std::vector< double > extractParameters (DDFilteredView &fv) const
 get parameter also for boolean solid. More...
 
RCPPlane plane (const DDFilteredView &fv, Bounds *bounds) const
 

Detailed Description

Build the DTGeometry from the DDD description.

Author
N. Amapane - CERN.
Port of: MuBarDDDGeomBuilder, MuBarDetBuilder (ORCA) by S. Lacaprara, M. Case

Definition at line 31 of file DTGeometryBuilderFromDDD.h.

Member Typedef Documentation

◆ RCPPlane

Definition at line 63 of file DTGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

◆ DTGeometryBuilderFromDDD()

DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD ( )

Constructor.

Definition at line 29 of file DTGeometryBuilderFromDDD.cc.

29 {}

◆ ~DTGeometryBuilderFromDDD()

DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 31 of file DTGeometryBuilderFromDDD.cc.

31 {}

Member Function Documentation

◆ build()

void DTGeometryBuilderFromDDD::build ( DTGeometry theGeometry,
const DDCompactView cview,
const MuonGeometryConstants muonConstants 
)

Definition at line 33 of file DTGeometryBuilderFromDDD.cc.

References ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DTGeometryESModule::setupDDDGeometry().

35  {
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("DTGeometry") << "DTGeometryBuilderFromDDD::build";
38 #endif
39 
40  std::string attribute = "MuStructure";
41  std::string value = "MuonBarrelDT";
42 
43  // Asking only for the Muon DTs
45 
46  DDFilteredView fview(*cview, filter);
47  buildGeometry(theGeometry, fview, muonConstants);
48 }
Log< level::Info, true > LogVerbatim
void buildGeometry(DTGeometry &theGeometry, DDFilteredView &fv, const MuonGeometryConstants &muonConstants) const
Definition: value.py:1

◆ buildChamber()

DTChamber * DTGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
const std::string &  type,
const MuonGeometryConstants muonConstants 
) const
private

create the chamber

SL the definition of length, width, thickness depends on the local reference frame of the Det

Definition at line 97 of file DTGeometryBuilderFromDDD.cc.

References relativeConstraints::chamber, hcalRecHitTable_cff::detId, DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and dtGeometryBuilder::getRecPlaneBounds().

99  {
100  MuonGeometryNumbering mdddnum(muonConstants);
101  DTNumberingScheme dtnum(muonConstants);
102  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
103  DTChamberId detId(rawid);
104 
105  // Chamber specific parameter (size)
106  // FIXME: some trouble for boolean solids?
107  std::vector<double> par = extractParameters(fv);
108 
110  // width is along local X. r-phi dimension - different in different chambers
111  // length is along local Y. z dimension - constant 125.55 cm
112  // thickness is long local Z. radial thickness - almost constant about 18 cm
113 
114  edm::LogVerbatim("DTGeometryBuilder") << "(1) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
115  << " par[2]: " << par[2];
116 
117  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
118 
119  DTChamber* chamber = new DTChamber(detId, surf);
120 
121  return chamber;
122 }
Log< level::Info, true > LogVerbatim
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
ReferenceCountingPointer< Plane > RCPPlane

◆ buildGeometry()

void DTGeometryBuilderFromDDD::buildGeometry ( DTGeometry theGeometry,
DDFilteredView fv,
const MuonGeometryConstants muonConstants 
) const
private

Definition at line 50 of file DTGeometryBuilderFromDDD.cc.

References DTGeometry::add(), relativeConstraints::chamber, DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), submitPVValidationJobs::params, DDFilteredView::parent(), AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

52  {
53  edm::LogVerbatim("DTGeometryBuilder") << "(0) DTGeometryBuilder - DDD ";
54 
55  bool doChamber = fv.firstChild();
56 
57  // Loop on chambers
58  while (doChamber) {
59  DDValue val("Type");
62  if (DDfetch(&params, val))
63  type = val.strings()[0];
64  // FIXME
65  val = DDValue("FEPos");
66  std::string FEPos;
67  if (DDfetch(&params, val))
68  FEPos = val.strings()[0];
69  DTChamber* chamber = buildChamber(fv, type, muonConstants);
70 
71  // Loop on SLs
72  bool doSL = fv.firstChild();
73  while (doSL) {
74  DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants);
75  theGeometry.add(sl);
76 
77  bool doL = fv.firstChild();
78  // Loop on SLs
79  while (doL) {
80  DTLayer* layer = buildLayer(fv, sl, type, muonConstants);
81  theGeometry.add(layer);
82 
83  fv.parent();
84  doL = fv.nextSibling(); // go to next layer
85  } // layers
86 
87  fv.parent();
88  doSL = fv.nextSibling(); // go to next SL
89  } // sls
90  theGeometry.add(chamber);
91 
92  fv.parent();
93  doChamber = fv.nextSibling(); // go to next chamber
94  } // chambers
95 }
Log< level::Info, true > LogVerbatim
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the chamber
DDsvalues_type mergedSpecifics() const
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the SL
DTLayer * buildLayer(DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the layer
bool firstChild()
set the current node to the first child ...
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42

◆ buildLayer()

DTLayer * DTGeometryBuilderFromDDD::buildLayer ( DDFilteredView fv,
DTSuperLayer sl,
const std::string &  type,
const MuonGeometryConstants muonConstants 
) const
private

create the layer

Definition at line 156 of file DTGeometryBuilderFromDDD.cc.

References DTSuperLayer::add(), angle_units::operators::convertMmToCm(), DDFilteredView::copyno(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), dtGeometryBuilder::getRecPlaneBounds(), DDFilteredView::nextSibling(), and HLT_2024v13_cff::topology.

159  {
160  MuonGeometryNumbering mdddnum(muonConstants);
161  DTNumberingScheme dtnum(muonConstants);
162  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
163  DTLayerId layId(rawid);
164 
165  // Layer specific parameter (size)
166  std::vector<double> par = extractParameters(fv);
167  // width -- r-phi dimension - different in different chambers
168  // length -- z dimension - constant 126.8 cm
169  // thickness -- radial thickness - almost constant about 20 cm
170 
171  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
172 
173  edm::LogVerbatim("DTGeometryBuilder") << "(3) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
174  << " par[2]: " << par[2];
175 
176  // Loop on wires
177  bool doWire = fv.firstChild();
178  int WCounter = 0;
179  int firstWire = fv.copyno();
180  par = extractParameters(fv);
181  float wireLength = convertMmToCm(par[1]);
182 
183  edm::LogVerbatim("DTGeometryBuilder") << "(4) detId: " << rawid
184  << " wireLenght in ddd, wpar[1] in dd4hep: " << wireLength
185  << " firstWire: " << firstWire;
186 
187  while (doWire) {
188  WCounter++;
189  doWire = fv.nextSibling(); // next wire
190  }
191  //int lastWire=fv.copyno();
192  DTTopology topology(firstWire, WCounter, wireLength);
193 
194  DTLayerType layerType;
195 
196  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
197 
198  sl->add(layer);
199  return layer;
200 }
Log< level::Info, true > LogVerbatim
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
bool nextSibling()
set the current node to the next sibling ...
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
int copyno() const
Copy number associated with the current node.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
ReferenceCountingPointer< Plane > RCPPlane
bool firstChild()
set the current node to the first child ...

◆ buildSuperLayer()

DTSuperLayer * DTGeometryBuilderFromDDD::buildSuperLayer ( DDFilteredView fv,
DTChamber chamber,
const std::string &  type,
const MuonGeometryConstants muonConstants 
) const
private

create the SL

Definition at line 124 of file DTGeometryBuilderFromDDD.cc.

References relativeConstraints::chamber, DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and dtGeometryBuilder::getRecPlaneBounds().

127  {
128  MuonGeometryNumbering mdddnum(muonConstants);
129  DTNumberingScheme dtnum(muonConstants);
130  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
131  DTSuperLayerId slId(rawid);
132 
133  // Slayer specific parameter (size)
134  std::vector<double> par = extractParameters(fv);
135 
136  edm::LogVerbatim("DTGeometryBuilder") << "(2) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
137  << " par[2]: " << par[2];
138 
139  // r-phi dimension - different in different chambers
140  // z dimension - constant 126.8 cm
141  // radial thickness - almost constant about 20 cm
142 
143  // Ok this is the s-layer position...
144  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
145 
146  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
147 
148  //LocalPoint lpos(10,20,30);
149  //GlobalPoint gpos=slayer->toGlobal(lpos);
150 
151  // add to the chamber
152  chamber->add(slayer);
153  return slayer;
154 }
Log< level::Info, true > LogVerbatim
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
ReferenceCountingPointer< Plane > RCPPlane

◆ extractParameters()

std::vector< double > DTGeometryBuilderFromDDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 202 of file DTGeometryBuilderFromDDD.cc.

References A, cms::cuda::bs, ddbox, DDFilteredView::logicalPart(), DDSolid::parameters(), DDSolid::shape(), and DDLogicalPart::solid().

202  {
203  std::vector<double> par;
204  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
206  DDSolid A = bs.solidA();
207  while (A.shape() != DDSolidShape::ddbox) {
209  A = bs.solidA();
210  }
211  par = A.parameters();
212  } else {
213  par = fv.logicalPart().solid().parameters();
214  }
215  return par;
216 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: APVGainStruct.h:7

◆ plane()

DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
Bounds bounds 
) const
private

Definition at line 218 of file DTGeometryBuilderFromDDD.cc.

References angle_units::operators::convertMmToCm(), nano_mu_digi_cff::float, LogTrace, idealTransformation::rotation, DDFilteredView::rotation(), DDFilteredView::translation(), and x.

218  {
219  // extract the position
220  const DDTranslation& trans(fv.translation());
221 
222  const Surface::PositionType posResult(
223  float(convertMmToCm(trans.x())), float(convertMmToCm(trans.y())), float(convertMmToCm(trans.z())));
224  LogTrace("DTGeometryBuilderFromDDD") << "DTGeometryBuilderFromDDD::plane posResult: " << posResult;
225  // now the rotation
226  // 'active' and 'passive' rotations are inverse to each other
227  const DDRotationMatrix& rotation = fv.rotation(); //REMOVED .Inverse();
228  DD3Vector x, y, z;
229  rotation.GetComponents(x, y, z);
230 #ifdef EDM_ML_DEBUG
231  edm::LogVerbatim("DTGeometry") << "INVERSE rotation by its own operator: " << fv.rotation();
232  edm::LogVerbatim("DTGeometry") << "INVERSE rotation manually: " << x.X() << ", " << x.Y() << ", " << x.Z()
233  << std::endl
234  << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
235  << z.X() << ", " << z.Y() << ", " << z.Z();
236 #endif
237  Surface::RotationType rotResult(float(x.X()),
238  float(x.Y()),
239  float(x.Z()),
240  float(y.X()),
241  float(y.Y()),
242  float(y.Z()),
243  float(z.X()),
244  float(z.Y()),
245  float(z.Z()));
246 
247  return RCPPlane(new Plane(posResult, rotResult, bounds));
248 }
Log< level::Info, true > LogVerbatim
Definition: Plane.h:16
#define LogTrace(id)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
ReferenceCountingPointer< Plane > RCPPlane
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7