forked from mgmarino/OrcaROOT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathORKatrinV4FLTWaveformDecoder.hh
135 lines (110 loc) · 4.35 KB
/
ORKatrinV4FLTWaveformDecoder.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
// ORKatrinV4FLTWaveformDecoder.hh
#ifndef _ORKatrinV4FLTWaveformDecoder_hh_
#define _ORKatrinV4FLTWaveformDecoder_hh_
#include "ORVDigitizerDecoder.hh"
/** Decodes the binary Orca data format and writes it into a ROOT TFile.
* The binary data format description is in \file ORKatrinV4FLTDecoder.m .
* In \file ORKatrinV4FLTModel.m in - (NSDictionary*) dataRecordDescription
* the entries in the data dictionary define the data key and its according
* selector of the decoder. In this case it is "KatrinV4FLTWaveForm". The decoder of
* this dictionary is defined as ORKatrinV4FLTDecoderForEnergy.
* The source code (in \file ORKatrinV4FLTDecoder.m) of this method (ORKatrinV4FLTDecoderForWaveForm)
* holds the description of this format.
*
* This format is recognized by the return value of GetDataObjectPath() which is
* "ORKatrinV4FLTModel:KatrinV4FLTWaveForm".
*/ //-tb- 2008-02-6
class ORKatrinV4FLTWaveformDecoder: public ORVDigitizerDecoder
{
public:
ORKatrinV4FLTWaveformDecoder();
virtual ~ORKatrinV4FLTWaveformDecoder() {}
enum EKatrinV4FLTWaveformConsts {kBufHeadLen = 9,
kWaveformLength = 2048, //this is no longer valid, use GetWaveformLen() -tb-
//maybe rename to kWaveformPageLength ... ?
kNumFLTChannels = 24};
size_t fWaveformLength;
virtual std::string GetDataObjectPath() { return "ORKatrinV4FLTModel:KatrinV4FLTWaveForm"; }
//!< KatrinV4FLTWaveForm is the key in ORKatrinV4FLTModel.m in - (NSDictionary*) ORKatrinV4FLTModel::dataRecordDescription -tb- 2008-02-12
virtual bool SetDataRecord(UInt_t* record);
//Functions that return data from buffer header:
virtual inline UInt_t GetSec();
virtual inline UInt_t GetSubSec();
virtual inline UInt_t GetChannelMap();
virtual inline UShort_t GetChannel();
virtual inline UInt_t GetEventInfo();
virtual inline UInt_t GetEnergy();
virtual inline UInt_t GetEventID();
virtual inline UInt_t GetEventFlags(size_t event=0);
// Waveform Functions
virtual inline size_t GetWaveformLen();
virtual inline UInt_t* GetWaveformDataPointer();
virtual size_t CopyWaveformDataDouble(double* waveform, size_t len);
virtual size_t CopyWaveformData(UShort_t* waveform, size_t len);
/* Satisfying ORVDigitizerDecoder interface. */
virtual double GetSamplingFrequency() {return .01;}
virtual UShort_t GetBitResolution() {return 14;}
virtual size_t GetNumberOfEvents() {return 1;}
virtual ULong64_t GetEventTime(size_t /*event*/);
virtual UInt_t GetEventEnergy(size_t /*event*/) {return GetEnergy();}
virtual UShort_t GetEventChannel(size_t /*event*/) {return GetChannel();}
virtual size_t GetEventWaveformLength(size_t /*event*/)
{ return GetWaveformLen(); }
virtual UInt_t GetEventWaveformPoint( size_t /*event*/,
size_t waveformPoint )
{ return (UInt_t) GetWaveformDataPointer()[waveformPoint]; }
//Error checking:
virtual bool IsValid();
virtual void DumpBufferHeader();
//debugging:
void Dump(UInt_t* dataRecord);
};
//inline functions: ************************************************************************
/*! Returns the number of the waveform in shorts (two shorts are stored in one long int).
* Will be set by SetDataRecord(...)
*/ // -tb-
inline size_t ORKatrinV4FLTWaveformDecoder::GetWaveformLen()
{
return fWaveformLength;
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetSec()
{
return (fDataRecord[2]);
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetSubSec()
{
return (fDataRecord[3]);
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetChannelMap()
{
return (fDataRecord[4]);
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetEventInfo() //changed 2011-06-14 -tb-
{
return ( fDataRecord[5] );
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetEnergy()
{
return (fDataRecord[6] & 0x000FFFFF);
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetEventID()
{
return ( ( fDataRecord[6] & 0xFFF00000 ) >> 20);
}
inline UInt_t ORKatrinV4FLTWaveformDecoder::GetEventFlags(size_t)
{
return (fDataRecord[7]);
}
inline UShort_t ORKatrinV4FLTWaveformDecoder::GetChannel()
{
return ( fDataRecord[1] & 0xFF00 ) >> 8;
}
inline UInt_t* ORKatrinV4FLTWaveformDecoder::GetWaveformDataPointer()
{
return (fDataRecord + kBufHeadLen);
}
inline ULong64_t ORKatrinV4FLTWaveformDecoder::GetEventTime( size_t )
{
return ((ULong64_t)GetSec() << 32 ) + (ULong64_t)GetSubSec();
}
#endif