From 52dcd2d23bf55f8394877b1baf4f6092eea978cf Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Wed, 26 Oct 2022 11:17:43 +0200 Subject: [PATCH] Remove warnings from TBB, python and clang-tidy --- DDDigi/include/DDDigi/DigiAction.h | 6 + .../include/DDDigi/DigiParallelWorkerGroup.h | 1 + DDDigi/python/dddigi.py | 29 +++-- DDDigi/src/DigiAction.cpp | 17 +++ DDDigi/src/DigiKernel.cpp | 100 ++++++++-------- DDTest/python/test_import.py | 2 +- examples/DDDigi/scripts/TestDepositCount.py | 1 + examples/DDDigi/scripts/TestIPMove.py | 4 +- examples/DDDigi/scripts/TestProperties.py | 108 +++++++++--------- examples/DDDigi/scripts/TestResegmentation.py | 12 +- 10 files changed, 159 insertions(+), 121 deletions(-) diff --git a/DDDigi/include/DDDigi/DigiAction.h b/DDDigi/include/DDDigi/DigiAction.h index e274ebb2e..9db7b5e6b 100644 --- a/DDDigi/include/DDDigi/DigiAction.h +++ b/DDDigi/include/DDDigi/DigiAction.h @@ -164,6 +164,12 @@ namespace dd4hep { /// Access single property (CONST) const Property& property(const std::string& name) const; + /// Adopt named property of another action for data processing + virtual void adopt_property(DigiAction* action, const std::string& foreign_name, const std::string& local_name); + + /// Adopt named tool to delegate actions + virtual void adopt_tool(DigiAction* action, const std::string& typ); + /// Support for messages with variable output level using output level void print(const char* fmt, ...) const; /// Support for building formatted messages diff --git a/DDDigi/include/DDDigi/DigiParallelWorkerGroup.h b/DDDigi/include/DDDigi/DigiParallelWorkerGroup.h index f1ca58a3c..1cd72009c 100644 --- a/DDDigi/include/DDDigi/DigiParallelWorkerGroup.h +++ b/DDDigi/include/DDDigi/DigiParallelWorkerGroup.h @@ -18,6 +18,7 @@ /// C/C++ include files #include <cstdint> +#include <vector> /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDDigi/python/dddigi.py b/DDDigi/python/dddigi.py index c38dffca5..c808cfa69 100644 --- a/DDDigi/python/dddigi.py +++ b/DDDigi/python/dddigi.py @@ -158,6 +158,11 @@ def _setKernelProperty(self, name, value): raise KeyError(msg) +# --------------------------------------------------------------------------- +def _adopt_property(self, action, foreign_name, local_name): + Interface.adoptProperty(self.get(), action, str(foreign_name), str(local_name)) + + # --------------------------------------------------------------------------- def _add_property(self, name, value): Interface.addProperty(self.get(), str(name), value) @@ -199,14 +204,30 @@ Kernel.__setattr__ = _setKernelProperty Kernel.terminate = _kernel_terminate # --------------------------------------------------------------------------- ActionHandle = digi.ActionHandle +ActionHandle.adopt_property = _adopt_property ActionHandle.add_property = _add_property ActionHandle.add_position_property = _add_position_property ActionHandle.add_set_property = _add_set_property ActionHandle.add_list_property = _add_list_property ActionHandle.add_vector_property = _add_vector_property ActionHandle.add_mapped_property = _add_mapped_property +# --------------------------------------------------------------------------- + +def _get_action(self): + if hasattr(self, 'I_am_a_ROOT_interface_handle'): + return Interface.toAction(self.get()) + return self # --------------------------------------------------------------------------- + + +def _get_container_action(self): + if hasattr(self, 'I_am_a_ROOT_interface_handle'): + return Interface.toContainerAction(self.get()) + return self +# --------------------------------------------------------------------------- + + def TestAction(kernel, nam, sleep=0): obj = Interface.createEventAction(kernel, str('DigiTestAction/' + nam)) if sleep != 0: @@ -234,14 +255,8 @@ def _adopt_event_action(self, action): def _adopt_processor_action(self, action, container): " Helper to convert DigiActions objects to DigiEventAction " - print(str(action.__class__)) attr = getattr(self, 'adopt_processor') - if hasattr(action, 'I_am_a_ROOT_interface_handle'): - proc = Interface.toContainerProcessor(action.get()) - attr(proc, container) - else: - proc = action - # print(str(proc.__class__)) + proc = _get_container_action(self) attr(proc, container) # print('ContainerProcessor succesfully adopted') # --------------------------------------------------------------------------- diff --git a/DDDigi/src/DigiAction.cpp b/DDDigi/src/DigiAction.cpp index faff69356..f68f560ca 100644 --- a/DDDigi/src/DigiAction.cpp +++ b/DDDigi/src/DigiAction.cpp @@ -69,6 +69,23 @@ long DigiAction::release() { return count; } +/// Adopt named property of another action for data processing +void DigiAction::adopt_property(DigiAction* action, const std::string& foreign_name, const std::string& local_name) { + if ( action ) { + PropertyManager& mgr = action->properties(); + Property& prop = mgr.property(foreign_name); + properties().add(local_name, prop); + return; + } + except("+++ adoptProperty: Invalid source action to access property %s", foreign_name.c_str()); +} + +/// Adopt named tool to delegate actions +void DigiAction::adopt_tool(DigiAction* /* action */, const std::string& typ) { + except("+++ adoptTool: Invalid call: A tool type %s is not useful for action %s", + typ.c_str(), c_name()); +} + /// Set the output level; returns previous value dd4hep::PrintLevel DigiAction::setOutputLevel(PrintLevel new_level) { int old = m_outputLevel; diff --git a/DDDigi/src/DigiKernel.cpp b/DDDigi/src/DigiKernel.cpp index 01a3b5a23..33cd1c5c6 100644 --- a/DDDigi/src/DigiKernel.cpp +++ b/DDDigi/src/DigiKernel.cpp @@ -24,7 +24,10 @@ #include <DDDigi/DigiActionSequence.h> #ifdef DD4HEP_USE_TBB -#include <tbb/tbb.h> +#include <tbb/task_group.h> +#include <tbb/global_control.h> +#else +namespace tbb { struct global_control { enum { max_allowed_parallelism = -1 }; }; } #endif #include <TRandom.h> @@ -55,11 +58,11 @@ public: /// Property: Client output levels ClientOutputLevels clientLevels; /// Atomic counter: Number of events still to be processed in this run - std::atomic_int eventsToDo; + std::atomic_int events_todo; /// Atomic counter: Number of events still to be processed in this run - std::atomic_int eventsFinished; + std::atomic_int events_finished; /// Atomic counter: Number of events still to be processed in this run - std::size_t eventsSubmitted; + std::size_t events_submitted; /// Lock to ensure counter safety std::mutex counter_lock { }; @@ -85,17 +88,17 @@ public: CallbackSequence end_event { }; /// The main data input action sequence - DigiActionSequence* inputAction { nullptr }; + DigiActionSequence* input_action { nullptr }; /// The main event action sequence - DigiActionSequence* eventAction { nullptr }; + DigiActionSequence* event_action { nullptr }; /// The main data output action sequence - DigiActionSequence* outputAction { nullptr }; + DigiActionSequence* output_action { nullptr }; /// Random generator TRandom* root_random; - std::shared_ptr<DigiRandomGenerator> random {}; + std::shared_ptr<DigiRandomGenerator> random { }; /// TBB initializer (If TBB is used) - void* tbbInit { nullptr }; + std::unique_ptr<tbb::global_control> tbb_init { }; /// Property: Output level int outputLevel; /// Property: maximum number of events to be processed (if < 0: infinite) @@ -103,7 +106,7 @@ public: /// Property: maximum number of events to be processed in parallel (if TBB) int maxEventsParallel; /// Property: maximum number of threads to be used (if TBB) - int numThreads; + int num_threads; /// Property: Allow to stop execution from interactive prompt bool stop = false; Internals() = default; @@ -150,8 +153,8 @@ public: todo = -1; { std::lock_guard<std::mutex> lock(kernel.internals->counter_lock); - if( !kernel.internals->stop && kernel.internals->eventsToDo > 0) - todo = --kernel.internals->eventsToDo; + if( !kernel.internals->stop && kernel.internals->events_todo > 0) + todo = --kernel.internals->events_todo; } if ( todo >= 0 ) { int ev_num = kernel.internals->numEvents - todo; @@ -169,23 +172,19 @@ DigiKernel::DigiKernel(Detector& description_ref) : m_detDesc(&description_ref) { internals = new Internals(); -#ifdef DD4HEP_USE_TBB - internals->numThreads = tbb::task_scheduler_init::default_num_threads(); -#else - internals->numThreads = -1; -#endif + internals->num_threads = tbb::global_control::max_allowed_parallelism; declareProperty("maxEventsParallel",internals->maxEventsParallel = 1); - declareProperty("numThreads", internals->numThreads); + declareProperty("numThreads", internals->num_threads); declareProperty("numEvents", internals->numEvents = 10); declareProperty("stop", internals->stop = false); declareProperty("OutputLevel", internals->outputLevel = DEBUG); declareProperty("OutputLevels", internals->clientLevels); - internals->inputAction = new DigiActionSequence(*this, "InputAction"); - internals->eventAction = new DigiActionSequence(*this, "EventAction"); - internals->outputAction = new DigiActionSequence(*this, "OutputAction"); - internals->inputAction->setExecuteParallel(false); - internals->eventAction->setExecuteParallel(false); - internals->outputAction->setExecuteParallel(false); + internals->input_action = new DigiActionSequence(*this, "InputAction"); + internals->event_action = new DigiActionSequence(*this, "EventAction"); + internals->output_action = new DigiActionSequence(*this, "OutputAction"); + internals->input_action->setExecuteParallel(false); + internals->event_action->setExecuteParallel(false); + internals->output_action->setExecuteParallel(false); internals->root_random = new TRandom(); internals->random = std::make_shared<DigiRandomGenerator>(); internals->random->engine = [this] { return this->internals->root_random->Uniform(1.0); }; @@ -195,13 +194,10 @@ DigiKernel::DigiKernel(Detector& description_ref) /// Default destructor DigiKernel::~DigiKernel() { std::lock_guard<std::mutex> lock(kernel_mutex); -#ifdef DD4HEP_USE_TBB - tbb::task_scheduler_init* init = (tbb::task_scheduler_init*)internals->tbbInit; - if ( init ) delete init; -#endif - detail::releasePtr(internals->outputAction); - detail::releasePtr(internals->eventAction); - detail::releasePtr(internals->inputAction); + internals->tbb_init.reset(); + detail::releasePtr(internals->output_action); + detail::releasePtr(internals->event_action); + detail::releasePtr(internals->input_action); detail::deletePtr(internals); InstanceCount::decrement(this); } @@ -283,21 +279,21 @@ dd4hep::PrintLevel DigiKernel::setOutputLevel(PrintLevel new_level) { /// Access current number of events still to process std::size_t DigiKernel::events_todo() const { std::lock_guard<std::mutex> lock(this->internals->counter_lock); - std::size_t evts = this->internals->eventsToDo; + std::size_t evts = this->internals->events_todo; return evts; } /// Access current number of events already processed std::size_t DigiKernel::events_done() const { std::lock_guard<std::mutex> lock(this->internals->counter_lock); - std::size_t evts = this->internals->numEvents - this->internals->eventsToDo; + std::size_t evts = this->internals->numEvents - this->internals->events_todo; return evts; } /// Access current number of events processing (events in flight) std::size_t DigiKernel::events_processing() const { std::lock_guard<std::mutex> lock(this->internals->counter_lock); - std::size_t evts = this->internals->eventsSubmitted - this->internals->eventsFinished; + std::size_t evts = this->internals->events_submitted - this->internals->events_finished; return evts; } @@ -355,23 +351,23 @@ void DigiKernel::register_end_event(const Callback& callback) const { /// Access to the main input action sequence from the kernel object DigiActionSequence& DigiKernel::inputAction() const { - return *internals->inputAction; + return *internals->input_action; } /// Access to the main event action sequence from the kernel object DigiActionSequence& DigiKernel::eventAction() const { - return *internals->eventAction; + return *internals->event_action; } /// Access to the main output action sequence from the kernel object DigiActionSequence& DigiKernel::outputAction() const { - return *internals->outputAction; + return *internals->output_action; } /// Submit a bunch of actions to be executed in parallel void DigiKernel::submit (ParallelCall*const algorithms[], std::size_t count, void* context, bool parallel) const { #ifdef DD4HEP_USE_TBB - bool para = parallel && (0 != internals->tbbInit && internals->numThreads>0); + bool para = parallel && (internals->tbb_init && internals->num_threads > 0); if ( para ) { tbb::task_group que; printout(INFO,"DigiKernel","+++ Executing chunk of %ld execution entries in parallel", count); @@ -417,7 +413,7 @@ void DigiKernel::notify(std::unique_ptr<DigiContext>&& context) { context->event.reset(); } context.reset(); - ++internals->eventsFinished; + ++internals->events_finished; } /// Notify kernel that the execution of one single event finished @@ -432,20 +428,22 @@ void DigiKernel::notify(std::unique_ptr<DigiContext>&& context, const std::excep int DigiKernel::run() { std::chrono::system_clock::time_point start = std::chrono::system_clock::now(); internals->stop = false; - internals->eventsFinished = 0; - internals->eventsSubmitted = 0; - internals->eventsToDo = internals->numEvents; + internals->events_finished = 0; + internals->events_submitted = 0; + internals->events_todo = internals->numEvents; printout(INFO, "DigiKernel","+++ Total number of events: %d",internals->numEvents); #ifdef DD4HEP_USE_TBB - if ( 0 == internals->tbbInit && internals->numThreads>=0 ) { - if ( 0 == internals->numThreads ) - internals->numThreads = tbb::task_scheduler_init::default_num_threads(); - printout(INFO, "DigiKernel", "+++ Number of TBB threads to: %d",internals->numThreads); + if ( !internals->tbb_init && internals->num_threads>=0 ) { + using ctrl_t = tbb::global_control; + if ( 0 == internals->num_threads ) { + internals->num_threads = ctrl_t::max_allowed_parallelism; + } + printout(INFO, "DigiKernel", "+++ Number of TBB threads to: %d",internals->num_threads); printout(INFO, "DigiKernel", "+++ Number of parallel events: %d",internals->maxEventsParallel); - internals->tbbInit = new tbb::task_scheduler_init(internals->numThreads); + internals->tbb_init = std::make_unique<ctrl_t>(ctrl_t::max_allowed_parallelism,internals->num_threads+1); if ( internals->maxEventsParallel > 1 ) { - int todo_evt = internals->eventsToDo; + int todo_evt = internals->events_todo; int num_proc = std::min(todo_evt,internals->maxEventsParallel); tbb::task_group main_group; for(int i=0; i < num_proc; ++i) @@ -455,16 +453,16 @@ int DigiKernel::run() { } } #endif - while ( internals->eventsToDo > 0 && !internals->stop ) { + while ( internals->events_todo > 0 && !internals->stop ) { Processor proc(*this); proc(); - ++internals->eventsSubmitted; + ++internals->events_submitted; } std::chrono::duration<double> duration = std::chrono::system_clock::now() - start; double sec = std::chrono::duration_cast<std::chrono::seconds>(duration).count(); printout(DEBUG, "DigiKernel", "+++ %d Events out of %d processed. " "Total: %7.1f seconds %7.3f seconds/event", - internals->numEvents-int(internals->eventsToDo), internals->numEvents, + internals->numEvents-int(internals->events_todo), internals->numEvents, sec, sec/double(std::max(1,internals->numEvents))); return 1; } diff --git a/DDTest/python/test_import.py b/DDTest/python/test_import.py index 6c658fe17..40796d3d2 100644 --- a/DDTest/python/test_import.py +++ b/DDTest/python/test_import.py @@ -13,7 +13,7 @@ parametrize = pytest.mark.parametrize moduleNames = [ 'dd4hep', 'DDRec', - 'DDDigi', + 'dddigi', ] # List here the modules that are allowed to Fail. diff --git a/examples/DDDigi/scripts/TestDepositCount.py b/examples/DDDigi/scripts/TestDepositCount.py index 6aa866e76..01aa2733c 100644 --- a/examples/DDDigi/scripts/TestDepositCount.py +++ b/examples/DDDigi/scripts/TestDepositCount.py @@ -24,6 +24,7 @@ def run(): parallel=True, input_mask=0x0, input_segment='inputs') count = digi.create_action('DigiCellMultiplicityCounter/CellCounter') sequence.adopt_container_processor(count, digi.containers()) + digi.check_creation([reader,signal,sequence,count]) # ======================================================================================================== digi.run_checked(num_events=7, num_threads=7, parallel=3) diff --git a/examples/DDDigi/scripts/TestIPMove.py b/examples/DDDigi/scripts/TestIPMove.py index f5435bb36..bc629b501 100644 --- a/examples/DDDigi/scripts/TestIPMove.py +++ b/examples/DDDigi/scripts/TestIPMove.py @@ -19,10 +19,10 @@ def run(): # ======================================================================================================== digi.info('Created SIGNAL input') signal = input.adopt_action('DigiSequentialActionSequence/Signal') - reader = signal.adopt_action('DigiROOTInput/SignalReader', mask=0x0, input=[digi.next_input()]) + signal.adopt_action('DigiROOTInput/SignalReader', mask=0x0, input=[digi.next_input()]) set_ip = signal.adopt_action('DigiIPCreate/SignalIP') set_ip.offset_ip = [1, 2, 3] - set_ip.sigma_ip = [.5, .5, 3.0] + set_ip.sigma_ip = [.5, .5, 3.0] move_seq = signal.adopt_action('DigiContainerSequenceAction/MoveSignal', parallel=True, input_mask=0x0, input_segment='inputs') mover = digi.create_action('DigiIPMover/MoveIPSignal') diff --git a/examples/DDDigi/scripts/TestProperties.py b/examples/DDDigi/scripts/TestProperties.py index be4d294d3..50a37814e 100644 --- a/examples/DDDigi/scripts/TestProperties.py +++ b/examples/DDDigi/scripts/TestProperties.py @@ -22,70 +22,70 @@ def run(): input = digi.input_action('DigiParallelActionSequence/Test') input.add_property('property_int', 1) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_int')),)) - print('property: property_int = %s'%(str(input.property_int),)) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_int')),)) + print('property: property_int = %s' % (str(input.property_int),)) input.property_int = 123456 - print('property: property_int = %s'%(str(input.property_int),)) - - input.add_vector_property('property_vector_int', [1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_vector_int')),)) - print('property: property_vector_int = %s'%(str(input.property_vector_int),)) - input.property_vector_int = [1,2,3,4,5,6,7,8,9,0] - print('property: property_vector_int = %s'%(str(input.property_vector_int),)) - - input.add_list_property('property_list_int', [1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_list_int')),)) - print('property: property_list_int = %s'%(str(input.property_list_int),)) - input.property_list_int = [1,2,3,4,5,6,7,8,9,0] - print('property: property_list_int = %s'%(str(input.property_list_int),)) - - input.add_set_property('property_set_int', [1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_set_int')),)) - print('property: property_set_int = %s'%(str(input.property_set_int),)) - input.property_set_int = [1,2,3,4,5,6,7,8,9,0] - print('property: property_set_int = %s'%(str(input.property_set_int),)) + print('property: property_int = %s' % (str(input.property_int),)) + + input.add_vector_property('property_vector_int', [1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_vector_int')),)) + print('property: property_vector_int = %s' % (str(input.property_vector_int),)) + input.property_vector_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_vector_int = %s' % (str(input.property_vector_int),)) + + input.add_list_property('property_list_int', [1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_list_int')),)) + print('property: property_list_int = %s' % (str(input.property_list_int),)) + input.property_list_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_list_int = %s' % (str(input.property_list_int),)) + + input.add_set_property('property_set_int', [1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_set_int')),)) + print('property: property_set_int = %s' % (str(input.property_set_int),)) + input.property_set_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_set_int = %s' % (str(input.property_set_int),)) input.add_property('property_double', 1.0) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_double')),)) - print('property: property_double = %s'%(str(input.property_double),)) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_double')),)) + print('property: property_double = %s' % (str(input.property_double),)) input.property_double = 123456.7 - print('property: property_double = %s'%(str(input.property_double),)) - - input.add_vector_property('property_vector_double', [1.1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_vector_double')),)) - print('property: property_vector_double = %s'%(str(input.property_vector_double),)) - input.property_vector_double = [1.5,2,3,4,5,6,7,8,9,0] - print('property: property_vector_double = %s'%(str(input.property_vector_double),)) - - input.add_list_property('property_list_double', [1.1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_list_double')),)) - print('property: property_list_double = %s'%(str(input.property_list_double),)) - input.property_list_double = [1.5,2,3,4,5,6,7,8,9,0] - print('property: property_list_double = %s'%(str(input.property_list_double),)) - - input.add_set_property('property_set_double', [1.1,2,3]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_set_double')),)) - print('property: property_set_double = %s'%(str(input.property_set_double),)) - input.property_set_double = [1.5,2,3,4,5,6,7,8,9,0] - print('property: property_set_double = %s'%(str(input.property_set_double),)) + print('property: property_double = %s' % (str(input.property_double),)) + + input.add_vector_property('property_vector_double', [1.1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_vector_double')),)) + print('property: property_vector_double = %s' % (str(input.property_vector_double),)) + input.property_vector_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_vector_double = %s' % (str(input.property_vector_double),)) + + input.add_list_property('property_list_double', [1.1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_list_double')),)) + print('property: property_list_double = %s' % (str(input.property_list_double),)) + input.property_list_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_list_double = %s' % (str(input.property_list_double),)) + + input.add_set_property('property_set_double', [1.1, 2, 3]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_set_double')),)) + print('property: property_set_double = %s' % (str(input.property_set_double),)) + input.property_set_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0] + print('property: property_set_double = %s' % (str(input.property_set_double),)) input.add_property('property_string', "string_1") - print('property: has_property = %s'%(yes_no(input.hasProperty('property_string')),)) - print('property: property_string = %s'%(input.property_string,)) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_string')),)) + print('property: property_string = %s' % (input.property_string,)) input.property_string = "string_1123456" - print('property: property_string = %s'%(input.property_string,)) + print('property: property_string = %s' % (input.property_string,)) - input.add_vector_property('property_vector_string', ["string1","string2","string3"]) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_vector_string')),)) - print('property: property_vector_string = %s'%(input.property_vector_string,)) - input.property_vector_string = ["string1","string2","string3","string4","string5","string6"] - print('property: property_vector_string = %s'%(input.property_vector_string,)) + input.add_vector_property('property_vector_string', ["string1", "string2", "string3"]) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_vector_string')),)) + print('property: property_vector_string = %s' % (input.property_vector_string,)) + input.property_vector_string = ["string1", "string2", "string3", "string4", "string5", "string6"] + print('property: property_vector_string = %s' % (input.property_vector_string,)) - input.add_position_property('property_position', (1.,2.,3.)) - print('property: has_property = %s'%(yes_no(input.hasProperty('property_position')),)) - print('property: property_position = %s'%(input.property_position,)) + input.add_position_property('property_position', (1., 2., 3.)) + print('property: has_property = %s' % (yes_no(input.hasProperty('property_position')),)) + print('property: property_position = %s' % (input.property_position,)) input.property_position = (111.1, 222.2, 333.3) - print('property: property_position = %s'%(input.property_position,)) + print('property: property_position = %s' % (input.property_position,)) if __name__ == '__main__': diff --git a/examples/DDDigi/scripts/TestResegmentation.py b/examples/DDDigi/scripts/TestResegmentation.py index ed42aa1ee..d29af0775 100644 --- a/examples/DDDigi/scripts/TestResegmentation.py +++ b/examples/DDDigi/scripts/TestResegmentation.py @@ -23,20 +23,20 @@ def run(): # ======================================================================== event = digi.event_action('DigiSequentialActionSequence/EventAction') seq = event.adopt_action('DigiContainerSequenceAction/ResegmentSeq', - parallel=True, + parallel=True, input_mask=0x0, input_segment='inputs', output_mask=0xFEED, output_segment='outputs') resegment = digi.create_action('DigiResegment/Resegment') resegment.detector = 'EcalBarrel' - resegment.readout = 'NewEcalBarrelHits' + resegment.readout = 'NewEcalBarrelHits' resegment.descriptor = """ <readout name="NewEcalBarrelHits"> - <segmentation type="CartesianGridXY" grid_size_x="10" grid_size_y="10" /> + <segmentation type="CartesianGridXY" grid_size_x="10" grid_size_y="10"/> <id>system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16</id> - </readout> + </readout> """ - seq.adopt_container_processor(resegment,'EcalBarrelHits') - dump = event.adopt_action('DigiStoreDump/StoreDump') + seq.adopt_container_processor(resegment, 'EcalBarrelHits') + event.adopt_action('DigiStoreDump/StoreDump') digi.info('Created event.dump') # ======================================================================== -- GitLab