1 | #ifndef _H_Aperture_
|
---|
2 | #define _H_Aperture_
|
---|
3 |
|
---|
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 | */
|
---|
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
|
---|
23 | #define NONE 0
|
---|
24 | #define RECTANGULAR 1
|
---|
25 | #define ELLIPTIC 2
|
---|
26 | #define CIRCULAR 3
|
---|
27 | #define RECTELLIPSE 4
|
---|
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&);
|
---|
44 | virtual ~H_Aperture() {return;};
|
---|
45 | //@}
|
---|
46 |
|
---|
47 | /// Prints the aperture features
|
---|
48 | virtual void printProperties() const;
|
---|
49 | /// Draws the aperture shape
|
---|
50 | virtual void draw() const {return;};
|
---|
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
|
---|
56 | inline int getType() const {return type;};
|
---|
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 ...)
|
---|
63 | int type;
|
---|
64 | /// Aperture shape string
|
---|
65 | string aptypestring;
|
---|
66 |
|
---|
67 | /// Aperture geometrical sizes (length/width or great/small radii) [m]
|
---|
68 | //@{
|
---|
69 | float x1, x2, x3, x4;
|
---|
70 | //@}
|
---|
71 |
|
---|
72 | /// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
|
---|
73 | //@{
|
---|
74 | float fx, fy;
|
---|
75 | //@}
|
---|
76 | /// Sets the name of the aperture from its type.
|
---|
77 | void setApertureString();
|
---|
78 | };
|
---|
79 |
|
---|
80 | #endif
|
---|