////////////////////////////////////////////////////////////////////
/// \class RAT::DU::Utility
///
/// \brief Return the total transit time given the effective group velocities
///
/// \author Phil G Jones
///
/// REVISION HISTORY:\n
/// - 2014-03-02 : P G Jones - new file
/// - 2016-07-20 : M. Mottram: add ROOT IO constructor for ROOT6 compatibility.
/// - 2017-12-05 : I. Coulter: add ReactorNuOsc
///
/// \details This is the global Utility (data utility) class that
/// contains various useful database derived information classes,
/// e.g. PMT information.
///
/// It can be used in RAT, ROOT or external programs that link to
/// the libRATEvent library.
///
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
/// \namespace RAT::DU
///
/// \brief The Data Utility Namespace
///
/// \details This namespace contains all the classes that make up the
/// data utility. These classes simply ratdb access in both rat and
/// root.
///
////////////////////////////////////////////////////////////////////
#ifndef __RAT_DU_Utility___
#define __RAT_DU_Utility___
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class TRootIOCtor;
namespace RAT
{
namespace DU
{
class Utility : public TObject
{
public:
/// Singleton accessor
///
/// @return pointer to the Utility instance
inline static Utility* Get();
/// Helper method to load and begin a run.
///
/// This initialises the global database for a run and calls the appropriate
/// BeginOfRun methods. This should be used in the absence of a ROOT file to
/// set the global state up for a specific run.
static void LoadDBAndBeginRun();
/// Called at the beginning of the run to load from the database
void BeginOfRun();
/// Get the PMT information
///
/// @return reference to the PMTInfo
const PMTInfo& GetPMTInfo() const { return fPMTInfo; }
/// Get the Panel information
///
/// @return reference to the PanelInfo
const PanelInfo& GetPanelInfo() const { return fPanelInfo; }
/// Get the channel hardware status info (DQXX)
///
/// @return reference to the ChanHWStatus
const ChanHWStatus& GetChanHWStatus() const { return fChanHWStatus; }
/// Get the PMT calibration status
///
/// @return reference to the PMTCalStatus
const PMTCalStatus& GetPMTCalStatus() const { return fPMTCalStatus; }
/// Get the Reactor Anti-nu oscillation state
///
/// @return reference to the ReactorNuOsc
const ReactorNuOsc& GetReactorNuOsc() const { return fReactorNuOsc; }
/// Get the Segmentor
///
/// @return reference to the Segmentor
Segmentor& GetSegmentor() { return fSegmentor; }
/// Get the Light Path information
///
/// @return copy of the Light Path
LightPathCalculator GetLightPathCalculator() { return fLightPathCalculator; }
/// Get the Group Velocity information
///
/// @return reference to the Group Velocity
const GroupVelocity& GetGroupVelocity() const { return fGroupVelocity; }
/// Get the Effective Velocity information
///
/// @return reference to the Effective Velocity
const EffectiveVelocity& GetEffectiveVelocity() const { return fEffectiveVelocity; }
/// Get the data cleaning bit mnemonics
///
/// @return reference to the Data Cleaning bit info
const DataCleaningBits& GetDataCleaningBits() const { return fDataCleaningBits; }
/// Get the data quality bit mnemonics
///
/// @return reference to the Data Cleaning bit info
const DataQualityBits& GetDataQualityBits() const { return fDataQualityBits; }
/// Get the channel software status utility
///
/// @return reference to the Channel Software Status utility
const ChanSWStatus& GetChanSWStatus() const { return fChanSWStatus; }
/// Get the trigger bit mnemonics
///
/// @return reference to the Trigger bit info
const TrigBits& GetTrigBits() const { return fTrigBits; }
/// Get the shadowing utility
///
/// @return reference to the shadowing utility
const ShadowingCalculator& GetShadowingCalculator() const { return fShadowingCalculator; }
/// Get the energy correction utility
///
/// @return reference to the shadowing utility
const ReconCorrector& GetReconCorrector() const { return fReconCorrector; }
// For ROOT6 build
Utility(TRootIOCtor*) : TObject() { };
// 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( Utility, 0 );
private:
PMTInfo fPMTInfo; ///< PMT Information
PanelInfo fPanelInfo; ///< Panel Information
ChanHWStatus fChanHWStatus; ///< Channel Hardware Status information
PMTCalStatus fPMTCalStatus; ///< PMTCal Status information
ReactorNuOsc fReactorNuOsc; ///< Apply reactor anti-nu oscillations
Segmentor fSegmentor; ///< Segmentor
LightPathCalculator fLightPathCalculator; ///< Light Path information
GroupVelocity fGroupVelocity; ///< Group Velocity information
EffectiveVelocity fEffectiveVelocity; ///< Effective Velocity information
DataCleaningBits fDataCleaningBits; ///< Data cleaning bit mnemonics
DataQualityBits fDataQualityBits; ///< Data quality bit mnemonics
ChanSWStatus fChanSWStatus; ///< Channel software status bit mnemonics
TrigBits fTrigBits; ///< Data quality bit mnemonics
ShadowingCalculator fShadowingCalculator; ///< Shadowing utility
ReconCorrector fReconCorrector;
/// Prevent usage of methods below
Utility() : TObject() { };
Utility( Utility& ) : TObject() { }
void operator=( Utility& ) { }
};
inline Utility*
Utility::Get()
{
static Utility utility;
return &utility;
}
} // namespace DU
} // namespace RAT
#endif