| 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: G4TwistTubsSide.hh,v 1.5 2006/06/29 18:47:58 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // G4TwistTubsSide
|
|---|
| 36 | //
|
|---|
| 37 | // Class description:
|
|---|
| 38 | //
|
|---|
| 39 | // Class describing a twisted boundary surface for a cylinder.
|
|---|
| 40 |
|
|---|
| 41 | // Author:
|
|---|
| 42 | // 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
|
|---|
| 43 | //
|
|---|
| 44 | // History:
|
|---|
| 45 | // 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
|
|---|
| 46 | // from original version in Jupiter-2.5.02 application.
|
|---|
| 47 | // --------------------------------------------------------------------
|
|---|
| 48 | #ifndef __G4TWISTTUBSSIDE__
|
|---|
| 49 | #define __G4TWISTTUBSSIDE__
|
|---|
| 50 |
|
|---|
| 51 | #include "G4VTwistSurface.hh"
|
|---|
| 52 |
|
|---|
| 53 | class G4TwistTubsSide : public G4VTwistSurface
|
|---|
| 54 | {
|
|---|
| 55 | public: // with description
|
|---|
| 56 |
|
|---|
| 57 | G4TwistTubsSide(const G4String &name,
|
|---|
| 58 | const G4RotationMatrix &rot, // 0.5*(phi-width segment)
|
|---|
| 59 | const G4ThreeVector &tlate,
|
|---|
| 60 | G4int handedness, // R-hand = 1, L-hand = -1
|
|---|
| 61 | const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
|
|---|
| 62 | const EAxis axis0 = kXAxis,
|
|---|
| 63 | const EAxis axis1 = kZAxis,
|
|---|
| 64 | G4double axis0min = -kInfinity,
|
|---|
| 65 | G4double axis1min = -kInfinity,
|
|---|
| 66 | G4double axis0max = kInfinity,
|
|---|
| 67 | G4double axis1max = kInfinity );
|
|---|
| 68 |
|
|---|
| 69 | G4TwistTubsSide(const G4String &name,
|
|---|
| 70 | G4double EndInnerRadius[2],
|
|---|
| 71 | G4double EndOuterRadius[2],
|
|---|
| 72 | G4double DPhi,
|
|---|
| 73 | G4double EndPhi[2],
|
|---|
| 74 | G4double EndZ[2],
|
|---|
| 75 | G4double InnerRadius,
|
|---|
| 76 | G4double OuterRadius,
|
|---|
| 77 | G4double Kappa,
|
|---|
| 78 | G4int handedness);
|
|---|
| 79 |
|
|---|
| 80 | virtual ~G4TwistTubsSide();
|
|---|
| 81 |
|
|---|
| 82 | virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
|---|
| 83 | G4bool isGlobal = false) ;
|
|---|
| 84 |
|
|---|
| 85 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 86 | const G4ThreeVector &gv,
|
|---|
| 87 | G4ThreeVector gxx[],
|
|---|
| 88 | G4double distance[],
|
|---|
| 89 | G4int areacode[],
|
|---|
| 90 | G4bool isvalid[],
|
|---|
| 91 | EValidate validate = kValidateWithTol);
|
|---|
| 92 |
|
|---|
| 93 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 94 | G4ThreeVector gxx[],
|
|---|
| 95 | G4double distance[],
|
|---|
| 96 | G4int areacode[]);
|
|---|
| 97 |
|
|---|
| 98 | inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p,
|
|---|
| 99 | G4bool isglobal = false) const ;
|
|---|
| 100 |
|
|---|
| 101 | virtual G4ThreeVector SurfacePoint(G4double, G4double,
|
|---|
| 102 | G4bool isGlobal = false) ;
|
|---|
| 103 | virtual G4double GetBoundaryMin(G4double phi) ;
|
|---|
| 104 | virtual G4double GetBoundaryMax(G4double phi) ;
|
|---|
| 105 | virtual G4double GetSurfaceArea() ;
|
|---|
| 106 | virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
|
|---|
| 107 | G4int faces[][4], G4int iside ) ;
|
|---|
| 108 |
|
|---|
| 109 | public: // without description
|
|---|
| 110 |
|
|---|
| 111 | G4TwistTubsSide(__void__&);
|
|---|
| 112 | // Fake default constructor for usage restricted to direct object
|
|---|
| 113 | // persistency for clients requiring preallocation of memory for
|
|---|
| 114 | // persistifiable objects.
|
|---|
| 115 |
|
|---|
| 116 | private:
|
|---|
| 117 |
|
|---|
| 118 | virtual G4double DistanceToPlane(const G4ThreeVector &p,
|
|---|
| 119 | const G4ThreeVector &A,
|
|---|
| 120 | const G4ThreeVector &B,
|
|---|
| 121 | const G4ThreeVector &C,
|
|---|
| 122 | const G4ThreeVector &D,
|
|---|
| 123 | const G4int parity,
|
|---|
| 124 | G4ThreeVector &xx,
|
|---|
| 125 | G4ThreeVector &n);
|
|---|
| 126 |
|
|---|
| 127 | virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
|---|
| 128 | G4bool withTol = true);
|
|---|
| 129 |
|
|---|
| 130 | virtual void SetCorners();
|
|---|
| 131 |
|
|---|
| 132 | virtual void SetCorners( G4double endInnerRad[2],
|
|---|
| 133 | G4double endOuterRad[2],
|
|---|
| 134 | G4double endPhi[2],
|
|---|
| 135 | G4double endZ[2] ) ;
|
|---|
| 136 |
|
|---|
| 137 | virtual void SetBoundaries();
|
|---|
| 138 |
|
|---|
| 139 | private:
|
|---|
| 140 |
|
|---|
| 141 | G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
|
|---|
| 142 | };
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | //========================================================
|
|---|
| 146 | // inline functions
|
|---|
| 147 | //========================================================
|
|---|
| 148 |
|
|---|
| 149 | inline
|
|---|
| 150 | G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector &p,
|
|---|
| 151 | G4bool isglobal) const
|
|---|
| 152 | {
|
|---|
| 153 | // Get Rho at p.z() on Hyperbolic Surface.
|
|---|
| 154 | G4ThreeVector tmpp;
|
|---|
| 155 | if (isglobal) {
|
|---|
| 156 | tmpp = fRot.inverse()*p - fTrans;
|
|---|
| 157 | } else {
|
|---|
| 158 | tmpp = p;
|
|---|
| 159 | }
|
|---|
| 160 | G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
|
|---|
| 161 | if (isglobal) { return (fRot * xx + fTrans); }
|
|---|
| 162 | return xx;
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | inline
|
|---|
| 166 | G4ThreeVector
|
|---|
| 167 | G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal)
|
|---|
| 168 | {
|
|---|
| 169 | G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
|
|---|
| 170 |
|
|---|
| 171 | if (isGlobal) { return (fRot * SurfPoint + fTrans); }
|
|---|
| 172 | return SurfPoint;
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | inline
|
|---|
| 176 | G4double G4TwistTubsSide::GetBoundaryMin(G4double)
|
|---|
| 177 | {
|
|---|
| 178 | return fAxisMin[0] ; // inner radius at z = 0
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | inline
|
|---|
| 182 | G4double G4TwistTubsSide::GetBoundaryMax(G4double)
|
|---|
| 183 | {
|
|---|
| 184 | return fAxisMax[0] ; // outer radius at z = 0
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | inline
|
|---|
| 188 | G4double G4TwistTubsSide::GetSurfaceArea()
|
|---|
| 189 | {
|
|---|
| 190 | // approximation only
|
|---|
| 191 | return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | #endif
|
|---|