Hall C ROOT/C++ Analyzer (hcana)
THcScalerEvtHandler.h
Go to the documentation of this file.
1 #ifndef THcScalerEvtHandler_
2 #define THcScalerEvtHandler_
3 
5 //
6 // THcScalerEvtHandler
7 // Class to handle Hall C scaler events (type 0)
8 // author Edward Brash (brash@jlab.org)
9 // based on THaScalerEvtHandler by Robert Michaels (rom@jlab.org)
10 //
12 
13 #include "THaEvtTypeHandler.h"
14 #include "Decoder.h"
15 #include <string>
16 #include <vector>
17 #include <set>
18 #include "TTree.h"
19 #include "TString.h"
20 #include <cstring>
21 
22 
23 class HCScalerLoc { // Utility class used by THcScalerEvtHandler
24  public:
25  HCScalerLoc(TString nm, TString desc, UInt_t idx, Int_t s1, UInt_t ich,
26  UInt_t iki, Int_t iv) :
27  name(nm), description(desc), index(idx), islot(s1), ichan(ich),
28  ikind(iki), ivar(iv) { };
32 };
33 
34 class THcScalerEvtHandler : public THaEvtTypeHandler {
35 
36 public:
37 
38  THcScalerEvtHandler(const char*, const char*);
39  virtual ~THcScalerEvtHandler();
40 
41  Int_t Analyze(THaEvData *evdata);
42  Int_t AnalyzeBuffer(UInt_t *rdata, Bool_t onlysync);
43  virtual EStatus Init( const TDatime& run_time);
44  virtual Int_t ReadDatabase(const TDatime& date );
45  virtual Int_t End( THaRunBase* r=0 );
46  virtual void SetUseFirstEvent(Bool_t b = kFALSE) {fUseFirstEvent = b;}
47  virtual void SetDelayedType(int evtype);
48  virtual void SetOnlyBanks(Bool_t b = kFALSE) {fOnlyBanks = b;fRocSet.clear();}
49  virtual void SetOnlyUseSyncEvents(Bool_t b=kFALSE) {fOnlySyncEvents = b;}
50 
51 private:
52 
53  void AddVars(TString name, TString desc, UInt_t iscal, UInt_t ichan, UInt_t ikind);
54  void DefVars();
55  static size_t FindNoCase(const std::string& sdata, const std::string& skey);
56 
57  std::vector<Decoder::GenScaler*> scalers;
58  std::vector<HCScalerLoc*> scalerloc;
71  std::vector <std::string> fBCM_Name;
79  std::vector<UInt_t> scal_prev_read;
80  std::vector<UInt_t> scal_present_read;
81  std::vector<UInt_t> scal_overflows;
91  std::vector<UInt_t*> fDelayedEvents;
92  std::set<UInt_t> fRocSet;
93  std::set<UInt_t> fModuleSet;
94 
97 
98  ClassDef(THcScalerEvtHandler,0) // Scaler Event handler
99 
100 };
101 
102 #endif
HCScalerLoc(TString nm, TString desc, UInt_t idx, Int_t s1, UInt_t ich, UInt_t iki, Int_t iv)
std::vector< HCScalerLoc * > scalerloc
std::set< UInt_t > fModuleSet
int Int_t
bool Bool_t
std::vector< std::string > fBCM_Name
std::vector< Decoder::GenScaler * > scalers
virtual Int_t ReadDatabase(const TDatime &date)
std::vector< UInt_t * > fDelayedEvents
virtual void SetDelayedType(int evtype)
#define ClassDef(name, id)
void AddVars(TString name, TString desc, UInt_t iscal, UInt_t ichan, UInt_t ikind)
std::vector< UInt_t > scal_prev_read
std::vector< UInt_t > scal_present_read
ROOT::R::TRInterface & r
unsigned int UInt_t
std::vector< UInt_t > scal_overflows
THcScalerEvtHandler & operator=(const THcScalerEvtHandler &fh)
THcScalerEvtHandler(const char *, const char *)
static size_t FindNoCase(const std::string &sdata, const std::string &skey)
virtual EStatus Init(const TDatime &run_time)
double Double_t
Event handler for Hall C scalers.
virtual Int_t End(THaRunBase *r=0)
std::set< UInt_t > fRocSet
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual void SetOnlyUseSyncEvents(Bool_t b=kFALSE)
Int_t Analyze(THaEvData *evdata)
virtual void SetUseFirstEvent(Bool_t b=kFALSE)
virtual void SetOnlyBanks(Bool_t b=kFALSE)
Int_t AnalyzeBuffer(UInt_t *rdata, Bool_t onlysync)