| [831] | 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: G4TwistTubsHypeSide.hh,v 1.5 2006/06/29 18:47:56 gunter Exp $
|
|---|
| [850] | 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| [831] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // G4TwistTubsHypeSide
|
|---|
| 36 | //
|
|---|
| 37 | // Class description:
|
|---|
| 38 | //
|
|---|
| 39 | // Class describing a hyperbolic 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 __G4TWISTTUBSHYPESIDE__
|
|---|
| 49 | #define __G4TWISTTUBSHYPESIDE__
|
|---|
| 50 |
|
|---|
| 51 | #include "G4VTwistSurface.hh"
|
|---|
| 52 | #include "G4Integrator.hh"
|
|---|
| 53 | #include "G4SimpleIntegration.hh"
|
|---|
| 54 |
|
|---|
| 55 | class G4TwistTubsHypeSide : public G4VTwistSurface
|
|---|
| 56 | {
|
|---|
| 57 | public: // with description
|
|---|
| 58 |
|
|---|
| 59 | G4TwistTubsHypeSide(const G4String &name,
|
|---|
| 60 | const G4RotationMatrix &rot, // 0.5*(phi-width segment)
|
|---|
| 61 | const G4ThreeVector &tlate,
|
|---|
| 62 | const G4int handedness,// R-hand = 1, L-hand = -1
|
|---|
| 63 | const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
|
|---|
| 64 | const G4double tanstereo, // tan(stereo angle)
|
|---|
| 65 | const G4double r0, // radius at z = 0
|
|---|
| 66 | const EAxis axis0 = kPhi,
|
|---|
| 67 | const EAxis axis1 = kZAxis,
|
|---|
| 68 | G4double axis0min = -kInfinity,
|
|---|
| 69 | G4double axis1min = -kInfinity,
|
|---|
| 70 | G4double axis0max = kInfinity,
|
|---|
| 71 | G4double axis1max = kInfinity);
|
|---|
| 72 |
|
|---|
| 73 | G4TwistTubsHypeSide(const G4String &name,
|
|---|
| 74 | G4double EndInnerRadius[2],
|
|---|
| 75 | G4double EndOuterRadius[2],
|
|---|
| 76 | G4double DPhi,
|
|---|
| 77 | G4double EndPhi[2],
|
|---|
| 78 | G4double EndZ[2],
|
|---|
| 79 | G4double InnerRadius,
|
|---|
| 80 | G4double OuterRadius,
|
|---|
| 81 | G4double Kappa,
|
|---|
| 82 | G4double TanInnerStereo,
|
|---|
| 83 | G4double TanOuterStereo,
|
|---|
| 84 | G4int handedness) ;
|
|---|
| 85 |
|
|---|
| 86 | virtual ~G4TwistTubsHypeSide();
|
|---|
| 87 |
|
|---|
| 88 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 89 | const G4ThreeVector &gv,
|
|---|
| 90 | G4ThreeVector gxx[],
|
|---|
| 91 | G4double distance[],
|
|---|
| 92 | G4int areacode[],
|
|---|
| 93 | G4bool isvalid[],
|
|---|
| 94 | EValidate validate = kValidateWithTol);
|
|---|
| 95 |
|
|---|
| 96 | virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
|---|
| 97 | G4ThreeVector gxx[],
|
|---|
| 98 | G4double distance[],
|
|---|
| 99 | G4int areacode[]);
|
|---|
| 100 |
|
|---|
| 101 | virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
|---|
| 102 | G4bool isGlobal = false) ;
|
|---|
| 103 | virtual EInside Inside(const G4ThreeVector &gp) ;
|
|---|
| 104 |
|
|---|
| 105 | virtual G4double GetRhoAtPZ(const G4ThreeVector &p,
|
|---|
| 106 | G4bool isglobal = false) const ;
|
|---|
| 107 |
|
|---|
| 108 | virtual G4ThreeVector SurfacePoint(G4double, G4double,
|
|---|
| 109 | G4bool isGlobal = false) ;
|
|---|
| 110 | virtual G4double GetBoundaryMin(G4double phi) ;
|
|---|
| 111 | virtual G4double GetBoundaryMax(G4double phi) ;
|
|---|
| 112 | virtual G4double GetSurfaceArea() ;
|
|---|
| 113 | virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
|
|---|
| 114 | G4int faces[][4], G4int iside ) ;
|
|---|
| 115 |
|
|---|
| 116 | public: // without description
|
|---|
| 117 |
|
|---|
| 118 | G4TwistTubsHypeSide(__void__&);
|
|---|
| 119 | // Fake default constructor for usage restricted to direct object
|
|---|
| 120 | // persistency for clients requiring preallocation of memory for
|
|---|
| 121 | // persistifiable objects.
|
|---|
| 122 |
|
|---|
| 123 | private:
|
|---|
| 124 |
|
|---|
| 125 | virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
|---|
| 126 | G4bool withTol = true);
|
|---|
| 127 | virtual G4int GetAreaCodeInPhi(const G4ThreeVector &xx,
|
|---|
| 128 | G4bool withTol = true);
|
|---|
| 129 | virtual void SetCorners();
|
|---|
| 130 |
|
|---|
| 131 | virtual void SetCorners(G4double EndInnerRadius[2],
|
|---|
| 132 | G4double EndOuterRadius[2],
|
|---|
| 133 | G4double DPhi,
|
|---|
| 134 | G4double EndPhi[2],
|
|---|
| 135 | G4double EndZ[2]);
|
|---|
| 136 | virtual void SetBoundaries();
|
|---|
| 137 |
|
|---|
| 138 | private:
|
|---|
| 139 |
|
|---|
| 140 | G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
|
|---|
| 141 | G4double fTanStereo; // std::tan(StereoAngle)
|
|---|
| 142 | G4double fTan2Stereo; // std::tan(StereoAngle)**2
|
|---|
| 143 | G4double fR0; // radius at z = 0
|
|---|
| 144 | G4double fR02; // radius**2 at z = 0
|
|---|
| 145 | G4double fDPhi ; // segment
|
|---|
| 146 |
|
|---|
| 147 | class Insidetype
|
|---|
| 148 | {
|
|---|
| 149 | public:
|
|---|
| 150 | G4ThreeVector gp;
|
|---|
| 151 | EInside inside;
|
|---|
| 152 | };
|
|---|
| 153 | Insidetype fInside;
|
|---|
| 154 | };
|
|---|
| 155 |
|
|---|
| 156 | //========================================================
|
|---|
| 157 | // inline functions
|
|---|
| 158 | //========================================================
|
|---|
| 159 |
|
|---|
| 160 | inline
|
|---|
| 161 | G4double G4TwistTubsHypeSide::GetRhoAtPZ(const G4ThreeVector &p,
|
|---|
| 162 | G4bool isglobal) const
|
|---|
| 163 | {
|
|---|
| 164 | // Get Rho at p.z() on Hyperbolic Surface.
|
|---|
| 165 | G4ThreeVector tmpp;
|
|---|
| 166 | if (isglobal) {
|
|---|
| 167 | tmpp = fRot.inverse()*p - fTrans;
|
|---|
| 168 | } else {
|
|---|
| 169 | tmpp = p;
|
|---|
| 170 | }
|
|---|
| 171 | return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | inline
|
|---|
| 175 | G4ThreeVector G4TwistTubsHypeSide::
|
|---|
| 176 | SurfacePoint(G4double phi , G4double z , G4bool isGlobal)
|
|---|
| 177 | {
|
|---|
| 178 | G4double rho = std::sqrt(fR02 + z * z * fTan2Stereo) ;
|
|---|
| 179 |
|
|---|
| 180 | G4ThreeVector SurfPoint (rho*std::cos(phi), rho*std::sin(phi), z) ;
|
|---|
| 181 |
|
|---|
| 182 | if (isGlobal) { return (fRot * SurfPoint + fTrans); }
|
|---|
| 183 | return SurfPoint;
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | inline
|
|---|
| 187 | G4double G4TwistTubsHypeSide::GetBoundaryMin(G4double z)
|
|---|
| 188 | {
|
|---|
| 189 | G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
|
|---|
| 190 | G4ThreeVector lowerlimit; // lower phi-boundary limit at z = ptmp.z()
|
|---|
| 191 | lowerlimit = GetBoundaryAtPZ(sAxis0 & sAxisMin, ptmp);
|
|---|
| 192 | return std::atan2( lowerlimit.y(), lowerlimit.x() ) ;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | inline
|
|---|
| 196 | G4double G4TwistTubsHypeSide::GetBoundaryMax(G4double z )
|
|---|
| 197 | {
|
|---|
| 198 | G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
|
|---|
| 199 | G4ThreeVector upperlimit; // upper phi-boundary limit at z = ptmp.z()
|
|---|
| 200 | upperlimit = GetBoundaryAtPZ(sAxis0 & sAxisMax, ptmp);
|
|---|
| 201 | return std::atan2( upperlimit.y(), upperlimit.x() ) ;
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | inline
|
|---|
| 205 | G4double G4TwistTubsHypeSide::GetSurfaceArea()
|
|---|
| 206 | {
|
|---|
| 207 | // approximation with tube surface
|
|---|
| 208 |
|
|---|
| 209 | return ( fAxisMax[1] - fAxisMin[1] ) * fR0 * fDPhi ;
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | #endif
|
|---|