44 double x=0.0,
y=0.0,
z=0.0;
49 if( myrSolid->size() == 0 )
52 if ( atts.find(
"firstSolid") != atts.end() && atts.find(
"secondSolid") != atts.end() ) {
56 std::string s (
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
61 else if (myrSolid->size() == 2)
63 ddn1 = myrSolid->getDDName(nmspace,
"name", 0);
64 ddn2 = myrSolid->getDDName(nmspace,
"name", 1);
66 std::string s(
"DDLBooleanSolid did not find any solids with which to form a boolean solid.");
71 if (myTranslation->size() > 0)
74 atts = myTranslation->getAttributeSet();
75 x = ev.
eval(nmspace, atts.find(
"x")->second);
76 y = ev.
eval(nmspace, atts.find(
"y")->second);
77 z = ev.
eval(nmspace, atts.find(
"z")->second);
80 if (myrRotation->size() > 0)
82 ddrot =
DDRotation( myrRotation->getDDName (nmspace) );
87 if (name ==
"UnionSolid") {
95 else if (name ==
"SubtractionSolid") {
103 else if (name ==
"IntersectionSolid") {
112 throw cms::Exception(
"DDException") <<
"DDLBooleanSolid was asked to do something other than Union-, Subtraction- or IntersectionSolid?";
118 myTranslation->clear();
119 myrRotation->clear();
131 s =
std::string (
"\n<") + name +
" name=\"" + atts.find(
"name")->second +
"\"";
133 if (atts.find(
"firstSolid") != atts.end()) s+=
" firstSolid=\"" + atts.find(
"firstSolid")->second +
"\"";
134 if (atts.find(
"secondSolid") != atts.end()) s+=
" secondSolid=\"" + atts.find(
"secondSolid")->second +
"\"";
140 if (myrSolid->size() > 0)
142 for (
size_t i = 0;
i < myrSolid->size(); ++
i)
144 atts = myrSolid->getAttributeSet(
i);
145 s+=
"<rSolid name=\"" + atts.find(
"name")->second +
"\"/>\n";
149 atts = myTranslation->getAttributeSet();
151 if (atts.find(
"x") != atts.end())
152 s+=
" x=\"" + atts.find(
"x")->second +
"\"";
153 if (atts.find(
"y") != atts.end())
154 s+=
" y=\"" + atts.find(
"y")->second +
"\"";
155 if (atts.find(
"z") != atts.end())
156 s+=
" z=\"" + atts.find(
"z")->second +
"\"";
159 atts = myrRotation->getAttributeSet();
160 if (atts.find(
"name") != atts.end())
162 s+=
"<rRotation name=\"" + atts.find(
"name")->second +
"\"/>\n";
164 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)