Fork me on GitHub

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

Last change on this file since 432 was 428, checked in by Xavier Rouby, 15 years ago

slight change to avoid compilation warning

File size: 3.1 KB
Line 
1#ifndef _H_Aperture_
2#define _H_Aperture_
3
4 /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
5 * *
6* --<--<-- A fast simulator --<--<-- *
7* / --<--<-- of particle --<--<-- *
8* ----HECTOR----< *
9* \ -->-->-- transport through -->-->-- *
10* -->-->-- generic beamlines -->-->-- *
11* *
12* JINST 2:P09005 (2007) *
13* X Rouby, J de Favereau, K Piotrzkowski (CP3) *
14* http://www.fynu.ucl.ac.be/hector.html *
15* *
16* Center for Cosmology, Particle Physics and Phenomenology *
17* Universite catholique de Louvain *
18* Louvain-la-Neuve, Belgium *
19 * *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22/// \file H_Aperture.h
23/// \brief Defines the aperture of beamline elements.
24
25// C++ #defines
26#include <string>
27#include <iostream>
28using namespace std;
29
30// local #defines
31enum {NONE=0, RECTANGULAR, ELLIPTIC, CIRCULAR, RECTELLIPSE};
32#define NONENAME "None "
33#define RECTANGULARNAME "Rectangle "
34#define ELLIPTICNAME "Ellipse "
35#define CIRCULARNAME "Circle "
36#define RECTELLIPSENAME "Rectellipse"
37
38/// Defines the aperture of any optics element.
39class H_Aperture {
40
41 public:
42 /// Constructors, destructor and operators
43 //@{
44 H_Aperture();
45 H_Aperture(const int, const float, const float, const float, const float, const float, const float);
46 H_Aperture(const H_Aperture&);
47 H_Aperture& operator=(const H_Aperture&);
48 virtual ~H_Aperture() { };
49 virtual H_Aperture* clone() const { return new H_Aperture(type_,x1,x2,x3,x4,fx,fy); };
50 //@}
51
52 /// Prints the aperture features
53 //virtual void printProperties() const;
54 void printProperties() const;
55 /// Draws the aperture shape
56 virtual void draw(const float) const {return;};
57 /// Sets the (x,y) position in [m]
58 void setPosition(const float,const float);
59 /// Checks whether the point is inside the aperture or not
60 virtual bool isInside(const float, const float) const;
61 /// Returns the (int) type of aperture
62 inline int getType() const {return type_;};
63 /// Returns the (string) type of the aperture
64 inline const string getTypeString() const { return aptypestring; }
65
66
67 protected:
68 /// Aperture shape (either RECTANGULAR or ELLIPTIC or ...)
69 int type_;
70 /// Aperture geometrical sizes (length/width or great/small radii) [m]
71 //@{
72 float x1, x2, x3, x4;
73 //@}
74 /// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
75 //@{
76 float fx, fy;
77 //@}
78 /// Aperture shape string
79 string aptypestring;
80 // Sets the name of the aperture from its type.
81 //void setApertureString();
82 /// Gets the name of the aperture from its type.
83 const string getApertureString() const;
84
85 friend std::ostream& operator<< (std::ostream& os, const H_Aperture& ap);
86};
87
88
89#endif
Note: See TracBrowser for help on using the repository browser.