9#include <top/modules/TOPChannelMasker/TOPChannelMaskerModule.h>
10#include <top/reconstruction_cpp/TOPRecoManager.h>
11#include <top/geometry/TOPGeometryPar.h>
35 setDescription(
"Masks dead, hot and uncalibrated channels from the reconstruction");
42 "if true, mask channelT0-uncalibrated channels",
true);
44 "if true, mask timebase-uncalibrated channels ",
true);
58 B2FATAL(
"channel mask not available");
61 B2FATAL(
"channel T0 calibration not available");
64 B2FATAL(
"timebase calibration not available");
81 if (pmtInstalled or pmtQEData or channelRQE or thresholdEff) {
87 bool asicMasksChanged =
false;
91 asicMasksChanged =
true;
99 bool timebaseChanged =
m_timebase.hasChanged();
103 if (channelMaskChanged or asicMasksChanged or
120 if (digit.getHitQuality() == TOPDigit::c_Masked or
121 digit.getHitQuality() == TOPDigit::c_Uncalibrated) {
122 digit.setHitQuality(TOPDigit::c_Good);
124 if (digit.getHitQuality() != TOPDigit::c_Good)
continue;
127 auto slotID = digit.getModuleID();
128 auto channel = digit.getChannel();
130 digit.setHitQuality(TOPDigit::c_Masked);
134 digit.setHitQuality(TOPDigit::c_Masked);
135 const unsigned maxCount = 10;
137 B2ERROR(
"Unexpected hit found in a channel that is masked-out by firmware"
138 <<
LogVar(
"slotID", slotID) <<
LogVar(
"channel", channel));
140 B2ERROR(
"Unexpected hit found in a channel that is masked-out by firmware"
141 <<
LogVar(
"slotID", slotID) <<
LogVar(
"channel", channel)
148 digit.setHitQuality(TOPDigit::c_Uncalibrated);
153 const auto* fe = fe_mapper.
getMap(slotID, channel / 128);
155 B2ERROR(
"No front-end map found" <<
LogVar(
"slotID", slotID) <<
LogVar(
"channel", channel));
156 digit.setHitQuality(TOPDigit::c_Uncalibrated);
160 const auto* sampleTimes =
m_timebase->getSampleTimes(scrodID, channel);
161 if (not sampleTimes->isCalibrated()) {
162 digit.setHitQuality(TOPDigit::c_Uncalibrated);
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
DBObjPtr< TOPCalChannelMask > m_channelMask
list of dead/noisy channels
OptionalDBArray< TOPPmtQE > m_pmtQEData
quantum efficiencies
DBObjPtr< TOPCalTimebase > m_timebase
timebase
unsigned m_errorCount
error count
DBObjPtr< TOPCalChannelThresholdEff > m_thresholdEff
channel threshold effi.
DBObjPtr< TOPCalChannelT0 > m_channelT0
channel T0
DBObjPtr< TOPCalChannelRQE > m_channelRQE
channel relative quantum effi.
bool m_maskUncalibratedChannelT0
if true mask channelT0-uncalibrated channels
StoreObjPtr< TOPAsicMask > m_eventAsicMask
masked asics in firmware
StoreArray< TOPDigit > m_digits
collection of digits
TOPAsicMask m_savedAsicMask
the default ones or a copy from data store
bool m_maskUncalibratedTimebase
if true mask timebase-uncalibrated channels
OptionalDBArray< TOPPmtInstallation > m_pmtInstalled
PMT installation data.
unsigned short getScrodID() const
Return SCROD ID.
const TOPFrontEndMap * getMap(int moduleID, int bs) const
Return map from TOP module side.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)
static void setChannelMask(const DBObjPtr< TOPCalChannelMask > &mask, const TOPAsicMask &asicMask)
Sets channel masks.
static void setChannelEffi()
Sets relative efficiencies of pixels.
static void setUncalibratedChannelsOff(const DBObjPtr< TOPCalChannelT0 > &channelT0)
Sets uncalibrated channels off.
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.
virtual void initialize() override
initialize method: registers datastore objects (the TOP hits)
virtual void event() override
event method: removes channels from the reconstruction pdf, flags hits from noisy channels as junk
virtual void beginRun() override
Called when entering a new run.
TOPChannelMaskerModule()
Constructor: Sets the description of the module.
Abstract base class for different kinds of events.