56#include "G4BooleanSolid.hh"
59#include "G4CutTubs.hh"
60#include "G4DisplacedSolid.hh"
61#include "G4Ellipsoid.hh"
62#include "G4EllipticalTube.hh"
63#include "G4ExtrudedSolid.hh"
64#include "G4GenericTrap.hh"
66#include "G4LogicalVolume.hh"
67#include "G4LogicalVolumeStore.hh"
68#include "G4MultiUnion.hh"
69#include "G4PVDivisionFactory.hh"
70#include "G4PVParameterised.hh"
72#include "G4Paraboloid.hh"
73#include "G4Polycone.hh"
74#include "G4Polyhedra.hh"
75#include "G4ReflectedSolid.hh"
76#include "G4ReplicatedSlice.hh"
77#include "G4ScaledSolid.hh"
79#include "G4SystemOfUnits.hh"
80#include "G4TessellatedSolid.hh"
85#include "G4VPhysicalVolume.hh"
90bool Geant4GM::Factory::fgSurfCheck =
false;
102 fgSurfCheck = surfCheck;
152void Geant4GM::Factory::ImportConstituentSolid(
int index, G4BooleanSolid* solid)
156 G4VSolid* consSolid =
164 std::cout <<
" Imported solid: " << *vgmSolid << std::endl;
166 std::cout <<
" Imported solid: "
167 <<
"0x0" << std::endl;
173void Geant4GM::Factory::ImportConstituentSolid(
int index, G4MultiUnion* solid)
177 G4VSolid* consSolid = solid->GetSolid(index);
180 VGM::ISolid* vgmSolid = ImportSolid(consSolid);
184 std::cout <<
" Imported solid: " << *vgmSolid << std::endl;
186 std::cout <<
" Imported solid: "
187 <<
"0x0" << std::endl;
193VGM::ISolid* Geant4GM::Factory::ImportSolid(G4VSolid* solid)
200 if (importedSolid)
return importedSolid;
204 std::cout <<
"Importing solid: ";
205 if (Debug() > 1) std::cout << solid <<
" ";
206 std::cout << solid->GetName() << std::endl;
209 G4VSolid* consSolid = solid;
213 G4ReflectedSolid* reflSolid =
dynamic_cast<G4ReflectedSolid*
>(solid);
214 if (reflSolid) consSolid = reflSolid->GetConstituentMovedSolid();
216 G4Box* box =
dynamic_cast<G4Box*
>(consSolid);
218 return Register(
new Geant4GM::Box(box, reflSolid));
221 G4Cons* cons =
dynamic_cast<G4Cons*
>(consSolid);
223 return Register(
new Geant4GM::Cons(cons, reflSolid));
226 G4CutTubs* ctubs =
dynamic_cast<G4CutTubs*
>(consSolid);
228 return Register(
new Geant4GM::Ctubs(ctubs, reflSolid));
231 G4Ellipsoid* ellipsoid =
dynamic_cast<G4Ellipsoid*
>(consSolid);
233 return Register(
new Geant4GM::Ellipsoid(ellipsoid, reflSolid));
236 G4EllipticalTube* eltu =
dynamic_cast<G4EllipticalTube*
>(consSolid);
238 return Register(
new Geant4GM::EllipticalTube(eltu, reflSolid));
241 G4ExtrudedSolid* xtru =
dynamic_cast<G4ExtrudedSolid*
>(consSolid);
243 return Register(
new Geant4GM::ExtrudedSolid(xtru, reflSolid));
246 G4GenericTrap* gtrap =
dynamic_cast<G4GenericTrap*
>(consSolid);
248 return Register(
new Geant4GM::Arb8(gtrap, reflSolid));
251 G4Hype* hype =
dynamic_cast<G4Hype*
>(consSolid);
253 return Register(
new Geant4GM::Hype(hype, reflSolid));
256 G4Para* para =
dynamic_cast<G4Para*
>(consSolid);
258 return Register(
new Geant4GM::Para(para, reflSolid));
261 G4Paraboloid* paraboloid =
dynamic_cast<G4Paraboloid*
>(consSolid);
263 return Register(
new Geant4GM::Paraboloid(paraboloid, reflSolid));
266 G4Polycone* polycone =
dynamic_cast<G4Polycone*
>(consSolid);
268 return Register(
new Geant4GM::Polycone(polycone, reflSolid));
271 G4Polyhedra* polyhedra =
dynamic_cast<G4Polyhedra*
>(consSolid);
273 return Register(
new Geant4GM::Polyhedra(polyhedra, reflSolid));
276 G4Sphere* sphere =
dynamic_cast<G4Sphere*
>(consSolid);
278 return Register(
new Geant4GM::Sphere(sphere, reflSolid));
281 G4TessellatedSolid* tessel =
dynamic_cast<G4TessellatedSolid*
>(consSolid);
283 return Register(
new Geant4GM::TessellatedSolid(tessel, reflSolid));
286 G4Torus* torus =
dynamic_cast<G4Torus*
>(consSolid);
288 return Register(
new Geant4GM::Torus(torus, reflSolid));
291 G4Trap* trap =
dynamic_cast<G4Trap*
>(consSolid);
293 return Register(
new Geant4GM::Trap(trap, reflSolid));
296 G4Trd* trd =
dynamic_cast<G4Trd*
>(consSolid);
298 return Register(
new Geant4GM::Trd(trd, reflSolid));
301 G4Tubs* tubs =
dynamic_cast<G4Tubs*
>(consSolid);
303 return Register(
new Geant4GM::Tubs(tubs, reflSolid));
306 G4DisplacedSolid* displaced =
dynamic_cast<G4DisplacedSolid*
>(consSolid);
308 ImportSolid(displaced->GetConstituentMovedSolid());
309 return Register(
new Geant4GM::DisplacedSolid(displaced, reflSolid));
312 G4ScaledSolid* scaled =
dynamic_cast<G4ScaledSolid*
>(consSolid);
314 ImportSolid(scaled->GetUnscaledSolid());
315 return Register(
new Geant4GM::ScaledSolid(scaled, reflSolid));
318 G4BooleanSolid*
boolean =
dynamic_cast<G4BooleanSolid*
>(consSolid);
320 ImportConstituentSolid(0,
boolean);
321 ImportConstituentSolid(1,
boolean);
322 VGM::IBooleanSolid* vgmBoolean =
323 new Geant4GM::BooleanSolid(
boolean, reflSolid);
324 Register(vgmBoolean);
328 std::cout <<
"Imported Boolean solid: ";
329 if (Debug() > 1) std::cout << vgmBoolean;
330 std::cout << std::endl;
332 std::cout << *vgmBoolean << std::endl;
338 G4MultiUnion* multiUnion =
dynamic_cast<G4MultiUnion*
>(consSolid);
340 for (G4int i = 0; i < multiUnion->GetNumberOfSolids(); ++i) {
341 ImportConstituentSolid(i, multiUnion);
343 VGM::IMultiUnion* vgmMultiUnion =
344 new Geant4GM::MultiUnion(multiUnion, reflSolid);
345 Register(vgmMultiUnion);
349 std::cout <<
"Imported MultiUnion solid: ";
350 if (Debug() > 1) std::cout << vgmMultiUnion;
351 std::cout << std::endl;
353 std::cout << *vgmMultiUnion << std::endl;
356 return vgmMultiUnion;
359 std::cerr <<
"Geant4GM::Factory::ImportSolid: " << std::endl;
360 std::cerr <<
"Unsupported solid type (solid \"" << solid->GetName() <<
"\""
361 <<
" type \"" << solid->GetEntityType() <<
"\")" << std::endl;
364 std::cerr <<
"*** Warning: Using a box instead ***" << std::endl;
365 return Register(
new Geant4GM::Box(solid->GetName(),
371 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
377VGM::IVolume* Geant4GM::Factory::ImportLV(G4LogicalVolume* lv)
383 std::cout <<
"Importing LV: " << lv->GetName() << std::endl;
387 VGM::ISolid* solid = ImportSolid(lv->GetSolid());
392 std::cout <<
" Imported solid: " << *solid << std::endl;
394 std::cout <<
" Imported solid: "
395 <<
"0x0" << std::endl;
399 VGM::IVolume* volume =
400 new Geant4GM::Volume(solid, lv, lv->GetMaterial()->GetName());
406VGM::IVolume* Geant4GM::Factory::ImportLV(
407 G4LogicalVolume* lv,
const std::string& mediumName)
413 std::cout <<
"Importing LV: " << lv->GetName() << std::endl;
417 VGM::ISolid* solid = ImportSolid(lv->GetSolid());
420 VGM::IVolume* volume =
new Geant4GM::Volume(solid, lv, mediumName);
426void Geant4GM::Factory::ImportDaughters(G4LogicalVolume* lv)
432 std::cout <<
"ImportDaughters for " << lv->GetName() << std::endl;
444 std::map<std::pair<G4VSolid*, G4Material*>, G4LogicalVolume*> localSolidMaterialStore;
446 for (
size_t i = 0; i < lv->GetNoDaughters(); i++) {
448 G4LogicalVolume* dLV = lv->GetDaughter(i)->GetLogicalVolume();
457 localSolidMaterialStore.insert(
458 std::make_pair(std::make_pair(dLV->GetSolid(), dLV->GetMaterial()), dLV));
461 G4PVParameterised* paraPhysVol =
462 dynamic_cast<G4PVParameterised*
>(lv->GetDaughter(i));
467 std::cout <<
"Processing parameterised daughter " << paraPhysVol->GetName()
468 <<
" (multiplicity = " << paraPhysVol->GetMultiplicity() <<
")"
472 G4LogicalVolume* localLV = paraPhysVol->GetLogicalVolume();
473 std::vector< G4LogicalVolume*> paramVolumes;
476 for (
int k = 0; k < paraPhysVol->GetMultiplicity(); ++k) {
478 G4VPVParameterisation* pParam = paraPhysVol->GetParameterisation();
479 G4VSolid* pSolid = pParam->ComputeSolid(k, paraPhysVol);
480 pSolid->ComputeDimensions(pParam, k, paraPhysVol);
481 G4Material* pMat = pParam->ComputeMaterial(k, paraPhysVol);
485 auto itv = localSolidMaterialStore.find(std::make_pair(pSolid, pMat));
486 if (itv == localSolidMaterialStore.end()) {
490 auto newName = localLV->GetName() +
"_" + std::to_string(k);
494 std::cout <<
" Going to create LV " << newName << std::endl;
497 auto newLV =
new G4LogicalVolume(pSolid, pMat, newName);
498 localSolidMaterialStore.insert(std::make_pair(std::make_pair(pSolid, pMat), newLV));
499 paramVolumes.emplace_back(newLV);
504 auto newName = localLV->GetName() +
"_" + std::to_string(k);
506 std::cout <<
" Skipping creating LV " << newName << std::endl;
508 paramVolumes.emplace_back(itv->second);
517 ImportDaughters(dLV);
523void Geant4GM::Factory::ImportPositions()
529 std::cout <<
"Import positions: " << std::endl;
532 for (
unsigned int i = 0; i < Volumes().size(); i++) {
534 VGM::IVolume* volume = Volumes()[i];
539 std::cout << i <<
"th volume: " << lv->GetName() <<
" ";
541 std::cout <<
" lv: " << lv <<
" "
542 <<
" vgm: " << volume;
543 std::cout << std::endl;
546 for (
size_t id = 0;
id < lv->GetNoDaughters();
id++) {
548 G4VPhysicalVolume* dPV = lv->GetDaughter(
id);
549 G4LogicalVolume* dLV = dPV->GetLogicalVolume();
553 std::cout <<
" " <<
id <<
"th daughter pv = ";
554 if (Debug() > 1) std::cout << dPV <<
" ";
555 std::cout << dPV->GetName() <<
" lv = ";
556 if (Debug() > 1) std::cout << dLV <<
" ";
557 std::cout << dLV->GetName();
563 VGM::IPlacement* dPlacement =
564 new Geant4GM::Placement(dVolume, volume, dPV);
567 std::cout <<
" vgmPl = ";
568 if (Debug() > 1) std::cout << dPlacement <<
" ";
569 std::cout << dPlacement->
Name() <<
" vgmVol = ";
570 if (Debug() > 1) std::cout << dVolume <<
" ";
571 std::cout << dVolume->
Name() << std::endl;
578void Geant4GM::Factory::ImportPositions(G4LogicalVolume* lv)
585 std::cout <<
"ImportPositions for lv " << lv->GetName()
586 <<
" nofDaughters: " << lv->GetNoDaughters() << std::endl;
591 for (
size_t id = 0;
id < lv->GetNoDaughters();
id++) {
593 G4VPhysicalVolume* dPV = lv->GetDaughter(
id);
597 std::cout <<
id <<
"th daugher: " << dPV->GetName() << std::endl;
611 G4LogicalVolume* dLV = dPV->GetLogicalVolume();
615 new Geant4GM::Placement(dVolume, volume, dPV);
618 ImportPositions(dLV);
635VGM::IPlacement* Geant4GM::Factory::ImportPVPair(VGM::IVolume* volume,
636 VGM::IVolume* motherVolume, G4PhysicalVolumesPair pvPair)
638 G4ReflectionFactory* g4ReflectionFactory = G4ReflectionFactory::Instance();
641 G4VPhysicalVolume* pv1 = pvPair.first;
642 G4LogicalVolume* lv1 = pv1->GetLogicalVolume();
648 ImportDaughters(lv1);
649 ImportPositions(lv1);
651 VGM::IPlacement* placement1 =
new Geant4GM::Placement(iv1, motherVolume, pv1);
655 G4VPhysicalVolume* pv2 = pvPair.second;
657 G4LogicalVolume* g4MotherLV =
662 G4LogicalVolume* mlv2 = 0;
663 if (g4ReflectionFactory->IsReflected(g4MotherLV))
664 mlv2 = g4ReflectionFactory->GetConstituentLV(g4MotherLV);
665 if (g4ReflectionFactory->IsConstituent(g4MotherLV))
666 mlv2 = g4ReflectionFactory->GetReflectedLV(g4MotherLV);
669 std::cerr <<
" Geant4GM::Factory::CreatePlacement: " << std::endl;
670 std::cerr <<
" Misundersood G4ReflectionFactory behavior "
672 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
679 std::cerr <<
" Geant4GM::Factory::CreatePlacement: " << std::endl;
680 std::cerr <<
" Missing mapping of existing LV to VGM" << std::endl;
681 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
685 G4LogicalVolume* lv2 = pv2->GetLogicalVolume();
691 ImportDaughters(lv2);
692 ImportPositions(lv2);
694 VGM::IPlacement* placement2 =
new Geant4GM::Placement(iv2, miv2, pv2);
708bool Geant4GM::Factory::SwitchSolid(
709 VGM::IVolume* volume, G4LogicalVolume* g4LV, G4LogicalVolume* g4MotherLV)
717 if (g4LV->GetSolid()->GetEntityType() ==
"G4Cons" &&
718 g4MotherLV->GetSolid()->GetEntityType() ==
"G4Polycone") {
720 G4Cons* cons =
static_cast<G4Cons*
>(g4LV->GetSolid());
721 VGM::ISolid* vgmSolid =
new Geant4GM::Polycone(cons);
722 dynamic_cast<Geant4GM::Volume*
>(volume)->ResetSolid(vgmSolid);
727 if (g4LV->GetSolid()->GetEntityType() ==
"G4Tubs" &&
728 g4MotherLV->GetSolid()->GetEntityType() ==
"G4Polycone") {
730 G4Tubs* tubs =
static_cast<G4Tubs*
>(g4LV->GetSolid());
731 VGM::ISolid* vgmSolid =
new Geant4GM::Polycone(tubs);
732 dynamic_cast<Geant4GM::Volume*
>(volume)->ResetSolid(vgmSolid);
745 G4VPhysicalVolume* worldPV =
static_cast<G4VPhysicalVolume*
>(topVolume);
747 return Import(worldPV);
751bool Geant4GM::Factory::ImportSolid(
void* solid)
755 G4VSolid* g4Solid =
static_cast<G4VSolid*
>(solid);
757 return Import(g4Solid);
761VGM::ISolid* Geant4GM::Factory::Register(VGM::ISolid* vgmSolid)
787 const std::string& name,
double hz, std::vector<VGM::TwoVector> vertices)
796 std::cerr <<
"*** Error: Cannot create Arb8 solid \"" << name
797 <<
"\" in Geant4: it cannot be represented by one or two "
798 "G4GenericTrap solids ***"
801 std::cerr <<
"*** Warning: Using a box instead ***" << std::endl;
805 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
816 const std::string& name,
double hx,
double hy,
double hz)
824 double rout1,
double rin2,
double rout2,
double hz,
double sphi,
double dphi)
828 new Geant4GM::Cons(name, rin1, rout1, rin2, rout2, hz, sphi, dphi));
833 double rout,
double hz,
double sphi,
double dphi,
double nxlow,
double nylow,
834 double nzlow,
double nxhigh,
double nyhigh,
double nzhigh)
837 return Register(
new Geant4GM::Ctubs(name, rin, rout, hz, sphi, dphi, nxlow,
838 nylow, nzlow, nxhigh, nyhigh, nzhigh));
843 double dx,
double dy,
double dz,
double zBottomCut,
double zTopCut)
852 const std::string& name,
double dx,
double dy,
double hz)
860 double r2,
double stereo1,
double stereo2,
double hz)
863 return Register(
new Geant4GM::Hype(name, r1, r2, stereo1, stereo2, hz));
868 double dy,
double dz,
double alpha,
double theta,
double phi)
871 return Register(
new Geant4GM::Para(name, dx, dy, dz, alpha, theta, phi));
876 const std::string& name,
double r1,
double r2,
double hz)
884 double sphi,
double dphi,
int nofZplanes,
double* z,
double* rin,
894 double sphi,
double dphi,
int nofSides,
int nofZplanes,
double* z,
895 double* rin,
double* rout)
899 name, sphi, dphi, nofSides, nofZplanes, z, rin, rout));
904 double rin,
double rout,
double sphi,
double dphi,
double stheta,
914 const std::string& name, std::vector<std::vector<VGM::ThreeVector> > facets)
922 double rout,
double rax,
double sphi,
double dphi)
925 return Register(
new Geant4GM::Torus(name, rin, rout, rax, sphi, dphi));
930 double theta,
double phi,
double dy1,
double dx1,
double dx2,
double alpha1,
931 double dy2,
double dx3,
double dx4,
double alpha2)
935 name, hz, theta, phi, dy1, dx1, dx2, alpha1, dy2, dx3, dx4, alpha2));
940 double hx2,
double hy1,
double hy2,
double hz)
943 return Register(
new Geant4GM::Trd(name, hx1, hx2, hy1, hy2, hz));
948 double rout,
double hz,
double sphi,
double dphi)
951 return Register(
new Geant4GM::Tubs(name, rin, rout, hz, sphi, dphi));
956 std::vector<VGM::TwoVector> polygon,
957 std::vector<std::vector<double> > zsections)
969 std::cerr <<
" Geant4GM::Factory::CreateIntersectionSolid:" << std::endl;
970 std::cerr <<
" Reflection in Boolean solid not supported in Geant4."
972 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
988 std::cerr <<
" Geant4GM::Factory::CreateSubtractionSolid:" << std::endl;
989 std::cerr <<
" Reflection in Boolean solid not supported in Geant4."
991 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1006 std::cerr <<
" Geant4GM::Factory::CreateUnionSolid:" << std::endl;
1007 std::cerr <<
" Reflection in Boolean solid not supported in Geant4."
1009 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1024 std::cerr <<
" Geant4GM::Factory::CreateDisplacedSolid:" << std::endl;
1025 std::cerr <<
" Reflection in Displaced solid not supported in Geant4."
1027 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1042 std::cerr <<
" Geant4GM::Factory::CreateDisplacedSolid:" << std::endl;
1043 std::cerr <<
" Reflection in ScaledSolid solid not supported in Geant4."
1045 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1055 std::vector<VGM::ISolid*> constituents,
1056 std::vector<VGM::Transform> transforms)
1059 std::vector<G4Transform3D> g4Transforms;
1060 for (
auto transform : transforms) {
1062 std::cerr <<
" Geant4GM::Factory::CreateMultiUnion:" << std::endl;
1064 <<
" Reflection in MultiUnion solid is not supported in Geant4."
1066 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1077 const std::string& name,
VGM::ISolid* solid,
const std::string& mediumName)
1083 std::cerr <<
"Geant4GM::Factory::CreateVolume: " << std::endl;
1084 std::cerr <<
" Medium " << mediumName <<
" not found." << std::endl;
1089 std::cerr <<
"Geant4GM::Factory::CreateVolume: " << std::endl;
1090 std::cerr <<
" No material is defined for medium " << mediumName
1094 std::string materialName = material->
Name();
1118 G4LogicalVolume* g4MotherLV =
1123 G4ReflectionFactory* g4ReflectionFactory = G4ReflectionFactory::Instance();
1125 G4PhysicalVolumesPair pvPair =
1127 g4MotherLV,
false, copyNo, fgSurfCheck);
1130 VGM::IPlacement* placement1 = ImportPVPair(volume, motherVolume, pvPair);
1133 if (!motherVolume) {
1137 std::cerr <<
" Geant4GM::Factory::CreatePlacement:" << std::endl;
1138 std::cerr <<
" Top volume defined twice!" << std::endl;
1139 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1151 VGM::Axis axis,
int nofItems,
double width,
double offset,
double halfGap)
1156 if (!motherVolume) {
1157 std::cerr <<
"Geant4GM::Factory::CreateMultiplePlacement: "
1158 <<
" Mother volume not defined!" << std::endl;
1159 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1166 G4LogicalVolume* g4MotherLV =
1173 if (solidType != motherSolidType) {
1174 bool result = SwitchSolid(volume, g4LV, g4MotherLV);
1176 std::cerr <<
" Geant4GM::Factory::CreateMultiplePlacement: "
1178 <<
" Different solid types in volume and mother!"
1180 <<
" volume: " << volume->
Name() <<
" "
1182 <<
" mother: " << motherVolume->
Name() <<
" "
1184 <<
"*** Error: Aborting execution ***" << std::endl;
1194 if (axis ==
VGM::kPhi && offset + nofItems * width > 2 * CLHEP::pi)
1195 offset = offset - 2 * CLHEP::pi;
1198 G4PVDivisionFactory::GetInstance();
1201 G4PhysicalVolumesPair pvPair;
1202 if (halfGap != 0.) {
1203 G4VPhysicalVolume* replicatedSlice =
1204 new G4ReplicatedSlice(name, g4LV, g4MotherLV,
1206 pvPair.first = replicatedSlice;
1212 G4ReflectionFactory* g4ReflectionFactory = G4ReflectionFactory::Instance();
1215 pvPair = g4ReflectionFactory->Divide(name, g4LV, g4MotherLV,
1220 VGM::IPlacement* placement1 = ImportPVPair(volume, motherVolume, pvPair);
1229 const std::vector<VGM::Transform>& transforms,
1230 const std::vector<VGM::IVolume*>& volumes)
1233 bool failure =
false;
1234 std::string failureMessage;
1237 if (!motherVolume) {
1238 failureMessage =
" Mother volume not defined!";
1243 if (transforms.size() != volumes.size()) {
1244 failureMessage =
" Transformations and Volumes vector sizes cannot differ!";
1249 std::cerr <<
" Geant4GM::Factory::CreateParameterisedPlacement:"
1250 << std::endl << failureMessage << std::endl;
1251 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
1255 for (
size_t i = 0; i < transforms.size(); ++i) {
1300 std::cout <<
"Geant4GM::Factory::Import started ...";
1301 if (
Debug() > 1) std::cout << worldPV;
1302 std::cout << std::endl;
1314 G4LogicalVolume* worldLV = worldPV->GetLogicalVolume();
1320 ImportDaughters(worldLV);
1327 std::cout << std::endl;
1338 std::cout <<
"Geant4GM::Factory::Import finished." << std::endl;
1352 std::cout <<
"Geant4GM::Factory::Import of one solid started ...";
1353 if (
Debug() > 1) std::cout << solid;
1354 std::cout << std::endl;
1366 fSolid = ImportSolid(solid);
1370 std::cout <<
"Geant4GM::Factory::Import of one solid finished."
1374 return (fSolid != 0);
VFactory(const std::string &name, VGM::IMaterialFactory *materialFactory)
virtual void PrintSolids() const
Print all solids.
virtual void SetSingleMode(bool singleMode)
Set single mode option.
virtual VGM::IMaterialFactory * MaterialFactory() const
Return the associated material factory.
virtual void PrintVolumes() const
Print all volumes.
virtual bool Ignore() const
Return the ignore option.
virtual VGM::SolidStore & SolidStore()
virtual int Debug() const
Return the debug level.
virtual VGM::VolumeStore & VolumeStore()
static double Length()
Return CLHEP default length unit in VGM units.
static double AxisUnit(VGM::Axis axis)
Convert CLHEP default unit for given axis type in VGM units.
VGM implementation for Geant4 Arb8 solid, the shape is implemented using G4TessellatedSolid,...
static bool IsTwisted(std::vector< VGM::TwoVector > vertices)
static double MaxTwistAngle(const std::vector< VGM::TwoVector > &vertices)
VGM implementation for Geant4 Boolean solid.
static G4VSolid * GetConstituentSolid(int index, G4BooleanSolid *booleanSolid)
VGM implementation for Geant4 box solid.
VGM implementation for Geant4 cons solid.
VGM implementation for cut tubs solid in Geant4.
VGM implementation for Geant4 displaced solid.
VGM implementation for Geant4 ellipsoid solid.
VGM implementation for Geant4 elliptical tube solid.
VGM implementation for Geant4 xtru solid.
virtual VGM::ISolid * CreateTrap(const std::string &name, double hz, double theta, double phi, double dy1, double dx1, double dx2, double alpha1, double dy2, double dx3, double dx4, double alpha2)
Create the trap solid = general trapezoid ( Note that of the 11 parameters described below,...
virtual VGM::ISolid * CreateEllipsoid(const std::string &name, double dx, double dy, double dz, double zBottomCut, double zTopCut)
Create the ellipsoid solid.
virtual VGM::ISolid * CreateScaledSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create scaled solid.
virtual VGM::ISolid * CreateBox(const std::string &name, double hx, double hy, double hz)
Create the box solid.
virtual VGM::ISolid * CreateMultiUnion(const std::string &name, std::vector< VGM::ISolid * > constituents, std::vector< VGM::Transform > transforms)
Create the multi union of solids.
virtual VGM::IPlacement * CreateParameterisedPlacement(const std::string &name, VGM::IVolume *motherVolume, const std::vector< VGM::Transform > &transforms, const std::vector< VGM::IVolume * > &volumes)
Create the parameterised volume placement.
bool Import(G4VPhysicalVolume *topVolume)
virtual VGM::ISolid * SingleSolid() const
Return solid (if in one solid conversion mode).
virtual VGM::ISolid * CreateSphere(const std::string &name, double rin, double rout, double sphi, double dphi, double stheta, double dtheta)
Create the sphere solid = phi segment of a spherical shell.
virtual VGM::ISolid * CreateEllipticalTube(const std::string &name, double dx, double dy, double hz)
Create the elliptical tube solid.
virtual VGM::ISolid * CreateTorus(const std::string &name, double rin, double rout, double rax, double sphi, double dphi)
Create the torus solid = phi segment of a torus.
virtual VGM::ISolid * CreateExtrudedSolid(const std::string &name, std::vector< VGM::TwoVector > polygon, std::vector< std::vector< double > > zsections)
Create the extruded solid.
virtual VGM::ISolid * CreateArb8(const std::string &name, double hz, std::vector< VGM::TwoVector > vertices)
Create the arbitrary trapezoid with 8 vertices standing on two paralel planes perpendicular to Z axis...
virtual VGM::ISolid * CreateTessellatedSolid(const std::string &name, std::vector< std::vector< VGM::ThreeVector > > facets)
Create tessellated solid = solid composed from triangular and rectangular facets.
virtual VGM::ISolid * CreateDisplacedSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create displaced solid.
virtual VGM::ISolid * CreateHype(const std::string &name, double r1, double r2, double stereo1, double stereo2, double hz)
Create the hyperboloid solid.
virtual VGM::IPlacement * Top() const
Return the top volume placement.
virtual VGM::ISolid * CreatePolyhedra(const std::string &name, double sphi, double dphi, int nofSides, int nofZplanes, double *z, double *rin, double *rout)
Create the polyhedra solid = phi segment of a polyhedra (polygone).
virtual VGM::ISolid * CreatePara(const std::string &name, double dx, double dy, double dz, double alpha, double theta, double phi)
Create the para solid = parallelepiped.
virtual VGM::ISolid * CreateIntersectionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the intersection of two solids.
virtual VGM::IPlacement * CreatePlacement(const std::string &name, int copyNo, VGM::IVolume *volume, VGM::IVolume *motherVolume, const VGM::Transform &transform)
Create the simple volume placement.
virtual VGM::ISolid * CreateCons(const std::string &name, double rin1, double rout1, double rin2, double rout2, double hz, double sphi, double dphi)
Create the cons solid = phi segment of a conical tube.
static bool GetSurfCheck()
virtual VGM::ISolid * CreateTrd(const std::string &name, double hx1, double hx2, double hy1, double hy2, double hz)
Create the trd solid = a trapezoid with the x and y dimensions varying along z.
virtual VGM::ISolid * CreateSubtractionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the subtraction of two solids.
virtual void SetSolid(VGM::ISolid *solid)
Set solid (in single mode).
virtual VGM::ISolid * CreateTubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi)
Create the trd solid = phi segment of a tube.
virtual VGM::IPlacement * CreateMultiplePlacement(const std::string &name, VGM::IVolume *volume, VGM::IVolume *motherVolume, VGM::Axis axis, int nofItems, double width, double offset, double halfGap)
Create the multiple volume placement.
virtual VGM::ISolid * CreateUnionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the union of two solids.
virtual VGM::ISolid * CreateCtubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi, double nxlow, double nylow, double nzlow, double nxhigh, double nyhigh, double nzhigh)
Create the cut tubs solid = phi segment of a tube cut with two planes.
virtual VGM::IVolume * CreateVolume(const std::string &name, VGM::ISolid *solid, const std::string &mediumName)
Create the volume.
virtual VGM::ISolid * CreatePolycone(const std::string &name, double sphi, double dphi, int nofZplanes, double *z, double *rin, double *rout)
Create the polycone solid = phi segment of a polycone.
static void SetSurfCheck(bool surfCheck)
G4VPhysicalVolume * World() const
virtual VGM::ISolid * CreateParaboloid(const std::string &name, double r1, double r2, double hz)
Create the paraboloid solid.
VGM implementation for Geant4 hyperboloid solid.
VGM implementation for Geant4 Boolean solid.
VGM implementation for Geant4 para solid.
VGM implementation for Geant4 paraboloid solid.
static PlacementMap * Instance()
void AddPlacement(VGM::IPlacement *, G4VPhysicalVolume *)
G4VPhysicalVolume * GetPlacement(VGM::IPlacement *iPlacement) const
VGM implementation for Geant4 positions of volumes.
static EAxis GetAxis(VGM::Axis axis)
VGM implementation for Geant4 polycone solid.
VGM implementation for Geant4 polyhedra solid.
VGM implementation for Geant4 Scaled solid.
G4VSolid * GetSolid(VGM::ISolid *iSolid) const
static SolidMap * Instance()
VGM implementation for Geant4 sphere solid.
VGM implementation for Geant4 tessellated solid.
VGM implementation for Geant4 torus solid.
VGM implementation for Geant4 trap solid.
VGM implementation for Geant4 trd solid.
VGM implementation for Geant4 tubs solid.
void AddParamVolume(G4LogicalVolume *, const std::vector< G4LogicalVolume * > &)
static VolumeMap * Instance()
G4LogicalVolume * GetVolume(VGM::IVolume *iVolume) const
VGM implementation for Geant4 volume.
The VGM interface to materials.
virtual std::string Name() const =0
Return the name of this element.
The VGM interface to tracking medium.
virtual IMaterial * Material() const =0
Return its associated material.
The VGM interface to positions of volumes.
virtual std::string Name() const =0
Return the name of this placement.
The VGM interface to solids.
virtual SolidType Type() const =0
Return the type of this solid.
The VGM interface to volumes.
virtual ISolid * Solid() const =0
Return the associated solid.
virtual std::string Name() const =0
Return the name of this volume.
virtual std::string MediumName() const =0
Return the name of the associated medium.
void DebugInfo()
Debug printing.
bool HasReflection(const HepGeom::Transform3D &transform)
VGM::Transform Transform(const CLHEP::HepRotation &rotation, const CLHEP::Hep3Vector &translation)
CLHEP::Hep3Vector Translation(const VGM::Transform &transform)
CLHEP::HepRotation Rotation(const VGM::Transform &transform)
HepGeom::Scale3D Scale(const VGM::Transform &transform)
VGM implementation for Geant4.
Arb8SplitResult SplitArb8ForGenericTrap(double halfLength, const std::vector< VGM::TwoVector > &vertices, Arb8Split &split)
Split an Arb8 whose corresponding end edges form angles greater than 90 degrees into two pieces accep...
std::vector< double > Transform
std::string SolidTypeName(VGM::SolidType typeId)
std::vector< IVolume * > VolumeStore
std::vector< ISolid * > SolidStore
Parameters of two G4GenericTrap-compatible pieces obtained by cutting an Arb8 with a plane perpendicu...