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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/solids/CSG/include/G4Trap.icc (Version 11.3.0) and /geometry/solids/CSG/include/G4Trap.icc (Version 9.1.p2)


  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.8 2006/10/19 15:33:37 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
                                                   >>  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 {                                                 112 {
105    return std::atan(std::sqrt(fTthetaCphi*fTth << 113    G4double area = 0.5*((p1-p0).cross(p2-p1).mag()+(p3-p2).cross(p0-p3).mag());
106                               +fTthetaSphi*fTt << 114    return area;
107 }                                                 115 }
108                                                   116 
109 inline G4double G4Trap::GetAlpha1() const      << 117 inline
110 {                                              << 118 G4double G4Trap::GetCubicVolume()
111   return std::atan(fTalpha1);                  << 119 {
                                                   >> 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;
112 }                                                 124 }
113                                                   125 
114 inline G4double G4Trap::GetAlpha2() const      << 126 inline
115 {                                              << 127 G4double G4Trap::GetSurfaceArea()
116   return std::atan(fTalpha2);                  << 128 {
                                                   >> 129   if(fSurfaceArea != 0.) {;}
                                                   >> 130   else
                                                   >> 131   { 
                                                   >> 132     G4ThreeVector ba(fDx1-fDx2+fTalpha1*2*fDy1,2*fDy1,0);
                                                   >> 133     G4ThreeVector bc(2*fDz*fTthetaCphi-(fDx4-fDx2)+fTalpha2*fDy2-fTalpha1*fDy1,
                                                   >> 134                      2*fDz*fTthetaSphi+fDy2-fDy1, 2*fDz);
                                                   >> 135     G4ThreeVector dc(-fDx4+fDx3+2*fTalpha2*fDy2, 2*fDy2,0);
                                                   >> 136     G4ThreeVector da(-2*fDz*fTthetaCphi-(fDx1-fDx3)-fTalpha1*fDy1+fTalpha2*fDy2,
                                                   >> 137                      -2*fDz*fTthetaSphi-fDy1+fDy2,-2*fDz);
                                                   >> 138 
                                                   >> 139     G4ThreeVector ef(fDx2-fDx1+2*fTalpha1*fDy1, 2*fDy1,0);
                                                   >> 140     G4ThreeVector eh(2*fDz*fTthetaCphi+fDx3-fDx1+fTalpha1*fDy1-fTalpha2*fDy2,
                                                   >> 141                      2*fDz*fTthetaSphi-fDy2+fDy1,2*fDz);
                                                   >> 142     G4ThreeVector gh(fDx3-fDx4-2*fTalpha2*fDy2, -2*fDy2,0);
                                                   >> 143     G4ThreeVector gf(-2*fDz*fTthetaCphi+fDx2-fDx4+fTalpha1*fDy1-fTalpha2*fDy2,
                                                   >> 144                      -2*fDz*fTthetaSphi+fDy1-fDy2,-2*fDz);
                                                   >> 145 
                                                   >> 146     G4ThreeVector cr;
                                                   >> 147     cr = ba.cross(bc);
                                                   >> 148     G4double babc=cr.mag();
                                                   >> 149     cr = dc.cross(da);
                                                   >> 150     G4double dcda=cr.mag();
                                                   >> 151     cr = ef.cross(eh);
                                                   >> 152     G4double efeh=cr.mag();
                                                   >> 153     cr = gh.cross(gf);
                                                   >> 154     G4double ghgf=cr.mag();
                                                   >> 155 
                                                   >> 156     fSurfaceArea = 2*fDy1*(fDx1+fDx2)+2*fDy2*(fDx3+fDx4)
                                                   >> 157                  + (fDx1+fDx3)
                                                   >> 158                  * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1-2*fDz*fTthetaSphi,2))
                                                   >> 159                  + (fDx2+fDx4)
                                                   >> 160                  * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1+2*fDz*fTthetaSphi,2))
                                                   >> 161                  + 0.5*(babc+dcda+efeh+ghgf);
                                                   >> 162   }
                                                   >> 163   return fSurfaceArea;
117 }                                                 164 }
118                                                   165