[1365] | 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
|
---|
[1360] | 5 |
|
---|
[1365] | 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 |
|
---|
[1360] | 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"
|
---|
| 20 | using namespace std;
|
---|
| 21 |
|
---|
[1365] | 22 | H_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;
|
---|
[1360] | 31 | }
|
---|
| 32 |
|
---|
[1365] | 33 | H_Aperture::H_Aperture(const int dtype, const float size1, const float size2, const float size3, const float size4, const float posx, const float posy) {
|
---|
[1360] | 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]
|
---|
[1365] | 37 | type = dtype;
|
---|
| 38 | setApertureString();
|
---|
| 39 | x1 = size1;
|
---|
| 40 | x2 = size2;
|
---|
| 41 | x3 = size3;
|
---|
| 42 | x4 = size4;
|
---|
| 43 | fx = posx;
|
---|
| 44 | fy = posy;
|
---|
[1360] | 45 | }
|
---|
| 46 |
|
---|
[1365] | 47 | H_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;
|
---|
[1360] | 56 | }
|
---|
| 57 |
|
---|
| 58 | H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
|
---|
| 59 | if(this==&ap) return *this;
|
---|
[1365] | 60 | type = ap.type;
|
---|
| 61 | aptypestring = ap.aptypestring;
|
---|
[1360] | 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 |
|
---|
| 71 | void H_Aperture::printProperties() const {
|
---|
[1365] | 72 | cout << "Aperture shape:" << getTypeString() << ", parameters"<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl;
|
---|
| 73 | cout << " \t Center : " << fx << "," << fy << endl;
|
---|
[1360] | 74 | return;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void 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 |
|
---|
[1365] | 85 | bool H_Aperture::isInside(const float x, const float y) const {
|
---|
[1360] | 86 | /// @param x, y are the (x,y) coordinates of the proton, in [m]
|
---|
[1365] | 87 | cout << "aperture::isInside" << endl;
|
---|
[1360] | 88 | return false;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 |
|
---|
[1365] | 92 | void H_Aperture::setApertureString() {
|
---|
| 93 | switch (type) {
|
---|
[1360] | 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 | }
|
---|