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,v 1.7 2006/10/19 15:33:37 gcosmo Exp $ >> 28 // GEANT4 tag $Name: geant4-08-02-patch-01-ref $ >> 29 // >> 30 // -------------------------------------------------------------------- >> 31 // GEANT 4 inline definitions file >> 32 // >> 33 // G4Para.icc >> 34 // 26 // Implementation of inline methods of G4Para 35 // Implementation of inline methods of G4Para 27 // ------------------------------------------- 36 // -------------------------------------------------------------------- 28 37 29 inline 38 inline 30 G4double G4Para::GetZHalfLength() const 39 G4double G4Para::GetZHalfLength() const 31 { 40 { 32 return fDz; << 41 return fDz ; 33 } 42 } 34 43 35 inline 44 inline 36 G4ThreeVector G4Para::GetSymAxis() const 45 G4ThreeVector G4Para::GetSymAxis() const 37 { 46 { 38 return G4ThreeVector(fTthetaCphi,fTthetaSphi << 47 G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi + >> 48 fTthetaSphi*fTthetaSphi) ; >> 49 >> 50 return G4ThreeVector(fTthetaCphi*cosTheta, >> 51 fTthetaSphi*cosTheta, >> 52 cosTheta) ; 39 } 53 } 40 54 41 inline 55 inline 42 G4double G4Para::GetYHalfLength() const 56 G4double G4Para::GetYHalfLength() const 43 { 57 { 44 return fDy; << 58 return fDy ; 45 } 59 } 46 60 47 inline 61 inline 48 G4double G4Para::GetXHalfLength() const 62 G4double G4Para::GetXHalfLength() const 49 { 63 { 50 return fDx; << 64 return fDx ; 51 } 65 } 52 66 53 inline 67 inline 54 G4double G4Para::GetTanAlpha() const 68 G4double G4Para::GetTanAlpha() const 55 { 69 { 56 return fTalpha; << 70 return fTalpha ; 57 } 71 } 58 72 59 inline 73 inline 60 void G4Para::SetXHalfLength(G4double val) 74 void G4Para::SetXHalfLength(G4double val) 61 { 75 { 62 fDx = val; << 76 fDx= val; 63 << 77 fCubicVolume= 0.; 64 fCubicVolume = 0.; << 78 fSurfaceArea= 0.; 65 fSurfaceArea = 0.; << 79 fpPolyhedron = 0; 66 fRebuildPolyhedron = true; << 67 << 68 CheckParameters(); << 69 MakePlanes(); << 70 } 80 } 71 81 72 inline 82 inline 73 void G4Para::SetYHalfLength(G4double val) 83 void G4Para::SetYHalfLength(G4double val) 74 { 84 { 75 fDy = val; << 85 fDy= val; 76 << 86 fCubicVolume= 0.; 77 fCubicVolume = 0.; << 87 fSurfaceArea= 0.; 78 fSurfaceArea = 0.; << 88 fpPolyhedron = 0; 79 fRebuildPolyhedron = true; << 80 << 81 CheckParameters(); << 82 MakePlanes(); << 83 } 89 } 84 90 85 inline 91 inline 86 void G4Para::SetZHalfLength(G4double val) 92 void G4Para::SetZHalfLength(G4double val) 87 { 93 { 88 fDz = val; << 94 fDz= val; 89 << 95 fCubicVolume= 0.; 90 fCubicVolume = 0.; << 96 fSurfaceArea= 0.; 91 fSurfaceArea = 0.; << 97 fpPolyhedron = 0; 92 fRebuildPolyhedron = true; << 93 << 94 CheckParameters(); << 95 MakePlanes(); << 96 } 98 } 97 99 98 inline 100 inline 99 void G4Para::SetAlpha(G4double alpha) 101 void G4Para::SetAlpha(G4double alpha) 100 { 102 { 101 fTalpha = std::tan(alpha); << 103 fTalpha= std::tan(alpha); 102 << 104 fSurfaceArea= 0.; 103 fSurfaceArea = 0.; << 105 fCubicVolume= 0.; 104 fCubicVolume = 0.; << 106 fpPolyhedron = 0; 105 fRebuildPolyhedron = true; << 106 << 107 MakePlanes(); << 108 } 107 } 109 108 110 inline 109 inline 111 void G4Para::SetTanAlpha(G4double val) 110 void G4Para::SetTanAlpha(G4double val) 112 { 111 { 113 fTalpha = val; << 112 fTalpha= val; 114 << 113 fCubicVolume= 0.; 115 fCubicVolume = 0.; << 114 fSurfaceArea= 0.; 116 fSurfaceArea = 0.; << 115 fpPolyhedron = 0; 117 fRebuildPolyhedron = true; << 118 << 119 MakePlanes(); << 120 } 116 } 121 117 122 inline 118 inline 123 void G4Para::SetThetaAndPhi(G4double pTheta, G << 119 void G4Para::SetThetaAndPhi(double pTheta, double pPhi) 124 { 120 { 125 G4double tanTheta = std::tan(pTheta); << 121 fTthetaCphi=std::tan(pTheta)*std::cos(pPhi); 126 fTthetaCphi = tanTheta*std::cos(pPhi); << 122 fTthetaSphi=std::tan(pTheta)*std::sin(pPhi); 127 fTthetaSphi = tanTheta*std::sin(pPhi); << 123 fCubicVolume= 0.; 128 << 124 fSurfaceArea= 0.; 129 fCubicVolume = 0.; << 125 fpPolyhedron = 0; 130 fSurfaceArea = 0.; << 131 fRebuildPolyhedron = true; << 132 << 133 MakePlanes(); << 134 } 126 } 135 127 136 inline G4double G4Para::GetPhi() const << 128 inline >> 129 G4double G4Para::GetCubicVolume() 137 { 130 { 138 return std::atan2(fTthetaSphi,fTthetaCphi); << 131 // 139 } << 132 // It is like G4Box, since para transformations keep the volume to be const 140 133 141 inline G4double G4Para::GetTheta() const << 134 if(fCubicVolume != 0.) {;} 142 { << 135 else fCubicVolume = 8*fDx*fDy*fDz; 143 return std::atan(std::sqrt(fTthetaCphi*fTth << 136 return fCubicVolume; 144 +fTthetaSphi*fTt << 145 } 137 } 146 138 147 inline G4double G4Para::GetAlpha() const << 139 inline >> 140 G4double G4Para::GetSurfaceArea() 148 { 141 { 149 return std::atan(fTalpha); << 142 if(fSurfaceArea != 0.) {;} >> 143 else >> 144 { >> 145 fSurfaceArea = 8*(fDx*fDy >> 146 + fDx*fDz*std::sqrt(1+fTthetaSphi*fTthetaSphi) >> 147 + fDy*fDz*std::sqrt(1+fTalpha*fTalpha >> 148 +std::pow(fTthetaCphi-fTthetaSphi*fTalpha, 2)) ); >> 149 } >> 150 return fSurfaceArea; 150 } 151 } 151 152