////////////////////////////////////////////////////////////////////////
/// \class RAT::GenPMTEff
///
/// \brief Top Level Event Producer - Generate photons for caculating average
//   PMT effectiveness
///
///  \author Bill Heintzelman <billh@hep.upenn.edu>
///
///  REVISION HISTORY\n
///     07-02-2017 - N. Barros - Removed instances of low level generators (now inherited from GLG4Gen)
///                            - Added concrete implementations of BeginOfRUn and EndOfRun
///  \detail This generator creates photons, one per PMT, randomly
///          distributed on the face of the PMT concentrator, with a specified
///          wavelength, angle of incidence and polarization.
///
////////////////////////////////////////////////////////////////////////


#ifndef __RAT_Gen_PMTEff__
#define __RAT_Gen_PMTEff__

#include <RAT/GLG4Gen.hh>
#include <RAT/DB.hh>

class G4ParticleDefinition;

namespace RAT {

class GenPMTEff : public GLG4Gen {
public:
  GenPMTEff();
  virtual ~GenPMTEff();

  virtual void GenerateEvent(G4Event *event);
  virtual bool IsRepeatable() const { return true; };

  virtual void SetState(G4String state);
  virtual G4String GetState() const;

  virtual void ResetTime(double offset=0.0);

  virtual void BeginOfRun();

protected:
  G4String fStateStr;
  double fPhEnergy;     // energy of photons to be generated
  double fIncAngle;     // desired angle of incidence on the concentrator face
  bool fPSenkrecht;     // true if desired polarization relative to the plane
                        // of incidence is senkrecht (perpendicular), false if
                        // parallel
  bool fPrintNOnLine;   // set true initially to print number of tubes on-line
                        // the first time GenerateEvent function is called.

  RAT::DBLinkPtr daqDB;
  double rConc;
};

} // namespace RAT

#endif