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.6 2006/06/29 18:44:23 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-01 $ >> 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 fpPolyhedron = 0; 65 fSurfaceArea = 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 fpPolyhedron = 0; 78 fSurfaceArea = 0.; << 79 fRebuildPolyhedron = true; << 80 << 81 CheckParameters(); << 82 MakePlanes(); << 83 } 87 } 84 88 85 inline 89 inline 86 void G4Para::SetZHalfLength(G4double val) 90 void G4Para::SetZHalfLength(G4double val) 87 { 91 { 88 fDz = val; << 92 fDz= val; 89 << 93 fCubicVolume= 0.; 90 fCubicVolume = 0.; << 94 fpPolyhedron = 0; 91 fSurfaceArea = 0.; << 92 fRebuildPolyhedron = true; << 93 << 94 CheckParameters(); << 95 MakePlanes(); << 96 } 95 } 97 96 98 inline 97 inline 99 void G4Para::SetAlpha(G4double alpha) 98 void G4Para::SetAlpha(G4double alpha) 100 { 99 { 101 fTalpha = std::tan(alpha); << 100 fTalpha= std::tan(alpha); 102 << 101 fCubicVolume= 0.; 103 fSurfaceArea = 0.; << 102 fpPolyhedron = 0; 104 fCubicVolume = 0.; << 105 fRebuildPolyhedron = true; << 106 << 107 MakePlanes(); << 108 } 103 } 109 104 110 inline 105 inline 111 void G4Para::SetTanAlpha(G4double val) 106 void G4Para::SetTanAlpha(G4double val) 112 { 107 { 113 fTalpha = val; << 108 fTalpha= val; 114 << 109 fCubicVolume= 0.; 115 fCubicVolume = 0.; << 110 fpPolyhedron = 0; 116 fSurfaceArea = 0.; << 117 fRebuildPolyhedron = true; << 118 << 119 MakePlanes(); << 120 } 111 } 121 112 122 inline 113 inline 123 void G4Para::SetThetaAndPhi(G4double pTheta, G << 114 void G4Para::SetThetaAndPhi(double pTheta, double pPhi) 124 { << 125 G4double tanTheta = std::tan(pTheta); << 126 fTthetaCphi = tanTheta*std::cos(pPhi); << 127 fTthetaSphi = tanTheta*std::sin(pPhi); << 128 << 129 fCubicVolume = 0.; << 130 fSurfaceArea = 0.; << 131 fRebuildPolyhedron = true; << 132 << 133 MakePlanes(); << 134 } << 135 << 136 inline G4double G4Para::GetPhi() const << 137 { 115 { 138 return std::atan2(fTthetaSphi,fTthetaCphi); << 116 fTthetaCphi=std::tan(pTheta)*std::cos(pPhi); >> 117 fTthetaSphi=std::tan(pTheta)*std::sin(pPhi); >> 118 fCubicVolume= 0.; >> 119 fpPolyhedron = 0; 139 } 120 } 140 121 141 inline G4double G4Para::GetTheta() const << 122 /////////////////////////////////////////////////// 142 { << 123 // 143 return std::atan(std::sqrt(fTthetaCphi*fTth << 124 // It is like G4Box, since para transformations keep the volume to be const 144 +fTthetaSphi*fTt << 145 } << 146 125 147 inline G4double G4Para::GetAlpha() const << 126 inline >> 127 G4double G4Para::GetCubicVolume() 148 { 128 { 149 return std::atan(fTalpha); << 129 if(fCubicVolume != 0.) ; >> 130 else fCubicVolume = 8*fDx*fDy*fDz; >> 131 return fCubicVolume; 150 } 132 } 151 133