24#include "G4BooleanSolid.hh"
25#include "G4DisplacedSolid.hh"
26#include "G4IntersectionSolid.hh"
27#include "G4ReflectedSolid.hh"
28#include "G4SubtractionSolid.hh"
29#include "G4UnionSolid.hh"
34 CLHEP::HepRotation* rotation,
const CLHEP::Hep3Vector& translation)
54 fBooleanSolid =
new G4IntersectionSolid(
55 name, g4SolidA, g4SolidB, rotation, translation);
60 new G4SubtractionSolid(name, g4SolidA, g4SolidB, rotation, translation);
65 new G4UnionSolid(name, g4SolidA, g4SolidB, rotation, translation);
70 std::cerr <<
" Geant4GM::BooleanSolid::BooleanSolid:" << std::endl;
71 std::cerr <<
" Unknown Boolean solid type (solid \"" << name <<
"\")"
73 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
82 G4BooleanSolid* booleanSolid, G4ReflectedSolid* reflectedBoolean)
86 fBooleanSolid(booleanSolid),
91 if (reflectedBoolean) {
92 fToBeReflected =
true;
101 :
VGM::ISolid(),
VGM::IBooleanSolid(),
BaseVGM::VBooleanSolid()
108 :
VGM::ISolid(rhs),
VGM::IBooleanSolid(rhs),
BaseVGM::VBooleanSolid(rhs)
124const G4DisplacedSolid* Geant4GM::BooleanSolid::DisplacedSolid()
const
129 G4VSolid* g4SolidB = fBooleanSolid->GetConstituentSolid(1);
130 return g4SolidB->GetDisplacedSolidPtr();
143 return fBooleanSolid->GetName();
152 if (fBooleanSolid->GetEntityType() ==
"G4IntersectionSolid")
155 if (fBooleanSolid->GetEntityType() ==
"G4SubtractionSolid")
158 if (fBooleanSolid->GetEntityType() ==
"G4UnionSolid")
return VGM::kUnion;
169 G4VSolid* g4SolidA = GetConstituentSolid(0, fBooleanSolid);
181 G4VSolid* g4SolidB = GetConstituentSolid(1, fBooleanSolid);
196 if (g4DisplacedSolid) {
198 g4DisplacedSolid->GetObjectTranslation());
206 int index, G4BooleanSolid* booleanSolid)
213 G4VSolid* consSolid = booleanSolid->GetConstituentSolid(index);
214 if (index == 0)
return consSolid;
216 G4DisplacedSolid* displacedSolid = consSolid->GetDisplacedSolidPtr();
217 if (displacedSolid) consSolid = displacedSolid->GetConstituentMovedSolid();
VGM implementation for Geant4 Boolean solid.
virtual VGM::ISolid * ConstituentSolidA() const
Return the first constituent solid.
virtual std::string Name() const
Return the name of this solid.
virtual VGM::Transform Displacement() const
Return the 3D displacement of the second constituent solid with respect to the first one.
static G4VSolid * GetConstituentSolid(int index, G4BooleanSolid *booleanSolid)
virtual VGM::BooleanType BoolType() const
Return the Boolean type of this solid.
virtual VGM::ISolid * ConstituentSolidB() const
Return the second constituent solid.
VGM implementation for Geant4 displaced solid.
G4VSolid * GetSolid(VGM::ISolid *iSolid) const
static SolidMap * Instance()
void AddSolid(VGM::ISolid *, G4VSolid *)
The VGM interface to solids.
VGM::Transform Transform(const CLHEP::HepRotation &rotation, const CLHEP::Hep3Vector &translation)
std::vector< double > Transform