forked from JeffersonLab/SBS-offline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SBSScalerEvtHandler.h
114 lines (98 loc) · 3.21 KB
/
SBSScalerEvtHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef THcScalerEvtHandler_
#define THcScalerEvtHandler_
/////////////////////////////////////////////////////////////////////
//
// THcScalerEvtHandler
// Class to handle Hall C scaler events (type 0)
// author Edward Brash ([email protected])
// based on THaScalerEvtHandler by Robert Michaels ([email protected])
//
/////////////////////////////////////////////////////////////////////
#include "THaEvtTypeHandler.h"
#include "Decoder.h"
#include <string>
#include <vector>
#include <set>
#include "TTree.h"
#include "TString.h"
#include <cstring>
class TH1D;
class HCScalerLoc { // Utility class used by SBSScalerEvtHandler
public:
HCScalerLoc(TString nm, TString desc, UInt_t idx, Int_t s1, UInt_t ich,
UInt_t iki, Int_t iv) :
name(nm), description(desc), index(idx), islot(s1), ichan(ich),
ikind(iki), ivar(iv) { };
~HCScalerLoc() {}
TString name, description;
UInt_t index, islot, ichan, ikind, ivar;
};
class SBSScalerEvtHandler : public THaEvtTypeHandler {
public:
SBSScalerEvtHandler(const char*, const char*);
virtual ~SBSScalerEvtHandler();
Int_t Analyze(THaEvData *evdata);
Int_t AnalyzeBuffer(UInt_t *rdata, Bool_t onlysync);
virtual Int_t Begin( THaRunBase* r=0 );
virtual EStatus Init( const TDatime& run_time);
virtual Int_t ReadDatabase(const TDatime& date );
virtual Int_t End( THaRunBase* r=0 );
virtual void SetUseFirstEvent(Bool_t b = kFALSE) {fUseFirstEvent = b;}
virtual void SetDelayedType(int evtype);
virtual void SetOnlyBanks(Bool_t b = kFALSE) {fOnlyBanks = b;fRocSet.clear();}
virtual void SetOnlyUseSyncEvents(Bool_t b=kFALSE) {fOnlySyncEvents = b;}
private:
void AddVars(TString name, TString desc, UInt_t iscal, UInt_t ichan, UInt_t ikind);
void DefVars();
static size_t FindNoCase(const std::string& sdata, const std::string& skey);
std::vector<Decoder::GenScaler*> scalers;
std::vector<HCScalerLoc*> scalerloc;
Int_t fNumBCMs;
Double_t *fBCM_Gain;
Double_t *fBCM_Offset;
Double_t *fBCM_SatOffset;
Double_t *fBCM_SatQuadratic;
Double_t *fBCM_delta_charge;
Double_t fTotalTime;
Double_t fDeltaTime;
Double_t fPrevTotalTime;
Double_t fbcm_Current_Threshold;
Double_t fClockFreq;
Int_t fbcm_Current_Threshold_Index;
std::vector <std::string> fBCM_Name;
UInt_t evcount;
Double_t evcountR;
UInt_t evNumber;
Double_t evNumberR;
Int_t Nvars, ifound, fNormIdx, fNormSlot, nscalers;
Double_t *dvars;
UInt_t *dvars_prev_read;
std::vector<UInt_t> scal_prev_read;
std::vector<UInt_t> scal_present_read;
std::vector<UInt_t> scal_overflows;
Double_t *dvarsFirst;
TTree *fScalerTree;
Bool_t fUseFirstEvent;
Bool_t fOnlySyncEvents;
Bool_t fOnlyBanks;
Int_t fDelayedType;
Int_t fClockChan;
UInt_t fLastClock;
Int_t fClockOverflows;
Long64_t fPhysicsEventNumber;
std::vector<UInt_t*> fDelayedEvents;
std::set<UInt_t> fRocSet;
std::set<UInt_t> fModuleSet;
Bool_t fHistosInitialized;
TH1D* fIunserVsTime;
TH1D* fIu1VsTime;
TH1D* fIunewVsTime;
TH1D* fIdnewVsTime;
TH1D* fId1VsTime;
TH1D* fId3VsTime;
TH1D* fId10VsTime;
SBSScalerEvtHandler(const SBSScalerEvtHandler& fh);
SBSScalerEvtHandler& operator=(const SBSScalerEvtHandler& fh);
ClassDef(SBSScalerEvtHandler,0) // Scaler Event handler
};
#endif