Fork me on GitHub

source: git/external/Hector/H_Aperture.cc@ 7fc0708

Last change on this file since 7fc0708 was 3c40083, checked in by pavel <pavel@…>, 11 years ago

switch to a more stable Hector version

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2---- Hector the simulator ----
3 A fast simulator of particles through generic beamlines.
4 J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
5
6 http://www.fynu.ucl.ac.be/hector.html
7
8 Centre de Physique des Particules et de Phénoménologie (CP3)
9 Université Catholique de Louvain (UCL)
10*/
11
12/// \file H_Aperture.cc
13/// \brief Classes aiming at simulating the aperture of the LHC beamline elements.
14
15// C++ #includes
16#include <iostream>
17
18// local #includes
19#include "H_Aperture.h"
20using namespace std;
21
22H_Aperture::H_Aperture() {
23 type = NONE;
24 setApertureString();
25 x1 = 0;
26 x2 = 0;
27 x3 = 0;
28 x4 = 0;
29 fx = 0;
30 fy = 0;
31}
32
33H_Aperture::H_Aperture(const int dtype, const float size1, const float size2, const float size3, const float size4, const float posx, const float posy) {
34 /// @param dtype defines the aperture shape
35 /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m
36 /// @param posx, posy are the (x,y) coordinates of the center of the aperture [m]
37 type = dtype;
38 setApertureString();
39 x1 = size1;
40 x2 = size2;
41 x3 = size3;
42 x4 = size4;
43 fx = posx;
44 fy = posy;
45}
46
47H_Aperture::H_Aperture(const H_Aperture& ap) {
48 type = ap.type;
49 aptypestring = ap.aptypestring;
50 x1 = ap.x1;
51 x2 = ap.x2;
52 x3 = ap.x3;
53 x4 = ap.x4;
54 fx = ap.fx;
55 fy = ap.fy;
56}
57
58H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
59 if(this==&ap) return *this;
60 type = ap.type;
61 aptypestring = ap.aptypestring;
62 x1 = ap.x1;
63 x2 = ap.x2;
64 x3 = ap.x3;
65 x4 = ap.x4;
66 fx = ap.fx;
67 fy = ap.fy;
68 return *this;
69}
70
71void H_Aperture::printProperties() const {
72 cout << "Aperture shape:" << getTypeString() << ", parameters"<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl;
73 cout << " \t Center : " << fx << "," << fy << endl;
74 return;
75}
76
77void H_Aperture::setPosition(const float posx, const float posy) {
78 /// @param posx, posy are the (x,y) coordinates of the center of the apertures [m]
79 // posx, posy, fx, fy = [m]
80 fx = posx;
81 fy = posy;
82 return;
83}
84
85bool H_Aperture::isInside(const float x, const float y) const {
86 /// @param x, y are the (x,y) coordinates of the proton, in [m]
87 cout << "aperture::isInside" << endl;
88 return false;
89}
90
91
92void H_Aperture::setApertureString() {
93 switch (type) {
94 case NONE: aptypestring = NONENAME; break;
95 case RECTANGULAR: aptypestring = RECTANGULARNAME; break;
96 case ELLIPTIC: aptypestring = ELLIPTICNAME; break;
97 case CIRCULAR: aptypestring = CIRCULARNAME; break;
98 case RECTELLIPSE: aptypestring = RECTELLIPSENAME; break;
99 default: aptypestring = NONENAME; break;
100 }
101}
Note: See TracBrowser for help on using the repository browser.