Hall A ROOT/C++ Analyzer (podd)
GenScaler.h
Go to the documentation of this file.
1 #ifndef Podd_GenScaler_h_
2 #define Podd_GenScaler_h_
3 
5 //
6 // GenScaler
7 // Generic scaler.
8 //
10 
11 #include "VmeModule.h"
12 #include <vector>
13 
14 namespace Decoder {
15 
16  class GenScaler : public VmeModule {
17 
18  public:
19 
21  fIsDecoded(false), fFirstTime(true), fDeltaT(0.0),
23  fHasClock(false), fClockRate(0.0), fNormScaler(nullptr),
24  firsttime(true), firstwarn(true) {}
25  GenScaler( UInt_t crate, UInt_t slot );
26 
27  using Module::GetData;
28 
29  virtual void Clear( Option_t* opt = "" );
30  virtual Int_t Decode( const UInt_t* evbuffer );
31  virtual UInt_t GetData( UInt_t chan ) const; // Raw scaler counts
32  virtual Bool_t IsSlot( UInt_t rdata );
33  virtual void DoPrint() const;
34 
35  void GenInit();
36  Int_t SetClock( Double_t deltaT, UInt_t clockchan = 0, Double_t clockrate = 0 );
37  Double_t GetRate( UInt_t chan) const; // Scaler rate
38  Double_t GetTimeSincePrev() const; // returns deltaT since last reading
39  Bool_t IsDecoded() const { return fIsDecoded; };
40  void LoadNormScaler(GenScaler *scal); // loads pointer to norm. scaler
41  void DebugPrint(std::ofstream *file=nullptr) const;
42 
43  // Loads sldat
44  virtual UInt_t LoadSlot( THaSlotData *sldat, const UInt_t *evbuffer, const UInt_t *pstop );
45  // Load slot for bank structures
46  virtual UInt_t LoadSlot( THaSlotData *sldat, const UInt_t *evbuffer, UInt_t pos, UInt_t len);
47 
48  virtual void SetBank(Int_t bank);
49 
50 
51  protected:
52 
53  void LoadRates();
54  Bool_t checkchan( UInt_t chan ) const { return (chan < fWordsExpect); }
56  Double_t fDeltaT;
57  std::vector<UInt_t> fDataArray, fPrevData;
58  std::vector<Double_t> fRate;
60  Bool_t fHasClock;
61  Double_t fClockRate;
64  static const UInt_t fgNumChanDefault=32;
65 
66  ClassDef(GenScaler,0) // A generic scaler. Abstract class.
67 
68  };
69 
70 }
71 
72 #endif
virtual void Clear(Option_t *opt="")
Definition: GenScaler.cxx:31
Double_t GetTimeSincePrev() const
Definition: GenScaler.cxx:139
void LoadNormScaler(GenScaler *scal)
Definition: GenScaler.cxx:102
static const UInt_t fgNumChanDefault
Definition: GenScaler.h:64
virtual UInt_t GetData(UInt_t chan) const
Definition: GenScaler.cxx:189
virtual Int_t Decode(const UInt_t *evbuffer)
Definition: GenScaler.cxx:115
UInt_t fClockChan
Definition: GenScaler.h:59
Bool_t IsDecoded() const
Definition: GenScaler.h:39
Bool_t firsttime
Definition: GenScaler.h:63
Definition: GenScaler.h:16
Bool_t fFirstTime
Definition: GenScaler.h:55
Bool_t fIsDecoded
Definition: GenScaler.h:55
Bool_t checkchan(UInt_t chan) const
Definition: GenScaler.h:54
GenScaler * fNormScaler
Definition: GenScaler.h:62
std::vector< Double_t > fRate
Definition: GenScaler.h:58
void LoadRates()
Definition: GenScaler.cxx:169
UInt_t fNumChanShift
Definition: GenScaler.h:59
virtual UInt_t LoadSlot(THaSlotData *sldat, const UInt_t *evbuffer, const UInt_t *pstop)
Definition: GenScaler.cxx:265
Bool_t fHasClock
Definition: GenScaler.h:60
void DebugPrint(std::ofstream *file=nullptr) const
Definition: GenScaler.cxx:216
Bool_t firstwarn
Definition: GenScaler.h:63
Definition: THaSlotData.h:37
std::vector< UInt_t > fPrevData
Definition: GenScaler.h:57
Double_t fDeltaT
Definition: GenScaler.h:56
Definition: VmeModule.h:15
Int_t SetClock(Double_t deltaT, UInt_t clockchan=0, Double_t clockrate=0)
Definition: GenScaler.cxx:65
UInt_t fNumChanMask
Definition: GenScaler.h:59
virtual Bool_t IsSlot(UInt_t rdata)
Definition: GenScaler.cxx:231
Double_t fClockRate
Definition: GenScaler.h:61
virtual void SetBank(Int_t bank)
Definition: GenScaler.cxx:56
UInt_t fWordsExpect
Definition: Module.h:123
GenScaler()
Definition: GenScaler.h:20
Definition: Caen1190Module.cxx:20
void GenInit()
Definition: GenScaler.cxx:37
std::vector< UInt_t > fDataArray
Definition: GenScaler.h:57
Double_t GetRate(UInt_t chan) const
Definition: GenScaler.cxx:197
virtual void DoPrint() const
Definition: GenScaler.cxx:205
virtual UInt_t GetData(UInt_t) const
Definition: Module.h:50