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 (const 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 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 ( std::shared_ptr< DTGeometry theGeometry,
const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 37 of file DTGeometryBuilderFromDDD.cc.

References ALCARECOTkAlBeamHalo_cff::filter, eostools::move(), 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(std::move(theGeometry), fview, muonConstants);
52 }
void buildGeometry(const std::shared_ptr< DTGeometry > &theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
Definition: value.py:1
def move(src, dest)
Definition: eostools.py:511
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 109 of file DTGeometryBuilderFromDDD.cc.

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

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

Definition at line 55 of file DTGeometryBuilderFromDDD.cc.

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

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

create the layer

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

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

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

139  {
140 
141  MuonDDDNumbering mdddnum(muonConstants);
142  DTNumberingScheme dtnum(muonConstants);
143  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
144  DTSuperLayerId slId(rawid);
145 
146  // Slayer specific parameter (size)
147  vector<double> par = extractParameters(fv);
148 
149  float width = par[0]/cm; // r-phi dimension - changes in different chambers
150  float length = par[1]/cm; // z dimension - constant 126.8 cm
151  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
152 
153  // Ok this is the slayer position...
154  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
155 
156  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
157 
158  //LocalPoint lpos(10,20,30);
159  //GlobalPoint gpos=slayer->toGlobal(lpos);
160 
161  // add to the chamber
162  chamber->add(slayer);
163  return slayer;
164 }
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 207 of file DTGeometryBuilderFromDDD.cc.

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

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

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

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