Changeset 281 in svn for trunk/Utilities/Hector/src/H_Aperture.cc
- Timestamp:
- Mar 1, 2009, 3:56:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/Hector/src/H_Aperture.cc
r3 r281 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 */ 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 * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 11 18 12 19 /// \file H_Aperture.cc … … 20 27 using namespace std; 21 28 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; 29 H_Aperture::H_Aperture() : 30 type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0), aptypestring(getApertureString()) { 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) { 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()) { 34 35 /// @param dtype defines the aperture shape 35 36 /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m 36 37 /// @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 38 } 46 39 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; 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) { 56 42 } 57 43 58 44 H_Aperture& H_Aperture::operator=(const H_Aperture& ap) { 59 45 if(this==&ap) return *this; 60 type = ap.type; 61 aptypestring = ap.aptypestring; 46 type_ = ap.type_; 62 47 x1 = ap.x1; 63 48 x2 = ap.x2; … … 66 51 fx = ap.fx; 67 52 fy = ap.fy; 53 aptypestring = ap.aptypestring; 68 54 return *this; 69 55 } 70 56 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 71 63 void H_Aperture::printProperties() const { 72 cout << "Aperture shape:" << getTypeString() << ", parameters "<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl; 73 cout << " \t Center : " << fx << "," << fy << endl; 64 cout << *this; 74 65 return; 75 66 } … … 90 81 91 82 92 void H_Aperture::setApertureString() {93 switch (type ) {83 /*void H_Aperture::setApertureString() { 84 switch (type_) { 94 85 case NONE: aptypestring = NONENAME; break; 95 86 case RECTANGULAR: aptypestring = RECTANGULARNAME; break; … … 100 91 } 101 92 } 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.