////////////////////////////////////////////////////////////////////////
/// \class RAT::PMTTransitTime
///
/// \brief Calculates front end time for a given hit (photoelectron) time
///
/// \author P G Jones
/// \author Gabriel Orebi Gann -- contact person
///
/// REVISION HISTORY:\n
/// 2013-10-29 : P G Jones - Refactor, code from G O Gann.\n
/// 2016-04-11 : W Heintzelman, add GetTimeLimits and GetIntervalProbability
/// functions, revise comments
/// 2017-10-30 : W Heintzelman - provide for inputs either with or without
/// cable delay to function GetIntervalProbability.
///
/// \details Adds cable delays etc.. to the hit time to give the front
/// end time.
////////////////////////////////////////////////////////////////////////
#ifndef __RAT_PMTTransitTime__
#define __RAT_PMTTransitTime__
#include
#include
#include
namespace RAT
{
class PMTTransitTime
{
public:
/// Singleton class instance
inline static PMTTransitTime* Get();
/// This method initializes the settings from the ratdb
void BeginOfRun();
// Calculate the front end time given the time of photoelectron creation
double CalculateFrontEndTime( const double PETime, const unsigned int pmtID );
// Use a different transit time distribution if we have an HQE PMT
void isHQE( const unsigned int pmtID );
// Return the smallest and largest possible time values, given the input
// probability distribution from the database and the cable delay. (The
// smallest value can be negative.)
void GetTimeLimits(double& smallest, double& largest);
// Return the probability that the time returned by CalculateFrontEndTime
// will be within the interval bounded by ta and tb (i.e., the pdf).
// cableDelay=true to indicate that the input times ta and tb include cable
// delay
double GetIntervalProbability ( double ta, double tb, bool cableDelay=true);
private:
std::vector fX; ///< Sampled delay time distribution, ordinate
std::vector fY; ///< Sampled delay time distribution, abssica
double fCableDelay; ///< The average cable delay
std::vector fX_hqe; ///< Sampled delay time distribution, ordinate
std::vector fY_hqe; ///< Sampled delay time distribution, abssica
std::vector time;
std::vector cdf;
/// Prevent usage of methods below
PMTTransitTime() { };
PMTTransitTime( PMTTransitTime& );
void operator=( PMTTransitTime& );
};
inline PMTTransitTime*
PMTTransitTime::Get()
{
static PMTTransitTime instance;
return &instance;
}
} // namespace RAT
#endif