Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DetectorDescription/DDCMS/interface/DDNamespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace cms {
DDParsingContext* setContext() { return m_context; }

std::string_view name() const { return m_name; }
std::string noNamespace(const std::string&) const;

std::vector<double> vecDbl(const std::string& name) const;
std::vector<float> vecFloat(const std::string& name) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ void Converter<DDLRotationByAxis>::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 axis = ns.attr<string>(xrot, DD_CMU(axis));
double angle = ns.attr<double>(xrot, _U(angle));
Rotation3D rot;
Expand Down Expand Up @@ -786,7 +786,7 @@ void Converter<DDLLogicalPart>::operator()(xml_h element) const {
xml_dim_t e(element);
string sol = e.child(DD_CMU(rSolid)).attr<string>(_U(name));
string mat = e.child(DD_CMU(rMaterial)).attr<string>(_U(name));
string volName = e.attr<string>(_U(name));
string volName = ns.prepend(e.attr<string>(_U(name)));
Solid solid = ns.solid(sol);
Material material = ns.material(mat);

Expand Down Expand Up @@ -852,8 +852,8 @@ void Converter<DDLPosPart>::operator()(xml_h element) const {
cms::DDNamespace ns(_param<cms::DDParsingContext>()); //, element, true );
xml_dim_t e(element);
int copy = e.attr<int>(DD_CMU(copyNumber));
string parentName = ns.attr<string>(e.child(DD_CMU(rParent)), _U(name));
string childName = ns.attr<string>(e.child(DD_CMU(rChild)), _U(name));
string parentName = ns.prepend(ns.attr<string>(e.child(DD_CMU(rParent)), _U(name)));
string childName = ns.prepend(ns.attr<string>(e.child(DD_CMU(rChild)), _U(name)));
Volume parent = ns.volume(parentName, false);
Volume child = ns.volume(childName, false);

Expand Down
12 changes: 11 additions & 1 deletion DetectorDescription/DDCMS/src/DDNamespace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const dd4hep::Rotation3D& DDNamespace::rotation(const string& name) const {
}

dd4hep::Volume DDNamespace::addVolumeNS(dd4hep::Volume vol) const {
string n = vol.name();
string n = prepend(vol.name());
dd4hep::Solid s = vol.solid();
dd4hep::Material m = vol.material();
vol->SetName(n.c_str());
Expand Down Expand Up @@ -278,3 +278,13 @@ std::vector<float> DDNamespace::vecFloat(const std::string& name) const {
} else
return std::vector<float>();
}

std::string DDNamespace::noNamespace(const std::string& fullName) const {
std::string result(fullName);
auto n = result.find(':');
if (n == std::string::npos) {
return result;
} else {
return result.substr(n + 1);
}
}
4 changes: 2 additions & 2 deletions DetectorDescription/DDCMS/test/DDFilteredView.find.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void testDDFilteredViewFind::checkFilteredView() {
fview.goTo({0, 0, 8});
printMe(fview);

CPPUNIT_ASSERT(fview.name() == "MUON");
CPPUNIT_ASSERT(fview.name() == "muonBase:MUON");

// Go to the first daughter
fview.next(0);
Expand Down Expand Up @@ -129,7 +129,7 @@ void testDDFilteredViewFind::checkFilteredView() {
std::cout << "\n==== Let's do it again, go to Muon\n";
fview.goTo({0, 0, 8});
printMe(fview);
CPPUNIT_ASSERT(fview.name() == "MUON");
CPPUNIT_ASSERT(fview.name() == "muonBase:MUON");

// Go to the first daughter
fview.next(0);
Expand Down
4 changes: 2 additions & 2 deletions DetectorDescription/DDCMS/test/DDFilteredView.get.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void testDDFilteredViewGet::checkFilteredView() {
fview.goTo({0, 0, 8});
printMe(fview);

CPPUNIT_ASSERT(fview.name() == "MUON");
CPPUNIT_ASSERT(fview.name() == "muonBase:MUON");

// Go to the first daughter
fview.next(0);
Expand Down Expand Up @@ -132,7 +132,7 @@ void testDDFilteredViewGet::checkFilteredView() {
std::cout << "\n==== Let's do it again, go to Muon\n";
fview.goTo({0, 0, 8});
printMe(fview);
CPPUNIT_ASSERT(fview.name() == "MUON");
CPPUNIT_ASSERT(fview.name() == "muonBase:MUON");

// Go to the first daughter
fview.next(0);
Expand Down
4 changes: 2 additions & 2 deletions DetectorDescription/DDCMS/test/DDFilteredView.goto.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void testDDFilteredViewGoTo::checkFilteredView() {
// Start with Tracker
std::cout << "\n==== Let's go to Tracker\n";
fview.goTo({0, 0, 6});
CPPUNIT_ASSERT(fview.name() == "Tracker");
CPPUNIT_ASSERT(fview.name() == "tracker:Tracker");
printMe(fview);

// Go to the first daughter
Expand Down Expand Up @@ -123,7 +123,7 @@ void testDDFilteredViewGoTo::checkFilteredView() {

std::cout << "\n==== Let's do it again, go to Tracker\n";
fview.goTo({0, 0, 6});
CPPUNIT_ASSERT(fview.name() == "Tracker");
CPPUNIT_ASSERT(fview.name() == "tracker:Tracker");
printMe(fview);

// Go to the first daughter
Expand Down
8 changes: 4 additions & 4 deletions Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E
uint32_t level(0);

do {
if (fv.name() == "BarrelTimingLayer") {
if (dd4hep::dd::noNamespace(fv.name()) == "BarrelTimingLayer") {
isBarrel = true;
edm::LogInfo("DD4hep_TestMTDIdealGeometry") << "isBarrel = " << isBarrel;
} else if (fv.name() == "EndcapTimingLayer") {
} else if (dd4hep::dd::noNamespace(fv.name()) == "EndcapTimingLayer") {
isBarrel = false;
edm::LogInfo("DD4hep_TestMTDIdealGeometry") << "isBarrel = " << isBarrel;
}
Expand All @@ -168,7 +168,7 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E
write = false;
exitLoop = true;
}
if (fv.name() == ddTopNodeName_) {
if (dd4hep::dd::noNamespace(fv.name()) == ddTopNodeName_) {
write = true;
level = fv.navPos().size();
}
Expand All @@ -194,7 +194,7 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E

for (auto const& t : specs) {
for (auto const& it : t.second->paths) {
if (dd4hep::dd::compareEqual(fv.name(), dd4hep::dd::realTopName(it))) {
if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(fv.name()), dd4hep::dd::realTopName(it))) {
isSens = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static long algorithm(Detector& /* description */, cms::DDParsingContext& ctxt,
tag = "Stereo";
//usefull constants
const double topFrameEndZ = 0.5 * (-waferPosition + fullHeight) + pitchHeight + hybridHeight - topFrameHeight;
string idName = ns.prepend(ns.realName(mother.name()));
string idName = ns.noNamespace(mother.name());
edm::LogVerbatim("TECGeom") << "idName: " << idName << " parent " << mother.name() << " namespace " << ns.name();
Solid solid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

using namespace std;
using namespace dd4hep;
Expand Down