#ifndef ROOT_THaG0HelicityReader
#define ROOT_THaG0HelicityReader

//////////////////////////////////////////////////////////////////////////
//
// THaG0HelicityReader
//
// Routines for decoding G0 helicity hardware
//
//////////////////////////////////////////////////////////////////////////

#include "Rtypes.h"

class THaEvData;
class TDatime;

class THaG0HelicityReader {
  
public:
  THaG0HelicityReader();
  virtual ~THaG0HelicityReader();
  
  Bool_t GetValidTime() const { return fValidTime; }

  // Get ROC helicity information (for debugging)
  Int_t  GetQrt()      const { return fQrt; }
  Int_t  GetGate()     const { return fGate; }
  Int_t  GetReading()  const { return fPresentReading; }

protected:

  // Used by ReadDatabase
  enum EROC { kHel = 0, kTime, kROC2, kROC3 };
  Int_t SetROCinfo( EROC which, Int_t roc, Int_t header, Int_t index );

  virtual void  Clear( Option_t* opt="" );
  virtual Int_t ReadData( const THaEvData& evdata );
  Int_t         ReadDatabase( const char* dbfilename, const char* prefix,
			      const TDatime& date, int debug_flag = 0 );

  Bool_t   fPresentReading;   // Current helicity reading
  Bool_t   fQrt;              // Current QRT
  Bool_t   fGate;             // Current gate

  Double_t fTimestamp;        // Event time from 105 kHz clock
  Double_t fOldT1;            // Last event's timestamps
  Double_t fOldT2;
  Double_t fOldT3;
  Bool_t   fValidTime;        // fTimestamp valid

  // ROC information
  // If a header is zero the index is taken to be from the start of
  // the ROC (0 = first word of ROC), otherwise it's from the header
  // (0 = first word after header).
  struct ROCinfo {
    Int_t  roc;               // ROC to read out
    Int_t  header;            // Headers to search for (0 = ignore)
    Int_t  index;             // Index into buffer
  };
  ROCinfo  fROCinfo[kROC3+1]; // Primary readouts and two redundant clocks

  Int_t    fG0Debug;          // Debug level
  Bool_t   fHaveROCs;         // Required ROCs are defined
  Bool_t   fNegGate;          // Invert polarity of gate, so that 0=active

private:

  static Int_t FindWord( const THaEvData& evdata, const ROCinfo& info );

  ClassDef(THaG0HelicityReader,2) // Helper class for reading G0 helicity data

};

#endif

Last change: Sat Nov 7 21:26:47 2009
Last generated: 2009-11-07 21:26

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.