Changeset 3c40083 in git for external/Hector/H_Aperture.cc
- Timestamp:
- Apr 16, 2014, 3:56:14 PM (11 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 64a4950
- Parents:
- f6b9fec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/Hector/H_Aperture.cc
rf6b9fec r3c40083 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 * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 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 */ 18 11 19 12 /// \file H_Aperture.cc … … 27 20 using namespace std; 28 21 29 H_Aperture::H_Aperture() : 30 type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0), aptypestring(getApertureString()) { 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; 31 31 } 32 32 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()) { 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) { 35 34 /// @param dtype defines the aperture shape 36 35 /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m 37 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; 38 45 } 39 46 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) { 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; 42 56 } 43 57 44 58 H_Aperture& H_Aperture::operator=(const H_Aperture& ap) { 45 59 if(this==&ap) return *this; 46 type_ = ap.type_; 60 type = ap.type; 61 aptypestring = ap.aptypestring; 47 62 x1 = ap.x1; 48 63 x2 = ap.x2; … … 51 66 fx = ap.fx; 52 67 fy = ap.fy; 53 aptypestring = ap.aptypestring;54 68 return *this; 55 69 } 56 70 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 63 71 void H_Aperture::printProperties() const { 64 cout << *this; 72 cout << "Aperture shape:" << getTypeString() << ", parameters"<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl; 73 cout << " \t Center : " << fx << "," << fy << endl; 65 74 return; 66 75 } … … 74 83 } 75 84 76 bool H_Aperture::isInside(const float , const float) const {85 bool H_Aperture::isInside(const float x, const float y) const { 77 86 /// @param x, y are the (x,y) coordinates of the proton, in [m] 78 //cout << "aperture::isInside" << endl;87 cout << "aperture::isInside" << endl; 79 88 return false; 80 89 } 81 90 82 91 83 /*void H_Aperture::setApertureString() {84 switch (type _) {92 void H_Aperture::setApertureString() { 93 switch (type) { 85 94 case NONE: aptypestring = NONENAME; break; 86 95 case RECTANGULAR: aptypestring = RECTANGULARNAME; break; … … 91 100 } 92 101 } 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
Note:
See TracChangeset
for help on using the changeset viewer.