Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Orb.hh
Go to the documentation of this file.
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// G4Orb
27//
28// Class description:
29//
30// A G4Orb represents a full sphere; it is a simple case of G4Sphere.
31
32// Author: Vladimir Grichine (CERN), 20.08.2003 - Created
33// Evgueni Tcherniaev (CERN), 08.08.2017 - Revised
34// --------------------------------------------------------------------
35#ifndef G4ORB_HH
36#define G4ORB_HH
37
38#include "G4GeomTypes.hh"
39
40#if defined(G4GEOM_USE_USOLIDS)
41#define G4GEOM_USE_UORB 1
42#endif
43
44#if defined(G4GEOM_USE_UORB)
45 #define G4UOrb G4Orb
46 #include "G4UOrb.hh"
47#else
48
50
51#include "G4CSGSolid.hh"
52#include "G4Polyhedron.hh"
53
54/**
55 * @brief G4Orb represents a full sphere.
56 */
57
58class G4Orb : public G4CSGSolid
59{
60 public:
61
62 /**
63 * Constructs a full sphere, given a name and its radius.
64 * @param[in] pName The name of the solid.
65 * @param[in] pRmax Outer radius.
66 */
67 G4Orb(const G4String& pName, G4double pRmax);
68
69 /**
70 * Default destructor.
71 */
72 ~G4Orb() override = default;
73
74 /**
75 * Accessors and modifiers.
76 */
77 inline G4double GetRadius() const;
79 inline void SetRadius(G4double newRmax);
80
81 /**
82 * Returning an estimation of the solid volume (capacity) and
83 * surface area, in internal units.
84 */
85 G4double GetCubicVolume() override;
86 G4double GetSurfaceArea() override;
87
88 /**
89 * Dispatch method for parameterisation replication mechanism and
90 * dimension computation.
91 */
93 const G4int n,
94 const G4VPhysicalVolume* pRep) override;
95
96 /**
97 * Computes the bounding limits of the solid.
98 * @param[out] pMin The minimum bounding limit point.
99 * @param[out] pMax The maximum bounding limit point.
100 */
101 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
102
103 /**
104 * Calculates the minimum and maximum extent of the solid, when under the
105 * specified transform, and within the specified limits.
106 * @param[in] pAxis The axis along which compute the extent.
107 * @param[in] pVoxelLimit The limiting space dictated by voxels.
108 * @param[in] pTransform The internal transformation applied to the solid.
109 * @param[out] pMin The minimum extent value.
110 * @param[out] pMax The maximum extent value.
111 * @returns True if the solid is intersected by the extent region.
112 */
113 G4bool CalculateExtent(const EAxis pAxis,
114 const G4VoxelLimits& pVoxelLimit,
115 const G4AffineTransform& pTransform,
116 G4double& pmin, G4double& pmax) const override;
117
118 /**
119 * Concrete implementations of the expected query interfaces for
120 * solids, as defined in the base class G4VSolid.
121 */
122 EInside Inside(const G4ThreeVector& p) const override;
123 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
125 const G4ThreeVector& v) const override;
126 G4double DistanceToIn(const G4ThreeVector& p) const override;
128 const G4ThreeVector& v,
129 const G4bool calcNorm = false,
130 G4bool* validNorm = nullptr,
131 G4ThreeVector* n = nullptr) const override;
132 G4double DistanceToOut(const G4ThreeVector& p) const override;
133
134 /**
135 * Returns the type ID, "G4Orb" of the solid.
136 */
137 G4GeometryType GetEntityType() const override;
138
139 /**
140 * Returns a random point located and uniformly distributed on the
141 * surface of the solid.
142 */
143 G4ThreeVector GetPointOnSurface() const override;
144
145 /**
146 * Makes a clone of the object for use in multi-treading.
147 * @returns A pointer to the new cloned allocated solid.
148 */
149 G4VSolid* Clone() const override;
150
151 /**
152 * Streams the object contents to an output stream.
153 */
154 std::ostream& StreamInfo(std::ostream& os) const override;
155
156 /**
157 * Methods for creating graphical representations (i.e. for visualisation).
158 */
159 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
160 G4VisExtent GetExtent() const override;
161 G4Polyhedron* CreatePolyhedron() const override;
162
163 /**
164 * Fake default constructor for usage restricted to direct object
165 * persistency for clients requiring preallocation of memory for
166 * persistifiable objects.
167 */
168 G4Orb(__void__&);
169
170 /**
171 * Copy constructor and assignment operator.
172 */
173 G4Orb(const G4Orb& rhs) = default;
174 G4Orb& operator=(const G4Orb& rhs);
175
176 protected:
177
178 /**
179 * Checks radius and initialises data members. Used in constructor.
180 */
181 void Initialize();
182
183 private:
184
185 G4double fRmax = 0.0;
186 G4double halfRmaxTol = 0.0;
187 G4double sqrRmaxPlusTol = 0.0, sqrRmaxMinusTol = 0.0;
188};
189
190#include "G4Orb.icc"
191
192#endif
193
194#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4CSGSolid(const G4String &pName)
Definition G4CSGSolid.cc:49
G4Polyhedron * CreatePolyhedron() const override
Definition G4Orb.cc:484
G4double GetSurfaceArea() override
Definition G4Orb.cc:460
void Initialize()
Definition G4Orb.cc:102
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
Definition G4Orb.cc:125
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
Definition G4Orb.cc:266
void SetRadius(G4double newRmax)
EInside Inside(const G4ThreeVector &p) const override
Definition G4Orb.cc:244
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
Definition G4Orb.cc:161
G4double GetRadialTolerance() const
G4double GetCubicVolume() override
Definition G4Orb.cc:445
G4double GetRadius() const
std::ostream & StreamInfo(std::ostream &os) const override
Definition G4Orb.cc:410
G4Orb(const G4String &pName, G4double pRmax)
Definition G4Orb.cc:58
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
Definition G4Orb.cc:322
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
Definition G4Orb.cc:255
G4ThreeVector GetPointOnSurface() const override
Definition G4Orb.cc:428
G4GeometryType GetEntityType() const override
Definition G4Orb.cc:392
G4VisExtent GetExtent() const override
Definition G4Orb.cc:479
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
Definition G4Orb.cc:474
G4VSolid * Clone() const override
Definition G4Orb.cc:401
~G4Orb() override=default
G4Orb & operator=(const G4Orb &rhs)
Definition G4Orb.cc:78
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
Definition G4Orb.cc:136
G4Orb(const G4Orb &rhs)=default
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67