3 #include "DD4hep/Path.h" 4 #include "DD4hep/Printout.h" 13 : m_context( context )
16 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
21 "DD4CMS",
"+++ Current namespace is now: %s",
m_name.c_str());
29 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
34 "DD4CMS",
"+++ Current namespace is now: %s",
m_name.c_str());
54 "DD4CMS",
"+++ Current namespace is now: %s",
m_context->
ns().c_str());
69 while(( idx = val.find(
'[')) != string::npos )
73 idq = val.find(
']', idx );
75 if( idp == string::npos || idp > idq )
77 else if ( idp != string::npos && idp < idq )
88 return nam.substr( 0, idx );
97 return nam.substr( idx + 1 );
110 const string&
v =
val;
111 const string&
n = nam;
113 "DD4CMS",
"+++ Add constant object: %-40s = %s [type:%s]",
114 n.c_str(), v.c_str(), typ.c_str());
115 dd4hep::_toDictionary( n, v, typ );
133 const dd4hep::Rotation3D&
136 static dd4hep::Rotation3D s_null;
141 else if( nam ==
"NULL" )
143 else if( nam.find(
":NULL") == nam.length() - 5 )
154 cout <<
r.first << endl;
156 throw runtime_error(
"Unknown rotation identifier:"+nam);
162 string n = vol.name();
163 dd4hep::Solid
s = vol.solid();
165 vol->SetName(n.c_str());
168 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
169 vol.name(), s.name(), s.type(), m.name());
178 dd4hep::Solid
s = vol.solid();
180 vol->SetName(n.c_str());
183 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
184 vol.name(), s.name(), s.type(), m.name());
204 throw runtime_error(
"Unknown volume identifier:" + name );
213 "+++ Add shape of type %s : %s", solid->IsA()->GetName(), name.c_str());
243 throw runtime_error(
"Unknown shape identifier:" + nam );
dd4hep::Solid addSolidNS(const std::string &name, dd4hep::Solid solid) const
const std::string & ns() const
dd4hep::Volume volume(const std::string &name, bool exc=true) const
std::vector< std::string > namespaces
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
dd4hep::Detector * description
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
dd4hep::Solid solid(const std::string &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
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
std::unordered_map< std::string, dd4hep::Volume > volumes
static std::string objName(const std::string &)
dd4hep::Material material(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
const std::string & name() const
const dd4hep::Rotation3D & rotation(const std::string &name) const
std::unordered_map< std::string, dd4hep::Solid > shapes
void addConstant(const std::string &name, const std::string &value, const std::string &type) const