41 std::vector<double>
x,
y;
42 for(
size_t i = 0;
i < myXYPoints->size(); ++
i )
44 atts = myXYPoints->getAttributeSet(
i );
45 auto xit = atts.find(
"x" );
46 if( xit != atts.end())
47 x.emplace_back( ev.
eval( nmspace, xit->second ));
48 auto yit = atts.find(
"y" );
49 if( yit != atts.end())
50 y.emplace_back( ev.
eval( nmspace, yit->second ));
52 assert( x.size() == y.size());
55 std::vector<double>
z, zx, zy, zscale;
57 for(
size_t i = 0;
i < myZXYSection->size(); ++
i )
59 atts = myZXYSection->getAttributeSet(
i );
60 auto zit = atts.find(
"z" );
61 if( zit != atts.end())
62 z.emplace_back( ev.
eval( nmspace, zit->second ));
63 auto xit = atts.find(
"x" );
64 if( xit != atts.end())
65 zx.emplace_back( ev.
eval( nmspace, xit->second ));
66 auto yit = atts.find(
"y" );
67 if( yit != atts.end())
68 zy.emplace_back( ev.
eval( nmspace, yit->second ));
69 auto sit = atts.find(
"scale" );
70 if( sit != atts.end())
71 zscale.emplace_back( std::stod( sit->second ));
73 assert( z.size() == zx.size());
74 assert( z.size() == zy.size());
75 assert( z.size() == zscale.size());
78 if( name ==
"ExtrudedPolygon" )
86 std::string msg =
"\nDDLPgonGenerator::processElement was called with incorrect name of solid: " +
name;
93 myZXYSection->clear();
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.
Compact representation of the geometrical detector hierarchy.
std::map< std::string, std::string > DDXMLAttribute
A DDSolid represents the shape of a part.
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
ClhepEvaluator & evaluator()
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
DDLPgonGenerator(DDLElementRegistry *myreg)
DDLSolid processes Box elements.
static DDSolid extrudedpolygon(const DDName &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &zx, const std::vector< double > &zy, const std::vector< double > &zscale)
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
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.
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)