[5b822e5] | 1 | #ifndef _H_Aperture_
|
---|
| 2 | #define _H_Aperture_
|
---|
| 3 |
|
---|
[3c40083] | 4 | /*
|
---|
| 5 | ---- Hector the simulator ----
|
---|
| 6 | A fast simulator of particles through generic beamlines.
|
---|
| 7 | J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
|
---|
| 8 |
|
---|
| 9 | http://www.fynu.ucl.ac.be/hector.html
|
---|
| 10 |
|
---|
| 11 | Centre de Physique des Particules et de Phénoménologie (CP3)
|
---|
| 12 | Université Catholique de Louvain (UCL)
|
---|
| 13 | */
|
---|
[5b822e5] | 14 |
|
---|
| 15 | /// \file H_Aperture.h
|
---|
| 16 | /// \brief Defines the aperture of beamline elements.
|
---|
| 17 |
|
---|
| 18 | // C++ #defines
|
---|
| 19 | #include <string>
|
---|
| 20 | using namespace std;
|
---|
| 21 |
|
---|
| 22 | // local #defines
|
---|
[3c40083] | 23 | #define NONE 0
|
---|
| 24 | #define RECTANGULAR 1
|
---|
| 25 | #define ELLIPTIC 2
|
---|
| 26 | #define CIRCULAR 3
|
---|
| 27 | #define RECTELLIPSE 4
|
---|
[5b822e5] | 28 | #define NONENAME "None "
|
---|
| 29 | #define RECTANGULARNAME "Rectangle "
|
---|
| 30 | #define ELLIPTICNAME "Ellipse "
|
---|
| 31 | #define CIRCULARNAME "Circle "
|
---|
| 32 | #define RECTELLIPSENAME "Rectellipse"
|
---|
| 33 |
|
---|
| 34 | /// Defines the aperture of any optics element.
|
---|
| 35 | class H_Aperture {
|
---|
| 36 |
|
---|
| 37 | public:
|
---|
| 38 | /// Constructors, destructor and operators
|
---|
| 39 | //@{
|
---|
| 40 | H_Aperture();
|
---|
| 41 | H_Aperture(const int, const float, const float, const float, const float, const float, const float);
|
---|
| 42 | H_Aperture(const H_Aperture&);
|
---|
| 43 | H_Aperture& operator=(const H_Aperture&);
|
---|
[3c40083] | 44 | virtual ~H_Aperture() {return;};
|
---|
[5b822e5] | 45 | //@}
|
---|
| 46 |
|
---|
| 47 | /// Prints the aperture features
|
---|
[3c40083] | 48 | virtual void printProperties() const;
|
---|
[5b822e5] | 49 | /// Draws the aperture shape
|
---|
[3c40083] | 50 | virtual void draw() const {return;};
|
---|
[5b822e5] | 51 | /// Sets the (x,y) position in [m]
|
---|
| 52 | void setPosition(const float,const float);
|
---|
| 53 | /// Checks whether the point is inside the aperture or not
|
---|
| 54 | virtual bool isInside(const float, const float) const;
|
---|
| 55 | /// Returns the (int) type of aperture
|
---|
[3c40083] | 56 | inline int getType() const {return type;};
|
---|
[5b822e5] | 57 | /// Returns the (string) type of the aperture
|
---|
| 58 | inline const string getTypeString() const { return aptypestring; }
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | protected:
|
---|
| 62 | /// Aperture shape (either RECTANGULAR or ELLIPTIC or ...)
|
---|
[3c40083] | 63 | int type;
|
---|
| 64 | /// Aperture shape string
|
---|
| 65 | string aptypestring;
|
---|
| 66 |
|
---|
[5b822e5] | 67 | /// Aperture geometrical sizes (length/width or great/small radii) [m]
|
---|
| 68 | //@{
|
---|
| 69 | float x1, x2, x3, x4;
|
---|
| 70 | //@}
|
---|
[3c40083] | 71 |
|
---|
[5b822e5] | 72 | /// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
|
---|
| 73 | //@{
|
---|
| 74 | float fx, fy;
|
---|
| 75 | //@}
|
---|
[3c40083] | 76 | /// Sets the name of the aperture from its type.
|
---|
| 77 | void setApertureString();
|
---|
[5b822e5] | 78 | };
|
---|
| 79 |
|
---|
| 80 | #endif
|
---|