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 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4CutTubs
 27 //
 28 // Class description:
 29 //
 30 // G4CutTubs is a tube with possible cuts in +-Z.
 31 // Implementation adapted from G4Tubs (subclass of G4Tubs) and
 32 // from TGEo Ctube implementation (by A.Gheata, CERN)
 33 //
 34 // G4CutTubs(pName,pRMin,pRMax,pDZ,pSPhi,pEPhi,pLowNorm,pHighNorm)
 35 //           pName,pRMin,pRMax,pDZ,pSPhi,pEPhi are the same as for G4Tubs,
 36 //           pLowNorm=Outside Normal at -Z
 37 //           pHighNorm=Outsie Normal at +Z.
 38 
 39 // Author: Tatiana Nikitina, CERN
 40 // --------------------------------------------------------------------
 41 
 42 #ifndef G4CUTTUBS_HH
 43 #define G4CUTTUBS_HH
 44 
 45 #include "G4GeomTypes.hh"
 46 
 47 #if defined(G4GEOM_USE_USOLIDS)
 48 #define G4GEOM_USE_UCTUBS 1
 49 #endif
 50 
 51 #if defined(G4GEOM_USE_UCTUBS)
 52   #define G4UCutTubs G4CutTubs
 53   #include "G4UCutTubs.hh"
 54 #else
 55 
 56 #include "G4CSGSolid.hh"
 57 #include "G4Polyhedron.hh"
 58 
 59 class G4CutTubs : public G4CSGSolid
 60 {
 61   public:
 62 
 63     G4CutTubs( const G4String& pName,
 64                      G4double pRMin,
 65                      G4double pRMax,
 66                      G4double pDz,
 67                      G4double pSPhi,
 68                      G4double pDPhi,
 69                      G4ThreeVector pLowNorm,
 70                      G4ThreeVector pHighNorm );
 71       //
 72       // Constructs a tubs with the given name and dimensions
 73 
 74    ~G4CutTubs() override;
 75       //
 76       // Destructor
 77 
 78     // Accessors
 79 
 80     inline G4double GetInnerRadius   () const;
 81     inline G4double GetOuterRadius   () const;
 82     inline G4double GetZHalfLength   () const;
 83     inline G4double GetStartPhiAngle () const;
 84     inline G4double GetDeltaPhiAngle () const;
 85     inline G4double GetSinStartPhi   () const;
 86     inline G4double GetCosStartPhi   () const;
 87     inline G4double GetSinEndPhi     () const;
 88     inline G4double GetCosEndPhi     () const;
 89     inline G4ThreeVector GetLowNorm  () const;
 90     inline G4ThreeVector GetHighNorm () const;
 91 
 92     // Modifiers
 93 
 94     inline void SetInnerRadius   (G4double newRMin);
 95     inline void SetOuterRadius   (G4double newRMax);
 96     inline void SetZHalfLength   (G4double newDz);
 97     inline void SetStartPhiAngle (G4double newSPhi, G4bool trig=true);
 98     inline void SetDeltaPhiAngle (G4double newDPhi);
 99 
100     // Methods for solid
101 
102     G4double GetCubicVolume() override;
103     G4double GetSurfaceArea() override;
104 
105     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
106 
107     G4bool CalculateExtent(const EAxis pAxis,
108                            const G4VoxelLimits& pVoxelLimit,
109                            const G4AffineTransform& pTransform,
110                                  G4double& pmin, G4double& pmax) const override;
111 
112     EInside Inside( const G4ThreeVector& p ) const override;
113 
114     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
115 
116     G4double DistanceToIn(const G4ThreeVector& p,
117                           const G4ThreeVector& v) const override;
118     G4double DistanceToIn(const G4ThreeVector& p) const override;
119     G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
120                            const G4bool calcNorm = false,
121                                  G4bool* validNorm = nullptr,
122                                  G4ThreeVector* n = nullptr) const override;
123     G4double DistanceToOut(const G4ThreeVector& p) const override;
124 
125     G4GeometryType GetEntityType() const override;
126 
127     G4ThreeVector GetPointOnSurface() const override;
128 
129     G4VSolid* Clone() const override;
130 
131     std::ostream& StreamInfo( std::ostream& os ) const override;
132 
133     // Visualisation functions
134 
135     void          DescribeYourselfTo ( G4VGraphicsScene& scene ) const override;
136     G4Polyhedron* CreatePolyhedron () const override;
137 
138     G4CutTubs(__void__&);
139       //
140       // Fake default constructor for usage restricted to direct object
141       // persistency for clients requiring preallocation of memory for
142       // persistifiable objects.
143 
144     G4CutTubs(const G4CutTubs& rhs);
145     G4CutTubs& operator=(const G4CutTubs& rhs);
146       // Copy constructor and assignment operator.
147 
148   protected:
149 
150     inline void Initialize();
151       //
152       // Reset relevant values to zero
153 
154     inline void CheckSPhiAngle(G4double sPhi);
155     inline void CheckDPhiAngle(G4double dPhi);
156     inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
157       //
158       // Reset relevant flags and angle values
159 
160     inline void InitializeTrigonometry();
161       //
162       // Recompute relevant trigonometric values and cache them
163 
164     G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
165       //
166       // Algorithm for SurfaceNormal() following the original
167       // specification for points not on the surface
168 
169     G4bool IsCrossingCutPlanes() const;
170       // Check if the cutted planes are crossing.
171       // If 'true' , solid is ill defined
172 
173     G4double GetCutZ(const G4ThreeVector& p) const;
174       // Get Z value of the point on Cutted Plane
175 
176   private:
177 
178     G4double kRadTolerance, kAngTolerance;
179       //
180       // Radial and angular tolerances
181 
182      G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
183      mutable G4double fZMin, fZMax;
184       //
185       // Radial and angular dimensions
186 
187     G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
188              sinSPhi, cosSPhi, sinEPhi, cosEPhi;
189       //
190       // Cached trigonometric values
191 
192     G4bool fPhiFullCutTube = false;
193       //
194       // Flag for identification of section or full tube
195 
196     G4double halfCarTolerance, halfRadTolerance, halfAngTolerance;
197       //
198       // Cached half tolerance values
199 
200     G4ThreeVector fLowNorm, fHighNorm;
201       //
202       // Normals of Cut at -/+ Dz
203 };
204 
205 #include "G4CutTubs.icc"
206 
207 #endif
208 
209 #endif
210