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.

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

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

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  DDValue val(attribute, value, 0.0);
46 
47  // Asking only for the Muon DTs
49  filter.setCriteria(val, // name & value of a variable
52  true, // compare strings otherwise doubles
53  true // use merged-specifics or simple-specifics
54  );
55  DDFilteredView fview(*cview);
56  fview.addFilter(filter);
57  buildGeometry(theGeometry, fview, muonConstants);
58 }
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 115 of file DTGeometryBuilderFromDDD.cc.

References DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and create_public_lumi_plots::width.

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

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

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

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

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

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

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

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

213  {
214  vector<double> par;
215  if (fv.logicalPart().solid().shape() != ddbox) {
216  DDBooleanSolid bs(fv.logicalPart().solid());
217  DDSolid A = bs.solidA();
218  while (A.shape() != ddbox) {
219  DDBooleanSolid bs(A);
220  A = bs.solidA();
221  }
222  par=A.parameters();
223  } else {
224  par = fv.logicalPart().solid().parameters();
225  }
226  return par;
227 }
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 230 of file DTGeometryBuilderFromDDD.cc.

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

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