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 25 of file DTGeometryBuilderFromDDD.h.

Member Typedef Documentation

Definition at line 59 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 MuonDDDConstants muonConstants 
)

Definition at line 37 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().

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
48  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
49 
50  DDFilteredView fview(*cview,filter);
51  buildGeometry(theGeometry, fview, muonConstants);
52 }
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 105 of file DTGeometryBuilderFromDDD.cc.

References relativeConstraints::chamber, DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and ApeEstimator_cff::width.

106  {
107  MuonDDDNumbering mdddnum (muonConstants);
108  DTNumberingScheme dtnum (muonConstants);
109  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
110  DTChamberId detId(rawid);
111 
112  // Chamber specific parameter (size)
113  // FIXME: some trouble for boolean solids?
114  vector<double> par = extractParameters(fv);
115 
116  float width = par[0]/cm; // r-phi dimension - different in different chambers
117  float length = par[1]/cm; // z dimension - constant 125.55 cm
118  float thickness = par[2]/cm; // radial thickness - almost constant about 18 cm
119 
121  // width is along local X
122  // length is along local Y
123  // thickness is long local Z
124 
125  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
126 
127  DTChamber* chamber = new DTChamber(detId, surf);
128 
129  return chamber;
130 }
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 55 of file DTGeometryBuilderFromDDD.cc.

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

57  {
58 
59  bool doChamber = fv.firstChild();
60 
61  // Loop on chambers
62  int ChamCounter=0;
63  while (doChamber){
64  ChamCounter++;
65  DDValue val("Type");
66  const DDsvalues_type params(fv.mergedSpecifics());
67  string type;
68  if (DDfetch(&params,val)) type = val.strings()[0];
69  // FIXME
70  val=DDValue("FEPos");
71  string FEPos;
72  if (DDfetch(&params,val)) 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 }
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 163 of file DTGeometryBuilderFromDDD.cc.

References DTSuperLayer::add(), DDFilteredView::copyno(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), DDFilteredView::nextSibling(), ecaldqm::topology(), and ApeEstimator_cff::width.

166  {
167 
168  MuonDDDNumbering mdddnum(muonConstants);
169  DTNumberingScheme dtnum(muonConstants);
170  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
171  DTLayerId layId(rawid);
172 
173  // Layer specific parameter (size)
174  vector<double> par = extractParameters(fv);
175  float width = par[0]/cm; // r-phi dimension - changes in different chambers
176  float length = par[1]/cm; // z dimension - constant 126.8 cm
177  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
178 
179  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
180 
181  // Loop on wires
182  bool doWire = fv.firstChild();
183  int WCounter=0;
184  int firstWire=fv.copyno();
185  par = extractParameters(fv);
186  float wireLength = par[1]/cm;
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 }
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 ...
DTSuperLayer * DTGeometryBuilderFromDDD::buildSuperLayer ( DDFilteredView fv,
DTChamber chamber,
const std::string &  type,
const MuonDDDConstants muonConstants 
) const
private

create the SL

Definition at line 132 of file DTGeometryBuilderFromDDD.cc.

References DTChamber::add(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and ApeEstimator_cff::width.

135  {
136 
137  MuonDDDNumbering 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  float width = par[0]/cm; // r-phi dimension - changes in different chambers
146  float length = par[1]/cm; // z dimension - constant 126.8 cm
147  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
148 
149  // Ok this is the slayer position...
150  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
151 
152  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
153 
154  //LocalPoint lpos(10,20,30);
155  //GlobalPoint gpos=slayer->toGlobal(lpos);
156 
157  // add to the chamber
158  chamber->add(slayer);
159  return slayer;
160 }
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 203 of file DTGeometryBuilderFromDDD.cc.

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

203  {
204  vector<double> par;
205  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
206  DDBooleanSolid bs(fv.logicalPart().solid());
207  DDSolid A = bs.solidA();
208  while (A.shape() != DDSolidShape::ddbox) {
209  DDBooleanSolid bs(A);
210  A = bs.solidA();
211  }
212  par=A.parameters();
213  } else {
214  par = fv.logicalPart().solid().parameters();
215  }
216  return par;
217 }
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 220 of file DTGeometryBuilderFromDDD.cc.

References idealTransformation::rotation, DDFilteredView::rotation(), and DDFilteredView::translation().

221  {
222  // extract the position
223  const DDTranslation & trans(fv.translation());
224 
225  const Surface::PositionType posResult(float(trans.x()/cm),
226  float(trans.y()/cm),
227  float(trans.z()/cm));
228  // now the rotation
229  // DDRotationMatrix tmp = fv.rotation();
230  // === DDD uses 'active' rotations - see CLHEP user guide ===
231  // ORCA uses 'passive' rotation.
232  // 'active' and 'passive' rotations are inverse to each other
233  // DDRotationMatrix tmp = fv.rotation();
234  const DDRotationMatrix& rotation = fv.rotation();//REMOVED .Inverse();
235  DD3Vector x, y, z;
236  rotation.GetComponents(x,y,z);
237 // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
238 // std::cout << "INVERSE rotation manually: "
239 // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
240 // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
241 // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
242 
243  Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
244  float(y.X()),float(y.Y()),float(y.Z()),
245  float(z.X()),float(z.Y()),float(z.Z()));
246 
247 // std::cout << "rotation by its own operator: "<< tmp << std::endl;
248 // DD3Vector tx, ty,tz;
249 // tmp.GetComponents(tx, ty, tz);
250 // std::cout << "rotation manually: "
251 // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
252 // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
253 // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
254 
255  return RCPPlane( new Plane( posResult, rotResult, bounds));
256 }
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
ReferenceCountingPointer< Plane > RCPPlane
const DDTranslation & translation() const
The absolute translation of the current node.