-
Notifications
You must be signed in to change notification settings - Fork 3
/
ORAcqirisDC440Decoder.hh
135 lines (110 loc) · 4.65 KB
/
ORAcqirisDC440Decoder.hh
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
131
132
133
134
// ORAcqirisDC440Decoder.hh
#ifndef _ORAcqirisDC440Decoder_hh_
#define _ORAcqirisDC440Decoder_hh_
#include "ORVDigitizerDecoder.hh"
#include "ORUtils.hh"
using ORUtils::BitConcat;
class ORAcqirisDC440Decoder: public ORVDigitizerDecoder
{
public:
ORAcqirisDC440Decoder();
virtual ~ORAcqirisDC440Decoder() {}
enum EAcqirisDC440Consts {kBufHeadLen = 6};
enum EAcqirisDC440TriggerSlope { kPositive = 0,
kNegative,
kOutOfWindow,
kIntoWindow,
kHFDivide,
kSpikeStretcher };
enum EAcqirisDC440TriggerCoupling { kDC = 0,
kAC,
kHFReject,
kDC_50_Ohm,
kAC_50_Ohm };
enum EAcqirisDC440TriggerSource { kExternal = 0,
kChannelOne,
kChannelTwo };
enum EAcqirisDC440VerticalCoupling { kVC_Ground = 0,
kVC_DC_1_MOhm,
kVC_AC_1_MOhm,
kVC_DC_50_Ohm,
kVC_AC_50_Ohm };
virtual std::string GetDataObjectPath() { return "ORAcqirisDC440Model:Waveform"; }
virtual std::string GetDictionaryObjectPath() { return "ORAcqirisDC440Model"; }
virtual void Swap(UInt_t* dataRecord);
/* Overloading swap, this is a 16-bit style record. */
virtual bool SetDataRecord(UInt_t* record);
//Functions that return data from buffer header:
virtual inline UShort_t GetChannelNum();
virtual inline UInt_t GetTimeStampLo();
virtual inline UInt_t GetTimeStampHi();
virtual inline ULong64_t GetTimeStamp();
// Waveform Functions
virtual inline UInt_t GetIndexOffset();
virtual inline size_t GetWaveformLen();
virtual inline UShort_t* GetWaveformDataPointer();
/* Returns number of shorts in the waveform. */
virtual size_t CopyWaveformData(Short_t* waveform, size_t len);
virtual size_t CopyWaveformDataDouble(double* waveform, size_t len);
/* Functions that return information about card/channel settings. */
/* These are static throughout a run, so a processor should take *
* advantage of this and maybe not query during each record. */
virtual double GetDelayTime();
virtual double GetFullScale();
virtual UInt_t GetNumberOfSamples();
virtual double GetSampleInterval();
virtual EAcqirisDC440TriggerCoupling GetTriggerCoupling();
virtual double GetTriggerLevel();
virtual EAcqirisDC440TriggerSlope GetTriggerSlope();
virtual EAcqirisDC440TriggerSource GetTriggerSource();
virtual EAcqirisDC440VerticalCoupling GetVerticalCoupling();
virtual double GetVerticalOffset();
//Error checking:
virtual bool IsValid();
virtual void DumpBufferHeader();
//debugging:
void Dump(UInt_t* dataRecord);
/* Adhering to ORVDigitizerDecoder interface. */
virtual double GetSamplingFrequency();
virtual UShort_t GetBitResolution() {return 12;}
virtual size_t GetNumberOfEvents() {return 1;}
virtual ULong64_t GetEventTime(size_t /*event*/) { return GetTimeStamp(); }
/* This card doesn't calculate energy. */
virtual UInt_t GetEventEnergy(size_t /*event*/) { return 0; }
virtual UShort_t GetEventChannel(size_t /*event*/) { return GetChannelNum();}
virtual size_t GetEventWaveformLength(size_t /*event*/)
{ return GetWaveformLen(); }
virtual UInt_t GetEventWaveformPoint( size_t /*event*/,
size_t waveformPoint );
};
//inline functions: ************************************************************************
inline UShort_t ORAcqirisDC440Decoder::GetChannelNum()
{
return (UShort_t) ((fDataRecord[1] & 0xff00) >> 8);
}
inline UInt_t ORAcqirisDC440Decoder::GetTimeStampLo()
{
return (fDataRecord[2]);
}
inline UInt_t ORAcqirisDC440Decoder::GetTimeStampHi()
{
return (fDataRecord[3]);
}
inline ULong64_t ORAcqirisDC440Decoder::GetTimeStamp()
{
return BitConcat(GetTimeStampLo(), GetTimeStampHi());
}
inline UInt_t ORAcqirisDC440Decoder::GetIndexOffset()
{
return (fDataRecord[4]);
}
inline size_t ORAcqirisDC440Decoder::GetWaveformLen()
{
/* returns Waveform length in number of shorts */
return (fDataRecord[5]);
}
inline UShort_t* ORAcqirisDC440Decoder::GetWaveformDataPointer()
{
return (UShort_t*)(fDataRecord + kBufHeadLen) + GetIndexOffset();
}
#endif