[281] | 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
---|
| 2 | * *
|
---|
| 3 | * --<--<-- A fast simulator --<--<-- *
|
---|
| 4 | * / --<--<-- of particle --<--<-- *
|
---|
| 5 | * ----HECTOR----< *
|
---|
| 6 | * \ -->-->-- transport through -->-->-- *
|
---|
| 7 | * -->-->-- generic beamlines -->-->-- *
|
---|
| 8 | * *
|
---|
| 9 | * JINST 2:P09005 (2007) *
|
---|
| 10 | * X Rouby, J de Favereau, K Piotrzkowski (CP3) *
|
---|
| 11 | * http://www.fynu.ucl.ac.be/hector.html *
|
---|
| 12 | * *
|
---|
| 13 | * Center for Cosmology, Particle Physics and Phenomenology *
|
---|
| 14 | * Universite catholique de Louvain *
|
---|
| 15 | * Louvain-la-Neuve, Belgium *
|
---|
| 16 | * *
|
---|
| 17 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
---|
[3] | 18 |
|
---|
| 19 | /// \file H_Aperture.cc
|
---|
| 20 | /// \brief Classes aiming at simulating the aperture of the LHC beamline elements.
|
---|
| 21 |
|
---|
| 22 | // C++ #includes
|
---|
| 23 | #include <iostream>
|
---|
| 24 |
|
---|
| 25 | // local #includes
|
---|
| 26 | #include "H_Aperture.h"
|
---|
| 27 | using namespace std;
|
---|
| 28 |
|
---|
[281] | 29 | H_Aperture::H_Aperture() :
|
---|
| 30 | type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0), aptypestring(getApertureString()) {
|
---|
[3] | 31 | }
|
---|
| 32 |
|
---|
[281] | 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) :
|
---|
| 34 | type_(dtype), x1(size1), x2(size2), x3(size3), x4(size4), fx(posx), fy(posy), aptypestring(getApertureString()) {
|
---|
[3] | 35 | /// @param dtype defines the aperture shape
|
---|
| 36 | /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m
|
---|
| 37 | /// @param posx, posy are the (x,y) coordinates of the center of the aperture [m]
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[281] | 40 | H_Aperture::H_Aperture(const H_Aperture& ap) :
|
---|
| 41 | type_(ap.type_), x1(ap.x1), x2(ap.x2), x3(ap.x3), x4(ap.x4), fx(ap.fx), fy(ap.fy), aptypestring(ap.aptypestring) {
|
---|
[3] | 42 | }
|
---|
| 43 |
|
---|
| 44 | H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
|
---|
| 45 | if(this==&ap) return *this;
|
---|
[281] | 46 | type_ = ap.type_;
|
---|
[3] | 47 | x1 = ap.x1;
|
---|
| 48 | x2 = ap.x2;
|
---|
| 49 | x3 = ap.x3;
|
---|
| 50 | x4 = ap.x4;
|
---|
| 51 | fx = ap.fx;
|
---|
| 52 | fy = ap.fy;
|
---|
[281] | 53 | aptypestring = ap.aptypestring;
|
---|
[3] | 54 | return *this;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
[281] | 57 | std::ostream& operator<< (std::ostream& os, const H_Aperture& ap) {
|
---|
| 58 | os << "Aperture shape:" << ap.aptypestring << ", parameters "<<ap.x1<<", "<<ap.x2<<", "<<ap.x3<<", "<<ap.x4<<endl;
|
---|
| 59 | os << " \t Center : " << ap.fx << "," << ap.fy << endl;
|
---|
| 60 | return os;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
[3] | 63 | void H_Aperture::printProperties() const {
|
---|
[281] | 64 | cout << *this;
|
---|
[3] | 65 | return;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | void H_Aperture::setPosition(const float posx, const float posy) {
|
---|
| 69 | /// @param posx, posy are the (x,y) coordinates of the center of the apertures [m]
|
---|
| 70 | // posx, posy, fx, fy = [m]
|
---|
| 71 | fx = posx;
|
---|
| 72 | fy = posy;
|
---|
| 73 | return;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | bool H_Aperture::isInside(const float x, const float y) const {
|
---|
| 77 | /// @param x, y are the (x,y) coordinates of the proton, in [m]
|
---|
| 78 | //cout << "aperture::isInside" << endl;
|
---|
| 79 | return false;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
[281] | 83 | /*void H_Aperture::setApertureString() {
|
---|
| 84 | switch (type_) {
|
---|
[3] | 85 | case NONE: aptypestring = NONENAME; break;
|
---|
| 86 | case RECTANGULAR: aptypestring = RECTANGULARNAME; break;
|
---|
| 87 | case ELLIPTIC: aptypestring = ELLIPTICNAME; break;
|
---|
| 88 | case CIRCULAR: aptypestring = CIRCULARNAME; break;
|
---|
| 89 | case RECTELLIPSE: aptypestring = RECTELLIPSENAME; break;
|
---|
| 90 | default: aptypestring = NONENAME; break;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
[281] | 93 | */
|
---|
| 94 |
|
---|
| 95 | const string H_Aperture::getApertureString() const {
|
---|
| 96 | string str;
|
---|
| 97 | switch (type_) {
|
---|
| 98 | case NONE: str = NONENAME; break;
|
---|
| 99 | case RECTANGULAR: str = RECTANGULARNAME; break;
|
---|
| 100 | case ELLIPTIC: str = ELLIPTICNAME; break;
|
---|
| 101 | case CIRCULAR: str = CIRCULARNAME; break;
|
---|
| 102 | case RECTELLIPSE: str = RECTELLIPSENAME; break;
|
---|
| 103 | default: str = NONENAME; break;
|
---|
| 104 | }
|
---|
| 105 | return str;
|
---|
| 106 | }
|
---|
| 107 |
|
---|