Belle II Software  release-05-01-25
PXDErrorFlags.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: bjoern.spruck@belle2.org *
7  * Created: 23.10.2017 *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #include "pxd/dataobjects/PXDErrorFlags.h"
13 
14 const std::string& Belle2::PXD::PXDError::getPXDBitErrorName(int bit)
15 {
16  static const std::string undefined("undefined");
18  static const std::string error_name[ONSEN_MAX_TYPE_ERR] = {
19  // 0-3
20  "Event structure problem", "Frame TrigNr vs ONSEN Trigger Frame mismatch", "Frame TrigNr vs EvtMeta mismatch", "ONSEN Trigger is not first frame",
21  // 4-7
22  "DHC_END missing/wrong placed", "NR of Frames too small", "ROI packet invalid size", "DATA outside of DHE",
23  // 8-11
24  "DHC_START is not second frame", "DHE IDs have wrong order in DHC", "Fixed size frame wrong size", "DHE CRC Error:",
25  // 12-15
26  "Unknown DHC type", "Header Type invalid for Frame Type", "Event Header Full Packet Size Error", "Event Header Magic Error",
27  // 16-19
28  "Event Header Frame Count Error", "Event header Frame Size Error", "HLTROI Magic Error", "Merger HLT/DATCON TrigNr Mismatch",
29  // 20-23
30  "DHP Size too small", "DHP-DHE DHEID mismatch", "DHP-DHE Port mismatch", "DHP Pix w/o row",
31  // 24-27
32  "DHE START/END ID mismatch", "DHE ID mismatch of START and this frame", "DHE_START w/o prev END", "Nr PXD data ==0",
33  // 28-31
34  "Missing Datcon", "NO DHC data for Trigger", "DHE active mismatch", "DHP active mismatch",
35  // 32-35
36  "SendUnfiltered but Filtered Frame Type", "!SendUnfiltered but Unfiltered Frame Type", "DHP has double header", "Error bit in frame header set",
37  // 36-39
38  "Error bit in GHOST frame header not set", "Suspicious Padding/Checksum in DHP ZSP", "DHC Words in Event mismatch", "DHE Words in Event mismatch",
39  // 40-43
40  "Row Overflow/out of bounds >=768", "DHP Frames not continuesly", "DHP Frame numbers of different frames differ>1", "DHP Frame differ from DHE Frame by >1",
41  // 44-47
42  "DHE ID is invalid", "DHC ID Start/End Mismatch", "DHE End w/o Start", "double DHC End",
43  // 48-51
44  "DHC vs EvtMeta mismatch for TriggerNr", "DHE vs EvtMeta mismatch for TriggerNr", "DHP COL overflow (unconnected drain lines)", "Unexpected (=unsupported) Frame Type",
45  // 52-55
46  "DHC vs EvtMeta mismatch for Exp/Run/Subrun", "DHC vs EvtMeta mismatch for TimeTag", "ONS_TRG: HLT vs EvtMeta mismatch", "ONS_TRG: DATCON vs EvtMeta mismatch",
47  // 56-59
48  "TriggerGate differ for DHEs in event", "Trigger FrameNr differ for DHEs in event", "DHP row w/o Pix", "DHE_START is not third frame",
49  // 60-63
50  "Fake and NoFake frames for DHH", "Unusable Data in Module", "DHE or DHC END error bits set", "DHH OT FW Misc Error"
51  };
52  if (bit < 0 || bit >= ONSEN_MAX_TYPE_ERR) return undefined;
53  return error_name[bit];
54 }
55 
56 const std::string& Belle2::PXD::PXDError::getPXDBitMaskErrorName(EPXDErrMask mask)
57 {
58  static const std::string undefined("no bit or more than one bit set");
59  for (int i = 0; i < ONSEN_MAX_TYPE_ERR; i++) {
60  if ((mask & (1ull << i)) == mask) return getPXDBitErrorName(i);
61  }
62  return undefined;
63 }