////////////////////////////////////////////////////////////////////
/// \class RAT::DU::EffectiveVelocity
///
/// \brief Return the total transit time given the effective group velocities
///
/// \author Phil G Jones
/// \author Rob Stainforth -- contact person
///
/// REVISION HISTORY:
/// - 21 July 2011 : New File.
/// - 2014-03-01 : P G Jones - refactor as part of ds review, moved from ds.
/// - 2014-07-14 J.R.Wilson - change name of scint volume to inner_av
/// - 2014-04-02 : M Mottram - updated to work with partial fill.
///
///
/// \details This class loads effective velocity information from
/// the database and will calculate the transit time taken given
/// the loaded velocities.
/// It can be used in RAT, ROOT or external programs that link to
/// the libRATEvent library.
///
////////////////////////////////////////////////////////////////////
#ifndef __RAT_DU_EffectiveVelocity__
#define __RAT_DU_EffectiveVelocity__
#include
namespace RAT
{
namespace DU
{
class EffectiveVelocity : public TObject
{
public:
/// Called at the start of a run, loads from the database
void BeginOfRun();
/// Calculate the transit time by distance in the standard 3 SNO+ volumes
///
/// @param[in] distInInnerAV the distance in the scintillator (inner AV) volume
/// @param[in] distInAV the distance in the AV
/// @param[in] distInWater the distance in the water (cavity)
/// @return the transit time
inline double CalcByDistance( const double distInInnerAV, const double distInAV, const double distInWater ) const;
/// Get the inner_av volume effective velocity
///
/// @return the inner_av volume effective velocity
double GetInnerAVVelocity() const { return fInnerAVVelocity; }
/// Get the av volume effective velocity
///
/// @return the av volume effective velocity
double GetAVVelocity() const { return fAVVelocity; }
/// Get the water volume effective velocity
///
/// @return the water volume effective velocity
double GetWaterVelocity() const { return fWaterVelocity; }
/// Get the offset time, represents transit time in PMTs
///
/// @return the offset time
double GetOffset() const { return fOffset; }
// 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( EffectiveVelocity, 0 );
private:
double fInnerAVVelocity; ///< Effective target (inner_av) effective velocity
double fAVVelocity; ///< Effective av effective velocity
double fWaterVelocity; ///< Effective water effective velocity
double fOffset; ///< Offset required from fit, time taken on average in PMT.
};
double
EffectiveVelocity::CalcByDistance( const double distInInnerAV,
const double distInAV,
const double distInWater ) const
{
return distInInnerAV / fInnerAVVelocity + distInAV / fAVVelocity + distInWater / fWaterVelocity + fOffset;
}
} // namespace DU
} // namespace RAT
#endif