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 MuonDDDConstants &muonConstants)
 
 DTGeometryBuilderFromDDD ()
 Constructor. More...
 
virtual ~DTGeometryBuilderFromDDD ()
 Destructor. More...
 

Private Types

typedef ReferenceCountingPointer< PlaneRCPPlane
 

Private Member Functions

DTChamberbuildChamber (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the chamber More...
 
void buildGeometry (DTGeometry &theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
 
DTLayerbuildLayer (DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the layer More...
 
DTSuperLayerbuildSuperLayer (DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonDDDConstants &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 65 of file DTGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD ( )

Constructor.

Definition at line 34 of file DTGeometryBuilderFromDDD.cc.

34 {}
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 36 of file DTGeometryBuilderFromDDD.cc.

36 {}

Member Function Documentation

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

Definition at line 39 of file DTGeometryBuilderFromDDD.cc.

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

Referenced by AlignmentMonitorAsAnalyzer::analyze(), AlignmentProducerBase::createGeometries(), MuonAlignmentInputMethod::idealDTGeometry(), MisalignedMuonESProducer::produce(), DTGeometryESModule::setupGeometry(), and MuonAlignmentOutputXML::write().

41  {
42  // cout << "DTGeometryBuilderFromDDD::build" << endl;
43  // static const string t0 = "DTGeometryBuilderFromDDD::build";
44  // TimeMe timer(t0,true);
45 
46  std::string attribute = "MuStructure";
47  std::string value = "MuonBarrelDT";
48 
49  // Asking only for the Muon DTs
50  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
51 
52  DDFilteredView fview(*cview,filter);
53  buildGeometry(theGeometry, fview, muonConstants);
54 }
Definition: value.py:1
void buildGeometry(DTGeometry &theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
DTChamber * DTGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
const std::string &  type,
const MuonDDDConstants 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 relativeConstraints::chamber, DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and dtGeometryBuilder::getRecPlaneBounds().

107  {
108  MuonDDDNumbering 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 
123  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
124 
125  DTChamber* chamber = new DTChamber(detId, surf);
126 
127  return chamber;
128 }
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 MuonDDDConstants muonConstants 
) const
private

Definition at line 57 of file DTGeometryBuilderFromDDD.cc.

References DTGeometry::add(), relativeConstraints::chamber, DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), DDFilteredView::parent(), DDValue::strings(), and heppy_batch::val.

59  {
60  bool doChamber = fv.firstChild();
61 
62  // Loop on chambers
63  int ChamCounter=0;
64  while (doChamber){
65  ChamCounter++;
66  DDValue val("Type");
67  const DDsvalues_type params(fv.mergedSpecifics());
68  string type;
69  if (DDfetch(&params,val)) type = val.strings()[0];
70  // FIXME
71  val=DDValue("FEPos");
72  string FEPos;
73  if (DDfetch(&params,val)) 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 }
type
Definition: HCALResponse.h:21
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
DTLayer * buildLayer(DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonDDDConstants &muonConstants) const
create the layer
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const
create the chamber
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonDDDConstants &muonConstants) const
create the SL
DDsvalues_type mergedSpecifics() const
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
bool firstChild()
set the current node to the first child ...
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:44
DTLayer * DTGeometryBuilderFromDDD::buildLayer ( DDFilteredView fv,
DTSuperLayer sl,
const std::string &  type,
const MuonDDDConstants muonConstants 
) const
private

create the layer

Definition at line 161 of file DTGeometryBuilderFromDDD.cc.

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

164  {
165 
166  MuonDDDNumbering mdddnum(muonConstants);
167  DTNumberingScheme dtnum(muonConstants);
168  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
169  DTLayerId layId(rawid);
170 
171  // Layer specific parameter (size)
172  vector<double> par = extractParameters(fv);
173  // width -- r-phi dimension - different in different chambers
174  // length -- z dimension - constant 126.8 cm
175  // thickness -- radial thickness - almost constant about 20 cm
176 
177  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
178 
179  // Loop on wires
180  bool doWire = fv.firstChild();
181  int WCounter=0;
182  int firstWire=fv.copyno();
183  par = extractParameters(fv);
184  float wireLength = convertMmToCm( par[1] );
185  while (doWire) {
186  WCounter++;
187  doWire = fv.nextSibling(); // next wire
188  }
189  //int lastWire=fv.copyno();
190  DTTopology topology(firstWire, WCounter, wireLength);
191 
192  DTLayerType layerType;
193 
194  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
195 
196  sl->add(layer);
197  return layer;
198 }
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
CaloTopology const * topology(0)
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:59
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
int copyno() const
Copy number associated with 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
bool firstChild()
set the current node to the first child ...
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:110
DTSuperLayer * DTGeometryBuilderFromDDD::buildSuperLayer ( DDFilteredView fv,
DTChamber chamber,
const std::string &  type,
const MuonDDDConstants muonConstants 
) const
private

create the SL

Definition at line 130 of file DTGeometryBuilderFromDDD.cc.

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

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

get parameter also for boolean solid.

Definition at line 201 of file DTGeometryBuilderFromDDD.cc.

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

201  {
202  vector<double> par;
203  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
204  DDBooleanSolid bs(fv.logicalPart().solid());
205  DDSolid A = bs.solidA();
206  while (A.shape() != DDSolidShape::ddbox) {
207  DDBooleanSolid bs(A);
208  A = bs.solidA();
209  }
210  par=A.parameters();
211  } else {
212  par = fv.logicalPart().solid().parameters();
213  }
214  return par;
215 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
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:138
DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
Bounds bounds 
) const
private

Definition at line 218 of file DTGeometryBuilderFromDDD.cc.

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

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