Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ReflectedSolid Class Reference

#include <G4ReflectedSolid.hh>

+ Inheritance diagram for G4ReflectedSolid:

Public Member Functions

 G4ReflectedSolid (const G4String &pName, G4VSolid *pSolid, const G4Transform3D &transform)
 
virtual ~G4ReflectedSolid ()
 
EInside Inside (const G4ThreeVector &p) const
 
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4double GetCubicVolume ()
 
G4double GetSurfaceArea ()
 
G4ThreeVector GetPointOnSurface () const
 
G4VSolidClone () const
 
virtual G4GeometryType GetEntityType () const
 
virtual const G4ReflectedSolidGetReflectedSolidPtr () const
 
virtual G4ReflectedSolidGetReflectedSolidPtr ()
 
G4VSolidGetConstituentMovedSolid () const
 
G4Transform3D GetTransform3D () const
 
G4Transform3D GetDirectTransform3D () const
 
void SetDirectTransform3D (G4Transform3D &)
 
std::ostream & StreamInfo (std::ostream &os) const
 
 G4ReflectedSolid (const G4ReflectedSolid &rhs)
 
G4ReflectedSolidoperator= (const G4ReflectedSolid &rhs)
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4PolyhedronCreatePolyhedron () const
 
G4PolyhedronGetPolyhedron () const
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
virtual void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
virtual G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
 
virtual EInside Inside (const G4ThreeVector &p) const =0
 
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
 
virtual G4double DistanceToOut (const G4ThreeVector &p) const =0
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const =0
 
virtual G4ThreeVector GetPointOnSurface () const
 
virtual G4VSolidClone () const
 
virtual std::ostream & StreamInfo (std::ostream &os) const =0
 
void DumpInfo () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const =0
 
virtual G4VisExtent GetExtent () const
 
virtual G4PolyhedronCreatePolyhedron () const
 
virtual G4PolyhedronGetPolyhedron () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Protected Attributes

G4VSolidfPtrSolid = nullptr
 
G4Transform3DfDirectTransform3D = nullptr
 
G4bool fRebuildPolyhedron = false
 
G4PolyhedronfpPolyhedron = nullptr
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 

Detailed Description

Definition at line 42 of file G4ReflectedSolid.hh.

Constructor & Destructor Documentation

◆ G4ReflectedSolid() [1/2]

G4ReflectedSolid::G4ReflectedSolid ( const G4String pName,
G4VSolid pSolid,
const G4Transform3D transform 
)

Definition at line 51 of file G4ReflectedSolid.cc.

54 : G4VSolid(pName)
55{
56 fPtrSolid = pSolid;
57 fDirectTransform3D = new G4Transform3D(transform);
58}
HepGeom::Transform3D G4Transform3D
G4Transform3D * fDirectTransform3D

◆ ~G4ReflectedSolid()

G4ReflectedSolid::~G4ReflectedSolid ( )
virtual

Definition at line 63 of file G4ReflectedSolid.cc.

64{
65 delete fDirectTransform3D; fDirectTransform3D = nullptr;
66 delete fpPolyhedron; fpPolyhedron = nullptr;
67}
G4Polyhedron * fpPolyhedron

◆ G4ReflectedSolid() [2/2]

G4ReflectedSolid::G4ReflectedSolid ( const G4ReflectedSolid rhs)

Definition at line 72 of file G4ReflectedSolid.cc.

Member Function Documentation

◆ BoundingLimits()

void G4ReflectedSolid::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 149 of file G4ReflectedSolid.cc.

151{
152 fPtrSolid->BoundingLimits(pMin,pMax);
153 G4double xmin = pMin.x(), ymin = pMin.y(), zmin = pMin.z();
154 G4double xmax = pMax.x(), ymax = pMax.y(), zmax = pMax.z();
158
159 if (std::abs(xx) == 1 && std::abs(yy) == 1 && std::abs(zz) == 1)
160 {
161 // Special case of reflection in axis and pure translation
162 //
163 if (xx == -1) { G4double tmp = -xmin; xmin = -xmax; xmax = tmp; }
164 if (yy == -1) { G4double tmp = -ymin; ymin = -ymax; ymax = tmp; }
165 if (zz == -1) { G4double tmp = -zmin; zmin = -zmax; zmax = tmp; }
166 xmin += fDirectTransform3D->dx();
167 xmax += fDirectTransform3D->dx();
168 ymin += fDirectTransform3D->dy();
169 ymax += fDirectTransform3D->dy();
170 zmin += fDirectTransform3D->dz();
171 zmax += fDirectTransform3D->dz();
172 }
173 else
174 {
175 // Use additional reflection in Z to set up affine transformation
176 //
177 G4Transform3D transform3D = G4ReflectZ3D()*(*fDirectTransform3D);
178 G4AffineTransform transform(transform3D.getRotation().inverse(),
179 transform3D.getTranslation());
180
181 // Find bounding box
182 //
183 G4VoxelLimits unLimit;
184 fPtrSolid->CalculateExtent(kXAxis,unLimit,transform,xmin,xmax);
185 fPtrSolid->CalculateExtent(kYAxis,unLimit,transform,ymin,ymax);
186 fPtrSolid->CalculateExtent(kZAxis,unLimit,transform,zmin,zmax);
187 }
188
189 pMin.set(xmin,ymin,-zmax);
190 pMax.set(xmax,ymax,-zmin);
191
192 // Check correctness of the bounding box
193 //
194 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
195 {
196 std::ostringstream message;
197 message << "Bad bounding box (min >= max) for solid: "
198 << GetName() << " !"
199 << "\npMin = " << pMin
200 << "\npMax = " << pMax;
201 G4Exception("G4ReflectedSolid::BoundingLimits()", "GeomMgt0001",
202 JustWarning, message);
203 DumpInfo();
204 }
205}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
HepGeom::ReflectZ3D G4ReflectZ3D
double G4double
Definition: G4Types.hh:83
double z() const
double x() const
double y() const
void set(double x, double y, double z)
HepRotation inverse() const
G4String GetName() const
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
void DumpInfo() const
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:665
double dy() const
Definition: Transform3D.h:287
double zz() const
Definition: Transform3D.h:281
double dz() const
Definition: Transform3D.h:290
CLHEP::HepRotation getRotation() const
double dx() const
Definition: Transform3D.h:284
CLHEP::Hep3Vector getTranslation() const
double xx() const
Definition: Transform3D.h:257
double yy() const
Definition: Transform3D.h:269
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57

◆ CalculateExtent()

G4bool G4ReflectedSolid::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pMin,
G4double pMax 
) const
virtual

Implements G4VSolid.

Definition at line 212 of file G4ReflectedSolid.cc.

217{
218 // Separation of transformations. Calculation of the extent is done
219 // in a reflection of the global space. In such way, the voxel is
220 // reflected, but the solid is transformed just by G4AffineTransform.
221 // It allows one to use CalculateExtent() of the solid.
222
223 // Reflect voxel limits in Z
224 //
225 G4VoxelLimits limits;
226 limits.AddLimit(kXAxis, pVoxelLimits.GetMinXExtent(),
227 pVoxelLimits.GetMaxXExtent());
228 limits.AddLimit(kYAxis, pVoxelLimits.GetMinYExtent(),
229 pVoxelLimits.GetMaxYExtent());
230 limits.AddLimit(kZAxis,-pVoxelLimits.GetMaxZExtent(),
231 -pVoxelLimits.GetMinZExtent());
232
233 // Set affine transformation
234 //
235 G4Transform3D transform3D = G4ReflectZ3D()*pTransform*(*fDirectTransform3D);
236 G4AffineTransform transform(transform3D.getRotation().inverse(),
237 transform3D.getTranslation());
238
239 // Find extent
240 //
241 if (!fPtrSolid->CalculateExtent(pAxis, limits, transform, pMin, pMax))
242 {
243 return false;
244 }
245 if (pAxis == kZAxis)
246 {
247 G4double tmp= -pMin; pMin= -pMax; pMax= tmp;
248 }
249
250 return true;
251}
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)

◆ Clone()

G4VSolid * G4ReflectedSolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 384 of file G4ReflectedSolid.cc.

385{
386 return new G4ReflectedSolid(*this);
387}

◆ ComputeDimensions()

void G4ReflectedSolid::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 341 of file G4ReflectedSolid.cc.

344{
345 DumpInfo();
346 G4Exception("G4ReflectedSolid::ComputeDimensions()",
347 "GeomMgt0001", FatalException,
348 "Method not applicable in this context!");
349}
@ FatalException

◆ CreatePolyhedron()

G4Polyhedron * G4ReflectedSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 431 of file G4ReflectedSolid.cc.

432{
433 G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
434 if (polyhedron != nullptr)
435 {
436 polyhedron->Transform(*fDirectTransform3D);
437 return polyhedron;
438 }
439 else
440 {
441 std::ostringstream message;
442 message << "Solid - " << GetName()
443 << " - original solid has no" << G4endl
444 << "corresponding polyhedron. Returning NULL!";
445 G4Exception("G4ReflectedSolid::CreatePolyhedron()",
446 "GeomMgt1001", JustWarning, message);
447 return nullptr;
448 }
449}
#define G4endl
Definition: G4ios.hh:57
virtual G4Polyhedron * CreatePolyhedron() const
Definition: G4VSolid.cc:700
HepPolyhedron & Transform(const G4Transform3D &t)

Referenced by GetPolyhedron().

◆ DescribeYourselfTo()

void G4ReflectedSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 421 of file G4ReflectedSolid.cc.

422{
423 scene.AddSolid (*this);
424}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4ReflectedSolid::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 294 of file G4ReflectedSolid.cc.

295{
296 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
297 return fPtrSolid->DistanceToIn(newPoint);
298}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0

◆ DistanceToIn() [2/2]

G4double G4ReflectedSolid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 280 of file G4ReflectedSolid.cc.

282{
283 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
284 G4ThreeVector newDirection = (*fDirectTransform3D)*G4Vector3D(v);
285 return fPtrSolid->DistanceToIn(newPoint,newDirection);
286}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34

◆ DistanceToOut() [1/2]

G4double G4ReflectedSolid::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 330 of file G4ReflectedSolid.cc.

331{
332 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
333 return fPtrSolid->DistanceToOut(newPoint);
334}
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0

◆ DistanceToOut() [2/2]

G4double G4ReflectedSolid::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector n = nullptr 
) const
virtual

Implements G4VSolid.

Definition at line 305 of file G4ReflectedSolid.cc.

310{
311 G4ThreeVector solNorm;
312
313 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
314 G4ThreeVector newDirection = (*fDirectTransform3D)*G4Vector3D(v);
315
316 G4double dist = fPtrSolid->DistanceToOut(newPoint, newDirection,
317 calcNorm, validNorm, &solNorm);
318 if(calcNorm)
319 {
320 *n = (*fDirectTransform3D)*G4Vector3D(solNorm);
321 }
322 return dist;
323}

◆ GetConstituentMovedSolid()

G4VSolid * G4ReflectedSolid::GetConstituentMovedSolid ( ) const

Definition at line 120 of file G4ReflectedSolid.cc.

121{
122 return fPtrSolid;
123}

Referenced by G4tgbGeometryDumper::DumpSolid().

◆ GetCubicVolume()

G4double G4ReflectedSolid::GetCubicVolume ( )
virtual

Reimplemented from G4VSolid.

Definition at line 355 of file G4ReflectedSolid.cc.

356{
357 return fPtrSolid->GetCubicVolume();
358}
virtual G4double GetCubicVolume()
Definition: G4VSolid.cc:188

◆ GetDirectTransform3D()

G4Transform3D G4ReflectedSolid::GetDirectTransform3D ( ) const

Definition at line 133 of file G4ReflectedSolid.cc.

134{
135 G4Transform3D aTransform = *fDirectTransform3D;
136 return aTransform;
137}

◆ GetEntityType()

G4GeometryType G4ReflectedSolid::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 105 of file G4ReflectedSolid.cc.

106{
107 return G4String("G4ReflectedSolid");
108}

Referenced by StreamInfo().

◆ GetPointOnSurface()

G4ThreeVector G4ReflectedSolid::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 374 of file G4ReflectedSolid.cc.

375{
377 return (*fDirectTransform3D)*G4Point3D(p);
378}
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:152

◆ GetPolyhedron()

G4Polyhedron * G4ReflectedSolid::GetPolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 456 of file G4ReflectedSolid.cc.

457{
458 if ((fpPolyhedron == nullptr) || fRebuildPolyhedron ||
461 {
463 fRebuildPolyhedron = false;
464 }
465 return fpPolyhedron;
466}
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4Polyhedron * CreatePolyhedron() const
static G4int GetNumberOfRotationSteps()

◆ GetReflectedSolidPtr() [1/2]

G4ReflectedSolid * G4ReflectedSolid::GetReflectedSolidPtr ( )
virtual

Definition at line 115 of file G4ReflectedSolid.cc.

116{
117 return this;
118}

◆ GetReflectedSolidPtr() [2/2]

const G4ReflectedSolid * G4ReflectedSolid::GetReflectedSolidPtr ( ) const
virtual

Definition at line 110 of file G4ReflectedSolid.cc.

111{
112 return this;
113}

◆ GetSurfaceArea()

G4double G4ReflectedSolid::GetSurfaceArea ( )
virtual

Reimplemented from G4VSolid.

Definition at line 364 of file G4ReflectedSolid.cc.

365{
366 return fPtrSolid->GetSurfaceArea();
367}
virtual G4double GetSurfaceArea()
Definition: G4VSolid.cc:250

◆ GetTransform3D()

G4Transform3D G4ReflectedSolid::GetTransform3D ( ) const

Definition at line 128 of file G4ReflectedSolid.cc.

129{
130 return fDirectTransform3D->inverse();
131}
Transform3D inverse() const
Definition: Transform3D.cc:141

◆ Inside()

EInside G4ReflectedSolid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 257 of file G4ReflectedSolid.cc.

258{
259 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
260 return fPtrSolid->Inside(newPoint);
261}
virtual EInside Inside(const G4ThreeVector &p) const =0

◆ operator=()

G4ReflectedSolid & G4ReflectedSolid::operator= ( const G4ReflectedSolid rhs)

Definition at line 81 of file G4ReflectedSolid.cc.

82{
83 // Check assignment to self
84 //
85 if (this == &rhs) { return *this; }
86
87 // Copy base class data
88 //
90
91 // Copy data
92 //
93 fPtrSolid = rhs.fPtrSolid;
94 delete fDirectTransform3D;
96 fRebuildPolyhedron = false;
97 delete fpPolyhedron; fpPolyhedron = nullptr;
98
99 return *this;
100}
G4VSolid & operator=(const G4VSolid &rhs)
Definition: G4VSolid.cc:107

◆ SetDirectTransform3D()

void G4ReflectedSolid::SetDirectTransform3D ( G4Transform3D transform)

Definition at line 139 of file G4ReflectedSolid.cc.

140{
141 fDirectTransform3D = &transform;
142 fRebuildPolyhedron = true;
143}

◆ StreamInfo()

std::ostream & G4ReflectedSolid::StreamInfo ( std::ostream &  os) const
virtual

Implements G4VSolid.

Definition at line 394 of file G4ReflectedSolid.cc.

395{
396 os << "-----------------------------------------------------------\n"
397 << " *** Dump for Reflected solid - " << GetName() << " ***\n"
398 << " ===================================================\n"
399 << " Solid type: " << GetEntityType() << "\n"
400 << " Parameters of constituent solid: \n"
401 << "===========================================================\n";
403 os << "===========================================================\n"
404 << " Transformations: \n"
405 << " Direct transformation - translation : \n"
406 << " " << fDirectTransform3D->getTranslation() << "\n"
407 << " - rotation : \n"
408 << " ";
410 os << "\n"
411 << "===========================================================\n";
412
413 return os;
414}
std::ostream & print(std::ostream &os) const
Definition: RotationIO.cc:17
virtual G4GeometryType GetEntityType() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0

◆ SurfaceNormal()

G4ThreeVector G4ReflectedSolid::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 268 of file G4ReflectedSolid.cc.

269{
270 G4ThreeVector newPoint = (*fDirectTransform3D)*G4Point3D(p);
271 G4Vector3D normal = fPtrSolid->SurfaceNormal(newPoint);
272 return (*fDirectTransform3D)*normal;
273}
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0

Member Data Documentation

◆ fDirectTransform3D

◆ fpPolyhedron

G4Polyhedron* G4ReflectedSolid::fpPolyhedron = nullptr
mutableprotected

Definition at line 128 of file G4ReflectedSolid.hh.

Referenced by GetPolyhedron(), operator=(), and ~G4ReflectedSolid().

◆ fPtrSolid

◆ fRebuildPolyhedron

G4bool G4ReflectedSolid::fRebuildPolyhedron = false
mutableprotected

Definition at line 127 of file G4ReflectedSolid.hh.

Referenced by GetPolyhedron(), operator=(), and SetDirectTransform3D().


The documentation for this class was generated from the following files: