File indexing completed on 2025-01-18 09:14:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDDigi/DigiContext.h>
0016 #include <DDDigi/DigiSegmentSplitter.h>
0017 #include <DDDigi/DigiContainerProcessor.h>
0018
0019
0020 namespace dd4hep {
0021
0022
0023 namespace digi {
0024
0025
0026
0027
0028
0029
0030
0031
0032 class DigiSegmentDepositPrint : public DigiContainerProcessor {
0033 public:
0034
0035 DigiSegmentDepositPrint(const DigiKernel& kernel, const std::string& nam)
0036 : DigiContainerProcessor(kernel, nam) {}
0037
0038
0039 template <typename T> void
0040 print(const char* fmt, const T& cont, const predicate_t& predicate) const {
0041 for( const auto& dep : cont ) {
0042 if( predicate(dep) ) {
0043 info(fmt, predicate.segmentation->split_id(dep.first), dep.first,
0044 dep.second.history.hits.size(),
0045 dep.second.history.particles.size(),
0046 dep.second.deposit);
0047 }
0048 }
0049 }
0050
0051
0052 virtual void execute(DigiContext& context, work_t& work, const predicate_t& predicate) const override final {
0053 using ulonglong = unsigned long long;
0054 char format[256];
0055 ::snprintf(format, sizeof(format),
0056 "%s[%s] %s-id: %%d [processor:%d] Cell: %%016lX mask: %016llX "
0057 "hist:%%4ld hits %%4ld parts. "
0058 "entries deposit: %%f",
0059 context.event->id(),
0060 predicate.segmentation->idspec.name(), predicate.segmentation->cname(),
0061 predicate.id, ulonglong(predicate.segmentation->split_mask));
0062 if ( const auto* m = work.get_input<DepositMapping>() )
0063 print(format, *m, predicate);
0064 else if ( const auto* v = work.get_input<DepositVector>() )
0065 print(format, *v, predicate);
0066 else
0067 error("+++ Request to dump an invalid container %s", Key::key_name(work.input.key).c_str());
0068 }
0069 };
0070 }
0071 }
0072
0073
0074 #include <DDDigi/DigiFactories.h>
0075 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiSegmentDepositPrint)