25 #include <boost/regex.hpp>
33 "The \"RCOLLIMATOR\" element defines a rectangular collimator."),
36 (
"XSIZE",
"Horizontal half-aperture in m");
38 (
"YSIZE",
"Vertical half-aperture in m");
40 (
"OUTFN",
"Monitor output filename");
76 std::string Double(
"(-?[0-9]+\\.?[0-9]*([Ee][+-]?[0-9]+)?)");
79 boost::regex parser(
"rectangle\\(" + Double +
"," + Double +
"\\)");
81 if (!boost::regex_match(desc, what, parser))
return;
83 double width = atof(std::string(what[1]).c_str());
84 double height = atof(std::string(what[3]).c_str());
101 std::stringstream description;
102 description <<
"rectangle(" << width <<
"," << height <<
")";
std::string getDescription() const
Representation for a collimator.
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string'' element attribute.
Interface for basic beam line object.
virtual ~OpalRCollimator()
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
ValueFlag
Switch for value desired on ATTLIST command.
virtual OpalRCollimator * clone(const std::string &name)
Make clone.
virtual ElementBase * removeWrappers()
Return the design element.
virtual void setElementLength(double length)
Set design length.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static ParticleMatterInteraction * find(const std::string &name)
Find named PARTICLEMATTERINTERACTION.
ParticleMatterInteractionHandler * handler_m
static std::map< std::string, OwnPtr< AttCell > > attributeRegistry
The registry for named attributes.
const std::string & getOpalName() const
Return object name.
void setDescription(const std::string &desc)
void initParticleMatterInteractionHandler(ElementBase &element)
void setOutputFN(const std::string &fn)
Base class for all beam line elements.
void setElement(ElementBase *)
Assign new CLASSIC element.
void registerOwnership() const
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
virtual void update()
Update the embedded CLASSIC element.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
virtual void setParticleMatterInteraction(ParticleMatterInteractionHandler *spys)
ElementBase * getElement() const
Return the embedded CLASSIC element.
virtual void update()
Update the embedded CLASSIC collimator.
double getReal(const Attribute &attr)
Return real value.
ParticleMatterInteraction * parmatint_m
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static AttCell * registerRealAttribute(const std::string &name)
Register a ``real'' element attribute.
OpalRCollimator()
Exemplar constructor.
std::string getString(const Attribute &attr)
Get string value.