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
0017
0018 #include <limits>
0019
0020
0021 namespace dd4hep {
0022
0023
0024 namespace digi {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 class DigiDepositEnergyCut : public DigiDepositsProcessor {
0038 protected:
0039
0040 double m_cutoff { -std::numeric_limits<double>::epsilon() };
0041
0042 public:
0043
0044 template <typename T> void
0045 cut_energy(context_t& context, T& cont, work_t& , const predicate_t& predicate) const {
0046 std::size_t dropped = 0UL;
0047 for( auto& dep : cont ) {
0048 if ( predicate(dep) ) {
0049 EnergyDeposit& depo = dep.second;
0050 if ( depo.deposit < m_cutoff ) {
0051 depo.flag |= EnergyDeposit::KILLED;
0052 ++dropped;
0053 }
0054 }
0055 }
0056 if ( m_monitor ) m_monitor->count_shift(cont.size(), dropped);
0057 info("%s+++ %-32s dropped %6ld out of %6ld entries from mask: %04X",
0058 context.event->id(), cont.name.c_str(), dropped, cont.size(), cont.key.mask());
0059 }
0060
0061
0062 DigiDepositEnergyCut(const DigiKernel& krnl, const std::string& nam)
0063 : DigiDepositsProcessor(krnl, nam)
0064 {
0065 declareProperty("deposit_cutoff", m_cutoff);
0066 DEPOSIT_PROCESSOR_BIND_HANDLERS(DigiDepositEnergyCut::cut_energy);
0067 }
0068 };
0069 }
0070 }
0071
0072 #include <DDDigi/DigiFactories.h>
0073 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositEnergyCut)