/////////////////////////////////////////////////////////////////////////////// /// \class RAT::GeoFactory /// /// \brief Base class for geometry factories. /// /// \author Phil G Jones \n /// \author Aksel Hallin -- contact person /// /// REVISION HISTORY:\n /// 2013-06-21 : P G Jones - New file. \n /// 2017-02-13 : N Barros - Fixed a bunch of warnings caused from this source /// /// \details Base class for geometry factories. This base class has /// functionality to load the geomtry translation and visualisation. /// Additionally it can split solids (do not use if the volume should have /// daughters) and convert direction G4ThreeVectors into G4RotationMatrix's. /// /////////////////////////////////////////////////////////////////////////////// #ifndef __RAT_geo_GeoFactory_hh__ #define __RAT_geo_GeoFactory_hh__ #include #include #include #include #include #include class G4LogicalVolume; class G4VPhysicalVolume; class G4VisAttributes; class G4VSolid; namespace RAT { class GeoFactory { public: /// Invoke construction of table with factory /// /// @param[in] factory name of the factory /// @param[in] table ratdb table defining the factory parameters /// @param[in] checkOverlaps when placing static void ConstructVolume( const std::string& factory, DBLinkPtr table, const bool checkOverlaps ); /// Delete factories stored in the map static void Destruct(); /// Construct a GeoFactory /// /// Initialises the factory by registering it in the map /// /// @param[in] name of the factory GeoFactory( const std::string& name ); virtual ~GeoFactory() {} /// Construct the physical volume /// /// @param[in] table defines the volume /// @param[in] checkOverlaps when placing virtual void Construct( DBLinkPtr table, const bool checkOverlaps ) = 0; /// Build the visualisation properties from the table /// /// @param[in] table that defines the volume /// @return the geant4 visualisation attributes static G4VisAttributes* LoadVisualisation( DBLinkPtr table ); /// Convert a direction vector into a rotation matrix /// /// @param[in] direction the direction /// @return the rotation matrix static G4RotationMatrix* DirectionToRotation( const G4ThreeVector& direction ); protected: /// Return a pair of position + rotation for the volumes' position (correct by the volumes' relative) /// /// @param[in] table that defines the volume /// @return a pair of position and rotation static std::pair LoadTranslation( DBLinkPtr table ); /// Split a solid into two pieces /// /// @param[in] solid to split /// @param[in] name prefix of the solid /// @param[in] zSplit local coord z of split position /// @return a pair of geant4 solids, top and bottom static std::pair SplitSolid( G4VSolid* solid, const std::string& name, const double zSplit ); private: static std::map fsFactories; ///< Map of factories by name }; } //::RAT #endif