-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathMPDModuleVMEv4.h
130 lines (98 loc) · 3.62 KB
/
MPDModuleVMEv4.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef MPDModuleVMEv4_
#define MPDModuleVMEv4_
/////////////////////////////////////////////////////////////////////
//
// MPDModule
// This is the MPD INFN (GEM readout for SBS) module decoder
// Note, it must inherit from VmeModule.
// Feel free to copy this and make appropriate changes.
//
// other steps
// 1. Register (add "DoRegister" call and include the header)
// note: the number (4444) that is registered must appear in db_cratemap.dat
// 2. Add to namespace Decoder.h
// 3. Add to Makefile
// 4. Add to haDecode_LinkDef.h
// 5. Add line(s) for [crate,slot] in db_cratemap.dat
//
// if the pre-compiler flag "LIKEV792" is defined, the decoding is
// sort of like a V792 ... as an example.
//
/////////////////////////////////////////////////////////////////////
//#define LIKEV792x 0
// (jc2) What was this used for? Seems to conflict with a value defined
// in Caen775. So I've commented out.
//#define NTDCCHAN 32
#define MAXHIT 2048
#include "VmeModule.h"
namespace Decoder {
class MPDModuleVMEv4 : public VmeModule {
public:
MPDModuleVMEv4() = default;
MPDModuleVMEv4(Int_t crate, Int_t slot);
virtual ~MPDModuleVMEv4();
using VmeModule::GetData;
using VmeModule::LoadSlot;
using VmeModule::Init;
virtual UInt_t GetData( UInt_t adc, UInt_t sample, UInt_t chan) const;
virtual void Init();
virtual void Clear(const Option_t *opt="");
virtual Int_t Decode(const UInt_t *p); // { return 0; };
/*
void Config(Int_t mode, Int_t sampleperiod, Int_t nsample, Int_t nadc=16, Int_t nch=128) {
fAcqMode = mode;
fSamplePeriod = sampleperiod;
fNumSample = nsample;
fNumADC=nadc;
fNumChan=nch;
fData.clear();
fFrameHeader.clear();
fFrameTrailer.clear();
for (Int_t i=0;i<fNumADC*fNumSample*fNumChan;i++) {
fData.push_back(0);
}
for (Int_t i=0;i<fNumADC*fNumSample;i++) {
fFrameHeader.push_back(0);
fFrameTrailer.push_back(0);
}
IsInit = kTRUE;
// CheckSetMode();
}
*/
//#ifdef LIKEV792x
// Loads slot data. if you don't define this, the base class's method is used
virtual UInt_t LoadSlot( THaSlotData *sldat, const UInt_t *evbuffer, UInt_t pos, UInt_t len);
//#endif
//void CommonModeSubtraction();
private:
//bool fOnlineZeroSuppression; //if true, assumes that raw-data are already zero-suppressed and baseline-subtracted
// configuration parameters
Int_t fAcqMode; // normal, zero suppression, histogram, synch ...
Int_t fSamplePeriod; // 25 ns, 75 ns ...
UInt_t fNumSample; // number of sample / event
Int_t fNumADC; // number of ADC fifos (number of front end cards served by the MPD)
// current indices
Int_t fIdxA; // ADC
Int_t fIdxS; // Sample
Int_t fIdxC; // Channel
Int_t fIdxMPD; // MPD ID
Int_t fCountS; // Sample Counter from electronics
Int_t fCountW; // Word
Int_t fNumHits;
//New members/methods to parse MPD4 VME format used by UVA GEM cosmic test stand, Jan. 2021:
UInt_t fBlockHeader; //Default = 0x0
UInt_t fAPVHeader; //Default = 0x4
std::vector<Int_t> fFrameHeader; // Frame Header
std::vector<Int_t> fFrameTrailer; // Frame Trailer
static TypeIter_t fgThisType;
// linearization of the indeces
// inline Int_t as2i(Int_t adc, Int_t sample) const {
// return adc*fNumSample + sample;
// };
// inline UInt_t asc2i(UInt_t adc, UInt_t sample, UInt_t chan) const {
// return adc*fNumSample*fNumChan + sample*fNumChan + chan;
// };
ClassDef(MPDModuleVMEv4,0) // INFN MPD Module
};
}
#endif