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
< Plane
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, Bounds *bounds) const
 

Detailed Description

Build the DTGeometry from the DDD description.

Date:
2012/12/24 14:35:11
Revision:
1.5
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(), AlCaHLTBitMon_QueryRunRegistry::string, 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 create_public_lumi_plots::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 
137  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
138 
139  DTChamber* chamber = new DTChamber(detId, surf);
140 
141  return chamber;
142 }
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 ( 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: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: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 175 of file DTGeometryBuilderFromDDD.cc.

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

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

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

147  {
148 
149  MuonDDDNumbering mdddnum(muonConstants);
150  DTNumberingScheme dtnum(muonConstants);
151  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
152  DTSuperLayerId slId(rawid);
153 
154  // Slayer specific parameter (size)
155  vector<double> par = extractParameters(fv);
156 
157  float width = par[0]/cm; // r-phi dimension - changes in different chambers
158  float length = par[1]/cm; // z dimension - constant 126.8 cm
159  float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
160 
161  // Ok this is the slayer position...
162  RCPPlane surf(plane(fv, new RectangularPlaneBounds(width, length, thickness) ));
163 
164  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
165 
166  //LocalPoint lpos(10,20,30);
167  //GlobalPoint gpos=slayer->toGlobal(lpos);
168 
169  // add to the chamber
170  chamber->add(slayer);
171  return slayer;
172 }
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:43
ReferenceCountingPointer< Plane > RCPPlane
vector< double > DTGeometryBuilderFromDDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 215 of file DTGeometryBuilderFromDDD.cc.

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

215  {
216  vector<double> par;
217  if (fv.logicalPart().solid().shape() != ddbox) {
218  DDBooleanSolid bs(fv.logicalPart().solid());
219  DDSolid A = bs.solidA();
220  while (A.shape() != ddbox) {
221  DDBooleanSolid bs(A);
222  A = bs.solidA();
223  }
224  par=A.parameters();
225  } else {
226  par = fv.logicalPart().solid().parameters();
227  }
228  return par;
229 }
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,
Bounds bounds 
) const
private

Definition at line 232 of file DTGeometryBuilderFromDDD.cc.

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

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