| 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: G4CylindricalSurface.hh,v 1.10 2006/06/29 18:39:12 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| 29 | //
|
|---|
| 30 | // ----------------------------------------------------------------------
|
|---|
| 31 | // Class G4CylindricalSurface
|
|---|
| 32 | //
|
|---|
| 33 | // Class Description:
|
|---|
| 34 | //
|
|---|
| 35 | // Definition of a generic cylindrical surface.
|
|---|
| 36 |
|
|---|
| 37 | // The code for G4CylindricalSurface has been derived from the original
|
|---|
| 38 | // implementation in the "Gismo" package.
|
|---|
| 39 | //
|
|---|
| 40 | // Author: A.Breakstone
|
|---|
| 41 | // Adaptation: J.Sulkimo, P.Urban.
|
|---|
| 42 | // Revisions by: L.Broglia, G.Cosmo.
|
|---|
| 43 | // ----------------------------------------------------------------------
|
|---|
| 44 | #ifndef __G4CYLINDERSURFACE_H
|
|---|
| 45 | #define __G4CYLINDERSURFACE_H
|
|---|
| 46 |
|
|---|
| 47 | #include "G4Surface.hh"
|
|---|
| 48 |
|
|---|
| 49 | class G4CylindricalSurface : public G4Surface
|
|---|
| 50 | {
|
|---|
| 51 |
|
|---|
| 52 | public: // with description
|
|---|
| 53 |
|
|---|
| 54 | G4CylindricalSurface();
|
|---|
| 55 | // Default constructor.
|
|---|
| 56 |
|
|---|
| 57 | G4CylindricalSurface( const G4Vector3D& o, const G4Vector3D& a, G4double r );
|
|---|
| 58 | // Normal constructor:
|
|---|
| 59 | // - first argument is the origin of the G4CylindricalSurface
|
|---|
| 60 | // - second argument is the axis of the G4CylindricalSurface
|
|---|
| 61 | // - third argument is the radius of the G4CylindricalSurface.
|
|---|
| 62 |
|
|---|
| 63 | virtual ~G4CylindricalSurface();
|
|---|
| 64 | // Destructor.
|
|---|
| 65 |
|
|---|
| 66 | inline G4int operator==( const G4CylindricalSurface& c ) const;
|
|---|
| 67 | // Equality operator.
|
|---|
| 68 |
|
|---|
| 69 | inline G4String GetEntityType() const;
|
|---|
| 70 | // Returns the shape identifier.
|
|---|
| 71 |
|
|---|
| 72 | virtual const char* NameOf() const;
|
|---|
| 73 | // Returns the class name.
|
|---|
| 74 |
|
|---|
| 75 | virtual void PrintOn( std::ostream& os = G4cout ) const;
|
|---|
| 76 | // Printing function, streaming surface's attributes.
|
|---|
| 77 |
|
|---|
| 78 | virtual G4double HowNear( const G4Vector3D& x ) const;
|
|---|
| 79 | // Returns the distance from a point to a G4CylindricalSurface.
|
|---|
| 80 | // The point x is the (input) argument.
|
|---|
| 81 | // The distance is positive if the point is Inside, negative otherwise.
|
|---|
| 82 |
|
|---|
| 83 | virtual G4Vector3D Normal( const G4Vector3D& p ) const;
|
|---|
| 84 | // Returns the Normal unit vector to a G4CylindricalSurface at a point p
|
|---|
| 85 | // on (or nearly on) the G4CylindricalSurface.
|
|---|
| 86 |
|
|---|
| 87 | virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
|
|---|
| 88 | // Returns the Normal unit vector to the G4CylindricalSurface at a point
|
|---|
| 89 | // p on (or nearly on) the G4CylindricalSurface.
|
|---|
| 90 |
|
|---|
| 91 | virtual G4int Inside( const G4Vector3D& x ) const;
|
|---|
| 92 | // Returns 1 if the point x is Inside the G4CylindricalSurface,
|
|---|
| 93 | // returns 0 otherwise.
|
|---|
| 94 | // Outside means that the distance to the G4CylindricalSurface would
|
|---|
| 95 | // be negative.
|
|---|
| 96 | // Uses the HowNear() function to calculate this distance.
|
|---|
| 97 |
|
|---|
| 98 | virtual G4int WithinBoundary( const G4Vector3D& x ) const;
|
|---|
| 99 | // Function overwritten by finite-sized derived classes which returns
|
|---|
| 100 | // 1 if the point x is within the boundary, 0 otherwise.
|
|---|
| 101 | // Since a G4CylindricalSurface is infinite in extent, the function will
|
|---|
| 102 | // just check if the point is on the G4CylindricalSurface (to the surface
|
|---|
| 103 | // precision).
|
|---|
| 104 |
|
|---|
| 105 | virtual G4double Scale() const;
|
|---|
| 106 | // Function overwritten by finite-sized derived classes which returns
|
|---|
| 107 | // the radius, unless it is zero, in which case it returns the smallest
|
|---|
| 108 | // non-zero dimension.
|
|---|
| 109 | // Used for Scale-invariant tests of surface thickness.
|
|---|
| 110 |
|
|---|
| 111 | G4int Intersect(const G4Ray& ry);
|
|---|
| 112 | // Returns the distance along a Ray (straight line with G4Vector3D) to
|
|---|
| 113 | // leave or enter a G4CylindricalSurface.
|
|---|
| 114 | // If the G4Vector3D of the Ray is opposite to that of the Normal to
|
|---|
| 115 | // the G4CylindricalSurface at the intersection point, it will not leave
|
|---|
| 116 | // the G4CylindricalSurface.
|
|---|
| 117 | // Similarly, if the G4Vector3D of the Ray is along that of the Normal
|
|---|
| 118 | // to the G4CylindricalSurface at the intersection point, it will not enter
|
|---|
| 119 | // the G4CylindricalSurface.
|
|---|
| 120 | // This method is called by all finite shapes sub-classed to
|
|---|
| 121 | // G4CylindricalSurface.
|
|---|
| 122 | // A negative result means no intersection.
|
|---|
| 123 | // If no valid intersection point is found, the distance and intersection
|
|---|
| 124 | // point are set to large numbers.
|
|---|
| 125 |
|
|---|
| 126 | inline G4Vector3D GetAxis() const;
|
|---|
| 127 | inline G4double GetRadius() const;
|
|---|
| 128 | // Return the axis and radius of the G4CylindricalSurface.
|
|---|
| 129 |
|
|---|
| 130 | void SetRadius( G4double r );
|
|---|
| 131 | // Changes the radius of the G4CylindricalSurface.
|
|---|
| 132 | // Requires radius to be non-negative.
|
|---|
| 133 |
|
|---|
| 134 | public: // without description
|
|---|
| 135 |
|
|---|
| 136 | /*
|
|---|
| 137 | virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
|
|---|
| 138 | G4Vector3D& p ) const;
|
|---|
| 139 | // Returns the distance along a Ray to enter or leave a
|
|---|
| 140 | // G4CylindricalSurface. Arguments:
|
|---|
| 141 | // - first (input) argument is +1 to leave or -1 to enter
|
|---|
| 142 | // - second (input) argument is a pointer to the Ray
|
|---|
| 143 | // - third (output) argument returns the intersection point.
|
|---|
| 144 |
|
|---|
| 145 | virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx,
|
|---|
| 146 | G4Vector3D& p ) const;
|
|---|
| 147 | // Returns the distance along a Helix to enter or leave a
|
|---|
| 148 | // G4CylindricalSurface. Arguments:
|
|---|
| 149 | // - first (input) argument is +1 to leave or -1 to enter
|
|---|
| 150 | // - second (input) argument is a pointer to the Helix
|
|---|
| 151 | // - third (output) argument returns the intersection point.
|
|---|
| 152 |
|
|---|
| 153 | virtual void rotate( G4double alpha, G4double beta,
|
|---|
| 154 | G4double gamma, G4ThreeMat& m, G4int inverse );
|
|---|
| 155 | // Rotates the G4CylindricalSurface (the angles are assumed to be given
|
|---|
| 156 | // in radians). Arguments:
|
|---|
| 157 | // - first about global x-axis by angle alpha,
|
|---|
| 158 | // - second about global y-axis by angle beta,
|
|---|
| 159 | // - third about global z-axis by angle gamma
|
|---|
| 160 | // - fourth (output) argument gives the calculated rotation matrix
|
|---|
| 161 | // - fifth (input) argument is an integer flag which if non-zero
|
|---|
| 162 | // reverses the order of the rotations
|
|---|
| 163 |
|
|---|
| 164 | virtual void rotate( G4double alpha, G4double beta,
|
|---|
| 165 | G4double gamma, G4int inverse );
|
|---|
| 166 | // Rotates the G4CylindricalSurface (the angles are assumed to be given
|
|---|
| 167 | // in radians). Arguments:
|
|---|
| 168 | // - first about global x-axis by angle alpha,
|
|---|
| 169 | // - second about global y-axis by angle beta,
|
|---|
| 170 | // - third about global z-axis by angle gamma
|
|---|
| 171 | // - fourth (input) argument is an integer flag which if non-zero
|
|---|
| 172 | // reverses the order of the rotations
|
|---|
| 173 | */
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 | protected: // make available to derived classes
|
|---|
| 177 |
|
|---|
| 178 | G4Vector3D axis;
|
|---|
| 179 | // Direction of axis of G4CylindricalSurface (unit vector).
|
|---|
| 180 |
|
|---|
| 181 | G4double radius;
|
|---|
| 182 | // Radius of G4CylindricalSurface.
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 | private:
|
|---|
| 186 |
|
|---|
| 187 | G4CylindricalSurface(const G4CylindricalSurface&);
|
|---|
| 188 | G4CylindricalSurface& operator=(const G4CylindricalSurface&);
|
|---|
| 189 | // Private copy constructor and assignment operator.
|
|---|
| 190 |
|
|---|
| 191 | /*
|
|---|
| 192 | virtual G4double gropeAlongHelix( const Helix* hx ) const;
|
|---|
| 193 | // Private function to use a crude technique to find the intersection
|
|---|
| 194 | // of a Helix with a G4CylindricalSurface. It returns the turning angle
|
|---|
| 195 | // along the Helix at which the intersection occurs or -1.0 if no
|
|---|
| 196 | // intersection point is found. The argument to the call is the pointer
|
|---|
| 197 | // to the Helix.
|
|---|
| 198 | */
|
|---|
| 199 |
|
|---|
| 200 | };
|
|---|
| 201 |
|
|---|
| 202 | #include "G4CylindricalSurface.icc"
|
|---|
| 203 |
|
|---|
| 204 | #endif
|
|---|
| 205 |
|
|---|