|
|
Go to the documentation of this file.
4 #include "DD4hep/Path.h"
5 #include "DD4hep/Printout.h"
11 #include <unordered_map>
19 static constexpr
double roundingVal = 1 << 24;
20 value = (round(
value * roundingVal) / roundingVal);
27 for (
int row = 0; row <= 2; ++row) {
29 std::ostringstream numStream;
30 numStream <<
std::fixed << std::setprecision(7);
32 hashVal += numStream.str();
40 std::vector<double>
matrix;
44 std::ostringstream numStream;
45 numStream <<
std::fixed << std::setprecision(7);
47 hashVal += numStream.str();
61 "+++ Current namespace is now: %s",
74 "+++ Current namespace is now: %s",
93 "+++ Current namespace is now: %s",
106 size_t idx, idq, idp;
108 while ((
idx =
val.find(
'[')) != string::npos) {
113 if (idp == string::npos || idp > idq)
115 else if (idp != string::npos && idp < idq)
140 const string&
v =
val;
141 const string&
n =
name;
144 "+++ Add constant object: %-40s = %s [type:%s]",
148 dd4hep::_toDictionary(
n,
v,
type);
171 static const dd4hep::Rotation3D s_null;
178 else if (
name.find(
":NULL") ==
name.length() - 5)
187 throw runtime_error(
"Unknown rotation identifier:" +
name);
192 dd4hep::Solid
s = vol.solid();
194 vol->SetName(
n.c_str());
196 const char* solidName =
"Invalid solid";
198 solidName =
s.name();
201 "+++ Add volumeNS:%-38s Solid:%-26s[%-16s] Material:%s",
211 dd4hep::Solid
s = vol.solid();
214 const char* solidName =
"Invalid solid";
216 solidName =
s.name();
219 "+++ Add volume:%-38s as [%s] Solid:%-26s[%-16s] Material:%s",
258 throw runtime_error(
"Unknown assembly identifier: " +
name);
275 throw runtime_error(
"Unknown volume identifier:" +
name);
283 "+++ Add shape of type %s : %s",
284 solid->IsA()->GetName(),
316 auto tmpShape =
m_context->
shapes.emplace(nam, dd4hep::Solid(
nullptr));
317 return (*tmpShape.first).second;
322 auto it = registry->find(
name);
323 if (it != registry->end()) {
324 return {begin(it->second),
end(it->second)};
326 return std::vector<double>();
331 auto it = registry->find(
name);
332 if (it != registry->end()) {
333 std::vector<float>
result;
335 begin(it->second),
end(it->second), std::back_inserter(
result), [](
double i) ->
float { return (float)i; });
338 return std::vector<float>();
344 if (
n == std::string::npos) {
dd4hep::Assembly assembly(const std::string &name, bool exception=true) const
std::string realName(const std::string &) const
std::string rotHash(const Double_t *rot)
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
std::string noNamespace(const std::string &) const
std::vector< float > vecFloat(const std::string &name) const
dd4hep::Assembly addAssembly(dd4hep::Assembly asmb, bool addSolid=true) const
void addConstantNS(const std::string &name, const std::string &value, const std::string &type) const
const std::string & ns() const
static std::string objName(const std::string &)
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
std::unordered_map< std::string, std::string > rotRevMap
std::string prepend(const std::string &) const
const dd4hep::Rotation3D & rotation(const std::string &name) const
std::unordered_map< std::string, dd4hep::Solid > shapes
double roundBinary(double value)
dd4hep::Assembly addAssemblySolid(dd4hep::Assembly assembly) const
std::unordered_map< std::string, dd4hep::Assembly > assemblies
dd4hep::Volume addVolume(dd4hep::Volume vol) const
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
std::vector< std::string > namespaces
static std::string nsName(const std::string &)
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
std::vector< double > vecDbl(const std::string &name) const
std::unordered_map< std::string, dd4hep::Volume > volumes
std::string_view name() const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::unordered_set< std::string > assemblySolids
dd4hep::Detector & description
Namespace of DDCMS conversion namespace.