-
Notifications
You must be signed in to change notification settings - Fork 3
/
ORBocTIC3Decoder.cc
67 lines (58 loc) · 1.83 KB
/
ORBocTIC3Decoder.cc
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
// ORBocTIC3Decoder.cc
#include "ORBocTIC3Decoder.hh"
#include "ORLogger.hh"
//**************************************************************************************
Float_t ORBocTIC3Decoder::GetPressureOfChannel(UInt_t* record, UInt_t channel)
{
if (channel >= GetNumberOfChannels()) return 0.;
/* Don't access out of bounds! */
return (*((Float_t*) (record + 2*channel + 2)));
/* packed float into a 32-bit word. */
}
UInt_t ORBocTIC3Decoder::GetTimeOfChannel(UInt_t* record, UInt_t channel)
{
if (channel >= GetNumberOfChannels()) return 0;
/* Don't access out of bounds! */
return (record[2*channel + 3]);
}
std::string ORBocTIC3Decoder::GetParName(size_t iPar)
{
switch(iPar) {
case 0:
return "Device ID";
case 1:
return "Channel";
case 2:
return "Pressure";
case 3:
return "Time";
}
ORLog(kError) << "Parameter number out of bounds" << std::endl;
return "";
}
UInt_t ORBocTIC3Decoder::GetPar(UInt_t* record, size_t iPar, size_t iRow)
{
switch (iPar) {
case 0:
return GetDeviceID(record);
case 1:
return (UInt_t)iRow;
case 2:
return (UInt_t)GetPressureOfChannel(record, iRow);
case 3:
return GetTimeOfChannel(record, iRow);
}
ORLog(kError) << "Parameter number out of bounds" << std::endl;
return 0;
}
void ORBocTIC3Decoder::Dump(UInt_t* record)
{
ORLog(kDebug) << "*************** Dumping out data *************" << std::endl;
ORLog(kDebug) << "Number of Channels: " << GetNumberOfChannels() << std::endl;
for (size_t i=0; i<GetNumberOfChannels();i++) {
ORLog(kDebug) << "Channel: " << i << std::endl
<< " Pressure: " << GetPressureOfChannel(record, i) << std::endl
<< " Time: " << GetTimeOfChannel(record, i) << std::endl;
}
ORLog(kDebug) << "********************************************************" << std::endl;
}