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/DigiContext.h>
0016 #include <DDDigi/DigiContainerProcessor.h>
0017
0018
0019 namespace dd4hep {
0020
0021 namespace digi {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class DigiCellMultiplicityCounter : public DigiContainerProcessor {
0034 public:
0035
0036 using DigiContainerProcessor::DigiContainerProcessor;
0037
0038 template <typename T> void count_deposits(const char* tag, const T& cont) const {
0039 std::map<CellID, std::size_t> entries;
0040 for( const auto& dep : cont ) {
0041 CellID cell = dep.first;
0042 entries[cell] += 1;
0043 }
0044 info("%s+++ %-32s has %6ld entries and %6ld unique cells",
0045 tag, cont.name.c_str(), cont.size(), entries.size());
0046 }
0047
0048 virtual void execute(DigiContext& context, work_t& work, const predicate_t&) const override final {
0049 if ( const auto* m = work.get_input<DepositMapping>() )
0050 count_deposits(context.event->id(), *m);
0051 else if ( const auto* v = work.get_input<DepositVector>() )
0052 count_deposits(context.event->id(), *v);
0053 else
0054 except("Request to handle unknown data type: %s", work.input_type_name().c_str());
0055 }
0056 };
0057 }
0058 }
0059
0060 #include <DDDigi/DigiFactories.h>
0061 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiCellMultiplicityCounter)