File indexing completed on 2025-01-30 09:17:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDDigi/DigiContainerProcessor.h>
0016 #include <DD4hep/DD4hepUnits.h>
0017
0018
0019 #include <limits>
0020
0021
0022 namespace dd4hep {
0023
0024
0025 namespace digi {
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class DigiDepositZeroSuppress : public DigiDepositsProcessor {
0036 protected:
0037
0038 double m_energy_threshold { 0e0 };
0039
0040 public:
0041
0042 template <typename T> void
0043 handle_deposits(DigiContext& context, T& cont, work_t& , const predicate_t& predicate) const {
0044 std::size_t killed = 0UL;
0045 std::size_t handled = 0UL;
0046 for( auto& dep : cont ) {
0047 if ( predicate(dep) ) {
0048 int flag = EnergyDeposit::ZERO_SUPPRESSED;
0049 if ( dep.second.deposit * dd4hep::GeV < m_energy_threshold ) {
0050 flag |= EnergyDeposit::KILLED;
0051 ++killed;
0052 }
0053 dep.second.flag |= flag;
0054 ++handled;
0055 }
0056 }
0057 info("%s+++ %-32s Zero suppression: entries: %6ld handled: %6ld killed %6ld entries from mask: %04X",
0058 context.event->id(), cont.name.c_str(), cont.size(), handled, killed, cont.key.mask());
0059 }
0060
0061 DigiDepositZeroSuppress(const DigiKernel& krnl, const std::string& nam)
0062 : DigiDepositsProcessor(krnl, nam)
0063 {
0064 declareProperty("threshold", m_energy_threshold);
0065 DEPOSIT_PROCESSOR_BIND_HANDLERS(DigiDepositZeroSuppress::handle_deposits);
0066 }
0067 };
0068 }
0069 }
0070
0071 #include <DDDigi/DigiFactories.h>
0072 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositZeroSuppress)