9 #include <rawdata/modules/CheckErrorEvent.h>
28 setDescription(
"Encode DataStore into RingBuffer");
29 B2INFO(
"CheckErrorEvent: Constructor done.");
35 CheckErrorEventModule::~CheckErrorEventModule()
39 void CheckErrorEventModule::initialize()
41 B2INFO(
"CheckErrorEvent: initialize() started.");
42 m_packetCRCerr_cpr = 0;
43 m_eventCRCerr_cpr = 0;
44 m_packetCRCerr_evt = 0;
45 m_eventCRCerr_evt = 0;
46 m_eventCRCerr_evtmetadata = 0;
47 B2INFO(
"CheckErrorEvent: initialize() done.");
50 void CheckErrorEventModule::checkCRCError(
RawCOPPER* rawcpr,
int i)
55 m_packetCRCerr_cpr = + temp_packet;
56 m_eventCRCerr_cpr = + temp_event;
58 printf(
"Packet CRC error : block %d ent %d eve %.12u node %.8x\n", i, j,
62 printf(
"Packet EVE error : block %d ent %d eve %.12u node %.8x\n", i, j,
68 void CheckErrorEventModule::terminate()
73 printf(
"Event CRC error %d CPRs %d Events (obtained by checking each Raw*** header)\n",
77 printf(
"Event CRC error %d Events (obtained by checking EventMetaData. it should be equal to the above value. )\n",
78 m_eventCRCerr_evtmetadata);
81 void CheckErrorEventModule::event()
88 for (
int i = 0; i < raw_datablkarray.
getEntries(); i++) {
89 for (
int j = 0; j < raw_datablkarray[ i ]->GetNumEntries(); j++) {
90 int* temp_buf = raw_datablkarray[ i ]->GetBuffer(j);
91 int nwords = raw_datablkarray[ i ]->GetBlockNwords(j);
95 if (raw_datablkarray[ i ]->CheckFTSWID(j)) {
97 }
else if (raw_datablkarray[ i ]->CheckTLUID(j)) {
102 temp_raw_copper.
SetBuffer(temp_buf, nwords, delete_flag, num_nodes, num_events);
103 checkCRCError(&temp_raw_copper, i);
110 for (
int i = 0; i < raw_cprarray.
getEntries(); i++) {
111 checkCRCError(raw_cprarray[ i ], i);
115 for (
int i = 0; i < raw_svdarray.
getEntries(); i++) {
116 checkCRCError(raw_svdarray[ i ], i);
120 for (
int i = 0; i < raw_cdcarray.
getEntries(); i++) {
121 checkCRCError(raw_cdcarray[ i ], i);
125 for (
int i = 0; i < raw_toparray.
getEntries(); i++) {
126 checkCRCError(raw_toparray[ i ], i);
130 for (
int i = 0; i < raw_aricharray.
getEntries(); i++) {
131 checkCRCError(raw_aricharray[ i ], i);
135 for (
int i = 0; i < raw_klmarray.
getEntries(); i++) {
136 checkCRCError(raw_klmarray[ i ], i);
140 for (
int i = 0; i < raw_eclarray.
getEntries(); i++) {
141 checkCRCError(raw_eclarray[ i ], i);
145 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
146 checkCRCError(raw_trgarray[ i ], i);
153 if (evtmetadata->getErrorFlag()) {
154 printf(
"EventMeta Error %.8x : exp %d run %d sub %d eve %d\n",
155 evtmetadata->getErrorFlag(),
156 evtmetadata->getExperiment(), evtmetadata->getRun(),
157 evtmetadata->getSubrun(), evtmetadata->getEvent());
158 m_eventCRCerr_evtmetadata++;
Count the number of CRC error events by checking RawCOPPER's header/trailer and EventMetaData.
Module to get data from DataStore and send it to another network node.
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
void SetBuffer(int *bufin, int nwords, int delete_flag, int num_events, int num_nodes) OVERRIDE_CPP17
set buffer ( delete_flag : m_buffer is freeed( = 0 )/ not freeed( = 1 ) in Destructer )
virtual int GetNumEntries()
get # of data blocks = (# of nodes)*(# of events)
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Type-safe access to single objects in the data store.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
unsigned int GetEveNo(int n)
get subrun #(8bit)
int GetEventCRCError(int n)
check CRC event Error
int GetPacketCRCError(int n)
check CRC packet Error
unsigned int GetNodeID(int n)
get node-ID from data
Abstract base class for different kinds of events.