From 8928ea216918db494ca8cd4766dddb2060540a86 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Tue, 29 May 2018 14:48:21 +0200 Subject: [PATCH 1/3] Add shapes test --- .../DDCMS/data/cms-test-shapes.xml | 19 +- DetectorDescription/DDCMS/data/cmsWorld.xml | 22 + .../DDCMS/data/testLogicalParts.xml | 2 +- .../DDCMS/data/testPosParts.xml | 162 ++++ DetectorDescription/DDCMS/data/testSolids.xml | 6 +- DetectorDescription/DDCMS/macros/geo.fwc | 855 ++++++++++++++++++ .../DDCMS/python/cmsShapesXML_cfi.py | 12 + .../DDCMS/test/python/dumpDDShapes.py | 19 + .../DDCMS/test/python/testShapes.py | 3 +- 9 files changed, 1085 insertions(+), 15 deletions(-) create mode 100644 DetectorDescription/DDCMS/data/cmsWorld.xml create mode 100644 DetectorDescription/DDCMS/data/testPosParts.xml create mode 100644 DetectorDescription/DDCMS/macros/geo.fwc create mode 100644 DetectorDescription/DDCMS/python/cmsShapesXML_cfi.py create mode 100644 DetectorDescription/DDCMS/test/python/dumpDDShapes.py diff --git a/DetectorDescription/DDCMS/data/cms-test-shapes.xml b/DetectorDescription/DDCMS/data/cms-test-shapes.xml index 247a2c92c825f..4176505a11530 100644 --- a/DetectorDescription/DDCMS/data/cms-test-shapes.xml +++ b/DetectorDescription/DDCMS/data/cms-test-shapes.xml @@ -13,19 +13,11 @@ + @@ -45,7 +37,14 @@ + - + + + + + + + diff --git a/DetectorDescription/DDCMS/data/cmsWorld.xml b/DetectorDescription/DDCMS/data/cmsWorld.xml new file mode 100644 index 0000000000000..33f5c2144074b --- /dev/null +++ b/DetectorDescription/DDCMS/data/cmsWorld.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/DetectorDescription/DDCMS/data/testLogicalParts.xml b/DetectorDescription/DDCMS/data/testLogicalParts.xml index 2aec0e62ce6d5..4c1e772ce25a5 100644 --- a/DetectorDescription/DDCMS/data/testLogicalParts.xml +++ b/DetectorDescription/DDCMS/data/testLogicalParts.xml @@ -1,7 +1,7 @@ - + diff --git a/DetectorDescription/DDCMS/data/testPosParts.xml b/DetectorDescription/DDCMS/data/testPosParts.xml new file mode 100644 index 0000000000000..b4dd867677ca1 --- /dev/null +++ b/DetectorDescription/DDCMS/data/testPosParts.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DetectorDescription/DDCMS/data/testSolids.xml b/DetectorDescription/DDCMS/data/testSolids.xml index 3b582b20f834d..a83580766c6b0 100644 --- a/DetectorDescription/DDCMS/data/testSolids.xml +++ b/DetectorDescription/DDCMS/data/testSolids.xml @@ -4,8 +4,8 @@ - - + + @@ -66,7 +66,7 @@ problem with it. Can a Polycone come to a point "in the real world?" --> - + diff --git a/DetectorDescription/DDCMS/macros/geo.fwc b/DetectorDescription/DDCMS/macros/geo.fwc new file mode 100644 index 0000000000000..4d2cf30122a41 --- /dev/null +++ b/DetectorDescription/DDCMS/macros/geo.fwc @@ -0,0 +1,855 @@ + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + + + 50 + + + 90 + + + 1032 + + + 1033 + + + 1026 + + + 1017 + + + 1025 + + + 1022 + + + 1 + + + 50 + + + 3 + + + 1 + + + + 200 + + + 100 + + + 100 + + + + + 100 + + + 100 + + + 200 + + + + + 255 + + + 220 + + + 220 + + + + + 200 + + + 200 + + + 255 + + + + + + + + + + 1 + + + 0 + + + + + + 150 + + + 50 + + + 950 + + + 750 + + + 0.126849 + + + 1 + + + 1 + + + + + + 1 + + + 0 + + + 0 + + + 0 + + + 1 + + + 0 + + + 1 + + + 1 + + + 1 + + + 0 + + + 1 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0.2 + + + 0.2 + + + 10 + + + 0.03 + + + 0.05 + + + 0.95 + + + 0.2 + + + 0.02 + + + 0.98 + + + 1 + + + 50 + + + 3 + + + 1 + + + 0.837693 + + + -0.422261 + + + 0.346361 + + + 0 + + + 0.450123 + + + 0.892966 + + + 0 + + + 0 + + + -0.309289 + + + 0.155905 + + + 0.938101 + + + 0 + + + 2861.04 + + + -1442.18 + + + 1182.96 + + + 1 + + + -1 + + + 0 + + + 0 + + + 0 + + + 0 + + + -0 + + + 1 + + + 0 + + + 0 + + + 1 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 1 + + + 36.300000 + + + + + -1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 90 + + + 0 + + + 0 + + + 1 + + + 3 + + + + + + 0 + + + 1 + + + 0 + + + 10 + + + 1 + + + + + + + + + + + 1 + + + 0 + + + + + 1 + + + 0 + + + + + + + + + + + endcap + cscDetId.endcap + 0 + station + cscDetId.station + 0 + ring + cscDetId.ring + 0 + chamber + cscDetId.chamber + 0 + + + id + detid.rawId + 0 + energy + energy + 3 + time + time + 3 + flags + flags + 0 + + + emEt + emEt + 1 + hadEt + hadEt + 1 + et + Et + 1 + eta + eta + 3 + phi + phi + 3 + + + wheel + wireId.wheel + 0 + station + wireId.station + 0 + sector + wireId.sector + 0 + SL + wireId.superlayer + 0 + layer + wireId.layer + 0 + wire + wireId.wire + 0 + digiTime + digiTime + 2 + + + wheel + chamberId.wheel + 0 + station + chamberId.station + 0 + sector + chamberId.sector + 0 + t0phi + phiSegment.t0 + 2 + t0theta + zSegment.t0 + 2 + hasPhi + hasPhi + -2 + hasZed + hasZed + -2 + chi2 + chi2 + 2 + dof + degreesOfFreedom + 0 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + pdgId + pdgId + 0 + charge + charge + 0 + dxy + dxy + 3 + dzAssociatedPV + dzAssociatedPV() + 3 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + ECAL + p4().E() * emEnergyFraction() + 1 + HCAL + p4().E() * energyFractionHadronic() + 1 + emf + emEnergyFraction() + 3 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + E/p + eSuperClusterOverP + 3 + H/E + hadronicOverEm + 3 + fbrem + (trackMomentumAtVtx().R() - trackMomentumOut().R()) / trackMomentumAtVtx().R() + 3 + dei + deltaEtaSuperClusterTrackAtVtx + 3 + dpi + deltaPhiSuperClusterTrackAtVtx() + 3 + charge + charge + 0 + isPF + isPF() + 0 + sieie + sigmaIetaIeta + 3 + isNotConv + passConversionVeto + 1 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + status + status + 0 + pdgId + pdgId + 0 + + + q + charge + 0 + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + E/p + eSuperClusterOverP + 3 + H/E + hadronicOverEm + 3 + fbrem + (trackMomentumAtVtx().R() - trackMomentumOut().R()) / trackMomentumAtVtx().R() + 3 + dei + deltaEtaSuperClusterTrackAtVtx() + 3 + dpi + deltaPhiSuperClusterTrackAtVtx() + 3 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + electronEnergyFraction + electronEnergyFraction() + 3 + muonEnergyFraction + muonEnergyFraction() + 3 + photonEnergyFraction + photonEnergyFraction() + 3 + + + et + et + 1 + phi + phi + 3 + sumEt + sumEt + 1 + mEtSig + mEtSig + 3 + + + q + charge + 0 + pT + pt + 1 + global + isGlobalMuon + -2 + tracker + isTrackerMuon + -2 + SA + isStandAloneMuon + -2 + calo + isCaloMuon + -2 + tr pt + track().pt() + 1 + eta + eta + 3 + phi + phi + 3 + matches + numberOfMatches('SegmentArbitration') + 0 + d0 + track().d0() + 3 + d0 / d0Err + track().d0() / track().d0Error() + 3 + + + et + Et + 1 + eta + eta + 3 + phi + phi + 3 + ecalEnergy + ecalEnergy() + 3 + hcalEnergy + hcalEnergy() + 3 + track pt + trackRef().pt() + 3 + + + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + H/E + hadronicOverEm + 3 + + + q + charge + 0 + pT + pt + 1 + eta + eta + 3 + phi + phi + 3 + d0 + d0 + 5 + d0Err + d0Error + 5 + dz + dz + 5 + dzErr + dzError + 5 + vx + vx + 5 + vy + vy + 5 + vz + vz + 5 + pixel hits + hitPattern().numberOfValidPixelHits() + 0 + strip hits + hitPattern().numberOfValidStripHits() + 0 + chi2 + chi2 + 3 + ndof + ndof + 0 + + + x + x + 5 + xError + xError + 5 + y + y + 5 + yError + yError + 5 + z + z + 5 + zError + zError + 5 + tracks + tracksSize + 0 + chi2 + chi2 + 3 + ndof + ndof + 3 + + + CSCSegment + CaloRecHit + CaloTower + DTRecHit1DPair + DTRecSegment4D + pat::PackedCandidate + reco::CaloJet + reco::Electron + reco::GenParticle + reco::GsfElectron + reco::Jet + reco::MET + reco::Muon + reco::PFCandidate + reco::Photon + reco::Track + reco::Vertex + + + + + diff --git a/DetectorDescription/DDCMS/python/cmsShapesXML_cfi.py b/DetectorDescription/DDCMS/python/cmsShapesXML_cfi.py new file mode 100644 index 0000000000000..09593bcd234cd --- /dev/null +++ b/DetectorDescription/DDCMS/python/cmsShapesXML_cfi.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring("DetectorDescription/DDCMS/data/cmsWorld.xml", + "DetectorDescription/DDCMS/data/testMaterials.xml", + "DetectorDescription/DDCMS/data/testLogicalParts.xml", + "DetectorDescription/DDCMS/data/testRotations.xml", + "DetectorDescription/DDCMS/data/testSolids.xml", + "DetectorDescription/DDCMS/data/testPosParts.xml", + "DetectorDescription/DDCMS/data/materials.xml"), + rootNodeName = cms.string('cmsWorld:OCMS') +) diff --git a/DetectorDescription/DDCMS/test/python/dumpDDShapes.py b/DetectorDescription/DDCMS/test/python/dumpDDShapes.py new file mode 100644 index 0000000000000..9090916d7eb51 --- /dev/null +++ b/DetectorDescription/DDCMS/test/python/dumpDDShapes.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("SHAPESDUMP") +process.source = cms.Source("EmptySource") +process.load("DetectorDescription.DDCMS.cmsShapesXML_cfi") +##process.load("Geometry.CMSCommonData.cmsAllGeometryXML_cfi") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +process.add_(cms.ESProducer("TGeoMgrFromDdd", + verbose = cms.untracked.bool(True), + level = cms.untracked.int32(14) + )) + +process.dump = cms.EDAnalyzer("DumpSimGeometry", + tag = cms.untracked.string("DDShapes"), + outputFileName = cms.untracked.string("cmsDDShapesTest.root")) + +process.p = cms.Path(process.dump) diff --git a/DetectorDescription/DDCMS/test/python/testShapes.py b/DetectorDescription/DDCMS/test/python/testShapes.py index e00954a667f0c..f4f49790f2607 100644 --- a/DetectorDescription/DDCMS/test/python/testShapes.py +++ b/DetectorDescription/DDCMS/test/python/testShapes.py @@ -30,5 +30,6 @@ ) process.testVectors = cms.EDAnalyzer("DDTestVectors") +process.testDump = cms.EDAnalyzer("DDTestDumpFile") -process.p = cms.Path(process.test+process.testVectors) +process.p = cms.Path(process.test+process.testVectors+process.testDump) From e1aa4311fb230ee6aef911961b097db581f7f255 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 30 May 2018 15:21:25 +0200 Subject: [PATCH 2/3] Shapes bug fixes --- DetectorDescription/DDCMS/data/cmsWorld.xml | 8 +++++ .../DDCMS/data/testPosParts.xml | 36 +++++-------------- DetectorDescription/DDCMS/data/testSolids.xml | 3 +- .../DDCMS/plugins/DDDefinitions2Objects.cc | 20 +++++------ .../DDCMS/test/python/dumpDDShapes.py | 2 +- 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/DetectorDescription/DDCMS/data/cmsWorld.xml b/DetectorDescription/DDCMS/data/cmsWorld.xml index 33f5c2144074b..ac7cfc8fbf877 100644 --- a/DetectorDescription/DDCMS/data/cmsWorld.xml +++ b/DetectorDescription/DDCMS/data/cmsWorld.xml @@ -19,4 +19,12 @@ + + + + + + + + diff --git a/DetectorDescription/DDCMS/data/testPosParts.xml b/DetectorDescription/DDCMS/data/testPosParts.xml index b4dd867677ca1..d0824800ca106 100644 --- a/DetectorDescription/DDCMS/data/testPosParts.xml +++ b/DetectorDescription/DDCMS/data/testPosParts.xml @@ -4,37 +4,37 @@ - + - + - + - + - + - + @@ -59,9 +59,9 @@ - + - + @@ -72,11 +72,6 @@ - - - - - @@ -138,25 +133,10 @@ - - - - - - - - - - - - - - - diff --git a/DetectorDescription/DDCMS/data/testSolids.xml b/DetectorDescription/DDCMS/data/testSolids.xml index a83580766c6b0..9e52f52597b04 100644 --- a/DetectorDescription/DDCMS/data/testSolids.xml +++ b/DetectorDescription/DDCMS/data/testSolids.xml @@ -2,7 +2,8 @@ - + + diff --git a/DetectorDescription/DDCMS/plugins/DDDefinitions2Objects.cc b/DetectorDescription/DDCMS/plugins/DDDefinitions2Objects.cc index 4a59116199f40..df91658e95239 100644 --- a/DetectorDescription/DDCMS/plugins/DDDefinitions2Objects.cc +++ b/DetectorDescription/DDCMS/plugins/DDDefinitions2Objects.cc @@ -536,7 +536,7 @@ template <> void Converter::operator()(xml_h element) const xml_dim_t xrot(element); xml_dim_t par(xrot.parent()); if( xrot.hasAttr(_U(name))) { - string nam = xrot.nameStr() + string("Rotation"); // xrot.hasAttr(_U(name)) ? xrot.nameStr() : par.nameStr(); + string nam = xrot.nameStr();// + string("Rotation"); // xrot.hasAttr(_U(name)) ? xrot.nameStr() : par.nameStr(); string axis = _ns.attr(xrot,_CMU(axis)); double angle = _ns.attr(xrot,_U(angle)); Rotation3D rot; @@ -817,23 +817,23 @@ template <> void Converter::operator()(xml_h element) const { printout(_ns.context->debug_shapes ? ALWAYS : DEBUG, "MyDDCMS", "+ Trapezoid: dz=%10.3f [cm] alp1:%.3f bl1=%.3f tl1=%.3f alp2=%.3f bl2=%.3f tl2=%.3f h2=%.3f phi=%.3f theta=%.3f", dz, alp1, bl1, tl1, h1, alp2, bl2, tl2, h2, phi, theta); - _ns.addSolid(nam, Trap(dz, theta, phi, h1, bl1, tl1, alp1, h2, bl2, tl2, alp2)); + _ns.addSolid( nam, Trap( dz, theta, phi, h1, bl1, tl1, alp1, h2, bl2, tl2, alp2 )); } /// Converter for tags template <> void Converter::operator()(xml_h element) const { - cms::DDNamespace _ns(_param()); - xml_dim_t e(element); + cms::DDNamespace _ns( _param()); + xml_dim_t e( element ); string nam = e.nameStr(); - double dx1 = _ns.attr(e,_CMU(dx1)); - double dy1 = _ns.attr(e,_CMU(dy1)); - double dx2 = _ns.attr(e,_CMU(dx2),0.0); - double dy2 = _ns.attr(e,_CMU(dy2),0.0); - double dz = _ns.attr(e,_CMU(dz)); + double dx1 = _ns.attr( e, _CMU( dx1 )); + double dy1 = _ns.attr( e, _CMU( dy1 )); + double dx2 = _ns.attr( e, _CMU( dx2 ), 0.0 ); + double dy2 = _ns.attr( e, _CMU( dy2 ), dy1 ); + double dz = _ns.attr( e, _CMU( dz )); printout(_ns.context->debug_shapes ? ALWAYS : DEBUG, "MyDDCMS", "+ Trd1: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2:%.3f dy2:%.3f", dz, dx1, dy1, dx2, dy2); - _ns.addSolid(nam, Trapezoid(dx1, dx2, dy1, dy2, dz)); + _ns.addSolid( nam, Trapezoid( dx1, dx2, dy1, dy2, dz )); } /// Converter for tags diff --git a/DetectorDescription/DDCMS/test/python/dumpDDShapes.py b/DetectorDescription/DDCMS/test/python/dumpDDShapes.py index 9090916d7eb51..0f1c180f2f544 100644 --- a/DetectorDescription/DDCMS/test/python/dumpDDShapes.py +++ b/DetectorDescription/DDCMS/test/python/dumpDDShapes.py @@ -8,7 +8,7 @@ process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) process.add_(cms.ESProducer("TGeoMgrFromDdd", - verbose = cms.untracked.bool(True), + verbose = cms.untracked.bool(False), level = cms.untracked.int32(14) )) From 9e8bbdbf07040ce5da3edcadf0cda46f7675e405 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Wed, 30 May 2018 15:28:32 +0200 Subject: [PATCH 3/3] Reintroduce access to graph from compact view --- DetectorDescription/Core/interface/DDCompactView.h | 4 +++- .../Core/interface/DDCompactViewImpl.h | 9 ++++++--- DetectorDescription/Core/src/DDCompactView.cc | 7 +++++++ DetectorDescription/Core/src/DDCompactViewImpl.cc | 10 ++++++++-- Fireworks/Geometry/src/TGeoMgrFromDdd.cc | 11 ++++++----- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/DetectorDescription/Core/interface/DDCompactView.h b/DetectorDescription/Core/interface/DDCompactView.h index 9f784c1e88842..692d87fd084db 100644 --- a/DetectorDescription/Core/interface/DDCompactView.h +++ b/DetectorDescription/Core/interface/DDCompactView.h @@ -14,6 +14,7 @@ #include "DetectorDescription/Core/interface/DDPosData.h" #include "DetectorDescription/Core/interface/DDTransform.h" #include "DataFormats/Math/interface/Graph.h" +#include "DataFormats/Math/interface/GraphWalker.h" class DDCompactViewImpl; class DDDivision; @@ -27,7 +28,6 @@ namespace DDI { class Specific; } - /** Navigation through the compact view of the detector ... @@ -84,6 +84,7 @@ class DDCompactView { public: using Graph = math::Graph; + using GraphWalker = math::GraphWalker; //! Creates a compact-view explicit DDCompactView(); @@ -95,6 +96,7 @@ class DDCompactView //! Provides read-only access to the data structure of the compact-view. const Graph & graph() const; + GraphWalker walker() const; //! returns the DDLogicalPart representing the root of the geometrical hierarchy const DDLogicalPart & root() const; diff --git a/DetectorDescription/Core/interface/DDCompactViewImpl.h b/DetectorDescription/Core/interface/DDCompactViewImpl.h index 8d9d4004641cf..347b08977d6f6 100644 --- a/DetectorDescription/Core/interface/DDCompactViewImpl.h +++ b/DetectorDescription/Core/interface/DDCompactViewImpl.h @@ -6,6 +6,7 @@ #include "DetectorDescription/Core/interface/DDPosData.h" #include "DetectorDescription/Core/interface/DDTransform.h" #include "DataFormats/Math/interface/Graph.h" +#include "DataFormats/Math/interface/GraphWalker.h" class DDDivision; struct DDPosData; @@ -14,7 +15,8 @@ class DDCompactViewImpl { public: - using GraphNav = math::Graph; + using Graph = math::Graph; + using GraphWalker = math::GraphWalker; explicit DDCompactViewImpl(); DDCompactViewImpl(const DDLogicalPart & rootnodedata); @@ -27,7 +29,8 @@ class DDCompactViewImpl DDLogicalPart & current() const; - const GraphNav & graph() const { return graph_; } + const Graph& graph() const { return graph_; } + GraphWalker walker() const; void position (const DDLogicalPart & self, const DDLogicalPart & parent, @@ -41,7 +44,7 @@ class DDCompactViewImpl protected: // internal use ! (see comments in DDCompactView(bool)!) DDLogicalPart root_; - GraphNav graph_; + Graph graph_; }; #endif diff --git a/DetectorDescription/Core/src/DDCompactView.cc b/DetectorDescription/Core/src/DDCompactView.cc index 54d2d24c52a6e..207001c86c6f9 100644 --- a/DetectorDescription/Core/src/DDCompactView.cc +++ b/DetectorDescription/Core/src/DDCompactView.cc @@ -61,6 +61,12 @@ const DDCompactView::Graph & DDCompactView::graph() const return rep_->graph(); } +DDCompactView::GraphWalker +DDCompactView::walker() const +{ + return rep_->walker(); +} + const DDLogicalPart & DDCompactView::root() const { return rep_->root(); @@ -78,6 +84,7 @@ void DDCompactView::position (const DDLogicalPart & self, const DDRotation & rot, const DDDivision * div) { + std::cout << "DDCompactView::position " << self << " with translation " << trans << " and rotation " << rot << "\n"; int cpno = atoi(copyno.c_str()); position(self,parent,cpno,trans,rot, div); } diff --git a/DetectorDescription/Core/src/DDCompactViewImpl.cc b/DetectorDescription/Core/src/DDCompactViewImpl.cc index f37d79cbe111e..e255e8ac6058e 100644 --- a/DetectorDescription/Core/src/DDCompactViewImpl.cc +++ b/DetectorDescription/Core/src/DDCompactViewImpl.cc @@ -11,13 +11,13 @@ DDCompactViewImpl::DDCompactViewImpl( const DDLogicalPart & rootnodedata ) DDCompactViewImpl::~DDCompactViewImpl() { - GraphNav::adj_list::size_type it = 0; + Graph::adj_list::size_type it = 0; if( graph_.size() == 0 ) { LogDebug("DDCompactViewImpl") << "In destructor, graph is empty. Root:" << root_ << std::endl; } else { LogDebug("DDCompactViewImpl") << "In destructor, graph is NOT empty. Root:" << root_ << " graph_.size() = " << graph_.size() << std::endl; for(; it < graph_.size() ; ++it ) { - GraphNav::edge_range erange = graph_.edges( it ); + Graph::edge_range erange = graph_.edges( it ); for(; erange.first != erange.second; ++(erange.first)) { DDPosData * pd = graph_.edgeData( erange.first->second ); delete pd; @@ -28,6 +28,12 @@ DDCompactViewImpl::~DDCompactViewImpl() edm::LogInfo("DDCompactViewImpl") << std::endl << "DDD transient representation has been destructed." << std::endl << std::endl; } +DDCompactViewImpl::GraphWalker +DDCompactViewImpl::walker() const +{ + return GraphWalker( graph_, root_ ); +} + void DDCompactViewImpl::position( const DDLogicalPart & self, const DDLogicalPart & parent, diff --git a/Fireworks/Geometry/src/TGeoMgrFromDdd.cc b/Fireworks/Geometry/src/TGeoMgrFromDdd.cc index 503d8ee692458..3139aa86af98e 100644 --- a/Fireworks/Geometry/src/TGeoMgrFromDdd.cc +++ b/Fireworks/Geometry/src/TGeoMgrFromDdd.cc @@ -21,7 +21,6 @@ #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDSolid.h" #include "DetectorDescription/Core/interface/DDMaterial.h" -#include "DataFormats/Math/interface/GraphWalker.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" @@ -68,7 +67,6 @@ namespace TGeoCombiTrans* createPlacement(const DDRotationMatrix& iRot, const DDTranslation& iTrans) { - // std::cout << "in createPlacement" << std::endl; double elements[9]; iRot.GetComponents(elements); TGeoRotation r; @@ -106,8 +104,10 @@ TGeoMgrFromDdd::produce(const DisplayGeomRecord& iRecord) gGeoIdentity = new TGeoIdentity("Identity"); } - std::cout << "about to initialize the DDCompactView walker" << std::endl; - auto walker = math::GraphWalker( viewH->graph(), viewH->root()); + std::cout << "about to initialize the DDCompactView walker" + << " with a root node " << viewH->root() << std::endl; + + auto walker = viewH->walker(); auto info = walker.current(); // The top most item is actually the volume holding both the @@ -120,6 +120,7 @@ TGeoMgrFromDdd::produce(const DisplayGeomRecord& iRecord) TGeoVolume *top = createVolume(info.first.name().fullname(), info.first.solid(), info.first.material()); + if (top == nullptr) { return std::shared_ptr(); } @@ -141,7 +142,7 @@ TGeoMgrFromDdd::produce(const DisplayGeomRecord& iRecord) for(unsigned int i=0; icopyno()<<" " + std::cout << info.first.name() <<" "<copyno()<<" " << DDSolidShapesName::name(info.first.solid().shape())<