OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalDegrader.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalDegrader.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalDegrader
10 // The class of OPAL Degrader.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:39 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Elements/OpalDegrader.h"
20 #include "Attributes/Attributes.h"
23 
24 
25 // Class OpalDegrader
26 // ------------------------------------------------------------------------
27 
29  OpalElement(SIZE, "DEGRADER",
30  "The \"DEGRADER\" element defines a degrader."),
31  parmatint_m(NULL) {
33  ("XSIZE", "not used",0.0);
35  ("YSIZE", "not used",0.0);
37  ("OUTFN", "Degrader output filename");
38 
39  registerStringAttribute("OUTFN");
40 
42 
43  setElement((new DegraderRep("DEGRADER"))->makeAlignWrapper());
44 }
45 
46 
47 OpalDegrader::OpalDegrader(const std::string &name, OpalDegrader *parent):
48  OpalElement(name, parent),
49  parmatint_m(NULL) {
50  setElement((new DegraderRep(name))->makeAlignWrapper());
51 }
52 
53 
55  if(parmatint_m)
56  delete parmatint_m;
57 }
58 
59 
60 OpalDegrader *OpalDegrader::clone(const std::string &name) {
61  return new OpalDegrader(name, this);
62 }
63 
64 
67 }
68 
69 
72 
73  DegraderRep *deg =
74  dynamic_cast<DegraderRep *>(getElement()->removeWrappers());
75  double length = Attributes::getReal(itsAttr[LENGTH]);
76  deg->setElementLength(length);
77 
79 
84  }
85 
86  // Transmit "unknown" attributes.
88 }
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string&#39;&#39; element attribute.
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
ValueFlag
Switch for value desired on ATTLIST command.
Definition: OpalElement.h:71
virtual ElementBase * removeWrappers()
Return the design element.
ParticleMatterInteraction * parmatint_m
Definition: OpalDegrader.h:64
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:515
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
static ParticleMatterInteraction * find(const std::string &name)
Find named PARTICLEMATTERINTERACTION.
T deg(T x)
Convert radians to degrees.
Definition: matheval.hpp:82
ParticleMatterInteractionHandler * handler_m
const std::string & getOpalName() const
Return object name.
Definition: Object.cpp:284
The DEGRADER element.
Definition: OpalDegrader.h:29
void initParticleMatterInteractionHandler(ElementBase &element)
Representation for a collimator.
Definition: DegraderRep.h:32
Base class for all beam line elements.
Definition: OpalElement.h:41
OpalDegrader()
Exemplar constructor.
virtual ~OpalDegrader()
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
void registerOwnership() const
virtual void update()
Update the embedded CLASSIC element.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown&#39;&#39; (not known to OPAL) attributes to CLASSIC.
virtual void setParticleMatterInteraction(ParticleMatterInteractionHandler *spys)
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:128
virtual void update()
Update the embedded CLASSIC collimator.
const std::string name
virtual OpalDegrader * clone(const std::string &name)
Make clone.
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Definition: Attributes.cpp:296
void setOutputFN(std::string fn)
Definition: Degrader.cpp:182
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Definition: Attributes.cpp:205
std::string getString(const Attribute &attr)
Get string value.
Definition: Attributes.cpp:307