G4Trap.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4Trap.icc 69788 2013-05-15 12:06:57Z gcosmo $
00028 //
00029 // --------------------------------------------------------------------
00030 // GEANT 4 inline definitions file
00031 //
00032 // G4Trap.icc
00033 //
00034 // Implementation of inline methods of G4Trap
00035 // --------------------------------------------------------------------
00036 
00037 inline
00038 G4double G4Trap::GetZHalfLength() const
00039 {
00040   return fDz ;
00041 }
00042 
00043 inline
00044 G4ThreeVector G4Trap::GetSymAxis() const
00045 {
00046   G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi +
00047                                fTthetaSphi*fTthetaSphi) ;
00048 
00049   return G4ThreeVector(fTthetaCphi*cosTheta,
00050                        fTthetaSphi*cosTheta,
00051                        cosTheta) ;
00052 }
00053 
00054 inline
00055 G4double G4Trap::GetYHalfLength1() const
00056 {
00057   return fDy1 ;
00058 }
00059 
00060 inline
00061 G4double G4Trap::GetXHalfLength1() const
00062 {
00063   return fDx1 ;
00064 }
00065 
00066 inline
00067 G4double G4Trap::GetXHalfLength2() const
00068 {
00069   return fDx2 ;
00070 }
00071 
00072 inline
00073 G4double G4Trap::GetTanAlpha1() const
00074 {
00075   return fTalpha1 ;
00076 }
00077 
00078 inline
00079 G4double G4Trap::GetYHalfLength2() const
00080 {
00081   return fDy2 ;
00082 }
00083 
00084 inline
00085 G4double G4Trap::GetXHalfLength3() const
00086 {
00087   return fDx3 ;
00088 }
00089 
00090 inline
00091 G4double G4Trap::GetXHalfLength4() const
00092 {
00093   return fDx4 ;
00094 }
00095 
00096 inline
00097 G4double G4Trap::GetTanAlpha2() const
00098 {
00099   return fTalpha2 ;
00100 }
00101 
00102 inline
00103 TrapSidePlane G4Trap::GetSidePlane( G4int n ) const
00104 {
00105   return fPlanes[n] ;
00106 }
00107 
00108 inline
00109 G4double G4Trap::GetFaceArea(const G4ThreeVector& p0, const G4ThreeVector& p1,
00110                              const G4ThreeVector& p2, const G4ThreeVector& p3)
00111 {
00112    G4double area = 0.5*((p1-p0).cross(p2-p1).mag()+(p3-p2).cross(p0-p3).mag());
00113    return area;
00114 }
00115 
00116 inline
00117 G4double G4Trap::GetCubicVolume()
00118 {
00119   if(fCubicVolume != 0.) {;}
00120   else  { fCubicVolume = fDz*( (fDx1+fDx2+fDx3+fDx4)*(fDy1+fDy2)
00121                              + (fDx4+fDx3-fDx2-fDx1)*(fDy2-fDy1)/3 ); }
00122   return fCubicVolume;
00123 }
00124 
00125 inline
00126 G4double G4Trap::GetSurfaceArea()
00127 {
00128   if(fSurfaceArea != 0.) {;}
00129   else
00130   { 
00131     G4ThreeVector ba(fDx1-fDx2+fTalpha1*2*fDy1,2*fDy1,0);
00132     G4ThreeVector bc(2*fDz*fTthetaCphi-(fDx4-fDx2)+fTalpha2*fDy2-fTalpha1*fDy1,
00133                      2*fDz*fTthetaSphi+fDy2-fDy1, 2*fDz);
00134     G4ThreeVector dc(-fDx4+fDx3+2*fTalpha2*fDy2, 2*fDy2,0);
00135     G4ThreeVector da(-2*fDz*fTthetaCphi-(fDx1-fDx3)-fTalpha1*fDy1+fTalpha2*fDy2,
00136                      -2*fDz*fTthetaSphi-fDy1+fDy2,-2*fDz);
00137 
00138     G4ThreeVector ef(fDx2-fDx1+2*fTalpha1*fDy1, 2*fDy1,0);
00139     G4ThreeVector eh(2*fDz*fTthetaCphi+fDx3-fDx1+fTalpha1*fDy1-fTalpha2*fDy2,
00140                      2*fDz*fTthetaSphi-fDy2+fDy1,2*fDz);
00141     G4ThreeVector gh(fDx3-fDx4-2*fTalpha2*fDy2, -2*fDy2,0);
00142     G4ThreeVector gf(-2*fDz*fTthetaCphi+fDx2-fDx4+fTalpha1*fDy1-fTalpha2*fDy2,
00143                      -2*fDz*fTthetaSphi+fDy1-fDy2,-2*fDz);
00144 
00145     G4ThreeVector cr;
00146     cr = ba.cross(bc);
00147     G4double babc=cr.mag();
00148     cr = dc.cross(da);
00149     G4double dcda=cr.mag();
00150     cr = ef.cross(eh);
00151     G4double efeh=cr.mag();
00152     cr = gh.cross(gf);
00153     G4double ghgf=cr.mag();
00154 
00155     fSurfaceArea = 2*fDy1*(fDx1+fDx2)+2*fDy2*(fDx3+fDx4)
00156                  + (fDx1+fDx3)
00157                  * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1-2*fDz*fTthetaSphi,2))
00158                  + (fDx2+fDx4)
00159                  * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1+2*fDz*fTthetaSphi,2))
00160                  + 0.5*(babc+dcda+efeh+ghgf);
00161   }
00162   return fSurfaceArea;
00163 }

Generated on Mon May 27 17:50:03 2013 for Geant4 by  doxygen 1.4.7