#include <DTGeometryBuilderFromDDD.h>
Public Member Functions | |
void | build (boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants) |
DTGeometryBuilderFromDDD () | |
Constructor. | |
virtual | ~DTGeometryBuilderFromDDD () |
Destructor. | |
Private Types | |
typedef ReferenceCountingPointer < BoundPlane > | RCPPlane |
Private Member Functions | |
DTChamber * | buildChamber (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants) const |
create the chamber | |
void | buildGeometry (boost::shared_ptr< DTGeometry > theGeometry, DDFilteredView &fv, const MuonDDDConstants &muonConstants) const |
DTLayer * | buildLayer (DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonDDDConstants &muonConstants) const |
create the layer | |
DTSuperLayer * | buildSuperLayer (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 |
Build the DTGeometry from the DDD description.
Definition at line 27 of file DTGeometryBuilderFromDDD.h.
typedef ReferenceCountingPointer<BoundPlane> DTGeometryBuilderFromDDD::RCPPlane [private] |
Definition at line 61 of file DTGeometryBuilderFromDDD.h.
DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD | ( | ) |
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD | ( | ) | [virtual] |
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().
{ // cout << "DTGeometryBuilderFromDDD::build" << endl; // static const string t0 = "DTGeometryBuilderFromDDD::build"; // TimeMe timer(t0,true); std::string attribute = "MuStructure"; std::string value = "MuonBarrelDT"; DDValue val(attribute, value, 0.0); // Asking only for the Muon DTs DDSpecificsFilter filter; filter.setCriteria(val, // name & value of a variable DDSpecificsFilter::matches, DDSpecificsFilter::AND, true, // compare strings otherwise doubles true // use merged-specifics or simple-specifics ); DDFilteredView fview(*cview); fview.addFilter(filter); buildGeometry(theGeometry, fview, muonConstants); }
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.
{ MuonDDDNumbering mdddnum (muonConstants); DTNumberingScheme dtnum (muonConstants); int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory())); DTChamberId detId(rawid); // Chamber specific parameter (size) // FIXME: some trouble for boolean solids? vector<double> par = extractParameters(fv); float width = par[0]/cm; // r-phi dimension - different in different chambers float length = par[1]/cm; // z dimension - constant 125.55 cm float thickness = par[2]/cm; // radial thickness - almost constant about 18 cm // width is along local X // length is along local Y // thickness is long local Z RectangularPlaneBounds bound(width, length, thickness); RCPPlane surf(plane(fv,bound)); DTChamber* chamber = new DTChamber(detId, surf); return chamber; }
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().
{ // static const string t0 = "DTGeometryBuilderFromDDD::buildGeometry"; // TimeMe timer(t0,true); //DTGeometry* theGeometry = new DTGeometry; bool doChamber = fv.firstChild(); // Loop on chambers int ChamCounter=0; while (doChamber){ ChamCounter++; DDValue val("Type"); const DDsvalues_type params(fv.mergedSpecifics()); string type; if (DDfetch(¶ms,val)) type = val.strings()[0]; // FIXME val=DDValue("FEPos"); string FEPos; if (DDfetch(¶ms,val)) FEPos = val.strings()[0]; DTChamber* chamber = buildChamber(fv,type, muonConstants); // Loop on SLs bool doSL = fv.firstChild(); int SLCounter=0; while (doSL) { SLCounter++; DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants); theGeometry->add(sl); bool doL = fv.firstChild(); int LCounter=0; // Loop on SLs while (doL) { LCounter++; DTLayer* layer = buildLayer(fv, sl, type, muonConstants); theGeometry->add(layer); fv.parent(); doL = fv.nextSibling(); // go to next layer } // layers fv.parent(); doSL = fv.nextSibling(); // go to next SL } // sls theGeometry->add(chamber); fv.parent(); doChamber = fv.nextSibling(); // go to next chamber } // chambers }
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.
{ MuonDDDNumbering mdddnum(muonConstants); DTNumberingScheme dtnum(muonConstants); int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory())); DTLayerId layId(rawid); // Layer specific parameter (size) vector<double> par = extractParameters(fv); float width = par[0]/cm; // r-phi dimension - changes in different chambers float length = par[1]/cm; // z dimension - constant 126.8 cm float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm // define Bounds RectangularPlaneBounds bound(width, length, thickness); RCPPlane surf(plane(fv,bound)); // Loop on wires bool doWire = fv.firstChild(); int WCounter=0; int firstWire=fv.copyno(); par = extractParameters(fv); float wireLength = par[1]/cm; while (doWire) { WCounter++; doWire = fv.nextSibling(); // next wire } //int lastWire=fv.copyno(); DTTopology topology(firstWire, WCounter, wireLength); DTLayerType layerType; DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl); sl->add(layer); return layer; }
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.
{ MuonDDDNumbering mdddnum(muonConstants); DTNumberingScheme dtnum(muonConstants); int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory())); DTSuperLayerId slId(rawid); // Slayer specific parameter (size) vector<double> par = extractParameters(fv); float width = par[0]/cm; // r-phi dimension - changes in different chambers float length = par[1]/cm; // z dimension - constant 126.8 cm float thickness = par[2]/cm; // radial thickness - almost constant about 20 cm RectangularPlaneBounds bound(width, length, thickness); // Ok this is the slayer position... RCPPlane surf(plane(fv,bound)); DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber); //LocalPoint lpos(10,20,30); //GlobalPoint gpos=slayer->toGlobal(lpos); // add to the chamber chamber->add(slayer); return slayer; }
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().
{ vector<double> par; if (fv.logicalPart().solid().shape() != ddbox) { DDBooleanSolid bs(fv.logicalPart().solid()); DDSolid A = bs.solidA(); while (A.shape() != ddbox) { DDBooleanSolid bs(A); A = bs.solidA(); } par=A.parameters(); } else { par = fv.logicalPart().solid().parameters(); } return par; }
DTGeometryBuilderFromDDD::RCPPlane DTGeometryBuilderFromDDD::plane | ( | const DDFilteredView & | fv, |
const Bounds & | bounds | ||
) | const [private] |
Definition at line 238 of file DTGeometryBuilderFromDDD.cc.
References DDFilteredView::rotation(), idealTransformation::rotation, DDFilteredView::translation(), x, detailsBasic3DVector::y, and z.
{ // extract the position const DDTranslation & trans(fv.translation()); const Surface::PositionType posResult(float(trans.x()/cm), float(trans.y()/cm), float(trans.z()/cm)); // now the rotation // DDRotationMatrix tmp = fv.rotation(); // === DDD uses 'active' rotations - see CLHEP user guide === // ORCA uses 'passive' rotation. // 'active' and 'passive' rotations are inverse to each other // DDRotationMatrix tmp = fv.rotation(); DDRotationMatrix rotation = fv.rotation();//REMOVED .Inverse(); DD3Vector x, y, z; rotation.GetComponents(x,y,z); // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl; // std::cout << "INVERSE rotation manually: " // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl; Surface::RotationType rotResult(float(x.X()),float(x.Y()),float(x.Z()), float(y.X()),float(y.Y()),float(y.Z()), float(z.X()),float(z.Y()),float(z.Z())); // std::cout << "rotation by its own operator: "<< tmp << std::endl; // DD3Vector tx, ty,tz; // tmp.GetComponents(tx, ty, tz); // std::cout << "rotation manually: " // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl; return RCPPlane( new BoundPlane( posResult, rotResult, bounds)); }