Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 // >> 27 // $Id: G4Para.icc 81636 2014-06-04 09:06:08Z gcosmo $ >> 28 // >> 29 // -------------------------------------------------------------------- >> 30 // GEANT 4 inline definitions file >> 31 // >> 32 // G4Para.icc >> 33 // 26 // Implementation of inline methods of G4Para 34 // Implementation of inline methods of G4Para 27 // ------------------------------------------- 35 // -------------------------------------------------------------------- 28 36 29 inline 37 inline 30 G4double G4Para::GetZHalfLength() const 38 G4double G4Para::GetZHalfLength() const 31 { 39 { 32 return fDz; << 40 return fDz ; 33 } 41 } 34 42 35 inline 43 inline 36 G4ThreeVector G4Para::GetSymAxis() const 44 G4ThreeVector G4Para::GetSymAxis() const 37 { 45 { 38 return G4ThreeVector(fTthetaCphi,fTthetaSphi << 46 G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi + >> 47 fTthetaSphi*fTthetaSphi) ; >> 48 >> 49 return G4ThreeVector(fTthetaCphi*cosTheta, >> 50 fTthetaSphi*cosTheta, >> 51 cosTheta) ; 39 } 52 } 40 53 41 inline 54 inline 42 G4double G4Para::GetYHalfLength() const 55 G4double G4Para::GetYHalfLength() const 43 { 56 { 44 return fDy; << 57 return fDy ; 45 } 58 } 46 59 47 inline 60 inline 48 G4double G4Para::GetXHalfLength() const 61 G4double G4Para::GetXHalfLength() const 49 { 62 { 50 return fDx; << 63 return fDx ; 51 } 64 } 52 65 53 inline 66 inline 54 G4double G4Para::GetTanAlpha() const 67 G4double G4Para::GetTanAlpha() const 55 { 68 { 56 return fTalpha; << 69 return fTalpha ; 57 } 70 } 58 71 59 inline 72 inline 60 void G4Para::SetXHalfLength(G4double val) 73 void G4Para::SetXHalfLength(G4double val) 61 { 74 { 62 fDx = val; << 75 fDx= val; 63 << 76 fCubicVolume= 0.; 64 fCubicVolume = 0.; << 77 fSurfaceArea= 0.; 65 fSurfaceArea = 0.; << 78 delete fpPolyhedron; fpPolyhedron = 0; 66 fRebuildPolyhedron = true; << 67 << 68 CheckParameters(); << 69 MakePlanes(); << 70 } 79 } 71 80 72 inline 81 inline 73 void G4Para::SetYHalfLength(G4double val) 82 void G4Para::SetYHalfLength(G4double val) 74 { 83 { 75 fDy = val; << 84 fDy= val; 76 << 85 fCubicVolume= 0.; 77 fCubicVolume = 0.; << 86 fSurfaceArea= 0.; 78 fSurfaceArea = 0.; << 87 delete fpPolyhedron; fpPolyhedron = 0; 79 fRebuildPolyhedron = true; << 80 << 81 CheckParameters(); << 82 MakePlanes(); << 83 } 88 } 84 89 85 inline 90 inline 86 void G4Para::SetZHalfLength(G4double val) 91 void G4Para::SetZHalfLength(G4double val) 87 { 92 { 88 fDz = val; << 93 fDz= val; 89 << 94 fCubicVolume= 0.; 90 fCubicVolume = 0.; << 95 fSurfaceArea= 0.; 91 fSurfaceArea = 0.; << 96 delete fpPolyhedron; fpPolyhedron = 0; 92 fRebuildPolyhedron = true; << 93 << 94 CheckParameters(); << 95 MakePlanes(); << 96 } 97 } 97 98 98 inline 99 inline 99 void G4Para::SetAlpha(G4double alpha) 100 void G4Para::SetAlpha(G4double alpha) 100 { 101 { 101 fTalpha = std::tan(alpha); << 102 fTalpha= std::tan(alpha); 102 << 103 fSurfaceArea= 0.; 103 fSurfaceArea = 0.; << 104 fCubicVolume= 0.; 104 fCubicVolume = 0.; << 105 delete fpPolyhedron; fpPolyhedron = 0; 105 fRebuildPolyhedron = true; << 106 << 107 MakePlanes(); << 108 } 106 } 109 107 110 inline 108 inline 111 void G4Para::SetTanAlpha(G4double val) 109 void G4Para::SetTanAlpha(G4double val) 112 { 110 { 113 fTalpha = val; << 111 fTalpha= val; 114 << 112 fCubicVolume= 0.; 115 fCubicVolume = 0.; << 113 fSurfaceArea= 0.; 116 fSurfaceArea = 0.; << 114 delete fpPolyhedron; fpPolyhedron = 0; 117 fRebuildPolyhedron = true; << 118 << 119 MakePlanes(); << 120 } 115 } 121 116 122 inline 117 inline 123 void G4Para::SetThetaAndPhi(G4double pTheta, G << 118 void G4Para::SetThetaAndPhi(double pTheta, double pPhi) 124 { 119 { 125 G4double tanTheta = std::tan(pTheta); << 120 fTthetaCphi=std::tan(pTheta)*std::cos(pPhi); 126 fTthetaCphi = tanTheta*std::cos(pPhi); << 121 fTthetaSphi=std::tan(pTheta)*std::sin(pPhi); 127 fTthetaSphi = tanTheta*std::sin(pPhi); << 122 fCubicVolume= 0.; 128 << 123 fSurfaceArea= 0.; 129 fCubicVolume = 0.; << 124 delete fpPolyhedron; fpPolyhedron = 0; 130 fSurfaceArea = 0.; << 131 fRebuildPolyhedron = true; << 132 << 133 MakePlanes(); << 134 } 125 } 135 126 136 inline G4double G4Para::GetPhi() const << 127 inline >> 128 G4double G4Para::GetCubicVolume() 137 { 129 { 138 return std::atan2(fTthetaSphi,fTthetaCphi); << 130 // 139 } << 131 // It is like G4Box, since para transformations keep the volume to be const 140 132 141 inline G4double G4Para::GetTheta() const << 133 if(fCubicVolume != 0.) {;} 142 { << 134 else fCubicVolume = 8*fDx*fDy*fDz; 143 return std::atan(std::sqrt(fTthetaCphi*fTth << 135 return fCubicVolume; 144 +fTthetaSphi*fTt << 145 } 136 } 146 137 147 inline G4double G4Para::GetAlpha() const << 138 inline >> 139 G4double G4Para::GetSurfaceArea() 148 { 140 { 149 return std::atan(fTalpha); << 141 if(fSurfaceArea != 0.) {;} >> 142 else >> 143 { >> 144 fSurfaceArea = 8*(fDx*fDy >> 145 + fDx*fDz*std::sqrt(1+fTthetaSphi*fTthetaSphi) >> 146 + fDy*fDz*std::sqrt(1+fTalpha*fTalpha >> 147 +std::pow(fTthetaCphi-fTthetaSphi*fTalpha, 2)) ); >> 148 } >> 149 return fSurfaceArea; 150 } 150 } 151 151