8 #include <rawdata/modules/CheckErrorEvent.h>
27 setDescription(
"Encode DataStore into RingBuffer");
28 B2INFO(
"CheckErrorEvent: Constructor done.");
34 CheckErrorEventModule::~CheckErrorEventModule()
38 void CheckErrorEventModule::initialize()
40 B2INFO(
"CheckErrorEvent: initialize() started.");
41 m_packetCRCerr_cpr = 0;
42 m_eventCRCerr_cpr = 0;
43 m_packetCRCerr_evt = 0;
44 m_eventCRCerr_evt = 0;
45 m_eventCRCerr_evtmetadata = 0;
46 B2INFO(
"CheckErrorEvent: initialize() done.");
49 void CheckErrorEventModule::checkCRCError(
RawCOPPER* rawcpr,
int i)
54 m_packetCRCerr_cpr = + temp_packet;
55 m_eventCRCerr_cpr = + temp_event;
57 printf(
"Packet CRC error : block %d ent %d eve %.12u node %.8x\n", i, j,
61 printf(
"Packet EVE error : block %d ent %d eve %.12u node %.8x\n", i, j,
67 void CheckErrorEventModule::terminate()
72 printf(
"Event CRC error %d CPRs %d Events (obtained by checking each Raw*** header)\n",
76 printf(
"Event CRC error %d Events (obtained by checking EventMetaData. it should be equal to the above value. )\n",
77 m_eventCRCerr_evtmetadata);
80 void CheckErrorEventModule::event()
87 for (
int i = 0; i < raw_datablkarray.
getEntries(); i++) {
88 for (
int j = 0; j < raw_datablkarray[ i ]->GetNumEntries(); j++) {
89 int* temp_buf = raw_datablkarray[ i ]->GetBuffer(j);
90 int nwords = raw_datablkarray[ i ]->GetBlockNwords(j);
94 if (raw_datablkarray[ i ]->CheckFTSWID(j)) {
96 }
else if (raw_datablkarray[ i ]->CheckTLUID(j)) {
101 temp_raw_copper.
SetBuffer(temp_buf, nwords, delete_flag, num_nodes, num_events);
102 checkCRCError(&temp_raw_copper, i);
109 for (
int i = 0; i < raw_cprarray.
getEntries(); i++) {
110 checkCRCError(raw_cprarray[ i ], i);
114 for (
int i = 0; i < raw_svdarray.
getEntries(); i++) {
115 checkCRCError(raw_svdarray[ i ], i);
119 for (
int i = 0; i < raw_cdcarray.
getEntries(); i++) {
120 checkCRCError(raw_cdcarray[ i ], i);
124 for (
int i = 0; i < raw_toparray.
getEntries(); i++) {
125 checkCRCError(raw_toparray[ i ], i);
129 for (
int i = 0; i < raw_aricharray.
getEntries(); i++) {
130 checkCRCError(raw_aricharray[ i ], i);
134 for (
int i = 0; i < raw_klmarray.
getEntries(); i++) {
135 checkCRCError(raw_klmarray[ i ], i);
139 for (
int i = 0; i < raw_eclarray.
getEntries(); i++) {
140 checkCRCError(raw_eclarray[ i ], i);
144 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
145 checkCRCError(raw_trgarray[ i ], i);
152 if (evtmetadata->getErrorFlag()) {
153 printf(
"EventMeta Error %.8x : exp %d run %d sub %d eve %d\n",
154 evtmetadata->getErrorFlag(),
155 evtmetadata->getExperiment(), evtmetadata->getRun(),
156 evtmetadata->getSubrun(), evtmetadata->getEvent());
157 m_eventCRCerr_evtmetadata++;