Skip to content
Snippets Groups Projects
Commit 63418637 authored by Sergei Zharko's avatar Sergei Zharko
Browse files

Fixes to digis masking in event selector

parent e1708975
No related branches found
No related tags found
1 merge request!2049Preparation of the online binary for the mcbm gold runs
Pipeline #33246 passed
......@@ -38,15 +38,35 @@ namespace cbm::algo::evbuild
case ECbmModuleId::kTof:
if (!CheckTofLayers(event.fTof, entry.second)) return false;
break;
case ECbmModuleId::kBmon:
if (!CheckBmonDiamonds(event.fBmon, entry.second)) return false;
break;
default:
throw std::runtime_error("Number of layers for " + ::ToString(entry.first) + " is not implemented");
break;
}
}
// --- Test masked channels (if any)
for (auto& entry : fConfig.fMaskedChannels) {
size_t nDigisAccepted = 0;
auto det = entry.first;
auto itMinNumDigis = fConfig.fMinNumDigis.find(det);
if (itMinNumDigis != fConfig.fMinNumDigis.end() && itMinNumDigis->second > 0) {
switch (det) {
case ECbmModuleId::kBmon:
for (const auto& digi : event.fBmon) {
if (entry.second.find(digi.GetAddress()) == entry.second.end()) {
++nDigisAccepted;
}
}
break;
default:
// This was met in the first block of the function
break;
}
if (nDigisAccepted < itMinNumDigis->second) {
return false;
}
}
}
return true;
}
......@@ -131,27 +151,6 @@ namespace cbm::algo::evbuild
// --------------------------------------------------------------------------
// ----- Check number of digis in selected BMON diamonds ------------------
bool DigiEventSelector::CheckBmonDiamonds(gsl::span<const CbmBmonDigi> digis, size_t minNum) const
{
auto itMaskedChan = fConfig.fMaskedChannels.find(ECbmModuleId::kBmon);
if (itMaskedChan == fConfig.fMaskedChannels.end() || itMaskedChan->second.size() == 0) {
return digis.size() >= minNum;
}
size_t nAcceptedDigis{0};
const auto& maskedChannels = itMaskedChan->second;
for (const auto& digi : digis) {
if (maskedChannels.find(digi.GetAddress()) == maskedChannels.end()) {
++nAcceptedDigis;
}
}
return nAcceptedDigis >= minNum;
}
// --------------------------------------------------------------------------
// ----- Info to string -------------------------------------------------
std::string DigiEventSelector::ToString() const
{
......
......@@ -74,15 +74,6 @@ namespace cbm::algo::evbuild
bool CheckTofLayers(gsl::span<const CbmTofDigi> digis, size_t minNum) const;
// FIXME: apply for all detectors
/** @brief Test for digis in selected (=not masked) BMON diamonds
** @param digis Vector of BMON digis
** @param minNum Requested minimum of not masked BMON digis
** @return True if the number of not masked BMON digis is above the threshold
**/
bool CheckBmonDiamonds(gsl::span<const CbmBmonDigi> digis, size_t minNum) const;
private: // members
DigiEventSelectorConfig fConfig; ///< Configuration / parameters
std::shared_ptr<TrackingSetup> fpTrackingSetup = nullptr; ///< Tracking setup (access to stations info)
......
......@@ -6,6 +6,7 @@
#include "AlgoFairloggerCompat.h"
#include <iomanip>
namespace cbm::algo::evbuild
{
......@@ -40,6 +41,10 @@ namespace cbm::algo::evbuild
auto value = it->second.as<std::vector<uint32_t>>();
if (value.size() > 0) {
fMaskedChannels[det] = std::unordered_set<uint32_t>(value.begin(), value.end());
L_(info) << "Masking following " << ToString(det) << " channels from event selecting: ";
for (auto address : fMaskedChannels[det]) {
L_(info) << " - 0x" << std::hex << std::setw(8) << std::setfill('0') << address << std::dec;
}
}
}
}
......
set(PARAMETER_VERSION 4d23b9bfddd5e61fd347ba2090fc215ea72b5f32) # 2025/02/24
set(PARAMETER_VERSION 837c4d8a6ad72455bf5843d85360580f19700644) # 2025/03/07
set(PARAMETER_SRC_URL "https://git.cbm.gsi.de/s.zharko/cbmroot_parameter.git")
download_project_if_needed(PROJECT Parameter_source
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment