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 (std::shared_ptr< 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 (std::shared_ptr< 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 31 of file DTGeometryBuilderFromDDD.cc.

31 {}
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 33 of file DTGeometryBuilderFromDDD.cc.

33 {}

Member Function Documentation

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

Definition at line 36 of file DTGeometryBuilderFromDDD.cc.

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

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

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(std::shared_ptr< DTGeometry > theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
Definition: value.py:1
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 108 of file DTGeometryBuilderFromDDD.cc.

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

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

Definition at line 54 of file DTGeometryBuilderFromDDD.cc.

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

56  {
57  // static const string t0 = "DTGeometryBuilderFromDDD::buildGeometry";
58  // TimeMe timer(t0,true);
59 
60  //DTGeometry* theGeometry = new DTGeometry;
61 
62  bool doChamber = fv.firstChild();
63 
64  // Loop on chambers
65  int ChamCounter=0;
66  while (doChamber){
67  ChamCounter++;
68  DDValue val("Type");
69  const DDsvalues_type params(fv.mergedSpecifics());
70  string type;
71  if (DDfetch(&params,val)) type = val.strings()[0];
72  // FIXME
73  val=DDValue("FEPos");
74  string FEPos;
75  if (DDfetch(&params,val)) FEPos = val.strings()[0];
76  DTChamber* chamber = buildChamber(fv,type, muonConstants);
77 
78  // Loop on SLs
79  bool doSL = fv.firstChild();
80  int SLCounter=0;
81  while (doSL) {
82  SLCounter++;
83  DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants);
84  theGeometry->add(sl);
85 
86  bool doL = fv.firstChild();
87  int LCounter=0;
88  // Loop on SLs
89  while (doL) {
90  LCounter++;
91  DTLayer* layer = buildLayer(fv, sl, type, muonConstants);
92  theGeometry->add(layer);
93 
94  fv.parent();
95  doL = fv.nextSibling(); // go to next layer
96  } // layers
97 
98  fv.parent();
99  doSL = fv.nextSibling(); // go to next SL
100  } // sls
101  theGeometry->add(chamber);
102 
103  fv.parent();
104  doChamber = fv.nextSibling(); // go to next chamber
105  } // chambers
106 }
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:80
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const
create the chamber
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonDDDConstants &muonConstants) const
create the SL
DDsvalues_type mergedSpecifics() const
bool firstChild()
set the current node to the first child ...
DTLayer * DTGeometryBuilderFromDDD::buildLayer ( DDFilteredView fv,
DTSuperLayer sl,
const std::string &  type,
const MuonDDDConstants muonConstants 
) const
private

create the layer

Definition at line 166 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.

169  {
170 
171  MuonDDDNumbering mdddnum(muonConstants);
172  DTNumberingScheme dtnum(muonConstants);
173  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
174  DTLayerId layId(rawid);
175 
176  // Layer specific parameter (size)
177  vector<double> par = extractParameters(fv);
178  float width = par[0]/cm; // r-phi dimension - changes in different chambers
179  float length = par[1]/cm; // z dimension - constant 126.8 cm
180  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
181 
182  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
183 
184  // Loop on wires
185  bool doWire = fv.firstChild();
186  int WCounter=0;
187  int firstWire=fv.copyno();
188  par = extractParameters(fv);
189  float wireLength = par[1]/cm;
190  while (doWire) {
191  WCounter++;
192  doWire = fv.nextSibling(); // next wire
193  }
194  //int lastWire=fv.copyno();
195  DTTopology topology(firstWire, WCounter, wireLength);
196 
197  DTLayerType layerType;
198 
199  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
200 
201  sl->add(layer);
202  return layer;
203 }
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 135 of file DTGeometryBuilderFromDDD.cc.

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

138  {
139 
140  MuonDDDNumbering mdddnum(muonConstants);
141  DTNumberingScheme dtnum(muonConstants);
142  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
143  DTSuperLayerId slId(rawid);
144 
145  // Slayer specific parameter (size)
146  vector<double> par = extractParameters(fv);
147 
148  float width = par[0]/cm; // r-phi dimension - changes in different chambers
149  float length = par[1]/cm; // z dimension - constant 126.8 cm
150  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
151 
152  // Ok this is the slayer position...
153  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
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 }
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 206 of file DTGeometryBuilderFromDDD.cc.

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

206  {
207  vector<double> par;
208  if (fv.logicalPart().solid().shape() != ddbox) {
209  DDBooleanSolid bs(fv.logicalPart().solid());
210  DDSolid A = bs.solidA();
211  while (A.shape() != ddbox) {
212  DDBooleanSolid bs(A);
213  A = bs.solidA();
214  }
215  par=A.parameters();
216  } else {
217  par = fv.logicalPart().solid().parameters();
218  }
219  return par;
220 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:147
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:38
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:141
DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
Bounds bounds 
) const
private

Definition at line 223 of file DTGeometryBuilderFromDDD.cc.

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

224  {
225  // extract the position
226  const DDTranslation & trans(fv.translation());
227 
228  const Surface::PositionType posResult(float(trans.x()/cm),
229  float(trans.y()/cm),
230  float(trans.z()/cm));
231  // now the rotation
232  // DDRotationMatrix tmp = fv.rotation();
233  // === DDD uses 'active' rotations - see CLHEP user guide ===
234  // ORCA uses 'passive' rotation.
235  // 'active' and 'passive' rotations are inverse to each other
236  // DDRotationMatrix tmp = fv.rotation();
237  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()),float(x.Y()),float(x.Z()),
247  float(y.X()),float(y.Y()),float(y.Z()),
248  float(z.X()),float(z.Y()),float(z.Z()));
249 
250 // std::cout << "rotation by its own operator: "<< tmp << std::endl;
251 // DD3Vector tx, ty,tz;
252 // tmp.GetComponents(tx, ty, tz);
253 // std::cout << "rotation manually: "
254 // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
255 // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
256 // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
257 
258  return RCPPlane( new Plane( posResult, rotResult, bounds));
259 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
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.
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.