////////////////////////////////////////////////////////////////////
/// \class RAT::DU::PanelInfo
///
/// \brief This class holds all information taken from database concerning
/// Panels.
///
/// \author P G Jones
/// \author Christopher Jackson -- contact person
///
/// REVISION HISTORY:\n
/// 15 Apr 2010 : Gabriel Orebi Gann - remove fixed crate/card/channel
/// and CCCnumber arrays, and calculate instead from
/// logical channel number (RAT Panel ID)\n
/// 24 Feb 2011 : Gabriel Orebi Gann - Remove duplicate Panel type arrays
/// (eg IsNormal, IsInvalid etc)
/// and calc all required info from "type" array\n
/// 03 Mar 2011 : Gabriel Orebi Gann - Add methods for butt, neck, fecd
/// (==calib) channels\n
/// 20 Jul 2011 : Andy Mastbaum - Substantial refactoring so that this
/// DS class doesn't contain logic \n
/// 2014-03-01 : P G Jones - Refactor to move to DS::Utilities library.
/// 2015-11-19 : M Mottram - BeginOfRun fixes member vector sizes.
///
/// \details This class loads Panel information from the database and
/// provides accessors to that information in a more convenient
/// format.
/// It can be used in RAT, ROOT or external programs that link to
/// the libRATEvent library.
///
////////////////////////////////////////////////////////////////////
#ifndef __RAT_DU_PanelInfo__
#define __RAT_DU_PanelInfo__
#include
#include
#include
namespace RAT
{
namespace DU
{
class PanelInfo : public TObject
{
public:
/// The possible Panel types in SNO+
enum EPanelType { S7 = 0, S19 = 1, T21 = 2, T14 = 3, T10 = 4 };
/// Called at the start of a run, loads from the database
void BeginOfRun();
/// Get the Panel Type
///
/// @param[in] id of the panel
/// @return the Panel type of panel id
/// @throws out_of_range if the index is out of range
EPanelType GetType( const size_t id ) const { return fTypes.at( id ); }
/// Get the Panel panel number
///
/// @param[in] id of the panel
/// @return the Panel number for the panel
/// @throws out_of_range if the index is out of range
int GetPanelNumber( const size_t id ) const { return fPanels.at( id ); }
/// Get the Panel position
///
/// Is the position of the centre of the panel (see SNO+-doc-375-v2)
///
/// @param[in] id of the panel
/// @return the Panel position
/// @throws out_of_range if the index is out of range
TVector3 GetPosition( const size_t id ) const { return fPositions.at( id ); }
/// Get the Panel direction
///
/// Points from the Panel back face to the Panel front
///
/// @param[in] id of the panel
/// @return the Panel direction
/// @throws out_of_range if the index is out of range
TVector3 GetDirection( const size_t id ) const { return fDirections.at( id ); }
/// Get the total number of Panels in database
///
/// @return the number of Panels
size_t GetCount() const { return fTypes.size(); }
// This ROOT macro adds dictionary methods to this class.
// The number is 0 as this class is never, and should never be written to disc.
// It assumes this class has no virtual methods, use ClassDef if change this.
ClassDefNV( PanelInfo, 0 );
private:
std::vector fPositions; ///< The Panel positions
std::vector fDirections; ///< The Panel Directions
std::vector fTypes; ///< The panel types
std::vector fPanels; ///< The panel panel numbers
};
} // ::DU
} // ::RAT
#endif