////////////////////////////////////////////////////////////////////////
/// \class RAT::PMTVariation
///
/// \brief   PMT by PMT variation parameters
///
/// \author  Phil Jones <p.g.jones@qmul.ac.uk>
/// \author Ashley R. Back <a.r.back@qmul.ac.uk> -- contact person
///
/// REVISION HISTORY:\n
///     2013-12-18 : P.Jones - Refactor to correctly access the database.\n
///
/// \details  Returns the relative efficiency of the PMT as normalised
/// to the detector average.
///
////////////////////////////////////////////////////////////////////////
#ifndef __RAT_PMTVariation_hh__
#define __RAT_PMTVariation_hh__

#include <vector>

namespace RAT
{

class PMTVariation
{
public:
  /// Singleton class instance
  ///
  /// @return pointer to the PMTVariation
  inline static PMTVariation* Get();

  /// Initialise the variation for a new run
  void BeginOfRun();

  /// Get the variation for channel lcn
  ///
  /// @param[in] lcn of the channel
  /// @return the variation of the channel
  double GetVariation( const int lcn ) const;
protected:
  std::vector<double> fPMTVariation; ///< Relative PMT efficiencies

  /// Prevent usage of methods below
  PMTVariation() { }
  PMTVariation( PMTVariation& );
  void operator=( PMTVariation& );
};

inline PMTVariation*
PMTVariation::Get()
{
  static PMTVariation pmtVariation;
  return &pmtVariation;
}


} //::RAT

#endif