3 #include "DD4hep/Path.h" 4 #include "DD4hep/Printout.h" 8 #include "tbb/concurrent_unordered_map.h" 9 #include "tbb/concurrent_vector.h" 14 DDNamespace::DDNamespace(
DDParsingContext* context, xml_h element) : m_context(context) {
16 m_name = path.filename().substr(0, path.filename().rfind(
'.'));
23 "+++ Current namespace is now: %s",
30 m_name = path.filename().substr(0, path.filename().rfind(
'.'));
37 "+++ Current namespace is now: %s",
61 "+++ Current namespace is now: %s",
76 while ((idx = val.find(
'[')) != string::npos) {
79 idq = val.find(
']', idx);
81 if (idp == string::npos || idp > idq)
83 else if (idp != string::npos && idp < idq)
92 return nam.substr(0, idx);
99 return nam.substr(idx + 1);
108 const string&
v =
val;
109 const string&
n = nam;
112 "+++ Add constant object: %-40s = %s [type:%s]",
116 dd4hep::_toDictionary(n, v, typ);
131 static const dd4hep::Rotation3D s_null;
136 else if (nam ==
"NULL")
138 else if (nam.find(
":NULL") == nam.length() - 5)
147 throw runtime_error(
"Unknown rotation identifier:" + nam);
151 string n = vol.name();
152 dd4hep::Solid
s = vol.solid();
154 vol->SetName(n.c_str());
158 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
169 dd4hep::Solid
s = vol.solid();
175 "+++ Add volume:%-38s as [%s] Solid:%-26s[%-16s] Material:%s",
195 throw runtime_error(
"Unknown volume identifier:" + name);
203 "+++ Add shape of type %s : %s",
204 solid->IsA()->GetName(),
236 auto tmpShape =
m_context->
shapes.emplace(nam, dd4hep::Solid(
nullptr));
237 return (*tmpShape.first).second;
242 auto it = registry->find(name);
243 if (it != registry->end()) {
244 std::vector<double>
result;
245 for (
auto in : it->second)
246 result.emplace_back(
in);
249 return std::vector<double>();
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
bool const ns(std::string &result)
dd4hep::Solid solid(const std::string &name) const
std::atomic< dd4hep::Detector * > description
std::string_view name() const
void addConstantNS(const std::string &name, const std::string &value, const std::string &type) const
static std::string nsName(const std::string &)
void addRotation(const std::string &name, const dd4hep::Rotation3D &rot) const
std::string realName(const std::string &) const
static std::string objName(const std::string &)
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double >> DDVectorsMap
tbb::concurrent_unordered_map< std::string, dd4hep::Rotation3D > rotations
dd4hep::Material material(const std::string &name) const
tbb::concurrent_unordered_map< std::string, dd4hep::Volume > volumes
std::vector< double > vecDbl(const std::string &name) const
DDParsingContext * m_context
std::string prepend(const std::string &) const
Namespace of DDCMS conversion namespace.
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
tbb::concurrent_unordered_map< std::string, dd4hep::Solid > shapes
const dd4hep::Rotation3D & rotation(const std::string &name) const
tbb::concurrent_queue< std::string > namespaces
void addConstant(const std::string &name, const std::string &value, const std::string &type) const