G4TwistTrapFlatSide.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: G4TwistTrapFlatSide.hh 67011 2013-01-29 16:17:41Z gcosmo $
00028 //
00029 // 
00030 // --------------------------------------------------------------------
00031 // GEANT 4 class header file
00032 //
00033 //
00034 // G4FlatTrapSurface
00035 //
00036 // Class description:
00037 //
00038 //  Class describing a flat boundary surface for a trapezoid.
00039 
00040 // Author:
00041 //
00042 //   27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
00043 //
00044 // --------------------------------------------------------------------
00045 #ifndef __G4TWISTTRAPFLATSIDE__
00046 #define __G4TWISTTRAPFLATSIDE__
00047 
00048 #include "G4VTwistSurface.hh"
00049 
00050 class G4TwistTrapFlatSide : public G4VTwistSurface
00051 {
00052   public:  // with description
00053 
00054    G4TwistTrapFlatSide( const G4String& name,
00055                               G4double  PhiTwist,
00056                               G4double  pDx1,
00057                               G4double  pDx2,
00058                               G4double  pDy,
00059                               G4double  pDz,
00060                               G4double  pAlpha,
00061                               G4double  pPhi,
00062                               G4double  pTheta,
00063                               G4int     handedness  );
00064    virtual ~G4TwistTrapFlatSide();
00065 
00066    virtual G4ThreeVector  GetNormal(const G4ThreeVector & /* xx */ ,
00067                                           G4bool isGlobal = false);
00068    virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00069                                    const G4ThreeVector &gv,
00070                                          G4ThreeVector  gxx[],
00071                                          G4double       distance[],
00072                                          G4int          areacode[],
00073                                          G4bool         isvalid[],
00074                                          EValidate validate = kValidateWithTol);
00075 
00076    virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00077                                          G4ThreeVector  gxx[],
00078                                          G4double       distance[],
00079                                          G4int          areacode[]);
00080 
00081 
00082    virtual G4ThreeVector SurfacePoint(G4double x, G4double y,
00083                                              G4bool isGlobal = false);  
00084    virtual G4double GetBoundaryMin(G4double u);
00085    virtual G4double GetBoundaryMax(G4double u);
00086    virtual G4double GetSurfaceArea();
00087    virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
00088                            G4int faces[][4], G4int iside );
00089 
00090   public:  // without description
00091 
00092    G4TwistTrapFlatSide(__void__&);
00093      // Fake default constructor for usage restricted to direct object
00094      // persistency for clients requiring preallocation of memory for
00095      // persistifiable objects.
00096 
00097   protected:  // with description
00098 
00099    virtual G4int GetAreaCode(const G4ThreeVector &xx, 
00100                                    G4bool withTol = true);
00101 
00102   private:
00103 
00104    virtual void SetCorners();
00105    virtual void SetBoundaries();
00106 
00107    inline double xAxisMax(G4double u, G4double fTanAlpha) const;
00108  
00109   private:
00110   
00111    G4double fDx1;
00112    G4double fDx2;
00113    G4double fDy;
00114    G4double fDz;
00115    G4double fPhiTwist;
00116    G4double fAlpha;
00117    G4double fTAlph;
00118    G4double fPhi;
00119    G4double fTheta;
00120    G4double fdeltaX;
00121    G4double fdeltaY;
00122 };
00123 
00124 //========================================================
00125 // inline functions
00126 //========================================================
00127 
00128 inline 
00129 G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const
00130 {
00131   return (  ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha  ) ;
00132 }
00133 
00134 inline G4ThreeVector
00135 G4TwistTrapFlatSide::SurfacePoint(G4double x, G4double y, G4bool isGlobal)
00136 {
00137   G4ThreeVector SurfPoint ( x,y,0);
00138 
00139   if (isGlobal) { return (fRot*SurfPoint + fTrans); }
00140   return SurfPoint;
00141 }
00142 
00143 inline
00144 G4double G4TwistTrapFlatSide::GetBoundaryMin(G4double y )
00145 {
00146   return -xAxisMax(y, -fTAlph ) ;
00147 }
00148 
00149 inline
00150 G4double G4TwistTrapFlatSide::GetBoundaryMax(G4double y )
00151 {
00152   return xAxisMax(y, fTAlph ) ; 
00153 }
00154 
00155 inline
00156 G4double G4TwistTrapFlatSide::GetSurfaceArea()
00157 {
00158   return 2*(fDx1 + fDx2)*fDy ;
00159 }
00160 
00161 #endif

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