|
|
Go to the documentation of this file.
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) {
23 "+++ Current namespace is now: %s",
37 "+++ Current namespace is now: %s",
61 "+++ Current namespace is now: %s",
76 while ((
idx =
val.find(
'[')) != string::npos) {
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());
156 const char* solidName =
"Invalid solid";
158 solidName =
s.name();
161 "+++ Add volumeNS:%-38s Solid:%-26s[%-16s] Material:%s",
172 dd4hep::Solid
s = vol.solid();
176 const char* solidName =
"Invalid solid";
178 solidName =
s.name();
181 "+++ Add volume:%-38s as [%s] Solid:%-26s[%-16s] Material:%s",
201 throw runtime_error(
"Unknown volume identifier:" +
name);
209 "+++ Add shape of type %s : %s",
210 solid->IsA()->GetName(),
242 auto tmpShape =
m_context->
shapes.emplace(nam, dd4hep::Solid(
nullptr));
243 return (*tmpShape.first).second;
248 auto it = registry->find(
name);
249 if (it != registry->end()) {
250 std::vector<double>
result;
251 for (
auto in : it->second)
255 return std::vector<double>();
std::string realName(const std::string &) const
DDParsingContext * m_context
void addRotation(const std::string &name, const dd4hep::Rotation3D &rot) const
void addConstant(const std::string &name, const std::string &value, const std::string &type) const
dd4hep::Solid solid(const std::string &name) const
dd4hep::Material material(const std::string &name) const
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double > > DDVectorsMap
void addConstantNS(const std::string &name, const std::string &value, const std::string &type) const
static std::string objName(const std::string &)
std::atomic< dd4hep::Detector * > description
tbb::concurrent_unordered_map< std::string, dd4hep::Volume > volumes
tbb::concurrent_unordered_map< std::string, dd4hep::Rotation3D > rotations
std::string prepend(const std::string &) const
const dd4hep::Rotation3D & rotation(const std::string &name) const
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
static std::string nsName(const std::string &)
tbb::concurrent_unordered_map< std::string, dd4hep::Solid > shapes
tbb::concurrent_queue< std::string > namespaces
std::vector< double > vecDbl(const std::string &name) const
std::string_view name() const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
const bool ns(std::string &result)
Namespace of DDCMS conversion namespace.