-
Notifications
You must be signed in to change notification settings - Fork 3
/
ORKatrinV4FLTHitRateDecoder.cc
71 lines (61 loc) · 1.85 KB
/
ORKatrinV4FLTHitRateDecoder.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
68
69
70
71
// ORKatrinV4FLTHitRateDecoder.cc
#include "TROOT.h"
#include "ORKatrinV4FLTHitRateDecoder.hh"
#include "ORLogger.hh"
bool ORKatrinV4FLTHitRateDecoder::SetDataRecord(UInt_t* dataRecord)
{
fDataRecord = dataRecord;
//TODO: here I could cross check the length ... -tb-
ORLog(kDebug) << "SetDataRecord(): Exiting" << std::endl;
return true;
}
std::string ORKatrinV4FLTHitRateDecoder::GetParName(size_t iPar)
{
switch(iPar) {
case 0: return "crate";
case 1: return "card";
case 2: return "seconds";
case 3: return "hitRateLength";
case 4: return "totalHitRate";
case 5: return "nChannels";
case 6: return "version";
// case 6: return "channel";
// case 7: return "overflow";
// case 8: return "hitRate";
default:
ORLog(kWarning) << "GetParName(): index (" << iPar
<< ") out of range." << std::endl;
return "unknown";
}
}
UInt_t ORKatrinV4FLTHitRateDecoder::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 SecondsOf(record);
case 3: return HitRateLengthOf(record);
case 4: return TotalHitRateOf(record);
case 5: return NChannelsOf(record);
case 6: return VersionOf(record);
default:
ORLog(kWarning) << "GetPar(): index (" << iPar
<< ") out of range." << std::endl;
return 0;
}
}
size_t ORKatrinV4FLTHitRateDecoder::CopyRawData(UInt_t* data16, UInt_t* data32 /*=0*/)
{
UInt_t fNChannels= NChannelsOf(fDataRecord);
UInt_t version = VersionOf(fDataRecord);
//fill arrays
for(size_t i=0;i<fNChannels;i++) data16[i] = fDataRecord[i+kHeaderSize];
if(data32){
if(version==0){
for(size_t i=0;i<fNChannels;i++) data32[i] = 0;
}else{
for(size_t i=0;i<fNChannels;i++) data32[i] = fDataRecord[i+fNChannels+kHeaderSize];
}
}
return fNChannels;
}