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 32 of file DTGeometryBuilderFromDDD.cc.

32 {}

◆ ~DTGeometryBuilderFromDDD()

DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 34 of file DTGeometryBuilderFromDDD.cc.

34 {}

Member Function Documentation

◆ build()

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

Definition at line 36 of file DTGeometryBuilderFromDDD.cc.

38  {
39  // cout << "DTGeometryBuilderFromDDD::build" << endl;
40  // static const string t0 = "DTGeometryBuilderFromDDD::build";
41  // TimeMe timer(t0,true);
42 
43  std::string attribute = "MuStructure";
44  std::string value = "MuonBarrelDT";
45 
46  // Asking only for the Muon DTs
48 
49  DDFilteredView fview(*cview, filter);
50  buildGeometry(theGeometry, fview, muonConstants);
51 }

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

Referenced by DTGeometryESModule::setupDDDGeometry().

◆ 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 106 of file DTGeometryBuilderFromDDD.cc.

108  {
109  MuonGeometryNumbering mdddnum(muonConstants);
110  DTNumberingScheme dtnum(muonConstants);
111  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
112  DTChamberId detId(rawid);
113 
114  // Chamber specific parameter (size)
115  // FIXME: some trouble for boolean solids?
116  vector<double> par = extractParameters(fv);
117 
119  // width is along local X. r-phi dimension - different in different chambers
120  // length is along local Y. z dimension - constant 125.55 cm
121  // thickness is long local Z. radial thickness - almost constant about 18 cm
122 
123  edm::LogVerbatim("DTGeometryBuilder") << "(1) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
124  << " par[2]: " << par[2];
125 
126  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
127 
128  DTChamber* chamber = new DTChamber(detId, surf);
129 
130  return chamber;
131 }

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

◆ buildGeometry()

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

Definition at line 53 of file DTGeometryBuilderFromDDD.cc.

55  {
56  edm::LogVerbatim("DTGeometryBuilder") << "(0) DTGeometryBuilder - DDD ";
57 
58  bool doChamber = fv.firstChild();
59 
60  // Loop on chambers
61  int ChamCounter = 0;
62  while (doChamber) {
63  ChamCounter++;
64  DDValue val("Type");
66  string type;
67  if (DDfetch(&params, val))
68  type = val.strings()[0];
69  // FIXME
70  val = DDValue("FEPos");
71  string FEPos;
72  if (DDfetch(&params, val))
73  FEPos = val.strings()[0];
74  DTChamber* chamber = buildChamber(fv, type, muonConstants);
75 
76  // Loop on SLs
77  bool doSL = fv.firstChild();
78  int SLCounter = 0;
79  while (doSL) {
80  SLCounter++;
81  DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants);
82  theGeometry.add(sl);
83 
84  bool doL = fv.firstChild();
85  int LCounter = 0;
86  // Loop on SLs
87  while (doL) {
88  LCounter++;
89  DTLayer* layer = buildLayer(fv, sl, type, muonConstants);
90  theGeometry.add(layer);
91 
92  fv.parent();
93  doL = fv.nextSibling(); // go to next layer
94  } // layers
95 
96  fv.parent();
97  doSL = fv.nextSibling(); // go to next SL
98  } // sls
99  theGeometry.add(chamber);
100 
101  fv.parent();
102  doChamber = fv.nextSibling(); // go to next chamber
103  } // chambers
104 }

References DTGeometry::add(), relativeConstraints::chamber, DDfetch(), DDFilteredView::firstChild(), phase1PixelTopology::layer, DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), CalibrationSummaryClient_cfi::params, DDFilteredView::parent(), and heppy_batch::val.

◆ buildLayer()

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

create the layer

Definition at line 165 of file DTGeometryBuilderFromDDD.cc.

168  {
169  MuonGeometryNumbering mdddnum(muonConstants);
170  DTNumberingScheme dtnum(muonConstants);
171  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
172  DTLayerId layId(rawid);
173 
174  // Layer specific parameter (size)
175  vector<double> par = extractParameters(fv);
176  // width -- r-phi dimension - different in different chambers
177  // length -- z dimension - constant 126.8 cm
178  // thickness -- radial thickness - almost constant about 20 cm
179 
180  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
181 
182  edm::LogVerbatim("DTGeometryBuilder") << "(3) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
183  << " par[2]: " << par[2];
184 
185  // Loop on wires
186  bool doWire = fv.firstChild();
187  int WCounter = 0;
188  int firstWire = fv.copyno();
189  par = extractParameters(fv);
190  float wireLength = convertMmToCm(par[1]);
191 
192  edm::LogVerbatim("DTGeometryBuilder") << "(4) detId: " << rawid
193  << " wireLenght in ddd, wpar[1] in dd4hep: " << wireLength
194  << " firstWire: " << firstWire;
195 
196  while (doWire) {
197  WCounter++;
198  doWire = fv.nextSibling(); // next wire
199  }
200  //int lastWire=fv.copyno();
201  DTTopology topology(firstWire, WCounter, wireLength);
202 
203  DTLayerType layerType;
204 
205  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
206 
207  sl->add(layer);
208  return layer;
209 }

References DTSuperLayer::add(), geant_units::operators::convertMmToCm(), DDFilteredView::copyno(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), dtGeometryBuilder::getRecPlaneBounds(), phase1PixelTopology::layer, and DDFilteredView::nextSibling().

◆ buildSuperLayer()

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

create the SL

Definition at line 133 of file DTGeometryBuilderFromDDD.cc.

136  {
137  MuonGeometryNumbering mdddnum(muonConstants);
138  DTNumberingScheme dtnum(muonConstants);
139  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
140  DTSuperLayerId slId(rawid);
141 
142  // Slayer specific parameter (size)
143  vector<double> par = extractParameters(fv);
144 
145  edm::LogVerbatim("DTGeometryBuilder") << "(2) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
146  << " par[2]: " << par[2];
147 
148  // r-phi dimension - different in different chambers
149  // z dimension - constant 126.8 cm
150  // radial thickness - almost constant about 20 cm
151 
152  // Ok this is the s-layer position...
153  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
154 
155  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
156 
157  //LocalPoint lpos(10,20,30);
158  //GlobalPoint gpos=slayer->toGlobal(lpos);
159 
160  // add to the chamber
161  chamber->add(slayer);
162  return slayer;
163 }

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

◆ extractParameters()

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

get parameter also for boolean solid.

Definition at line 211 of file DTGeometryBuilderFromDDD.cc.

211  {
212  vector<double> par;
213  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
215  DDSolid A = bs.solidA();
216  while (A.shape() != DDSolidShape::ddbox) {
218  A = bs.solidA();
219  }
220  par = A.parameters();
221  } else {
222  par = fv.logicalPart().solid().parameters();
223  }
224  return par;
225 }

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

◆ plane()

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

Definition at line 227 of file DTGeometryBuilderFromDDD.cc.

227  {
228  // extract the position
229  const DDTranslation& trans(fv.translation());
230 
231  const Surface::PositionType posResult(
232  float(convertMmToCm(trans.x())), float(convertMmToCm(trans.y())), float(convertMmToCm(trans.z())));
233  LogTrace("DTGeometryBuilderFromDDD") << "DTGeometryBuilderFromDDD::plane "
234  << " posResult: " << posResult << std::endl;
235  // now the rotation
236  // 'active' and 'passive' rotations are inverse to each other
237  const DDRotationMatrix& rotation = fv.rotation(); //REMOVED .Inverse();
238  DD3Vector x, y, z;
239  rotation.GetComponents(x, y, z);
240  // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
241  // std::cout << "INVERSE rotation manually: "
242  // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
243  // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
244  // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
245 
246  Surface::RotationType rotResult(float(x.X()),
247  float(x.Y()),
248  float(x.Z()),
249  float(y.X()),
250  float(y.Y()),
251  float(y.Z()),
252  float(z.X()),
253  float(z.Y()),
254  float(z.Z()));
255 
256  // std::cout << "rotation by its own operator: "<< tmp << std::endl;
257  // DD3Vector tx, ty,tz;
258  // tmp.GetComponents(tx, ty, tz);
259  // std::cout << "rotation manually: "
260  // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
261  // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
262  // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
263 
264  return RCPPlane(new Plane(posResult, rotResult, bounds));
265 }

References geant_units::operators::convertMmToCm(), dqmMemoryStats::float, LogTrace, idealTransformation::rotation, DDFilteredView::rotation(), and DDFilteredView::translation().

TkRotation< float >
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DDAxes::y
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
dtGeometryBuilder::getRecPlaneBounds
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
Definition: DTGeometryBuilderFromCondDB.cc:80
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
DDFilteredView::mergedSpecifics
DDsvalues_type mergedSpecifics() const
Definition: DDFilteredView.cc:42
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
DTChamber
Definition: DTChamber.h:24
DDAxes::x
DTSuperLayer
Definition: DTSuperLayer.h:24
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DTGeometryBuilderFromDDD::plane
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
Definition: DTGeometryBuilderFromDDD.cc:227
DTTopology
Definition: DTTopology.h:28
DDBooleanSolid
Definition: DDSolid.h:184
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
cms::cuda::bs
bs
Definition: HistoContainer.h:76
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDAxes::z
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Point3DBase< float, GlobalTag >
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
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
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:20
DTGeometryBuilderFromDDD::buildSuperLayer
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the SL
Definition: DTGeometryBuilderFromDDD.cc:133
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
DTGeometryBuilderFromDDD::buildLayer
DTLayer * buildLayer(DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the layer
Definition: DTGeometryBuilderFromDDD.cc:165
DTGeometry::add
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
value
Definition: value.py:1
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
DTGeometryBuilderFromDDD::RCPPlane
ReferenceCountingPointer< Plane > RCPPlane
Definition: DTGeometryBuilderFromDDD.h:63
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTLayer
Definition: DTLayer.h:25
heppy_batch.val
val
Definition: heppy_batch.py:351
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DDSolidShape::ddbox
DTGeometryBuilderFromDDD::buildChamber
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the chamber
Definition: DTGeometryBuilderFromDDD.cc:106
DDValue
Definition: DDValue.h:22
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
DTLayerType
Definition: DTLayerType.h:15
Plane
Definition: Plane.h:16
DTGeometryBuilderFromDDD::buildGeometry
void buildGeometry(DTGeometry &theGeometry, DDFilteredView &fv, const MuonGeometryConstants &muonConstants) const
Definition: DTGeometryBuilderFromDDD.cc:53
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
MuonGeometryNumbering
Definition: MuonGeometryNumbering.h:24
DDFilteredView
Definition: DDFilteredView.h:20
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
DTGeometryBuilderFromDDD::extractParameters
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
Definition: DTGeometryBuilderFromDDD.cc:211
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
A
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
DDFilteredView::copyno
int copyno() const
Copy number associated with the current node.
Definition: DDFilteredView.cc:48
DTNumberingScheme
Definition: DTNumberingScheme.h:20