CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions
DTGeometryBuilderFromDDD Class Reference

#include <DTGeometryBuilderFromDDD.h>

Public Member Functions

void build (boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
 
 DTGeometryBuilderFromDDD ()
 Constructor. More...
 
virtual ~DTGeometryBuilderFromDDD ()
 Destructor. More...
 

Private Types

typedef
ReferenceCountingPointer
< BoundPlane
RCPPlane
 

Private Member Functions

DTChamberbuildChamber (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the chamber More...
 
void buildGeometry (boost::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, const Bounds &bounds) const
 

Detailed Description

Build the DTGeometry from the DDD description.

Date:
2009/01/16 11:11:46
Revision:
1.4
Author
N. Amapane - CERN.
Port of: MuBarDDDGeomBuilder, MuBarDetBuilder (ORCA) by S. Lacaprara, M. Case

Definition at line 27 of file DTGeometryBuilderFromDDD.h.

Member Typedef Documentation

Definition at line 61 of file DTGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD ( )

Constructor.

Definition at line 33 of file DTGeometryBuilderFromDDD.cc.

33 {}
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD ( )
virtual

Destructor.

Definition at line 35 of file DTGeometryBuilderFromDDD.cc.

35 {}

Member Function Documentation

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

Definition at line 38 of file DTGeometryBuilderFromDDD.cc.

References DDFilteredView::addFilter(), DDSpecificsFilter::AND, alcazmumu_cfi::filter, DDSpecificsFilter::matches, DDSpecificsFilter::setCriteria(), and relativeConstraints::value.

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

40  {
41  // cout << "DTGeometryBuilderFromDDD::build" << endl;
42  // static const string t0 = "DTGeometryBuilderFromDDD::build";
43  // TimeMe timer(t0,true);
44 
45  std::string attribute = "MuStructure";
46  std::string value = "MuonBarrelDT";
47  DDValue val(attribute, value, 0.0);
48 
49  // Asking only for the Muon DTs
51  filter.setCriteria(val, // name & value of a variable
54  true, // compare strings otherwise doubles
55  true // use merged-specifics or simple-specifics
56  );
57  DDFilteredView fview(*cview);
58  fview.addFilter(filter);
59  buildGeometry(theGeometry, fview, muonConstants);
60 }
void buildGeometry(boost::shared_ptr< DTGeometry > theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
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 117 of file DTGeometryBuilderFromDDD.cc.

References evf::soaputils::extractParameters(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and tablePrinter::width.

118  {
119  MuonDDDNumbering mdddnum (muonConstants);
120  DTNumberingScheme dtnum (muonConstants);
121  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
122  DTChamberId detId(rawid);
123 
124  // Chamber specific parameter (size)
125  // FIXME: some trouble for boolean solids?
126  vector<double> par = extractParameters(fv);
127 
128  float width = par[0]/cm; // r-phi dimension - different in different chambers
129  float length = par[1]/cm; // z dimension - constant 125.55 cm
130  float thickness = par[2]/cm; // radial thickness - almost constant about 18 cm
131 
133  // width is along local X
134  // length is along local Y
135  // thickness is long local Z
136  RectangularPlaneBounds bound(width, length, thickness);
137 
138  RCPPlane surf(plane(fv,bound));
139 
140  DTChamber* chamber = new DTChamber(detId, surf);
141 
142  return chamber;
143 }
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
RCPPlane plane(const DDFilteredView &fv, const Bounds &bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
ReferenceCountingPointer< BoundPlane > RCPPlane
void DTGeometryBuilderFromDDD::buildGeometry ( boost::shared_ptr< DTGeometry theGeometry,
DDFilteredView fv,
const MuonDDDConstants muonConstants 
) const
private

Definition at line 63 of file DTGeometryBuilderFromDDD.cc.

References DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), DDFilteredView::parent(), and DDValue::strings().

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

References DTSuperLayer::add(), DDFilteredView::copyno(), evf::soaputils::extractParameters(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), DDFilteredView::nextSibling(), and tablePrinter::width.

181  {
182 
183  MuonDDDNumbering mdddnum(muonConstants);
184  DTNumberingScheme dtnum(muonConstants);
185  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
186  DTLayerId layId(rawid);
187 
188  // Layer specific parameter (size)
189  vector<double> par = extractParameters(fv);
190  float width = par[0]/cm; // r-phi dimension - changes in different chambers
191  float length = par[1]/cm; // z dimension - constant 126.8 cm
192  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
193 
194  // define Bounds
195  RectangularPlaneBounds bound(width, length, thickness);
196 
197  RCPPlane surf(plane(fv,bound));
198 
199  // Loop on wires
200  bool doWire = fv.firstChild();
201  int WCounter=0;
202  int firstWire=fv.copyno();
203  par = extractParameters(fv);
204  float wireLength = par[1]/cm;
205  while (doWire) {
206  WCounter++;
207  doWire = fv.nextSibling(); // next wire
208  }
209  //int lastWire=fv.copyno();
210  DTTopology topology(firstWire, WCounter, wireLength);
211 
212  DTLayerType layerType;
213 
214  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
215 
216  sl->add(layer);
217  return layer;
218 }
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:61
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.
RCPPlane plane(const DDFilteredView &fv, const Bounds &bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
ReferenceCountingPointer< BoundPlane > 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 145 of file DTGeometryBuilderFromDDD.cc.

References DTChamber::add(), evf::soaputils::extractParameters(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and tablePrinter::width.

148  {
149 
150  MuonDDDNumbering mdddnum(muonConstants);
151  DTNumberingScheme dtnum(muonConstants);
152  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
153  DTSuperLayerId slId(rawid);
154 
155  // Slayer specific parameter (size)
156  vector<double> par = extractParameters(fv);
157 
158  float width = par[0]/cm; // r-phi dimension - changes in different chambers
159  float length = par[1]/cm; // z dimension - constant 126.8 cm
160  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
161 
162  RectangularPlaneBounds bound(width, length, thickness);
163 
164  // Ok this is the slayer position...
165  RCPPlane surf(plane(fv,bound));
166 
167  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
168 
169  //LocalPoint lpos(10,20,30);
170  //GlobalPoint gpos=slayer->toGlobal(lpos);
171 
172  // add to the chamber
173  chamber->add(slayer);
174  return slayer;
175 }
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
RCPPlane plane(const DDFilteredView &fv, const Bounds &bounds) const
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
ReferenceCountingPointer< BoundPlane > RCPPlane
void add(DTSuperLayer *sl)
Add SL to the chamber which takes ownership.
Definition: DTChamber.cc:43
vector< double > DTGeometryBuilderFromDDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 221 of file DTGeometryBuilderFromDDD.cc.

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

221  {
222  vector<double> par;
223  if (fv.logicalPart().solid().shape() != ddbox) {
224  DDBooleanSolid bs(fv.logicalPart().solid());
225  DDSolid A = bs.solidA();
226  while (A.shape() != ddbox) {
227  DDBooleanSolid bs(A);
228  A = bs.solidA();
229  }
230  par=A.parameters();
231  } else {
232  par = fv.logicalPart().solid().parameters();
233  }
234  return par;
235 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
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:35
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
const Bounds bounds 
) const
private

Definition at line 238 of file DTGeometryBuilderFromDDD.cc.

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

239  {
240  // extract the position
241  const DDTranslation & trans(fv.translation());
242 
243  const Surface::PositionType posResult(float(trans.x()/cm),
244  float(trans.y()/cm),
245  float(trans.z()/cm));
246  // now the rotation
247  // DDRotationMatrix tmp = fv.rotation();
248  // === DDD uses 'active' rotations - see CLHEP user guide ===
249  // ORCA uses 'passive' rotation.
250  // 'active' and 'passive' rotations are inverse to each other
251  // DDRotationMatrix tmp = fv.rotation();
252  DDRotationMatrix rotation = fv.rotation();//REMOVED .Inverse();
253  DD3Vector x, y, z;
254  rotation.GetComponents(x,y,z);
255 // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
256 // std::cout << "INVERSE rotation manually: "
257 // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
258 // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
259 // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
260 
261  Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
262  float(y.X()),float(y.Y()),float(y.Z()),
263  float(z.X()),float(z.Y()),float(z.Z()));
264 
265 // std::cout << "rotation by its own operator: "<< tmp << std::endl;
266 // DD3Vector tx, ty,tz;
267 // tmp.GetComponents(tx, ty, tz);
268 // std::cout << "rotation manually: "
269 // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
270 // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
271 // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
272 
273  return RCPPlane( new BoundPlane( posResult, rotResult, bounds));
274 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
double double double z
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< BoundPlane > RCPPlane
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDAxes.h:10
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.