CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< Plane
RCPPlane
 

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

Definition at line 63 of file DTGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD ( )

Constructor.

Definition at line 32 of file DTGeometryBuilderFromDDD.cc.

32 {}
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 34 of file DTGeometryBuilderFromDDD.cc.

34 {}

Member Function Documentation

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

Definition at line 36 of file DTGeometryBuilderFromDDD.cc.

References alcazmumu_cfi::filter, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by DTGeometryESModule::setupDDDGeometry().

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
47  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
48 
49  DDFilteredView fview(*cview, filter);
50  buildGeometry(theGeometry, fview, muonConstants);
51 }
void buildGeometry(DTGeometry &theGeometry, DDFilteredView &fv, const MuonGeometryConstants &muonConstants) const
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.

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

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 }
Log< level::Info, true > LogVerbatim
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
ReferenceCountingPointer< Plane > RCPPlane
void DTGeometryBuilderFromDDD::buildGeometry ( DTGeometry theGeometry,
DDFilteredView fv,
const MuonGeometryConstants muonConstants 
) const
private

Definition at line 53 of file DTGeometryBuilderFromDDD.cc.

References DTGeometry::add(), DDfetch(), DDFilteredView::firstChild(), phase1PixelTopology::layer, DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), submitPVValidationJobs::params, DDFilteredView::parent(), DDValue::strings(), and hgcalPerformanceValidation::val.

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 }
Log< level::Info, true > LogVerbatim
bool parent()
set the current node to the parent node ...
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the SL
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
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
DDsvalues_type mergedSpecifics() const
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the chamber
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
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.

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

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 }
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
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
constexpr std::array< uint8_t, layerIndexSize > layer
int copyno() const
Copy number associated with the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
ReferenceCountingPointer< Plane > RCPPlane
bool firstChild()
set the current node to the first child ...
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.

References DTChamber::add(), DDFilteredView::geoHistory(), MuonGeometryNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and dtGeometryBuilder::getRecPlaneBounds().

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 }
Log< level::Info, true > LogVerbatim
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
void add(DTSuperLayer *sl)
Add SL to the chamber which takes ownership.
Definition: DTChamber.cc:36
ReferenceCountingPointer< Plane > RCPPlane
vector< double > DTGeometryBuilderFromDDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 211 of file DTGeometryBuilderFromDDD.cc.

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

211  {
212  vector<double> par;
213  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
215  DDSolid A = bs.solidA();
216  while (A.shape() != DDSolidShape::ddbox) {
217  DDBooleanSolid bs(A);
218  A = bs.solidA();
219  }
220  par = A.parameters();
221  } else {
222  par = fv.logicalPart().solid().parameters();
223  }
224  return par;
225 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
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.
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
Definition: APVGainStruct.h:7
DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
Bounds bounds 
) const
private

Definition at line 227 of file DTGeometryBuilderFromDDD.cc.

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

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 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: Plane.h:16
#define LogTrace(id)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
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