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 10.5 ] [ 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 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 // G4TwistTubsHypeSide
 27 //
 28 // Class description:
 29 //
 30 // Class describing a hyperbolic boundary surface for a cylinder.
 31 
 32 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp), created.
 33 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
 34 //               from original version in Jupiter-2.5.02 application.
 35 // --------------------------------------------------------------------
 36 #ifndef G4TWISTTUBSHYPESIDE_HH
 37 #define G4TWISTTUBSHYPESIDE_HH
 38 
 39 #include "G4VTwistSurface.hh"
 40 #include "G4Integrator.hh"
 41 #include "G4SimpleIntegration.hh"
 42 
 43 class G4TwistTubsHypeSide : public G4VTwistSurface
 44 {
 45   public:
 46                        
 47     G4TwistTubsHypeSide(const G4String&         name,
 48                         const G4RotationMatrix& rot,  // 0.5*(phi-width segment)
 49                         const G4ThreeVector&    tlate,
 50                         const G4int     handedness,// R-hand = 1, L-hand = -1
 51                         const G4double  kappa,     // tan(TwistAngle/2)/fZHalfLen
 52                         const G4double  tanstereo, // tan(stereo angle)
 53                         const G4double  r0,        // radius at z = 0
 54                         const EAxis     axis0 = kPhi,
 55                         const EAxis     axis1 = kZAxis,
 56                               G4double  axis0min = -kInfinity,
 57                               G4double  axis1min = -kInfinity,
 58                               G4double  axis0max = kInfinity,
 59                               G4double  axis1max = kInfinity); 
 60                              
 61    G4TwistTubsHypeSide(const G4String&  name,
 62                              G4double   EndInnerRadius[2],
 63                              G4double   EndOuterRadius[2],
 64                              G4double   DPhi,
 65                              G4double   EndPhi[2],
 66                              G4double   EndZ[2], 
 67                              G4double   InnerRadius,
 68                              G4double   OuterRadius,
 69                              G4double   Kappa,
 70                              G4double   TanInnerStereo,
 71                              G4double   TanOuterStereo,
 72                              G4int      handedness) ;
 73 
 74    ~G4TwistTubsHypeSide() override;
 75 
 76     G4int DistanceToSurface(const G4ThreeVector& gp,
 77                             const G4ThreeVector& gv,
 78                                   G4ThreeVector  gxx[],
 79                                   G4double       distance[],
 80                                   G4int          areacode[],
 81                                   G4bool         isvalid[],
 82                             EValidate validate = kValidateWithTol) override;
 83                                                    
 84     G4int DistanceToSurface(const G4ThreeVector& gp,
 85                                   G4ThreeVector  gxx[],
 86                                   G4double       distance[],
 87                                   G4int          areacode[]) override;
 88  
 89     G4ThreeVector GetNormal(const G4ThreeVector& xx,
 90                                   G4bool isGlobal = false) override ;
 91     EInside Inside(const G4ThreeVector& gp) ;
 92    
 93     inline G4double GetRhoAtPZ(const G4ThreeVector& p,
 94                                      G4bool isglobal = false) const ;
 95    
 96     inline G4ThreeVector SurfacePoint(G4double, G4double,
 97                                       G4bool isGlobal = false) override ;  
 98     inline G4double GetBoundaryMin(G4double phi) override ;
 99     inline G4double GetBoundaryMax(G4double phi) override ;
100     inline G4double GetSurfaceArea() override ;
101     void GetFacets( G4int m, G4int n, G4double xyz[][3],
102                     G4int faces[][4], G4int iside ) override ;
103  
104     G4TwistTubsHypeSide(__void__&);
105       // Fake default constructor for usage restricted to direct object
106       // persistency for clients requiring preallocation of memory for
107       // persistifiable objects.
108 
109   private:
110 
111    G4int GetAreaCode(const G4ThreeVector& xx, 
112                            G4bool withTol = true) override;
113    G4int GetAreaCodeInPhi(const G4ThreeVector& xx, 
114                                 G4bool withTol = true);
115    void SetCorners() override;
116 
117    void SetCorners(G4double EndInnerRadius[2],
118                    G4double EndOuterRadius[2],
119                    G4double DPhi,
120                    G4double EndPhi[2],
121                    G4double EndZ[2]);
122    void SetBoundaries() override;
123 
124   private:
125    
126    G4double          fKappa;        // std::tan(TwistedAngle/2)/HalfLenZ;
127    G4double          fTanStereo;    // std::tan(StereoAngle)
128    G4double          fTan2Stereo;   // std::tan(StereoAngle)**2
129    G4double          fR0;           // radius at z = 0
130    G4double          fR02;          // radius**2 at z = 0
131    G4double          fDPhi ;        // segment
132 
133    class Insidetype
134    {
135      public:
136        G4ThreeVector gp;
137        EInside       inside;
138    };
139    Insidetype fInside;
140 };
141 
142 //========================================================
143 // inline functions
144 //========================================================
145 
146 inline
147 G4double G4TwistTubsHypeSide::GetRhoAtPZ(const G4ThreeVector& p,
148                                                G4bool isglobal) const 
149 {
150   // Get Rho at p.z() on Hyperbolic Surface.
151   G4ThreeVector tmpp;
152   if (isglobal) { tmpp = fRot.inverse()*p - fTrans; }
153   else          { tmpp = p; }
154 
155   return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo); 
156 }
157 
158 inline
159 G4ThreeVector G4TwistTubsHypeSide::
160 SurfacePoint(G4double phi , G4double z , G4bool isGlobal)
161 {
162   G4double rho = std::sqrt(fR02 + z * z * fTan2Stereo) ;
163 
164   G4ThreeVector SurfPoint (rho*std::cos(phi), rho*std::sin(phi), z) ;
165 
166   if (isGlobal) { return (fRot * SurfPoint + fTrans); }
167   return SurfPoint;
168 }
169 
170 inline
171 G4double G4TwistTubsHypeSide::GetBoundaryMin(G4double z)
172 {
173   G4ThreeVector ptmp(0,0,z) ;  // temporary point with z Komponent only
174   G4ThreeVector lowerlimit;    // lower phi-boundary limit at z = ptmp.z()
175   lowerlimit = GetBoundaryAtPZ(sAxis0 & sAxisMin, ptmp);
176   return  std::atan2( lowerlimit.y(), lowerlimit.x() ) ;  
177 }
178 
179 inline
180 G4double G4TwistTubsHypeSide::GetBoundaryMax(G4double z )
181 {
182   G4ThreeVector ptmp(0,0,z) ;  // temporary point with z Komponent only
183   G4ThreeVector upperlimit;    // upper phi-boundary limit at z = ptmp.z()
184   upperlimit = GetBoundaryAtPZ(sAxis0 & sAxisMax, ptmp);
185   return   std::atan2( upperlimit.y(), upperlimit.x() ) ;
186 }
187 
188 inline
189 G4double G4TwistTubsHypeSide::GetSurfaceArea()
190 {
191   // approximation with tube surface
192 
193   return ( fAxisMax[1] - fAxisMin[1] ) * fR0 * fDPhi ;
194 }
195 
196 #endif
197