Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:15

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 // G4TwistTubsFlatSide
0027 //
0028 // Class description:
0029 //
0030 // Class describing a flat 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 G4TWISTTUBSFLATSIDE_HH
0037 #define G4TWISTTUBSFLATSIDE_HH
0038 
0039 #include "G4VTwistSurface.hh"
0040 
0041 class G4TwistTubsFlatSide : public G4VTwistSurface
0042 {
0043   public:
0044 
0045     G4TwistTubsFlatSide(const G4String&   name,
0046                         const G4RotationMatrix& rot,
0047                         const G4ThreeVector&    tlate,
0048                         const G4ThreeVector&    n,
0049                         const EAxis             axis1 = kRho, // RHO axis !
0050                         const EAxis             axis2 = kPhi, // PHI axis !
0051                               G4double          axis0min = -kInfinity,
0052                               G4double          axis1min = -kInfinity,
0053                               G4double          axis0max = kInfinity,
0054                               G4double          axis1max = kInfinity);
0055 
0056     G4TwistTubsFlatSide(const G4String&  name,
0057                               G4double         EndInnerRadius[2],
0058                               G4double         EndOuterRadius[2],
0059                               G4double         DPhi,
0060                               G4double         EndPhi[2],
0061                               G4double         EndZ[2], 
0062                               G4int            handedness);
0063 
0064    ~G4TwistTubsFlatSide() override;
0065     G4ThreeVector  GetNormal(const G4ThreeVector& /* xx */ ,
0066                                    G4bool isGlobal = false) override;
0067     G4int DistanceToSurface(const G4ThreeVector& gp,
0068                             const G4ThreeVector& gv,
0069                                   G4ThreeVector  gxx[],
0070                                   G4double       distance[],
0071                                   G4int          areacode[],
0072                                   G4bool         isvalid[],
0073                             EValidate validate = kValidateWithTol) override;
0074 
0075     G4int DistanceToSurface(const G4ThreeVector& gp,
0076                                   G4ThreeVector  gxx[],
0077                                   G4double       distance[],
0078                                   G4int          areacode[]) override;
0079 
0080     inline G4ThreeVector SurfacePoint(G4double, G4double,
0081                                       G4bool isGlobal = false) override;  
0082     inline G4double GetBoundaryMin(G4double phi) override;
0083     inline G4double GetBoundaryMax(G4double phi) override;
0084     inline G4double GetSurfaceArea() override { return fSurfaceArea ; }
0085     void GetFacets( G4int m, G4int n, G4double xyz[][3],
0086                     G4int faces[][4], G4int iside ) override;
0087 
0088     G4TwistTubsFlatSide(__void__&);
0089       // Fake default constructor for usage restricted to direct object
0090       // persistency for clients requiring preallocation of memory for
0091       // persistifiable objects.
0092 
0093   protected:
0094 
0095     G4int GetAreaCode(const G4ThreeVector& xx, 
0096                             G4bool withTol = true) override ;
0097 
0098   private:
0099 
0100     void SetCorners() override;
0101     void SetBoundaries() override;
0102 
0103   private:
0104 
0105     G4double fSurfaceArea = 0.0;
0106 };
0107 
0108 inline G4ThreeVector G4TwistTubsFlatSide::
0109 SurfacePoint(G4double phi , G4double rho , G4bool isGlobal )
0110 {
0111   G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0);
0112 
0113   if (isGlobal) { return (fRot * SurfPoint + fTrans); }
0114   return SurfPoint;
0115 }
0116 
0117 inline
0118 G4double G4TwistTubsFlatSide::GetBoundaryMin(G4double)
0119 {
0120   G4ThreeVector dphimin = GetCorner(sC0Max1Min);
0121   return  std::atan2( dphimin.y(), dphimin.x() );  
0122 }
0123 
0124 inline
0125 G4double G4TwistTubsFlatSide::GetBoundaryMax(G4double)
0126 {
0127   G4ThreeVector dphimax = GetCorner(sC0Max1Max);   
0128   return  std::atan2( dphimax.y(), dphimax.x() );  
0129 }
0130 
0131 #endif