29#define USE_CADMESH_ASSIMP_READER
36#include "CLHEP/Units/SystemOfUnits.h"
39 std::unordered_map<std::string,
48 if (thisG4Volume->getSolid() !=
nullptr)
return thisG4Volume->getSolid();
54 G4String g4filename = fileName;
57 std::string extension =
61 if (extension ==
"ply" || extension ==
"stl") {
62 auto mesh = CADMesh::TessellatedMesh::From(g4filename,
63 CADMesh::File::ASSIMP());
66 mesh->SetScale(CLHEP::mm);
69 mesh->SetReverse(
false);
71 thisG4Volume->setSolid(mesh->GetSolid(),
log);
72 return thisG4Volume->getSolid();
76 log->
warning(
"G4CadSystemFactory: file <", fileName,
77 "> has unsupported extension <", extension,
">");
Factory that converts CAD files (PLY / STL) into Geant4 tessellated solids via CADMesh.
G4VSolid * buildSolid(const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s) override
Create (or fetch) a tessellated solid from a CAD file.
G4Volume * getOrCreateG4Volume(const std::string &volume_name, std::unordered_map< std::string, G4Volume * > *g4s)
Get or create a G4Volume wrapper entry in the map.
bool checkSolidDependencies(const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
Check whether all prerequisites to build a solid are satisfied.
Convenience container holding a Geant4 solid, logical, and physical volume.
std::shared_ptr< GLogger > log
void warning(Args &&... args) const
std::string getDescription() const
std::string getG4Name() const
vector< string > getStringVectorFromStringWithDelimiter(const string &input, const string &x)