9#include <pxd/modules/pxdUnpacking/PXDPostErrorCheckerModule.h>
13using namespace Belle2::PXD::PXDError;
35 "Set error mask for which data is removed (0=none, 1=default, other undefined yet)", 1);
44 B2INFO(
"Disabling critical error mask");
46 PXDError::PXDErrorFlags defaulterrormask;
47 defaulterrormask[c_nrEVENT_STRUCT ] = 1;
48 defaulterrormask[c_nrFRAME_TNR_MM ] = 1;
49 defaulterrormask[c_nrMETA_MM ] = 1;
50 defaulterrormask[c_nrONSEN_TRG_FIRST ] = 1;
52 defaulterrormask[c_nrDHC_END_MISS ] = 1;
53 defaulterrormask[c_nrNR_FRAMES_TO_SMALL ] = 1;
55 defaulterrormask[c_nrDATA_OUTSIDE ] = 1;
57 defaulterrormask[c_nrDHC_START_SECOND ] = 1;
59 defaulterrormask[c_nrFIX_SIZE ] = 1;
60 defaulterrormask[c_nrDHE_CRC ] = 1;
62 defaulterrormask[c_nrDHC_UNKNOWN ] = 1;
63 defaulterrormask[c_nrHEADERTYPE_INV ] = 1;
64 defaulterrormask[c_nrPACKET_SIZE ] = 1;
65 defaulterrormask[c_nrMAGIC ] = 1;
67 defaulterrormask[c_nrFRAME_NR ] = 1;
68 defaulterrormask[c_nrFRAME_SIZE ] = 1;
69 defaulterrormask[c_nrHLTROI_MAGIC ] = 1;
70 defaulterrormask[c_nrMERGER_TRIGNR ] = 1;
72 defaulterrormask[c_nrDHP_SIZE ] = 1;
73 defaulterrormask[c_nrDHE_DHP_DHEID ] = 1;
74 defaulterrormask[c_nrDHE_DHP_PORT ] = 1;
77 defaulterrormask[c_nrDHE_START_END_ID ] = 1;
78 defaulterrormask[c_nrDHE_START_ID ] = 1;
79 defaulterrormask[c_nrDHE_START_WO_END ] = 1;
84 defaulterrormask[c_nrDHE_ACTIVE ] = 1;
87 defaulterrormask[c_nrSENDALL_TYPE ] = 1;
88 defaulterrormask[c_nrNOTSENDALL_TYPE ] = 1;
89 defaulterrormask[c_nrDHP_DBL_HEADER ] = 1;
90 defaulterrormask[c_nrHEADER_ERR ] = 1;
92 defaulterrormask[c_nrHEADER_ERR_GHOST ] = 1;
93 defaulterrormask[c_nrSUSP_PADDING ] = 1;
94 defaulterrormask[c_nrDHC_WIE ] = 1;
95 defaulterrormask[c_nrDHE_WIE ] = 1;
97 defaulterrormask[c_nrROW_OVERFLOW ] = 1;
99 defaulterrormask[c_nrDHP_DHP_FRAME_DIFFER ] = 1;
100 defaulterrormask[c_nrDHP_DHE_FRAME_DIFFER ] = 1;
102 defaulterrormask[c_nrDHE_ID_INVALID ] = 1;
103 defaulterrormask[c_nrDHC_DHCID_START_END_MM ] = 1;
104 defaulterrormask[c_nrDHE_END_WO_START ] = 1;
105 defaulterrormask[c_nrDHC_END_DBL ] = 1;
107 defaulterrormask[c_nrMETA_MM_DHC ] = 1;
108 defaulterrormask[c_nrMETA_MM_DHE ] = 1;
110 defaulterrormask[c_nrUNEXPECTED_FRAME_TYPE ] = 1;
112 defaulterrormask[c_nrMETA_MM_DHC_ERS ] = 1;
114 defaulterrormask[c_nrMETA_MM_ONS_HLT ] = 1;
120 defaulterrormask[c_nrDHE_START_THIRD ] = 1;
122 defaulterrormask[c_nrFAKE_NO_FAKE_DATA ] = 1;
126 B2FATAL(
"Undefined value for criticalErrorMaskSet");
152 bool had_dhe =
false;
153 unsigned short triggergate = 0;
154 unsigned short dheframenr = 0;
155 std::map <int, int> found_dhe;
156 PXDErrorFlags mask{};
157 B2DEBUG(25,
"Iterate PXD Packets for this Event");
159 B2DEBUG(25,
"Iterate DHC in Pkt " << pkt.getPktIndex());
160 for (
auto& dhc : pkt) {
161 B2DEBUG(25,
"Iterate DHE in DHC " << dhc.getDHCID());
162 for (
auto& dhe : dhc) {
163 B2DEBUG(25,
"Iterate DHP in DHE " << dhe.getDHEID() <<
" TrigGate " << dhe.getTriggerGate() <<
" FrameNr " << dhe.getFrameNr());
164 found_dhe[dhe.getDHEID()]++;
166 if (dhe.getTriggerGate() != triggergate) {
168 triggergate) <<
LogVar(
"TriggerGate 2", dhe.getTriggerGate()));
169 mask [c_nrEVT_TRG_GATE_DIFFER] =
true;
171 if (dhe.getFrameNr() != dheframenr) {
174 mask [c_nrEVT_TRG_FRM_NR_DIFFER] =
true;
177 triggergate = dhe.getTriggerGate();
178 dheframenr = dhe.getFrameNr();
181 for (
auto& dhp : dhe) {
182 B2DEBUG(25,
"DHP " << dhp.getChipID() <<
" Framenr " << dhp.getFrameNr());
187 for (
auto it = dhe.cm_begin(); it < dhe.cm_end(); ++it) {
188 if (std::get<2>(*it) == 63) {
191 B2DEBUG(25,
"DHP data loss (CM=63) in " <<
LogVar(
"DHE", dhe.getDHEID()) <<
LogVar(
"DHP",
int(std::get<0>(*it))) <<
LogVar(
"Row",
196 if (error) B2WARNING(
"DHP data loss (CM=63) in " <<
LogVar(
"DHE", dhe.getDHEID()));
203 for (
auto& a : found_dhe) {
204 if (a.second > 1) B2WARNING(
"More than one packet for same DHE ID " << a.first);
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
void setReturnValue(int value)
Sets the return value for this module as integer.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
std::string m_PXDRawHitsName
The name of the StoreArray of PXDRawHits to be modified.
void initialize() override final
Initialize.
StoreObjPtr< PXDDAQStatus > m_storeDAQEvtStats
Input array for DAQ Status.
std::string m_PXDDAQEvtStatsName
The name of the StoreObjPtr of PXDDAQStatus to be read and modified.
StoreArray< PXDRawROIs > m_storeROIs
In/Output array for Raw ROIs.
bool m_ignoreDHPFrame
Flag: Ignore different dhp frame between DHEs.
PXDPostErrorCheckerModule()
Constructor defining the parameters.
void event() override final
Event.
StoreArray< PXDRawAdc > m_storeRawAdc
In/Output array for Raw Adcs.
int m_criticalErrorMaskParam
Module parameter for setting the critical error mask.
bool m_ignoreTriggerGate
TODO another mask for DHE Level if we want to clean ONLY modules?
std::string m_PXDRawAdcsName
The name of the StoreArray of PXDRawAdcs to be modified.
PXDError::PXDErrorFlags m_criticalErrorMask
Critical error mask which defines when data should be trashed, whole event only!
StoreArray< PXDRawHit > m_storeRawHits
In/Output array for Raw Hits.
std::string m_PXDRawROIsName
The name of the StoreArray of PXDRawROIs to be modified.
Class to store variables with their name which were sent to the logging service.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.