///////////////////////////////////////////////////////////////////////////////
/// \class RAT::Detector
///
/// \brief Constructs the detector
///
/// \author Phil G Jones
/// \author Aksel Hallin -- contact person
///
/// REVISION HISTORY:\n
/// 2013-06-20 : P G Jones - New file, code from DetectorConstructor \n
///
/// \details Constructs the detector for Geant4, materials, optics, surfaces
/// and geometry.
///
///////////////////////////////////////////////////////////////////////////////
#ifndef __RAT_Detector_hh__
#define __RAT_Detector_hh__
#include
#include
class G4String;
class G4LogicalVolume;
class G4PhysicalVolume;
namespace RAT
{
class DetectorMessenger;
class Detector : public G4VUserDetectorConstruction
{
public:
/// Find the logical volume by name
///
/// @param[in] volume the name of the volume to find.
/// @return the logical volume if found, NULL if not
static G4LogicalVolume* FindLogicalVolume( const G4String& volume );
/// Find the physical volume by name
///
/// @param[in] volume the name of the volume to find.
/// @param[in] check FIXME add comment here
/// @return the physical volume if found, NULL if not
static G4VPhysicalVolume* FindPhysicalVolume( const G4String& volume,
const bool check=true );
/// Return the world volume
///
/// There can only be one world volume, that returned by this
///
/// @return the physical world volume
static G4VPhysicalVolume* GetWorld() { return FindPhysicalVolume( "world" ); }
/// Return the active volume(s)
///
/// The active volume(s) are those that contain 0, 0, 0 i.e. the origin
/// Note that this volume could be a split volume, hence the plural return.
///
/// @return a vector of physical volumes that are active
static std::vector GetActiveVolumes();
/// Return the number of electrons in the active volumes
///
/// Helper function to return the number of electrons in the active volume(s).
///
/// @return a vector of electron numbers, ordering matches GetActiveVolumes
static std::vector GetActiveElectrons();
/// Construct the Detector, do nothing
Detector();
/// Destruct and delete the existing geometry
virtual ~Detector();
/// Construct the detector
///
/// @return the world physical volume
G4VPhysicalVolume* Construct();
/// Set the check overlaps flag
///
/// @param[in] check value, true or false
void SetCheckOverlaps( const bool check ) { fCheckOverlaps = check; }
private:
/// Clean (delete) the existing geometry
void CleanGeometry();
DetectorMessenger* fMessenger; ///< The detector messenger
bool fCheckOverlaps; ///< If true overlap checking is enabled
};
} //::RAT
#endif