Fork me on GitHub

source: svn/trunk/Utilities/Hector/include/H_Aperture.h@ 185

Last change on this file since 185 was 3, checked in by Xavier Rouby, 16 years ago

first commit

File size: 2.3 KB
Line 
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>
20using 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.
35class 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 virtual H_Aperture* clone() const { return new H_Aperture(type,x1,x2,x3,x4,fx,fy); };
46 //@}
47
48 /// Prints the aperture features
49 virtual void printProperties() const;
50 /// Draws the aperture shape
51 virtual void draw(const float scale=1) const {return;};
52 /// Sets the (x,y) position in [m]
53 void setPosition(const float,const float);
54 /// Checks whether the point is inside the aperture or not
55 virtual bool isInside(const float, const float) const;
56 /// Returns the (int) type of aperture
57 inline int getType() const {return type;};
58 /// Returns the (string) type of the aperture
59 inline const string getTypeString() const { return aptypestring; }
60
61
62 protected:
63 /// Aperture shape (either RECTANGULAR or ELLIPTIC or ...)
64 int type;
65 /// Aperture shape string
66 string aptypestring;
67
68 /// Aperture geometrical sizes (length/width or great/small radii) [m]
69 //@{
70 float x1, x2, x3, x4;
71 //@}
72
73 /// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
74 //@{
75 float fx, fy;
76 //@}
77 /// Sets the name of the aperture from its type.
78 void setApertureString();
79};
80
81#endif
Note: See TracBrowser for help on using the repository browser.