55 mThreshold = ic.
options().
get<
double>(
"mid-mask-threshold");
56 mNReset = ic.
options().
get<
int>(
"mid-mask-reset");
58 auto stop = [
this]() {
59 double scaleFactor = (mCounter == 0) ? 0 : 1.e6 / mCounter;
60 LOG(info) <<
"Processing time / " << mCounter <<
" events: full: " << mTimer.count() * scaleFactor <<
" us mask maker: " << mTimerMaskMaker.count() * scaleFactor <<
" us";
67 auto tStart = std::chrono::high_resolution_clock::now();
69 gsl::span<const ColumnData> calibData, fetData;
70 gsl::span<const ROFRecord> calibDataRof, fetDataRof;
72 calibData = pc.
inputs().
get<gsl::span<o2::mid::ColumnData>>(
"mid_data_1");
73 calibDataRof = pc.
inputs().
get<gsl::span<o2::mid::ROFRecord>>(
"mid_data_rof_1");
74 fetData = pc.
inputs().
get<gsl::span<o2::mid::ColumnData>>(
"mid_data_2");
75 fetDataRof = pc.
inputs().
get<gsl::span<o2::mid::ROFRecord>>(
"mid_data_rof_2");
77 unsigned long nEvents = calibDataRof.size();
82 auto tAlgoStart = std::chrono::high_resolution_clock::now();
84 for (
auto&
col : calibData) {
85 mScalers[0].count(
col);
88 for (
auto& rof : fetDataRof) {
89 auto subSet = fetData.subspan(rof.firstEntry, rof.nEntries);
90 auto deadChannels = mFetToDead.
process(subSet);
91 for (
auto&
col : deadChannels) {
92 mScalers[1].count(
col);
99 if (mCounterSinceReset >= mNReset) {
100 for (
size_t itype = 0; itype < 2; ++itype) {
101 auto masks =
o2::mid::makeMasks(mScalers[itype], mCounterSinceReset, mThreshold, mRefMasks);
104 mCounterSinceReset = 0;
105 for (
auto& scaler : mScalers) {
110 mTimerMaskMaker += std::chrono::high_resolution_clock::now() - tAlgoStart;
112 mTimer += std::chrono::high_resolution_clock::now() - tStart;
117 std::vector<ColumnData> mRefMasks{};
118 std::array<ChannelScalers, 2> mScalers{};
119 std::chrono::duration<double> mTimer{0};
120 std::chrono::duration<double> mTimerMaskMaker{0};
121 unsigned long mCounter{0};
122 unsigned long mCounterSinceReset{0};
123 double mThreshold{0.9};
129 std::vector<of::InputSpec> inputSpecs;
131 inputSpecs.emplace_back(fmt::format(
"mid_data_{}", subSpec),
o2::header::gDataOriginMID,
"DATA", subSpec, of::Lifetime::Timeframe);
132 inputSpecs.emplace_back(fmt::format(
"mid_data_rof_{}", subSpec),
o2::header::gDataOriginMID,
"DATAROF", subSpec, of::Lifetime::Timeframe);
135 std::vector<of::OutputSpec> outputSpecs{
143 of::AlgorithmSpec{of::adaptFromTask<o2::mid::MaskMakerDeviceDPL>(feeIdConfig, crateMasks)},
144 of::Options{{
"mid-mask-threshold", of::VariantType::Double, 0.9, {
"Tolerated occupancy before producing a map"}}, {
"mid-mask-reset", of::VariantType::Int, 100, {
"Number of calibration events to be checked before resetting the scalers"}}}};
MID channels masks handler.
Strip pattern (aka digits)
Class to convert the FEE test event into dead channels.
Processor to compute the masks.
Function to produce the MID masks.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ServiceRegistryRef services()
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
std::vector< ColumnData > process(gsl::span< const ColumnData > fetData)
void setMasks(const std::vector< ColumnData > &masks)
Sets the masks.
MaskMakerDeviceDPL(const FEEIdConfig &feeIdConfig, const CrateMasks &crateMasks)
void init(of::InitContext &ic)
void run(of::ProcessingContext &pc)
constexpr o2::header::DataOrigin gDataOriginMID
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< ColumnData > makeDefaultMasksFromCrateConfig(const FEEIdConfig &feeIdConfig=FEEIdConfig(), const CrateMasks &crateMasks=CrateMasks())
framework::DataProcessorSpec getMaskMakerSpec(const FEEIdConfig &feeIdConfig, const CrateMasks &crateMasks)
std::vector< ColumnData > makeMasks(const ChannelScalers &scalers, double timeOrTriggers, double threshold, const std::vector< ColumnData > &refMasks={})
constexpr uint32_t NEvTypes
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"