3 #include "DD4hep/Path.h" 4 #include "DD4hep/Printout.h" 12 #define NAMESPACE_SEP '_' 17 xml_dim_t elt( element );
18 bool has_label = elt.hasAttr(_U(
label));
19 m_name = has_label ? elt.labelStr() :
"";
25 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
34 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
40 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
47 xml_dim_t elt(element);
48 bool has_label = elt.hasAttr(_U(
label));
49 m_name = has_label ? elt.labelStr() :
"";
56 m_name = path.filename().substr( 0, path.filename().rfind(
'.'));
62 "MyDDCMS",
"+++ Current namespace is now: %s",
m_name.c_str());
82 "MyDDCMS",
"+++ Current namespace is now: %s",
context->
ns().c_str());
97 while(( idx = val.find(
'[')) != string::npos )
103 if( idp == string::npos || idp > idq )
104 val.insert( idx,
m_name );
105 else if ( idp != string::npos && idp < idq )
116 if(( idx = nam.find(
':')) != string::npos )
117 return nam.substr( 0, idx );
118 else if(( idx=nam.find(
'_')) != string::npos )
119 return nam.substr( 0, idx );
127 if(( idx = nam.find(
':')) != string::npos )
128 return nam.substr( idx + 1 );
129 else if (( idx=nam.find(
'_')) != string::npos )
130 return nam.substr( idx + 1 );
143 const string&
v =
val;
144 const string&
n = nam;
146 "MyDDCMS",
"+++ Add constant object: %-40s = %s [type:%s]",
147 n.c_str(), v.c_str(), typ.c_str());
148 dd4hep::_toDictionary( n, v, typ );
156 const vector<double>&
v =
value;
157 const string&
n =
name;
159 "MyDDCMS",
"+++ Add constant object: %-40s = %s ",
160 n.c_str(),
"vector<double>");
177 const dd4hep::Rotation3D&
180 static dd4hep::Rotation3D s_null;
185 else if( nam ==
"NULL" )
187 else if( nam.find(
"_NULL") == nam.length() - 5 )
190 if(( idx=nam.find(
':')) != string::npos )
198 cout <<
r.first << endl;
200 throw runtime_error(
"Unknown rotation identifier:"+nam);
206 string n = vol.name();
207 dd4hep::Solid
s = vol.solid();
209 vol->SetName(n.c_str());
212 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
213 vol.name(), s.name(), s.type(), m.name());
222 dd4hep::Solid
s = vol.solid();
224 vol->SetName(n.c_str());
227 "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s",
228 vol.name(), s.name(), s.type(), m.name());
240 if ( (idx=nam.find(
':')) != string::npos ) {
248 throw runtime_error(
"Unknown volume identifier:"+nam);
257 "+++ Add shape of type %s : %s",sol->IsA()->GetName(), nam.c_str());
277 if ( (idx=nam.find(
':')) != string::npos ) {
286 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