////////////////////////////////////////////////////////////////////////
/// \class RAT::PanelBase
///
/// \brief The Base class for panels, all panels inherit this
///
/// \author Phil Jones
/// \author Aksel Hallin -- contact person
///
/// REVISION HISTORY:\n
/// 07/09 : P.Jones - First Revision, new file. \n
/// 10/09 : P.Jones - Removed some overlap issues, second revision. \n
/// 07/11 : P.Jones - Relocated some of the code. \n
/// 07/12 : P.Jones - Refactor to use PANELINFO ratdb. \n
///
/// \details Does most of the work in building the panels, derived classes
/// fill the local position list, edge cut list and build the panel
/// solid.
///
///
////////////////////////////////////////////////////////////////////////
#ifndef __RAT_PanelBase__
#define __RAT_PanelBase__
#include
#include
#include
#include
class G4Material;
class G4LogicalVolume;
class G4VisAttributes;
namespace RAT
{
class EnvelopeConstructor;
class PanelBase
{
public:
class PanelPMT
{
public:
PanelPMT() { fEnvelope = NULL; fID = 0; }
/// Special constructor with only a position specified
PanelPMT( const G4ThreeVector pos ) { fEnvelope = NULL; fID = 0; fPos = pos; }
G4ThreeVector fPos; ///< Local position of pmt
EnvelopeConstructor* fEnvelope; ///< PMT Envelope
int fID; ///< Id of the PMT
};
PanelBase( const std::string& prefix,
const G4ThreeVector& position,
const G4ThreeVector& zAxis,
const G4ThreeVector& xAxis,
G4Material* panelMaterial,
G4VisAttributes* visAttributes );
virtual ~PanelBase();
/// Invokes construction of the panel volumes
///
/// @param[in] checkOverlaps when placing
void Construct( const bool checkOverlaps );
/// Add a pmt into the panel, must check size is correct
void AddPMT( EnvelopeConstructor* pmtEnvelope,
const int pmtID, ///< The pmt id, used to mark the envelope volume
const G4ThreeVector& globalPosition,
const G4ThreeVector& globalDirection ///< Used for testing
);
/// Fills in the rotation matrix and position matrix for the panel
void GetRotationAndPosition( G4RotationMatrix* rotationMatrix,
G4ThreeVector* position );
/// Returns the panel logical volume
G4LogicalVolume* GetLogicalVolume();
protected:
/// Constructs the panel volume
virtual void ConstructPanel() = 0;
/// Place the PMTs into the panel volume
///
/// @param[in] checkOverlaps when placing
void PlacePMTs( const bool checkOverlaps );
/// Cut out missing PMT spots
void CutPMTs();
/// Cut out the edge (part of panel volume building )
void CutEdge();
std::vector< PanelPMT > fPMTs; ///< vector of pmts
std::vector< G4ThreeVector > fEdgeCoords; ///< Local coords for the edge cutting
std::string fPrefix; ///< Panel Prefix
G4VisAttributes* fVisAttributes; ///< Visualisation attributes
G4ThreeVector fPanelXaxis; ///< In Global Co-ords
G4ThreeVector fPanelYaxis; ///< In Global Co-ords
G4ThreeVector fPanelZaxis; ///< In Global Co-ords
G4ThreeVector fPanelOrigin; ///< In Global Co-ords
G4Material* fPanelMaterial; ///< Panel Material
G4LogicalVolume* fPanelLogical; ///< Logical Volume of the panel
double fPMTRotation; ///< Z rotation of the pmts in this panel
double fPanelHeight; ///< Height of the panel (max height of the PMTs)
double fPanelDepth; ///< Depth of the panel (max depth of the PMTs)
//Helpful Numbers
const static double fPMTRadius; ///< Standard panel pmt radius
const static double fPMTb; ///< Standard panel b dimension
const static double fPMTc; ///< Standard panel c dimension
const static double fPMTd; ///< Standard panel d dimension
private:
/// Ensures panel is constructed with all the information
PanelBase();
};
} //::RAT
#endif