forked from mgmarino/OrcaROOT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ORL4532mainTriggerDecoder.cc
62 lines (55 loc) · 1.48 KB
/
ORL4532mainTriggerDecoder.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
// ORL4532mainTriggerDecoder.cc
#include "TROOT.h"
#include "ORL4532mainTriggerDecoder.hh"
#include "ORUtils.hh"
#include "ORLogger.hh"
void ORL4532mainTriggerDecoder::Swap(UInt_t* record)
{
ORUtils::Swap(record[1]);
ORUtils::Swap(record[2]);
/* Swap so we can tell if this has a timestamp.*/
size_t startSwapFrom = 3;
if (HasDoubleWordTimestamp(record)) {
ORUtils::Swap(record[3]);
ORUtils::Swap(record[4]);
UInt_t dummy = record[3];
record[3] = record[4];
record[4] = dummy;
startSwapFrom = 5;
}
for (size_t i=startSwapFrom;i<LengthOf(record);i++) {
ORUtils::Swap(record[i]);
}
}
double ORL4532mainTriggerDecoder::ReferenceDateOf(UInt_t* record)
{
double refDate = 0.0;
if(HasDoubleWordTimestamp(record)) {
refDate = (*((double*)(record+3)));
}
return refDate;
}
std::string ORL4532mainTriggerDecoder::GetParName(size_t iPar)
{
switch(iPar) {
case 0: return "crate";
case 1: return "card";
case 2: return "eventCount";
default:
ORLog(kWarning) << "GetParName(): index (" << iPar
<< ") out of range." << std::endl;
return "unknown";
}
}
UInt_t ORL4532mainTriggerDecoder::GetPar(UInt_t* record, size_t iPar, size_t /*iRow*/)
{
switch(iPar) {
case 0: return CrateOf(record);
case 1: return CardOf(record);
case 2: return EventCountOf(record);
default:
ORLog(kWarning) << "GetPar(): index (" << iPar
<< ") out of range." << std::endl;
return 0;
}
}