25 #if !defined(WIN32) && !defined(__ICC)
38 using namespace DD4hep;
39 using namespace DD4hep::Geometry;
43 size_t idx = s.find(
"(int)");
44 if (idx != string::npos)
48 double result = eval.evaluate(s.c_str());
50 cerr << value <<
": ";
52 throw runtime_error(
"DD4hep: Severe error during expression evaluation of " + value);
54 return (
short) result;
59 size_t idx = s.find(
"(int)");
60 if (idx != string::npos)
64 double result = eval.evaluate(s.c_str());
66 cerr << value <<
": ";
68 throw runtime_error(
"DD4hep: Severe error during expression evaluation of " + value);
75 size_t idx = s.find(
"(int)");
76 if (idx != string::npos)
80 double result = eval.evaluate(s.c_str());
82 cerr << value <<
": ";
84 throw runtime_error(
"DD4hep: Severe error during expression evaluation of " + value);
90 return value ==
"true" || value ==
"yes";
94 double result = eval.evaluate(value.c_str());
96 cerr << value <<
": ";
98 throw runtime_error(
"DD4hep: Severe error during expression evaluation of " + value);
100 return (
float) result;
104 double result = eval.evaluate(value.c_str());
106 cerr << value <<
": ";
108 throw runtime_error(
"DD4hep: Severe error during expression evaluation of " + value);
114 double val =
_toDouble(left +
"*" + right);
115 if ( val >=
double(SCHAR_MIN) && val <=
double(SCHAR_MAX) )
116 return (
char) (int)val;
118 "Multiplication %e = %s * %s out of bounds for conversion to char.",
119 val, left.c_str(), right.c_str());
124 double val =
_toDouble(left +
"*" + right);
125 if ( val >= 0 && val <=
double(UCHAR_MAX) )
126 return (
unsigned char) (int)val;
128 "Multiplication %e = %s * %s out of bounds for conversion to unsigned char.",
129 val, left.c_str(), right.c_str());
134 double val =
_toDouble(left +
"*" + right);
135 if ( val >=
double(SHRT_MIN) && val <=
double(SHRT_MAX) )
138 "Multiplication %e = %s * %s out of bounds for conversion to short.",
139 val, left.c_str(), right.c_str());
144 double val =
_toDouble(left +
"*" + right);
145 if ( val >= 0 && val <=
double(USHRT_MAX) )
146 return (
unsigned short)val;
148 "Multiplication %e = %s * %s out of bounds for conversion to unsigned short.",
149 val, left.c_str(), right.c_str());
154 return (
int)
_toDouble(left +
"*" + right);
158 return (
unsigned int)
_toDouble(left +
"*" + right);
162 return (
long)
_toDouble(left +
"*" + right);
166 return (
unsigned long)
_toDouble(left +
"*" + right);
170 return _toFloat(left +
"*" + right);
183 if ( typ ==
"string" ) {
184 eval.setEnviron(name.c_str(),value.c_str());
188 string n = name,
v = value;
189 size_t idx = v.find(
"(int)");
190 if (idx != string::npos)
192 idx = v.find(
"(float)");
193 if (idx != string::npos)
197 double result = eval.evaluate(v.c_str());
199 cerr << value <<
": ";
201 throw runtime_error(
"DD4hep: Severe error during expression evaluation " + name +
"=" + value);
203 eval.setVariable(n.c_str(), result);
207 template <
typename T>
static inline string __to_string(
T value,
const char* fmt) {
209 ::snprintf(text,
sizeof(text), fmt, value);
214 return value ?
"true" :
"false";
247 const char* edge =
"++++++++++++++++++++++++++++++++++++++++++";
248 size_t len = ::strlen(name);
249 cerr << edge << edge << edge << endl;
250 cerr <<
"++ The usage of the factory: \"" << name <<
"\" is DEPRECATED due to naming conventions."
251 << setw(53-len) << right <<
"++" << endl;
252 cerr <<
"++ Please use \"DD4hep_" << name <<
"\" instead." << setw(93-len) << right <<
"++" << endl;
253 cerr << edge << edge << edge << endl;
266 return this->m_element ? this->m_element->name().c_str() :
"";
279 #include "TGeoMedium.h"
280 #include "TGeoMaterial.h"
281 #include "TGeoElement.h"
286 #include "TGeoMatrix.h"
294 #include "TGeoNode.h"
300 #include "TGeoBBox.h"
301 #include "TGeoPcon.h"
302 #include "TGeoPgon.h"
303 #include "TGeoTube.h"
304 #include "TGeoCone.h"
305 #include "TGeoArb8.h"
306 #include "TGeoTrd1.h"
307 #include "TGeoTrd2.h"
308 #include "TGeoParaboloid.h"
309 #include "TGeoSphere.h"
310 #include "TGeoTorus.h"
311 #include "TGeoBoolNode.h"
312 #include "TGeoVolume.h"
313 #include "TGeoCompositeShape.h"
314 #include "TGeoShapeAssembly.h"
339 #include "TGeoPhysicalNode.h"
342 #include "TGeoBoolNode.h"
348 #include "TGeoPatternFinder.h"
void warning_deprecated_xml_factory(const char *name)
Function tp print warning about deprecated factory usage. Used by Plugin mechanism.
unsigned long _multiply< unsigned long >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
long _multiply< long >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
short _toShort(const std::string &value)
String conversions: string to integer value.
DDSegmentation::Segmentation _Segmentation
std::string _toString(bool value)
String conversions: boolean value to string.
short _multiply< short >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
unsigned short _multiply< unsigned short >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
unsigned char _multiply< unsigned char >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
double _multiply< double >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
int except(const std::string &src, const std::string &fmt,...)
Calls the display action with ERROR and throws an std::runtime_error exception.
float _multiply< float >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
static string __to_string(T value, const char *fmt)
DD4HEP_INSTANTIATE_HANDLE(TNamed)
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(LCDD)
bool _toBool(const std::string &value)
String conversions: string to boolean value.
Base class for all segmentations.
char _multiply< char >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
Intermediate class to overcome drawing probles with the TGeoTubeSeg.
int _multiply< int >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
unsigned int _multiply< unsigned int >(const std::string &left, const std::string &right)
Generic multiplication using the evaluator: result = left * right.
int _toInt(const std::string &value)
String conversions: string to integer value.
double _toDouble(const std::string &value)
String conversions: string to double value.
void increment_object_validations()
float _toFloat(const std::string &value)
String conversions: string to float value.
static long s_numVerifies
std::string _ptrToString(const void *p, const char *fmt="%p")
Pointer to text conversion.
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
long num_object_validations()
The main interface to the DD4hep detector description package.
void _toDictionary(const std::string &name, const std::string &value)
Enter name value pair to the dictionary. "value" must be a numerical expression, which is evaluated...
virtual void setName(const std::string &value)
Set the segmentation name.
long _toLong(const std::string &value)
String conversions: string to long integer value.
XmlTools::Evaluator & evaluator()