CMS 3D CMS Logo

DTGeometryBuilderFromDDD Class Reference

Build the DTGeometry from the DDD description. More...

#include <Geometry/DTGeometryBuilder/src/DTGeometryBuilderFromDDD.h>

List of all members.

Public Member Functions

DTGeometrybuild (const DDCompactView *cview, const MuonDDDConstants &muonConstants)
 DTGeometryBuilderFromDDD ()
 Constructor.
virtual ~DTGeometryBuilderFromDDD ()
 Destructor.

Private Types

typedef
ReferenceCountingPointer
< BoundPlane
RCPPlane

Private Member Functions

DTChamberbuildChamber (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the chamber
DTGeometrybuildGeometry (DDFilteredView &fv, const MuonDDDConstants &muonConstants) const
DTLayerbuildLayer (DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the layer
DTSuperLayerbuildSuperLayer (DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonDDDConstants &muonConstants) const
 create the SL
std::vector< double > extractParameters (DDFilteredView &fv) const
 get parameter also for boolean solid.
RCPPlane plane (const DDFilteredView &fv, const Bounds &bounds) const


Detailed Description

Build the DTGeometry from the DDD description.

Date
2007/03/09 00:40:41
Revision
1.3
Author:
N. Amapane - CERN.

Port of: MuBarDDDGeomBuilder, MuBarDetBuilder (ORCA) by S. Lacaprara, M. Case

Definition at line 26 of file DTGeometryBuilderFromDDD.h.


Member Typedef Documentation

typedef ReferenceCountingPointer<BoundPlane> DTGeometryBuilderFromDDD::RCPPlane [private]

Definition at line 59 of file DTGeometryBuilderFromDDD.h.


Constructor & Destructor Documentation

DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD (  ) 

Constructor.

Definition at line 36 of file DTGeometryBuilderFromDDD.cc.

00036 {}

DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD (  )  [virtual]

Destructor.

Definition at line 38 of file DTGeometryBuilderFromDDD.cc.

00038 {}


Member Function Documentation

DTGeometry * DTGeometryBuilderFromDDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 41 of file DTGeometryBuilderFromDDD.cc.

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

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

00041                                                                                                             {
00042   //   static const string t0 = "DTGeometryBuilderFromDDD::build";
00043   //   TimeMe timer(t0,true);
00044 
00045   std::string attribute = "MuStructure"; 
00046   std::string value     = "MuonBarrelDT";
00047   DDValue val(attribute, value, 0.0);
00048 
00049   // Asking only for the Muon DTs
00050   DDSpecificsFilter filter;
00051   filter.setCriteria(val,  // name & value of a variable 
00052                      DDSpecificsFilter::matches,
00053                      DDSpecificsFilter::AND, 
00054                      true, // compare strings otherwise doubles
00055                      true  // use merged-specifics or simple-specifics
00056                      );
00057   DDFilteredView fview(*cview);
00058   fview.addFilter(filter);
00059   return buildGeometry(fview, muonConstants);
00060 }

DTChamber* DTGeometryBuilderFromDDD::buildChamber ( DDFilteredView fv,
const std::string &  type,
const MuonDDDConstants muonConstants 
) const [private]

create the chamber

Referenced by buildGeometry().

DTGeometry * DTGeometryBuilderFromDDD::buildGeometry ( DDFilteredView fv,
const MuonDDDConstants muonConstants 
) const [private]

Definition at line 63 of file DTGeometryBuilderFromDDD.cc.

References DTGeometry::add(), buildChamber(), buildLayer(), buildSuperLayer(), DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), params, DDFilteredView::parent(), sl, and DDValue::strings().

Referenced by build().

00064                                                                                                    {
00065   // static const string t0 = "DTGeometryBuilderFromDDD::buildGeometry";
00066   // TimeMe timer(t0,true);
00067 
00068   DTGeometry* theGeometry = new DTGeometry;
00069 
00070   bool doChamber = fv.firstChild();
00071 
00072   // Loop on chambers
00073   int ChamCounter=0;
00074   while (doChamber){
00075     ChamCounter++;
00076     DDValue val("Type");
00077     const DDsvalues_type params(fv.mergedSpecifics());
00078     string type;
00079     if (DDfetch(&params,val)) type = val.strings()[0];
00080     // FIXME
00081     val=DDValue("FEPos");
00082     string FEPos;
00083     if (DDfetch(&params,val)) FEPos = val.strings()[0];
00084     DTChamber* chamber = buildChamber(fv,type, muonConstants);
00085 
00086     // Loop on SLs
00087     bool doSL = fv.firstChild();
00088     int SLCounter=0;
00089     while (doSL) {
00090       SLCounter++;
00091       DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants);
00092       theGeometry->add(sl);
00093 
00094       bool doL = fv.firstChild();
00095       int LCounter=0;
00096       // Loop on SLs
00097       while (doL) {
00098         LCounter++;
00099         DTLayer* layer = buildLayer(fv, sl, type, muonConstants);
00100         theGeometry->add(layer);
00101 
00102         fv.parent();
00103         doL = fv.nextSibling(); // go to next layer
00104       } // layers
00105 
00106       fv.parent();
00107       doSL = fv.nextSibling(); // go to next SL
00108     } // sls
00109     theGeometry->add(chamber);
00110 
00111     fv.parent();
00112     doChamber = fv.nextSibling(); // go to next chamber
00113   } // chambers
00114   return theGeometry;
00115 }

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(), extractParameters(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), DDFilteredView::nextSibling(), and plane().

Referenced by buildGeometry().

00181                                                                                            {
00182 
00183   MuonDDDNumbering mdddnum(muonConstants);
00184   DTNumberingScheme dtnum(muonConstants);
00185   int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
00186   DTLayerId layId(rawid);
00187 
00188   // Layer specific parameter (size)
00189   vector<double> par = extractParameters(fv);
00190   float width = par[0]/cm;     // r-phi  dimension - changes in different chambers
00191   float length = par[1]/cm;    // z      dimension - constant 126.8 cm
00192   float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
00193 
00194   // define Bounds
00195   RectangularPlaneBounds bound(width, length, thickness);
00196 
00197   RCPPlane surf(plane(fv,bound));
00198 
00199   // Loop on wires
00200   bool doWire = fv.firstChild();
00201   int WCounter=0;
00202   int firstWire=fv.copyno();
00203   par = extractParameters(fv);
00204   float wireLength = par[1]/cm;
00205   while (doWire) {
00206     WCounter++;
00207     doWire = fv.nextSibling(); // next wire
00208   }
00209   //int lastWire=fv.copyno();
00210   DTTopology topology(firstWire, WCounter, wireLength);
00211 
00212   DTLayerType layerType;
00213 
00214   DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
00215 
00216   sl->add(layer);
00217   return layer;
00218 }

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(), extractParameters(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), and plane().

Referenced by buildGeometry().

00148                                                                                                      {
00149 
00150   MuonDDDNumbering mdddnum(muonConstants);
00151   DTNumberingScheme dtnum(muonConstants);
00152   int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
00153   DTSuperLayerId slId(rawid);
00154 
00155   // Slayer specific parameter (size)
00156   vector<double> par = extractParameters(fv);
00157 
00158   float width = par[0]/cm;     // r-phi  dimension - changes in different chambers
00159   float length = par[1]/cm;    // z      dimension - constant 126.8 cm
00160   float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm
00161 
00162   RectangularPlaneBounds bound(width, length, thickness);
00163 
00164   // Ok this is the slayer position...
00165   RCPPlane surf(plane(fv,bound));
00166 
00167   DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
00168 
00169   //LocalPoint lpos(10,20,30);
00170   //GlobalPoint gpos=slayer->toGlobal(lpos);
00171 
00172   // add to the chamber
00173   chamber->add(slayer);
00174   return slayer;
00175 }

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().

Referenced by buildLayer(), and buildSuperLayer().

00221                                                                     {
00222   vector<double> par;
00223   if (fv.logicalPart().solid().shape() != ddbox) {
00224     DDBooleanSolid bs(fv.logicalPart().solid());
00225     DDSolid A = bs.solidA();
00226     while (A.shape() != ddbox) {
00227       DDBooleanSolid bs(A);
00228       A = bs.solidA();
00229     }
00230     par=A.parameters();
00231   } else {
00232     par = fv.logicalPart().solid().parameters();
00233   }
00234   return par;
00235 }

DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane ( const DDFilteredView fv,
const Bounds bounds 
) const [private]

Definition at line 238 of file DTGeometryBuilderFromDDD.cc.

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

Referenced by buildLayer(), and buildSuperLayer().

00239                                                             {
00240   // extract the position
00241   const DDTranslation & trans(fv.translation());
00242 
00243   const Surface::PositionType posResult(float(trans.x()/cm), 
00244                                         float(trans.y()/cm), 
00245                                         float(trans.z()/cm));
00246   // now the rotation
00247   //  DDRotationMatrix tmp = fv.rotation();
00248   // === DDD uses 'active' rotations - see CLHEP user guide ===
00249   //     ORCA uses 'passive' rotation. 
00250   //     'active' and 'passive' rotations are inverse to each other
00251   //  DDRotationMatrix tmp = fv.rotation();
00252   DDRotationMatrix rotation = fv.rotation();//REMOVED .Inverse();
00253   DD3Vector x, y, z;
00254   rotation.GetComponents(x,y,z);
00255 //   std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
00256 //   std::cout << "INVERSE rotation manually: "
00257 //          << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
00258 //          << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
00259 //          << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
00260 
00261   Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()),
00262                                   float(y.X()),float(y.Y()),float(y.Z()),
00263                                   float(z.X()),float(z.Y()),float(z.Z())); 
00264 
00265 //   std::cout << "rotation by its own operator: "<< tmp << std::endl;
00266 //   DD3Vector tx, ty,tz;
00267 //   tmp.GetComponents(tx, ty, tz);
00268 //   std::cout << "rotation manually: "
00269 //          << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
00270 //          << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
00271 //          << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
00272 
00273   return RCPPlane( new BoundPlane( posResult, rotResult, bounds));
00274 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:53 2009 for CMSSW by  doxygen 1.5.4