File indexing completed on 2025-01-18 09:14:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDDigi/DigiContainerProcessor.h>
0016
0017
0018 namespace dd4hep {
0019
0020
0021 namespace digi {
0022
0023
0024
0025
0026
0027
0028
0029
0030 class DigiDepositDropKilled : public DigiContainerProcessor {
0031 public:
0032
0033 using DigiContainerProcessor::DigiContainerProcessor;
0034
0035
0036 virtual void execute(DigiContext& context, work_t& work, const predicate_t&) const override final {
0037 std::size_t killed = 0, total = 0, i = 0;
0038 if ( auto* v = work.get_input<DepositVector>() ) {
0039 total = v->size();
0040 for( auto iter = v->begin(); iter != v->end(); ++iter, ++i ) {
0041 if ( v->at(i).flag&EnergyDeposit::KILLED ) {
0042 v->remove(iter);
0043 iter = v->begin() + (--i);
0044 }
0045 }
0046 killed = total - v->size();
0047 }
0048 else if ( auto* m = work.get_input<DepositMapping>() ) {
0049 CellID last_cell = ~0x0ULL;
0050 total = m->size();
0051 for( auto iter = m->begin(); iter != m->end(); ++iter ) {
0052 if ( iter->second.flag&EnergyDeposit::KILLED ) {
0053 m->remove(iter);
0054 iter = (last_cell != ~0x0ULL) ? m->data.find(last_cell) : m->begin();
0055 if ( iter == m->end() ) iter = m->begin();
0056 if ( iter == m->end() ) break;
0057 continue;
0058 }
0059 last_cell = iter->first;
0060 }
0061 killed = total - m->size();
0062 }
0063 else {
0064 except("Request to handle unknown data type: %s", work.input_type_name().c_str());
0065 }
0066 if ( m_monitor ) m_monitor->count_shift(total, killed);
0067 info("%s+++ Killed %6ld out of %6ld deposit entries from container: %s",context.event->id(), killed, total);
0068 }
0069 };
0070 }
0071 }
0072
0073 #include <DDDigi/DigiFactories.h>
0074 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositDropKilled)