////////////////////////////////////////////////////////////////////
/// \class RAT::QClusterCut
///
/// \brief  Tries to tag flasher events for data cleaning
///
/// \author Richie Bonventre <rbonv@hep.upenn.edu>
/// \contact Eric Marzec <marzece@hep.upenn.edu>
///
/// REVISION HISTORY:\n
///    31 June 2011 : Richie Bonventre - first version
///    13 Nov 2014 : Eric Marzec - Made myself contact person.
///
///  \details  This processor tags events that are considered
///   "qcluster" events. These are events with a cluster in
///   electronics space of hits related to a high charge hit
///   nearby. They can then be removed from an analysis by
///   setting a data cleaning mask.
///
///
///
///
////////////////////////////////////////////////////////////////////
#ifndef __RAT_QClusterCut__
#define __RAT_QClusterCut__

#include <RAT/Processor.hh>
#include <RAT/DataCleaningProc.hh>
#include <RAT/DS/Entry.hh>

namespace RAT {

  class QClusterCut : public DataCleaningProc {
    public:
      QClusterCut() : DataCleaningProc("qcluster",1){};
      virtual ~QClusterCut(){};
    virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds);
      void BeginOfRun(DS::Run&);

    protected:
      virtual Processor::Result Event(DS::Entry& ds, DS::EV& ev);
      std::vector<int> fBadCrates; ///< List of crates to ignore
      std::vector<int> fBadCards; ///< List of FECs to ignore
      std::vector<int> fBadChans; ///< List of channels to ignore
      int fWindowSize; ///< size of sliding window for cluster identification
      int fMaxHits; ///< max number of hits in sliding window
      int fMaxBad; ///<  threshold of channels with bad charge needed to reject event
      int fCutMode; ///< 1=raw adc only, 2=ped subtracted only, 3=whatevers available

      int fUnCalQHSLow; ///< Charge ranges for calibrated or uncalibrated to consider a hit bad
      int fUnCalQHSHigh;
      int fUnCalQHLLow;
      int fUnCalQHLHigh;
      int fUnCalQLXLow;
      int fUnCalQLXHigh;
      int fCalQHSLow;
      int fCalQHSHigh;
      int fCalQHLLow;
      int fCalQHLHigh;
      int fCalQLXLow;
      int fCalQLXHigh;
  };


} // namespace RAT
#endif