10#include <klm/eklm/modules/EKLMDataChecker/EKLMDataCheckerModule.h>
43 const uint16_t c_ChargeError = 0x0FFF;
45 std::map<int, StripData>::iterator it;
48 for (i = 0; i < n; i++) {
60 data.nBadDigits = (eklmDigit->
getCharge() == c_ChargeError) ? 1 : 0;
64 if (eklmDigit->
getCharge() == c_ChargeError)
65 it->second.nBadDigits++;
89 int section, layer, sector, plane, strip, stripGlobal;
90 std::map<int, StripData>::iterator it;
91 std::vector<StripData> stripDataVector;
92 std::vector<StripData>::iterator it2, it3, it4;
94 stripDataVector.push_back(it->second);
95 sort(stripDataVector.begin(), stripDataVector.end(), compareBadDigitRate);
96 printf(
"EKLM data checker report.\n"
97 "Strips with readout errors sorted by error rate:\n");
98 it2 = stripDataVector.begin();
99 while (it2 != stripDataVector.end()) {
100 if (it2->nBadDigits == 0)
103 while (it3 != stripDataVector.end()) {
104 if (it3->nBadDigits != it2->nBadDigits || it3->nDigits != it2->nDigits)
108 sort(it2, it3, compareStripNumber);
109 for (it4 = it2; it4 != it3; ++it4) {
111 it4->strip, §ion, &layer, §or, &plane, &strip);
112 printf(
"Section %d, layer %d, sector %d, plane %d, strip %d: %.1f%% "
114 section, layer, sector, plane, strip,
115 float(it4->nBadDigits) / it4->nDigits * 100,
116 it4->nBadDigits, it4->nDigits);
120 printf(
"Strips with no data collected:\n");
127 section, layer, sector, plane, strip);
130 printf(
"Section %d, layer %d, sector %d, plane %d, strip %d.\n",
131 section, layer, sector, plane, strip);
const EKLM::GeometryData * m_GeoDat
Geometry data.
StoreArray< KLMDigit > m_Digits
Digits.
~EKLMDataCheckerModule()
Destructor.
void initialize() override
Initializer.
std::map< int, struct StripData > m_StripDataMap
Map of strip data information.
void event() override
This method is called for each event.
void endRun() override
This method is called if the current run ends.
void terminate() override
This method is called at the end of the event processing.
void beginRun() override
Called when entering a new run.
const EKLMElementNumbers * m_ElementNumbers
Element numbers.
EKLMDataCheckerModule()
Constructor.
int stripNumber(int section, int layer, int sector, int plane, int strip) const
Get strip number.
void stripNumberToElementNumbers(int stripGlobal, int *section, int *layer, int *sector, int *plane, int *strip) const
Get element numbers by strip global number.
int getNPlanes() const
Get number of planes.
int getNSections() const
Get number of sections.
int getNDetectorLayers(int section) const
Get number of detector layers.
int getNStrips() const
Get number of strips.
int getNSectors() const
Get number of sectors.
static const GeometryData & Instance(enum DataSource dataSource=c_Database, const GearDir *gearDir=nullptr)
Instantiation.
KLM digit (class representing a digitized hit in RPCs or scintillators).
int getSubdetector() const
Get subdetector number.
int getLayer() const
Get layer number.
int getSection() const
Get section number.
int getPlane() const
Get plane number.
int getStrip() const
Get strip number.
int getSector() const
Get sector number.
uint16_t getCharge() const
Get charge.
void setDescription(const std::string &description)
Sets the description of the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
int strip
Strip global number.
int nDigits
Total number of digits.
int nBadDigits
Number of digits with readout error.