47 #include "HepPolyhedronProcessor.h"
64 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
65 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
66 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
67 createdDisplacedSolid(false)
82 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
83 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
84 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
85 createdDisplacedSolid(true)
99 G4VSolid(pName), fStatistics(1000000), fCubVolEpsilon(0.001),
100 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
101 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
102 createdDisplacedSolid(true)
114 :
G4VSolid(a), fPtrSolidA(0), fPtrSolidB(0),
115 fStatistics(1000000), fCubVolEpsilon(0.001),
116 fAreaAccuracy(-1.), fCubicVolume(0.), fSurfaceArea(0.),
117 fRebuildPolyhedron(false), fpPolyhedron(0), fPrimitivesSurfaceArea(0.),
118 createdDisplacedSolid(false)
140 :
G4VSolid (rhs), fPtrSolidA(rhs.fPtrSolidA), fPtrSolidB(rhs.fPtrSolidB),
141 fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
142 fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
143 fSurfaceArea(rhs.fSurfaceArea), fRebuildPolyhedron(false), fpPolyhedron(0),
144 createdDisplacedSolid(rhs.createdDisplacedSolid)
157 if (
this == &rhs) {
return *
this; }
193 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
216 G4Exception(
"G4BooleanSolid::GetConstituentSolid()",
238 os <<
"-----------------------------------------------------------\n"
239 <<
" *** Dump for Boolean solid - " <<
GetName() <<
" ***\n"
240 <<
" ===================================================\n"
242 <<
" Parameters of constituent solids: \n"
243 <<
"===========================================================\n";
246 os <<
"===========================================================\n";
256 std::vector<std::pair<G4VSolid *,G4Transform3D>>& primitives,
265 for (
G4int i=0; i<2; i++)
267 transform = curPlacement;
273 while (type ==
"G4DisplacedSolid" ||
274 type ==
"G4ReflectedSolid" ||
275 type ==
"G4ScaledSolid")
277 if (type ==
"G4DisplacedSolid")
284 else if (type ==
"G4ReflectedSolid")
289 else if (type ==
"G4ScaledSolid")
291 transform = transform * ((
G4ScaledSolid*)solid)->GetScaleTransform();
300 if (type ==
"G4UnionSolid" ||
301 type ==
"G4SubtractionSolid" ||
302 type ==
"G4IntersectionSolid" ||
303 type ==
"G4BooleanSolid")
305 ((
G4BooleanSolid *)solid)->GetListOfPrimitives(primitives,transform);
309 primitives.push_back(std::pair<G4VSolid*,G4Transform3D>(solid,transform));
322 std::pair<G4VSolid *, G4Transform3D> prim;
331 for (
G4int i=0; i<nprims; i++)
341 for (
G4int k=0; k<1000000; k++)
345 for (
G4int i=0; i<nprims; i++)
348 area += prim.first->GetSurfaceArea();
349 if (rand < area)
break;
351 p = prim.first->GetPointOnSurface();
355 std::ostringstream message;
356 message <<
"Solid - " <<
GetName() <<
"\n"
357 <<
"All attempts to generate a point on the surface have failed.\n"
358 <<
"Returning point from the last unsuccessful attempt!";
392 HepPolyhedronProcessor::Operation operation;
394 if (type ==
"G4UnionSolid")
395 { operation = HepPolyhedronProcessor::UNION; }
396 else if (type ==
"G4IntersectionSolid")
397 { operation = HepPolyhedronProcessor::INTERSECTION; }
398 else if (type ==
"G4SubtractionSolid")
399 { operation = HepPolyhedronProcessor::SUBTRACTION; }
402 std::ostringstream message;
403 message <<
"Solid - " << solid->
GetName()
404 <<
" - Unrecognised composite solid" <<
G4endl
405 <<
" Returning NULL !";
423 processor.push_back (operation, *operand);
virtual G4Polyhedron * GetPolyhedron() const
virtual G4Polyhedron * GetPolyhedron() const
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
virtual G4GeometryType GetEntityType() const
std::vector< ExP01TrackerHit * > a
HepGeom::Point3D< G4double > G4Point3D
virtual G4GeometryType GetEntityType() const =0
#define G4MUTEX_INITIALIZER
static int operand(pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
G4bool createdDisplacedSolid
virtual std::ostream & StreamInfo(std::ostream &os) const =0
G4double fPrimitivesSurfaceArea
virtual EInside Inside(const G4ThreeVector &p) const =0
void GetListOfPrimitives(std::vector< std::pair< G4VSolid *, G4Transform3D >> &, const G4Transform3D &) const
std::vector< std::pair< G4VSolid *, G4Transform3D > > fPrimitives
std::ostream & StreamInfo(std::ostream &os) const
G4Polyhedron * fpPolyhedron
virtual G4Polyhedron * CreatePolyhedron() const
virtual ~G4BooleanSolid()
virtual const G4VSolid * GetConstituentSolid(G4int no) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual const G4VSolid * GetConstituentSolid(G4int no) const
G4bool fRebuildPolyhedron
G4ThreeVector GetPointOnSurface() const
G4VSolid & operator=(const G4VSolid &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const