NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
DAQFill.cpp
Go to the documentation of this file.
1 #include "Containers/DAQ.h"
2 
3 namespace NAIA {
4 bool DAQData::Fill(DaqEventR &daq) {
5  DaqEventLength = daq.Length;
6 
7  for (int i = 0; i < 4; i++)
8  JINJStatus[i] = daq.JINJStatus[i];
9 
10  for (int i = 0; i < 24; i++)
11  JLength[i] = daq.JLength[i];
12 
13  JRoomError = daq.JRoomError;
14 
15  bool DaqBuildConditionsError = false;
16  bool DaqBuildErrors = false;
17  bool DaqCumulativeNodeStatus = false;
19  for (int i = 0; i < 24; i++) {
20  DaqBuildConditionsError |= (daq.JError[i] & 0x4);
21  DaqBuildErrors |= (daq.JError[i] & 0x2);
22  DaqCumulativeNodeStatus |= (daq.JError[i] & 0x1);
23  for (int code = 1; code < 14; code++)
24  DaqReplyCodeErrors |= (daq.JError[i] & 0x80 && ((daq.JError[i] >> 3) & 0xf) == code) << code;
25  }
26 
27  if (daq.HasHWError()) {
28  DaqErrors |= DAQError::HWError;
29  }
30  if (daq.L3ProcError()) {
31  DaqErrors |= DAQError::L3ProcError;
32  }
33  if (daq.L3RunError()) {
34  DaqErrors |= DAQError::L3RunError;
35  }
36  if (daq.L3EventError()) {
37  DaqErrors |= DAQError::L3EventError;
38  }
39  if (DaqBuildConditionsError) {
40  DaqErrors |= DAQError::BuildConditionError;
41  }
42  if (DaqBuildErrors) {
43  DaqErrors |= DAQError::BuildErrors;
44  }
45  if (DaqCumulativeNodeStatus) {
46  DaqErrors |= DAQError::CumulativeNodeStatus;
47  }
48 
50  for (int jinj = 0; jinj < 4; jinj++) {
51  if ((JINJStatus[jinj] >> 8) & 0x2) { // JINJ assembly error
52  for (int jinf = 0; jinf < 24; jinf++) {
53  if (((daq.JError[jinf] >> 3) == 0x1A) || ((daq.JError[jinf] >> 3) == 0x12)) { // JINF room error
54  DaqJinfRoomErrors |= (1 << jinf);
55  }
56  }
57  }
58  }
59 
60  return true;
61 }
62 } // namespace NAIA
std::array< unsigned int, 4 > JINJStatus
JINJ-[0,1,2,3] status word.
Definition: DAQ.h:55
std::bitset< 24 > JRoomError
Flag JINJ slaves with Room Errors.
Definition: DAQ.h:52
unsigned int DaqEventLength
Event length in bytes.
Definition: DAQ.h:48
DAQ container class description.
std::bitset< 14 > DaqReplyCodeErrors
Bit array showing presence of errors in any of the JINJ slaves reply codes as described in Table 6...
Definition: DAQ.h:50
std::bitset< 24 > DaqJinfRoomErrors
Bit array word flagging jinfs with room error.
Definition: DAQ.h:51
std::bitset< 8 > DaqErrors
Misc DAQ errors flags.
Definition: DAQ.h:49
std::array< unsigned int, 24 > JLength
Untruncated length in bytes of corresponding slave in JINJ block.
Definition: DAQ.h:56