3 #include "DD4hep/Path.h" 4 #include "DD4hep/Printout.h" 15 xml_dim_t elt( element );
16 bool has_label = elt.hasAttr(_U(
label));
17 m_name = has_label ? elt.labelStr() :
"";
23 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
32 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
38 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
45 xml_dim_t elt(element);
46 bool has_label = elt.hasAttr(_U(
label));
47 m_name = has_label ? elt.labelStr() :
"";
54 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
60 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
80 "MyDDCMS",
"+++ Current namespace is now: %s",
context->
ns().c_str());
95 while(( idx = val.find(
'[')) != string::npos )
99 idq = val.find(
']', idx );
101 if( idp == string::npos || idp > idq )
102 val.insert( idx,
m_name );
103 else if ( idp != string::npos && idp < idq )
114 return nam.substr( 0, idx );
123 return nam.substr( idx + 1 );
136 const string&
v =
val;
137 const string&
n = nam;
139 "MyDDCMS",
"+++ Add constant object: %-40s = %s [type:%s]",
140 n.c_str(), v.c_str(), typ.c_str());
141 dd4hep::_toDictionary( n, v, typ );
149 const vector<double>&
v =
value;
150 const string&
n =
name;
152 "MyDDCMS",
"+++ Add constant object: %-40s = %s ",
153 n.c_str(),
"vector<double>");
170 const dd4hep::Rotation3D&
173 static dd4hep::Rotation3D s_null;
178 else if( nam ==
"NULL" )
180 else if( nam.find(
":NULL") == nam.length() - 5 )
191 cout <<
r.first << endl;
193 throw runtime_error(
"Unknown rotation identifier:"+nam);
199 string n = vol.name();
200 dd4hep::Solid
s = vol.solid();
202 vol->SetName(n.c_str());
205 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
206 vol.name(), s.name(), s.type(), m.name());
215 dd4hep::Solid
s = vol.solid();
217 vol->SetName(n.c_str());
220 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
221 vol.name(), s.name(), s.type(), m.name());
241 throw runtime_error(
"Unknown volume identifier:"+nam);
250 "+++ Add shape of type %s : %s",sol->IsA()->GetName(), nam.c_str());
279 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
void addVector(const std::string &name, const VecDouble &value)
std::map< std::string, dd4hep::Solid > shapes
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 addVector(const std::string &name, const std::vector< double > &value) const
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 &)
std::map< std::string, dd4hep::Volume > volumes
dd4hep::Material material(const std::string &name) const
std::string prepend(const std::string &) const
Namespace of DDCMS conversion namespace.
std::vector< std::string > namespaces
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
DDParsingContext * context
const std::string & name() const
const dd4hep::Rotation3D & rotation(const std::string &name) const
std::map< std::string, dd4hep::Rotation3D > rotations
void addConstant(const std::string &name, const std::string &value, const std::string &type) const