Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4TwistTubsHypeSide.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4TwistTubsHypeSide
0027 //
0028 // Class description:
0029 //
0030 // Class describing a hyperbolic boundary surface for a cylinder.
0031 
0032 // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp), created.
0033 // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
0034 //               from original version in Jupiter-2.5.02 application.
0035 // --------------------------------------------------------------------
0036 #ifndef G4TWISTTUBSHYPESIDE_HH
0037 #define G4TWISTTUBSHYPESIDE_HH
0038 
0039 #include "G4VTwistSurface.hh"
0040 #include "G4Integrator.hh"
0041 #include "G4SimpleIntegration.hh"
0042 
0043 class G4TwistTubsHypeSide : public G4VTwistSurface
0044 {
0045   public:
0046                        
0047     G4TwistTubsHypeSide(const G4String&         name,
0048                         const G4RotationMatrix& rot,  // 0.5*(phi-width segment)
0049                         const G4ThreeVector&    tlate,
0050                         const G4int     handedness,// R-hand = 1, L-hand = -1
0051                         const G4double  kappa,     // tan(TwistAngle/2)/fZHalfLen
0052                         const G4double  tanstereo, // tan(stereo angle)
0053                         const G4double  r0,        // radius at z = 0
0054                         const EAxis     axis0 = kPhi,
0055                         const EAxis     axis1 = kZAxis,
0056                               G4double  axis0min = -kInfinity,
0057                               G4double  axis1min = -kInfinity,
0058                               G4double  axis0max = kInfinity,
0059                               G4double  axis1max = kInfinity); 
0060                              
0061    G4TwistTubsHypeSide(const G4String&  name,
0062                              G4double   EndInnerRadius[2],
0063                              G4double   EndOuterRadius[2],
0064                              G4double   DPhi,
0065                              G4double   EndPhi[2],
0066                              G4double   EndZ[2], 
0067                              G4double   InnerRadius,
0068                              G4double   OuterRadius,
0069                              G4double   Kappa,
0070                              G4double   TanInnerStereo,
0071                              G4double   TanOuterStereo,
0072                              G4int      handedness) ;
0073 
0074    ~G4TwistTubsHypeSide() override;
0075 
0076     G4int DistanceToSurface(const G4ThreeVector& gp,
0077                             const G4ThreeVector& gv,
0078                                   G4ThreeVector  gxx[],
0079                                   G4double       distance[],
0080                                   G4int          areacode[],
0081                                   G4bool         isvalid[],
0082                             EValidate validate = kValidateWithTol) override;
0083                                                    
0084     G4int DistanceToSurface(const G4ThreeVector& gp,
0085                                   G4ThreeVector  gxx[],
0086                                   G4double       distance[],
0087                                   G4int          areacode[]) override;
0088  
0089     G4ThreeVector GetNormal(const G4ThreeVector& xx,
0090                                   G4bool isGlobal = false) override ;
0091     EInside Inside(const G4ThreeVector& gp) ;
0092    
0093     inline G4double GetRhoAtPZ(const G4ThreeVector& p,
0094                                      G4bool isglobal = false) const ;
0095    
0096     inline G4ThreeVector SurfacePoint(G4double, G4double,
0097                                       G4bool isGlobal = false) override ;  
0098     inline G4double GetBoundaryMin(G4double phi) override ;
0099     inline G4double GetBoundaryMax(G4double phi) override ;
0100     inline G4double GetSurfaceArea() override ;
0101     void GetFacets( G4int m, G4int n, G4double xyz[][3],
0102                     G4int faces[][4], G4int iside ) override ;
0103  
0104     G4TwistTubsHypeSide(__void__&);
0105       // Fake default constructor for usage restricted to direct object
0106       // persistency for clients requiring preallocation of memory for
0107       // persistifiable objects.
0108 
0109   private:
0110 
0111    G4int GetAreaCode(const G4ThreeVector& xx, 
0112                            G4bool withTol = true) override;
0113    G4int GetAreaCodeInPhi(const G4ThreeVector& xx, 
0114                                 G4bool withTol = true);
0115    void SetCorners() override;
0116 
0117    void SetCorners(G4double EndInnerRadius[2],
0118                    G4double EndOuterRadius[2],
0119                    G4double DPhi,
0120                    G4double EndPhi[2],
0121                    G4double EndZ[2]);
0122    void SetBoundaries() override;
0123 
0124   private:
0125    
0126    G4double          fKappa;        // std::tan(TwistedAngle/2)/HalfLenZ;
0127    G4double          fTanStereo;    // std::tan(StereoAngle)
0128    G4double          fTan2Stereo;   // std::tan(StereoAngle)**2
0129    G4double          fR0;           // radius at z = 0
0130    G4double          fR02;          // radius**2 at z = 0
0131    G4double          fDPhi ;        // segment
0132 
0133    class Insidetype
0134    {
0135      public:
0136        G4ThreeVector gp;
0137        EInside       inside;
0138    };
0139    Insidetype fInside;
0140 };
0141 
0142 //========================================================
0143 // inline functions
0144 //========================================================
0145 
0146 inline
0147 G4double G4TwistTubsHypeSide::GetRhoAtPZ(const G4ThreeVector& p,
0148                                                G4bool isglobal) const 
0149 {
0150   // Get Rho at p.z() on Hyperbolic Surface.
0151   G4ThreeVector tmpp;
0152   if (isglobal) { tmpp = fRot.inverse()*p - fTrans; }
0153   else          { tmpp = p; }
0154 
0155   return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo); 
0156 }
0157 
0158 inline
0159 G4ThreeVector G4TwistTubsHypeSide::
0160 SurfacePoint(G4double phi , G4double z , G4bool isGlobal)
0161 {
0162   G4double rho = std::sqrt(fR02 + z * z * fTan2Stereo) ;
0163 
0164   G4ThreeVector SurfPoint (rho*std::cos(phi), rho*std::sin(phi), z) ;
0165 
0166   if (isGlobal) { return (fRot * SurfPoint + fTrans); }
0167   return SurfPoint;
0168 }
0169 
0170 inline
0171 G4double G4TwistTubsHypeSide::GetBoundaryMin(G4double z)
0172 {
0173   G4ThreeVector ptmp(0,0,z) ;  // temporary point with z Komponent only
0174   G4ThreeVector lowerlimit;    // lower phi-boundary limit at z = ptmp.z()
0175   lowerlimit = GetBoundaryAtPZ(sAxis0 & sAxisMin, ptmp);
0176   return  std::atan2( lowerlimit.y(), lowerlimit.x() ) ;  
0177 }
0178 
0179 inline
0180 G4double G4TwistTubsHypeSide::GetBoundaryMax(G4double z )
0181 {
0182   G4ThreeVector ptmp(0,0,z) ;  // temporary point with z Komponent only
0183   G4ThreeVector upperlimit;    // upper phi-boundary limit at z = ptmp.z()
0184   upperlimit = GetBoundaryAtPZ(sAxis0 & sAxisMax, ptmp);
0185   return   std::atan2( upperlimit.y(), upperlimit.x() ) ;
0186 }
0187 
0188 inline
0189 G4double G4TwistTubsHypeSide::GetSurfaceArea()
0190 {
0191   // approximation with tube surface
0192 
0193   return ( fAxisMax[1] - fAxisMin[1] ) * fR0 * fDPhi ;
0194 }
0195 
0196 #endif