diff --git a/DetectorDescription/DDCMS/interface/DDFilteredView.h b/DetectorDescription/DDCMS/interface/DDFilteredView.h index 941e51149f440..65c2aea802f19 100644 --- a/DetectorDescription/DDCMS/interface/DDFilteredView.h +++ b/DetectorDescription/DDCMS/interface/DDFilteredView.h @@ -66,6 +66,13 @@ namespace cms { //! The physical volume of the current node const PlacedVolume volume() const; + //! The full path to the current node + const std::string path() const; + + //! The list of the volume copy numbers + // along the full path to the current node + const std::vector copyNos() const; + //! The absolute translation of the current node // Return value is Double_t translation[3] with x, y, z elements. const Double_t* trans() const; diff --git a/DetectorDescription/DDCMS/src/DDFilteredView.cc b/DetectorDescription/DDCMS/src/DDFilteredView.cc index 76b187e7badde..2211eaebb08d9 100644 --- a/DetectorDescription/DDCMS/src/DDFilteredView.cc +++ b/DetectorDescription/DDCMS/src/DDFilteredView.cc @@ -68,6 +68,29 @@ const PlacedVolume DDFilteredView::volume() const { return PlacedVolume(node_); } +// +// This should be used for debug purpose only +// +const std::string DDFilteredView::path() const { + TString fullPath; + it_.back().GetPath(fullPath); + return std::string(fullPath.Data()); +} + +// +// The vector is filled from bottom up: +// result[0] contains the current node copy number +// +const std::vector DDFilteredView::copyNos() const { + std::vector result; + + for (int i = it_.back().GetLevel(); i > 0; --i) { + result.emplace_back(it_.back().GetNode(i)->GetNumber()); + } + + return result; +} + const Double_t* DDFilteredView::trans() const { return it_.back().GetCurrentMatrix()->GetTranslation(); } const Translation DDFilteredView::translation() const { diff --git a/DetectorDescription/DDCMS/test/DDFilteredView.cppunit.cc b/DetectorDescription/DDCMS/test/DDFilteredView.cppunit.cc index 745beb98bab4f..7d6d72c6a2262 100644 --- a/DetectorDescription/DDCMS/test/DDFilteredView.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDFilteredView.cppunit.cc @@ -68,6 +68,8 @@ void testDDFilteredView::checkFilteredView() { DDFilteredView fview(det.get(), det->description()->worldVolume()); fview.next(0); std::cout << fview.name() << " is a " << cms::dd::name(cms::DDSolidShapeMap, fview.shape()) << "\n"; + std::cout << "Full path to it is " << fview.path() << "\n"; + auto copyNos = fview.copyNos(); if (fview.isA()) cout << "It's a Box\n"; fview.parent();