File indexing completed on 2025-01-30 09:17:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/InstanceCount.h>
0016 #include <DDDigi/DigiInputAction.h>
0017
0018
0019 #include <stdexcept>
0020 #include <unistd.h>
0021
0022 using namespace dd4hep::digi;
0023
0024
0025 DigiInputAction::DigiInputAction(const DigiKernel& kernel, const std::string& nam)
0026 : DigiEventAction(kernel, nam)
0027 {
0028 declareProperty("input", m_input_sources);
0029 declareProperty("segment", m_input_segment);
0030 declareProperty("mask", m_input_mask);
0031 declareProperty("rescan", m_input_rescan);
0032 declareProperty("input_section", m_input_section);
0033 declareProperty("objects_enabled", m_objects_enabled);
0034 declareProperty("objects_disabled", m_objects_disabled);
0035 declareProperty("events_per_file", m_events_per_file);
0036 declareProperty("keep_raw", m_keep_raw);
0037 InstanceCount::increment(this);
0038 }
0039
0040
0041 DigiInputAction::~DigiInputAction() {
0042 InstanceCount::decrement(this);
0043 }
0044
0045
0046 bool DigiInputAction::fileLimitReached(input_source& source) const {
0047 if ( m_events_per_file > 0 ) {
0048 if ( source.event_count > m_events_per_file ) {
0049 return true;
0050 }
0051 }
0052 return false;
0053 }
0054
0055
0056 void DigiInputAction::onOpenFile(input_source& source) {
0057 source.event_count = 0;
0058 }
0059
0060
0061 void DigiInputAction::onProcessEvent(input_source& source, event_frame& ) {
0062 ++source.event_count = 0;
0063 }
0064
0065
0066 bool DigiInputAction::object_loading_is_enabled(const std::string& nam) const {
0067
0068 if ( m_objects_enabled.empty() && m_objects_disabled.empty() ) {
0069 return true;
0070 }
0071
0072 for( const auto& bname : m_objects_disabled ) {
0073 if ( bname == nam )
0074 return false;
0075 }
0076
0077 if ( m_objects_enabled.empty() ) {
0078 return true;
0079 }
0080
0081 for( const auto& bname : m_objects_enabled ) {
0082 if ( bname == nam ) {
0083 return true;
0084 }
0085 }
0086 return false;
0087 }
0088
0089
0090 void DigiInputAction::execute(DigiContext& ) const {
0091 info("+++ Virtual method execute() --- Should not be called");
0092 ::sleep(1);
0093 }