37 double x = 0.0,
y = 0.0,
z = 0.0;
42 if (myrSolid->size() == 0) {
44 if (atts.find(
"firstSolid") != atts.end() && atts.find(
"secondSolid") != atts.end()) {
48 std::string s(
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
52 }
else if (myrSolid->size() == 2) {
53 ddn1 = myrSolid->getDDName(nmspace,
"name", 0);
54 ddn2 = myrSolid->getDDName(nmspace,
"name", 1);
56 std::string s(
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
61 if (myTranslation->size() > 0) {
63 atts = myTranslation->getAttributeSet();
64 x = ev.
eval(nmspace, atts.find(
"x")->second);
65 y = ev.
eval(nmspace, atts.find(
"y")->second);
66 z = ev.
eval(nmspace, atts.find(
"z")->second);
69 if (myrRotation->size() > 0) {
70 ddrot =
DDRotation(myrRotation->getDDName(nmspace));
75 if (name ==
"UnionSolid") {
78 }
else if (name ==
"SubtractionSolid") {
81 }
else if (name ==
"IntersectionSolid") {
86 <<
"DDLBooleanSolid was asked to do something other than Union-, Subtraction- or IntersectionSolid?";
92 myTranslation->clear();
103 s =
std::string(
"\n<") + name +
" name=\"" + atts.find(
"name")->second +
"\"";
105 if (atts.find(
"firstSolid") != atts.end())
106 s +=
" firstSolid=\"" + atts.find(
"firstSolid")->second +
"\"";
107 if (atts.find(
"secondSolid") != atts.end())
108 s +=
" secondSolid=\"" + atts.find(
"secondSolid")->second +
"\"";
114 if (myrSolid->size() > 0) {
115 for (
size_t i = 0;
i < myrSolid->size(); ++
i) {
116 atts = myrSolid->getAttributeSet(
i);
117 s +=
"<rSolid name=\"" + atts.find(
"name")->second +
"\"/>\n";
121 atts = myTranslation->getAttributeSet();
123 if (atts.find(
"x") != atts.end())
124 s +=
" x=\"" + atts.find(
"x")->second +
"\"";
125 if (atts.find(
"y") != atts.end())
126 s +=
" y=\"" + atts.find(
"y")->second +
"\"";
127 if (atts.find(
"z") != atts.end())
128 s +=
" z=\"" + atts.find(
"z")->second +
"\"";
131 atts = myrRotation->getAttributeSet();
132 if (atts.find(
"name") != atts.end()) {
133 s +=
"<rRotation name=\"" + atts.find(
"name")->second +
"\"/>\n";
135 s +=
"</" + name +
">\n\n";
DDLElementRegistry * myRegistry_
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
DDName is used to identify DDD entities uniquely.
Compact representation of the geometrical detector hierarchy.
std::map< std::string, std::string > DDXMLAttribute
A DDSolid represents the shape of a part.
Represents a uniquely identifyable rotation matrix.
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
ClhepEvaluator & evaluator()
static DDSolid intersection(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
DDLBooleanSolid(DDLElementRegistry *myreg)
std::string dumpBooleanSolid(const std::string &name, const std::string &nmspace)
DDLSolid processes Box elements.
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
void setReference(const std::string &nmspace, DDCompactView &cpv)