43 double x=0.0,
y=0.0,
z=0.0;
48 if( myrSolid->size() == 0 )
51 if ( atts.find(
"firstSolid") != atts.end() && atts.find(
"secondSolid") != atts.end() ) {
55 std::string s (
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
60 else if (myrSolid->size() == 2)
62 ddn1 = myrSolid->getDDName(nmspace,
"name", 0);
63 ddn2 = myrSolid->getDDName(nmspace,
"name", 1);
65 std::string s(
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
70 if (myTranslation->size() > 0)
73 atts = myTranslation->getAttributeSet();
74 x = ev.
eval(nmspace, atts.find(
"x")->second);
75 y = ev.
eval(nmspace, atts.find(
"y")->second);
76 z = ev.
eval(nmspace, atts.find(
"z")->second);
79 if (myrRotation->size() > 0)
81 ddrot =
DDRotation( myrRotation->getDDName (nmspace) );
86 if (name ==
"UnionSolid") {
94 else if (name ==
"SubtractionSolid") {
102 else if (name ==
"IntersectionSolid") {
111 throw cms::Exception(
"DDException") <<
"DDLBooleanSolid was asked to do something other than Union-, Subtraction- or IntersectionSolid?";
117 myTranslation->clear();
118 myrRotation->clear();
130 s =
std::string (
"\n<") + name +
" name=\"" + atts.find(
"name")->second +
"\"";
132 if (atts.find(
"firstSolid") != atts.end()) s+=
" firstSolid=\"" + atts.find(
"firstSolid")->second +
"\"";
133 if (atts.find(
"secondSolid") != atts.end()) s+=
" secondSolid=\"" + atts.find(
"secondSolid")->second +
"\"";
139 if (myrSolid->size() > 0)
141 for (
size_t i = 0;
i < myrSolid->size(); ++
i)
143 atts = myrSolid->getAttributeSet(
i);
144 s+=
"<rSolid name=\"" + atts.find(
"name")->second +
"\"/>\n";
148 atts = myTranslation->getAttributeSet();
150 if (atts.find(
"x") != atts.end())
151 s+=
" x=\"" + atts.find(
"x")->second +
"\"";
152 if (atts.find(
"y") != atts.end())
153 s+=
" y=\"" + atts.find(
"y")->second +
"\"";
154 if (atts.find(
"z") != atts.end())
155 s+=
" z=\"" + atts.find(
"z")->second +
"\"";
158 atts = myrRotation->getAttributeSet();
159 if (atts.find(
"name") != atts.end())
161 s+=
"<rRotation name=\"" + atts.find(
"name")->second +
"\"/>\n";
163 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.
type of data representation of DDCompactView
std::map< std::string, std::string > DDXMLAttribute
A DDSolid represents the shape of a part.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
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)
void setReference(const std::string &nmspace, DDCompactView &cpv)