forked from JeffersonLab/SBS-offline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LHRSScalerEvtHandler.h
94 lines (75 loc) · 2.58 KB
/
LHRSScalerEvtHandler.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
#ifndef LHRSScalerEvtHandler_H
#define LHRSScalerEvtHandler_H
///////////////////////////////////////////////////////////////////
//
// LHRSScalerEvtHandler
// Class to handle Hall A scaler events (type 140)
// Adapted by David Flay ([email protected]), based on code from:
// - THaEvtHandler (author Robert Michaels, [email protected] )
// - TriScalerEvtHandler (author Hanjie Liu, [email protected] )
//
/////////////////////////////////////////////////////////////////////
#include "THaEvtTypeHandler.h"
#include "Decoder.h"
#include <string>
#include <vector>
#include "TTree.h"
#include "TString.h"
class ScalerVar { // Utility class used by LHRSScalerEvtHandler
public:
ScalerVar(TString nm, TString desc, Int_t idx, Int_t sl, Int_t ich, Int_t iki) :
name(nm), description(desc), index(idx), islot(sl), ichan(ich), ikind(iki) { };
~ScalerVar();
TString name, description;
UInt_t index, islot, ichan, ivar, ikind;
Bool_t found;
};
class LHRSScalerEvtHandler : public THaEvtTypeHandler {
public:
LHRSScalerEvtHandler(const char* name, const char* description);
virtual ~LHRSScalerEvtHandler();
virtual Int_t Analyze(THaEvData *evdata);
virtual EStatus Init( const TDatime& run_time);
virtual Int_t End( THaRunBase* r=0 );
private:
void AddVars(TString name, TString desc, Int_t iscal, Int_t ichan, Int_t ikind);
void DefVars();
Int_t ParseData(char *msg,std::string *word,UInt_t *word_int);
Int_t AnalyzeBuffer(Int_t ndata,UInt_t *rdata);
Int_t ReadDatabase(const TDatime& date);
std::vector<Decoder::GenScaler*> scalers;
std::vector<ScalerVar*> scalerloc;
Double_t evcount;
UInt_t *rdata;
Int_t fNormIdx, fNormSlot;
Double_t *dvars;
TTree *fScalerTree;
// added by D Flay
Bool_t fUseFirstEvent;
Int_t fClockChan;
Double_t fClockFreq;
UInt_t fLastClock;
Int_t fClockOverflows;
Double_t fTotalTime;
Double_t fPrevTotalTime;
Double_t fDeltaTime;
Double_t *dvarsFirst;
UInt_t *dvars_prev_read;
Long64_t fPhysicsEventNumber;
Int_t fNumBCMs;
Int_t fbcm_Current_Threshold_Index;
Double_t fbcm_Current_Threshold;
Double_t *fBCM_Gain;
Double_t *fBCM_Offset;
Double_t *fBCM_SatOffset;
Double_t *fBCM_SatQuadratic;
Double_t *fBCM_delta_charge;
std::vector<std::string> fBCM_Name;
std::vector<UInt_t> scal_prev_read;
std::vector<UInt_t> scal_present_read;
std::vector<UInt_t> scal_overflows;
LHRSScalerEvtHandler(const LHRSScalerEvtHandler& fh);
LHRSScalerEvtHandler& operator=(const LHRSScalerEvtHandler& fh);
ClassDef(LHRSScalerEvtHandler,0) // Scaler Event handler
};
#endif