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: G4Trap.icc,v 1.7 2006/06/29 18:44:51 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-01 $ >> 29 // >> 30 // -------------------------------------------------------------------- >> 31 // GEANT 4 inline definitions file >> 32 // >> 33 // G4Trap.icc >> 34 // 26 // Implementation of inline methods of G4Trap 35 // Implementation of inline methods of G4Trap 27 // ------------------------------------------- 36 // -------------------------------------------------------------------- 28 37 29 inline 38 inline 30 G4double G4Trap::GetZHalfLength() const 39 G4double G4Trap::GetZHalfLength() const 31 { 40 { 32 return fDz ; 41 return fDz ; 33 } 42 } 34 43 35 inline 44 inline 36 G4ThreeVector G4Trap::GetSymAxis() const 45 G4ThreeVector G4Trap::GetSymAxis() const 37 { 46 { 38 G4double cosTheta = 1.0/std::sqrt(1+fTthetaC 47 G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi + 39 fTthetaSphi*fTt 48 fTthetaSphi*fTthetaSphi) ; 40 49 41 return { fTthetaCphi*cosTheta, fTthetaSphi*c << 50 return G4ThreeVector(fTthetaCphi*cosTheta, >> 51 fTthetaSphi*cosTheta, >> 52 cosTheta) ; 42 } 53 } 43 54 44 inline 55 inline 45 G4double G4Trap::GetYHalfLength1() const 56 G4double G4Trap::GetYHalfLength1() const 46 { 57 { 47 return fDy1 ; 58 return fDy1 ; 48 } 59 } 49 60 50 inline 61 inline 51 G4double G4Trap::GetXHalfLength1() const 62 G4double G4Trap::GetXHalfLength1() const 52 { 63 { 53 return fDx1 ; 64 return fDx1 ; 54 } 65 } 55 66 56 inline 67 inline 57 G4double G4Trap::GetXHalfLength2() const 68 G4double G4Trap::GetXHalfLength2() const 58 { 69 { 59 return fDx2 ; 70 return fDx2 ; 60 } 71 } 61 72 62 inline 73 inline 63 G4double G4Trap::GetTanAlpha1() const 74 G4double G4Trap::GetTanAlpha1() const 64 { 75 { 65 return fTalpha1 ; 76 return fTalpha1 ; 66 } 77 } 67 78 68 inline 79 inline 69 G4double G4Trap::GetYHalfLength2() const 80 G4double G4Trap::GetYHalfLength2() const 70 { 81 { 71 return fDy2 ; 82 return fDy2 ; 72 } 83 } 73 84 74 inline 85 inline 75 G4double G4Trap::GetXHalfLength3() const 86 G4double G4Trap::GetXHalfLength3() const 76 { 87 { 77 return fDx3 ; 88 return fDx3 ; 78 } 89 } 79 90 80 inline 91 inline 81 G4double G4Trap::GetXHalfLength4() const 92 G4double G4Trap::GetXHalfLength4() const 82 { 93 { 83 return fDx4 ; 94 return fDx4 ; 84 } 95 } 85 96 86 inline 97 inline 87 G4double G4Trap::GetTanAlpha2() const 98 G4double G4Trap::GetTanAlpha2() const 88 { 99 { 89 return fTalpha2 ; 100 return fTalpha2 ; 90 } 101 } 91 102 92 inline 103 inline 93 TrapSidePlane G4Trap::GetSidePlane( G4int n ) 104 TrapSidePlane G4Trap::GetSidePlane( G4int n ) const 94 { 105 { 95 return fPlanes[n] ; 106 return fPlanes[n] ; 96 } 107 } 97 108 98 inline G4double G4Trap::GetPhi() const << 109 inline 99 { << 110 G4double G4Trap::GetFaceArea(const G4ThreeVector& p0, const G4ThreeVector& p1, 100 return std::atan2(fTthetaSphi,fTthetaCphi); << 111 const G4ThreeVector& p2, const G4ThreeVector& p3) 101 } << 102 << 103 inline G4double G4Trap::GetTheta() const << 104 { << 105 return std::atan(std::sqrt(fTthetaCphi*fTth << 106 +fTthetaSphi*fTt << 107 } << 108 << 109 inline G4double G4Trap::GetAlpha1() const << 110 { 112 { 111 return std::atan(fTalpha1); << 113 G4double area = 0.5*((p1-p0).cross(p2-p1).mag()+(p3-p2).cross(p0-p3).mag()); >> 114 return area; 112 } 115 } 113 116 114 inline G4double G4Trap::GetAlpha2() const << 117 inline >> 118 G4double G4Trap::GetCubicVolume() 115 { 119 { 116 return std::atan(fTalpha2); << 120 if(fCubicVolume != 0.) {;} >> 121 else { fCubicVolume = fDz*( (fDx1+fDx2+fDx3+fDx4)*(fDy1+fDy2) >> 122 + (fDx4+fDx3-fDx2-fDx1)*(fDy2-fDy1)/3 ); } >> 123 return fCubicVolume; 117 } 124 } 118 125