G4TwistTubsSide.hh

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: G4TwistTubsSide.hh 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 // 
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 //
00034 // G4TwistTubsSide
00035 //
00036 // Class description:
00037 //
00038 //  Class describing a twisted boundary surface for a cylinder.
00039 
00040 // Author: 
00041 //   01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
00042 //
00043 // History:
00044 //   13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
00045 //                 from original version in Jupiter-2.5.02 application.
00046 // --------------------------------------------------------------------
00047 #ifndef __G4TWISTTUBSSIDE__
00048 #define __G4TWISTTUBSSIDE__
00049 
00050 #include "G4VTwistSurface.hh"
00051 
00052 class G4TwistTubsSide : public G4VTwistSurface
00053 {
00054   public:  // with description
00055    
00056    G4TwistTubsSide(const G4String         &name,
00057                    const G4RotationMatrix &rot,   // 0.5*(phi-width segment)
00058                    const G4ThreeVector    &tlate,
00059                          G4int    handedness, // R-hand = 1, L-hand = -1
00060                    const G4double kappa,      // tan(TwistAngle/2)/fZHalfLen
00061                    const EAxis    axis0 = kXAxis,
00062                    const EAxis    axis1 = kZAxis,
00063                          G4double axis0min = -kInfinity,
00064                          G4double axis1min = -kInfinity,
00065                          G4double axis0max = kInfinity,
00066                          G4double axis1max = kInfinity );
00067     
00068    G4TwistTubsSide(const G4String     &name,
00069                          G4double      EndInnerRadius[2],
00070                          G4double      EndOuterRadius[2],
00071                          G4double      DPhi,
00072                          G4double      EndPhi[2],
00073                          G4double      EndZ[2], 
00074                          G4double      InnerRadius,
00075                          G4double      OuterRadius,
00076                          G4double      Kappa,
00077                          G4int         handedness);
00078 
00079    virtual ~G4TwistTubsSide();
00080    
00081    virtual G4ThreeVector  GetNormal(const G4ThreeVector &xx,
00082                                           G4bool isGlobal = false) ;   
00083    
00084    virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00085                                    const G4ThreeVector &gv,
00086                                          G4ThreeVector  gxx[],
00087                                          G4double  distance[],
00088                                          G4int     areacode[],
00089                                          G4bool    isvalid[],
00090                                          EValidate validate = kValidateWithTol);
00091                                                   
00092    virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00093                                          G4ThreeVector  gxx[],
00094                                          G4double       distance[],
00095                                          G4int          areacode[]);
00096  
00097    inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p,
00098                                             G4bool isglobal = false) const ;
00099 
00100    virtual G4ThreeVector SurfacePoint(G4double, G4double,
00101                                       G4bool isGlobal = false) ;  
00102    virtual G4double GetBoundaryMin(G4double phi) ;
00103    virtual G4double GetBoundaryMax(G4double phi) ;
00104    virtual G4double GetSurfaceArea() ;
00105    virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
00106                            G4int faces[][4], G4int iside ) ;
00107 
00108  public:  // without description
00109 
00110    G4TwistTubsSide(__void__&);
00111      // Fake default constructor for usage restricted to direct object
00112      // persistency for clients requiring preallocation of memory for
00113      // persistifiable objects.
00114 
00115  private:
00116 
00117    virtual G4double DistanceToPlane(const G4ThreeVector &p,
00118                                     const G4ThreeVector &A,
00119                                     const G4ThreeVector &B,
00120                                     const G4ThreeVector &C,
00121                                     const G4ThreeVector &D,
00122                                     const G4int          parity,
00123                                           G4ThreeVector &xx,
00124                                           G4ThreeVector &n);
00125 
00126    virtual G4int GetAreaCode(const G4ThreeVector &xx, 
00127                                    G4bool         withTol = true);
00128 
00129    virtual void SetCorners();
00130 
00131    virtual void SetCorners(  G4double      endInnerRad[2],
00132                              G4double      endOuterRad[2],
00133                              G4double      endPhi[2],
00134                              G4double      endZ[2] ) ;
00135 
00136    virtual void SetBoundaries();
00137 
00138   private:
00139 
00140    G4double       fKappa;          // std::tan(TwistedAngle/2)/HalfLenZ;
00141 };   
00142 
00143 
00144 //========================================================
00145 // inline functions
00146 //========================================================
00147 
00148 inline
00149 G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector &p, 
00150                                                    G4bool isglobal) const 
00151 {
00152   // Get Rho at p.z() on Hyperbolic Surface.
00153   G4ThreeVector tmpp;
00154   if (isglobal) {
00155      tmpp = fRot.inverse()*p - fTrans;
00156   } else {
00157      tmpp = p;
00158   }
00159   G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
00160   if (isglobal) { return (fRot * xx + fTrans); }
00161   return xx;
00162 }
00163 
00164 inline
00165 G4ThreeVector
00166 G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal)
00167 {
00168   G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
00169 
00170   if (isGlobal) { return (fRot * SurfPoint + fTrans); }
00171   return SurfPoint;
00172 }
00173 
00174 inline
00175 G4double G4TwistTubsSide::GetBoundaryMin(G4double)
00176 {
00177   return  fAxisMin[0] ;  // inner radius at z = 0
00178 }
00179 
00180 inline
00181 G4double G4TwistTubsSide::GetBoundaryMax(G4double)
00182 {
00183   return  fAxisMax[0] ;  // outer radius at z = 0
00184 }
00185 
00186 inline
00187 G4double G4TwistTubsSide::GetSurfaceArea()
00188 {
00189   // approximation only
00190   return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
00191 }
00192 
00193 #endif

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