| 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 | //
|
|---|
| 27 | // $Id: G4TwistTrapFlatSide.hh,v 1.5 2006/06/29 18:47:48 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // G4FlatTrapSurface
|
|---|
| 36 | //
|
|---|
| 37 | // Class description:
|
|---|
| 38 | //
|
|---|
| 39 | // Class describing a flat boundary surface for a trapezoid.
|
|---|
| 40 |
|
|---|
| 41 | // Author:
|
|---|
| 42 | //
|
|---|
| 43 | // 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
|
|---|
| 44 | //
|
|---|
| 45 | // --------------------------------------------------------------------
|
|---|
| 46 | #ifndef __G4TWISTTRAPFLATSIDE__
|
|---|
| 47 | #define __G4TWISTTRAPFLATSIDE__
|
|---|
| 48 |
|
|---|
| 49 | #include "G4VTwistSurface.hh"
|
|---|
| 50 |
|
|---|
| 51 | class G4TwistTrapFlatSide : public G4VTwistSurface
|
|---|
| 52 | {
|
|---|
| 53 | public: // with description
|
|---|
| 54 |
|
|---|
| 55 | G4TwistTrapFlatSide( const G4String& name,
|
|---|
| 56 | G4double PhiTwist,
|
|---|
| 57 | G4double pDx1,
|
|---|
| 58 | G4double pDx2,
|
|---|
| 59 | G4double pDy,
|
|---|
| 60 | G4double pDz,
|
|---|
| 61 | G4double pAlpha,
|
|---|
| 62 | G4double pPhi,
|
|---|
| 63 | G4double pTheta,
|
|---|
| 64 | G4int handedness );
|
|---|
| 65 | virtual ~G4TwistTrapFlatSide();
|
|---|
| 66 |
|
|---|
| 67 | virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
|
|---|
| 68 | G4bool isGlobal = false);
|
|---|
| 69 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 70 | const G4ThreeVector &gv,
|
|---|
| 71 | G4ThreeVector gxx[],
|
|---|
| 72 | G4double distance[],
|
|---|
| 73 | G4int areacode[],
|
|---|
| 74 | G4bool isvalid[],
|
|---|
| 75 | EValidate validate = kValidateWithTol);
|
|---|
| 76 |
|
|---|
| 77 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 78 | G4ThreeVector gxx[],
|
|---|
| 79 | G4double distance[],
|
|---|
| 80 | G4int areacode[]);
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | virtual G4ThreeVector SurfacePoint(G4double x, G4double y,
|
|---|
| 84 | G4bool isGlobal = false);
|
|---|
| 85 | virtual G4double GetBoundaryMin(G4double u);
|
|---|
| 86 | virtual G4double GetBoundaryMax(G4double u);
|
|---|
| 87 | virtual G4double GetSurfaceArea();
|
|---|
| 88 | virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
|
|---|
| 89 | G4int faces[][4], G4int iside );
|
|---|
| 90 |
|
|---|
| 91 | public: // without description
|
|---|
| 92 |
|
|---|
| 93 | G4TwistTrapFlatSide(__void__&);
|
|---|
| 94 | // Fake default constructor for usage restricted to direct object
|
|---|
| 95 | // persistency for clients requiring preallocation of memory for
|
|---|
| 96 | // persistifiable objects.
|
|---|
| 97 |
|
|---|
| 98 | protected: // with description
|
|---|
| 99 |
|
|---|
| 100 | virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
|---|
| 101 | G4bool withTol = true);
|
|---|
| 102 |
|
|---|
| 103 | private:
|
|---|
| 104 |
|
|---|
| 105 | virtual void SetCorners();
|
|---|
| 106 | virtual void SetBoundaries();
|
|---|
| 107 |
|
|---|
| 108 | inline double xAxisMax(G4double u, G4double fTanAlpha) const;
|
|---|
| 109 |
|
|---|
| 110 | private:
|
|---|
| 111 |
|
|---|
| 112 | G4double fDx1;
|
|---|
| 113 | G4double fDx2;
|
|---|
| 114 | G4double fDy;
|
|---|
| 115 | G4double fDz;
|
|---|
| 116 | G4double fPhiTwist;
|
|---|
| 117 | G4double fAlpha;
|
|---|
| 118 | G4double fTAlph;
|
|---|
| 119 | G4double fPhi;
|
|---|
| 120 | G4double fTheta;
|
|---|
| 121 | G4double fdeltaX;
|
|---|
| 122 | G4double fdeltaY;
|
|---|
| 123 | };
|
|---|
| 124 |
|
|---|
| 125 | //========================================================
|
|---|
| 126 | // inline functions
|
|---|
| 127 | //========================================================
|
|---|
| 128 |
|
|---|
| 129 | inline
|
|---|
| 130 | G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const
|
|---|
| 131 | {
|
|---|
| 132 | return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha ) ;
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| 135 | inline G4ThreeVector
|
|---|
| 136 | G4TwistTrapFlatSide::SurfacePoint(G4double x, G4double y, G4bool isGlobal)
|
|---|
| 137 | {
|
|---|
| 138 | G4ThreeVector SurfPoint ( x,y,0);
|
|---|
| 139 |
|
|---|
| 140 | if (isGlobal) { return (fRot*SurfPoint + fTrans); }
|
|---|
| 141 | return SurfPoint;
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | inline
|
|---|
| 145 | G4double G4TwistTrapFlatSide::GetBoundaryMin(G4double y )
|
|---|
| 146 | {
|
|---|
| 147 | return -xAxisMax(y, -fTAlph ) ;
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | inline
|
|---|
| 151 | G4double G4TwistTrapFlatSide::GetBoundaryMax(G4double y )
|
|---|
| 152 | {
|
|---|
| 153 | return xAxisMax(y, fTAlph ) ;
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | inline
|
|---|
| 157 | G4double G4TwistTrapFlatSide::GetSurfaceArea()
|
|---|
| 158 | {
|
|---|
| 159 | return 2*(fDx1 + fDx2)*fDy ;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | #endif
|
|---|