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

33 {}

◆ ~DTGeometryBuilderFromDDD()

DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 35 of file DTGeometryBuilderFromDDD.cc.

35 {}

Member Function Documentation

◆ build()

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

Definition at line 37 of file DTGeometryBuilderFromDDD.cc.

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

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

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

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

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

References DTGeometry::add(), relativeConstraints::chamber, DDfetch(), DDFilteredView::firstChild(), 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 158 of file DTGeometryBuilderFromDDD.cc.

161  {
162  MuonGeometryNumbering mdddnum(muonConstants);
163  DTNumberingScheme dtnum(muonConstants);
164  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
165  DTLayerId layId(rawid);
166 
167  // Layer specific parameter (size)
168  vector<double> par = extractParameters(fv);
169  // width -- r-phi dimension - different in different chambers
170  // length -- z dimension - constant 126.8 cm
171  // thickness -- radial thickness - almost constant about 20 cm
172 
173  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
174 
175  // Loop on wires
176  bool doWire = fv.firstChild();
177  int WCounter = 0;
178  int firstWire = fv.copyno();
179  par = extractParameters(fv);
180  float wireLength = convertMmToCm(par[1]);
181  while (doWire) {
182  WCounter++;
183  doWire = fv.nextSibling(); // next wire
184  }
185  //int lastWire=fv.copyno();
186  DTTopology topology(firstWire, WCounter, wireLength);
187 
188  DTLayerType layerType;
189 
190  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
191 
192  sl->add(layer);
193  return layer;
194 }

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

◆ buildSuperLayer()

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

create the SL

Definition at line 129 of file DTGeometryBuilderFromDDD.cc.

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

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

196  {
197  vector<double> par;
198  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
200  DDSolid A = bs.solidA();
201  while (A.shape() != DDSolidShape::ddbox) {
203  A = bs.solidA();
204  }
205  par = A.parameters();
206  } else {
207  par = fv.logicalPart().solid().parameters();
208  }
209  return par;
210 }

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

212  {
213  // extract the position
214  const DDTranslation& trans(fv.translation());
215 
216  const Surface::PositionType posResult(
217  float(convertMmToCm(trans.x())), float(convertMmToCm(trans.y())), float(convertMmToCm(trans.z())));
218  LogTrace("DTGeometryBuilderFromDDD") << "DTGeometryBuilderFromDDD::plane "
219  << " posResult: " << posResult << std::endl;
220  // now the rotation
221  // 'active' and 'passive' rotations are inverse to each other
222  const DDRotationMatrix& rotation = fv.rotation(); //REMOVED .Inverse();
223  DD3Vector x, y, z;
224  rotation.GetComponents(x, y, z);
225  // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
226  // std::cout << "INVERSE rotation manually: "
227  // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
228  // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
229  // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
230 
231  Surface::RotationType rotResult(float(x.X()),
232  float(x.Y()),
233  float(x.Z()),
234  float(y.X()),
235  float(y.Y()),
236  float(y.Z()),
237  float(z.X()),
238  float(z.Y()),
239  float(z.Z()));
240 
241  // std::cout << "rotation by its own operator: "<< tmp << std::endl;
242  // DD3Vector tx, ty,tz;
243  // tmp.GetComponents(tx, ty, tz);
244  // std::cout << "rotation manually: "
245  // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
246  // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
247  // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
248 
249  return RCPPlane(new Plane(posResult, rotResult, bounds));
250 }

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:212
DTTopology
Definition: DTTopology.h:28
DDBooleanSolid
Definition: DDSolid.h:173
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
cms::cuda::bs
bs
Definition: HistoContainer.h:127
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
ecaldqm::topology
const CaloTopology * topology(nullptr)
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:19
DTGeometryBuilderFromDDD::buildSuperLayer
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the SL
Definition: DTGeometryBuilderFromDDD.cc:129
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:158
DTGeometry::add
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
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
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:105
DDValue
Definition: DDValue.h:21
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:54
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
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:62
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
DTGeometryBuilderFromDDD::extractParameters
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
Definition: DTGeometryBuilderFromDDD.cc:196
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