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/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 DigiDepositMapCreator : public DigiContainerProcessor {
0034 public:
0035
0036 using DigiContainerProcessor::DigiContainerProcessor;
0037
0038 template <typename T> void
0039 create_deposits(const char* tag, const T& cont, work_t& work, const predicate_t& predicate) const {
0040 Key key(cont.name, work.environ.output.mask);
0041 DepositMapping m(cont.name, work.environ.output.mask, cont.data_type);
0042 std::size_t start = m.size();
0043 for( const auto& dep : cont ) {
0044 if ( predicate(dep) ) {
0045 m.data.emplace(dep.first, EnergyDeposit());
0046 }
0047 }
0048 std::size_t end = m.size();
0049 work.environ.output.data.put(m.key, std::move(m));
0050 info("%s+++ %-32s added %6ld entries (now: %6ld) from mask: %04X to mask: %04X",
0051 tag, cont.name.c_str(), end-start, end, cont.key.mask(), m.key.mask());
0052 }
0053
0054 virtual void execute(DigiContext& context, work_t& work, const predicate_t& predicate) const override final {
0055 if ( const auto* m = work.get_input<DepositMapping>() )
0056 create_deposits(context.event->id(), *m, work, predicate);
0057 else if ( const auto* v = work.get_input<DepositVector>() )
0058 create_deposits(context.event->id(), *v, work, predicate);
0059 else
0060 except("Request to handle unknown data type: %s", work.input_type_name().c_str());
0061 }
0062 };
0063 }
0064 }
0065
0066 #include <DDDigi/DigiFactories.h>
0067 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositMapCreator)