////////////////////////////////////////////////////////////////////
/// \class RAT::DS::SOCPMT
///
/// \brief The PMT information useful for the SOC analysis.
///
/// \author P G Jones
///
/// REVISION HISTORY:\n
/// 2 Oct 2012 : P Jones - New File.\n
/// 9 Oct 2013 : J Maneira - methods name changed.\n
/// 12 Feb 2014 : G Prior - changed double for float
/// excepted for centroid/error
/// because FitPMT contains double
/// - changed more method names.\n
/// 2014-04-04 : P Jones - refactor as part of ds review.
/// 2014-10-07 : G. Prior - changed PeakFind return value
///
/// \details This contains the summary information for all the hits
/// on this PMT (lcn) channel.
///
////////////////////////////////////////////////////////////////////
#ifndef __RAT_DS_SOCPMT__
#define __RAT_DS_SOCPMT__
#include
#include
namespace RAT
{
namespace DS
{
class SOCPMT : public TObject
{
public:
/// These are the possible peak finder errors
enum EPeakFindStatus { eSuccess = 0, eTooFewEntries = -1, eNoData = -2, eBoundaryError = -3,
eNoConvergence = -4, ePeakOutsideOfWindow = -5, eUnknown = -10 };
/// Initialise with the id as -1
SOCPMT() : TObject(), lcn(-1), manipTimeOfFlight(0), promptOccupancy(0), tacCentroid(0), tacError(0),
peakFindOk(eUnknown), shadowRelativeOccupancy(0), ropeShadowRelativeOccupancy(0) { }
/// Initialise the SOCPMT with its lcn
///
/// @param[in] id of the pmt, LCN
SOCPMT( UInt_t id ) : TObject(), lcn(id), manipTimeOfFlight(0), promptOccupancy(0), tacCentroid(0), tacError(0),
peakFindOk(eUnknown), shadowRelativeOccupancy(0), ropeShadowRelativeOccupancy(0) { }
/// Set the ID
///
/// @param[in] id of the pmt aka LCN or Logical Channel Number
void SetID( const UInt_t id ) { lcn = id; }
/// Get the ID aka LCN or Logical Channel Number
///
/// @return the pmt ID aka LCN or Logical Channel Number
UInt_t GetID() const { return lcn; }
/// @copydoc GetID()
Int_t GetLCN() const { return lcn; }
/// Add a hit time for this pmt
///
/// @param[in] time in ns
void AddTime( const Float_t time ) { TACs.push_back( time ); }
/// Get the times
///
/// @return a vector of hit times
std::vector GetTimes() const { return TACs; }
/// Add a QHL Charge for this pmt
///
/// @param[in] qhl charge value
void AddQHL( const Float_t qhl ) { QHLs.push_back( qhl ); }
/// Get the QHL Charges
///
/// @return a vector of hit qhl charges
std::vector GetQHLs() const { return QHLs; }
/// Add a QHS Charge for this pmt
///
/// @param[in] qhs charge value
void AddQHS( const Float_t qhs ) { QHSs.push_back( qhs ); }
/// Get the QHS Charges
///
/// @return a vector of hit qhs charges
std::vector GetQHSs() const { return QHSs; }
/// Set the Time Of Flight, TOF, from the manip position
///
/// @param[in] tof value in ns
void SetTOFManipulator( const Float_t tof ) { manipTimeOfFlight = tof; }
/// Get the Time Of Flight, TOF, from the manip position
///
/// @return tof value in ns
Float_t GetTOFManipulator() const { return manipTimeOfFlight; }
/// Set the prompt occupancy, number of hits in +/- 4ns of peak
///
/// @param[in] occupancy as count
void SetPromptOccupancy( const Float_t occupancy ) { promptOccupancy = occupancy; }
/// Get the prompt occupancy, number of hits in +/- 4ns of peak
///
/// @return occupancy as count
Float_t GetPromptOccupancy() const { return promptOccupancy; };
/// Set the relative occupancy of this channel [0,1], 0 fully obscured
///
/// @param[in] occupancy in [0, 1]
void SetShadowRelativeOccupancy( const Float_t occupancy ) { shadowRelativeOccupancy = occupancy; }
/// Get the relative occupancy of this channel [0,1], 0 fully obscured
///
/// @return occupancy in [0, 1]
Float_t GetShadowRelativeOccupancy() const { return shadowRelativeOccupancy; };
/// Set the relative occupancy of this channel w/wo HD ropes [0,1], 0 fully obscured
///
/// @param[in] occupancy in [0, 1]
void SetRopeShadowRelativeOccupancy( const Float_t occupancy ) { ropeShadowRelativeOccupancy = occupancy; }
/// Get the relative occupancy of this channel w/wo HD ropes [0,1], 0 fully obscured
///
/// @return occupancy in [0, 1]
Float_t GetRopeShadowRelativeOccupancy() const { return ropeShadowRelativeOccupancy; };
/// Set the Time centroid, average time of the prompt peak
///
/// @param[in] centroid value in ns
/// @param[in] error with of the prompt peak
void SetTimeCentroid( const Float_t centroid, const Float_t error ) { tacCentroid = centroid; tacError = error; }
/// Get the time centroid
///
/// @return the time centroid
Float_t GetTimeCentroid() const { return tacCentroid; }
/// Get the time centroid error/width
///
/// @return the time centroid error/width
Float_t GetTimeCentroidError() const { return tacError; }
/// Set the peak finding success flag
///
/// @param[in] ok 0 if success
void SetPeakFindOK( const EPeakFindStatus ok ) { peakFindOk = ok; }
/// Get the peak finding success flag
///
/// @return 0 if success
EPeakFindStatus GetPeakFindOK() const { return peakFindOk; };
/// Merge another SOC PMT data into this one, only merges TACs, QHLs, and QHSs
///
/// @param[in] socpmt to merge in
inline void Merge( const SOCPMT& socpmt );
// This ROOT macro adds dictionary methods to this class.
// The number should be incremented whenever this class's members are changed.
// It assumes this class has no virtual methods, use ClassDef if change this.
ClassDefNV(SOCPMT,4);
protected:
std::vector TACs; ///< All hit TAC values
std::vector QHLs; ///< All hit QHL values
std::vector QHSs; ///< All hit QHS values
Int_t lcn; ///< LCN value for this channel
Float_t manipTimeOfFlight; ///< Time of flight to this channel calculated from manip position and light path, using wavelength
Float_t promptOccupancy; ///< Count of hits in +-4ns peak
Double_t tacCentroid; ///< Average time of prompt peak
Double_t tacError; ///< Width of prompt peak
EPeakFindStatus peakFindOk; ///< PeakFinder successful
Float_t shadowRelativeOccupancy; ///< Relative occupancy of this channel [0,1], 0 fully obscured
Float_t ropeShadowRelativeOccupancy; ///< Relative occupancy of this channel w/wo HD ropes [0,1], 0 fully obscured
};
inline void
SOCPMT::Merge( const SOCPMT& socpmt )
{
TACs.insert( TACs.end(), socpmt.TACs.begin(), socpmt.TACs.end() );
QHLs.insert( QHLs.end(), socpmt.QHLs.begin(), socpmt.QHLs.end() );
QHSs.insert( QHSs.end(), socpmt.QHSs.begin(), socpmt.QHSs.end() );
}
} // namespace DS
} // namespace RAT
#endif