From 7e86b11f550567d9cdf220225497906921df145b Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Tue, 1 Aug 2023 17:35:44 +0200 Subject: [PATCH] Fix tests in parallel and fix the transformer multiple test --- test/k4FWCoreTest/CMakeLists.txt | 6 ++++-- .../ExampleFunctionalTransformerMultiple.cpp | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index 3511a76e..3f932a91 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -161,7 +161,7 @@ add_test(NAME ExampleFunctionalTransformer set_test_env(ExampleFunctionalTransformer) set_tests_properties(ExampleFunctionalTransformer PROPERTIES PASS_REGULAR_EXPRESSION "Application Manager Terminated successfully with a user requested ScheduledStop" - DEPENDS ExampleFunctionalProducer) + DEPENDS "ExampleFunctionalProducer;ExampleFunctionalConsumer") add_test(NAME ExampleFunctionalProducerMultiple WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} @@ -178,4 +178,6 @@ add_test(NAME ExampleFunctionalTransformerMultiple WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND ${K4RUN} options/runExampleFunctionalTransformerMultiple.py) set_test_env(ExampleFunctionalTransformerMultiple) -set_tests_properties(ExampleFunctionalTransformerMultiple PROPERTIES DEPENDS ExampleFunctionalProducerMultiple) +set_tests_properties(ExampleFunctionalTransformerMultiple PROPERTIES + PASS_REGULAR_EXPRESSION "Application Manager Terminated successfully with a user requested ScheduledStop" + DEPENDS "ExampleFunctionalProducerMultiple;ExampleFunctionalConsumerMultiple") diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp index bd86e1a9..55337ea9 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp @@ -39,8 +39,8 @@ struct ExampleFunctionalTransformerMultiple final : Gaudi::Functional::MultiTran KeyValue("InputLocationTracks", "Tracks") }, { - KeyValue("OutputLocationFloat", "VectorFloat"), - KeyValue("InputLocationParticles", "MCParticles") + KeyValue("OutputLocationCounter", "Counter"), + KeyValue("OutputLocationParticles", "MCParticles_out") } ) {} @@ -61,12 +61,21 @@ struct ExampleFunctionalTransformerMultiple final : Gaudi::Functional::MultiTran auto particlesColl = dynamic_cast(particles.getData()); auto newParticlesColl = std::make_unique(); for (const auto& p : *particlesColl) { - newParticlesColl->push_back(p); + // We need to create a new particle since the current one is already in a collection + + // We could create a new one + auto newParticle = newParticlesColl->create(); + newParticle.setPDG(p.getPDG()); + newParticle.setGeneratorStatus(p.getGeneratorStatus() + 1); + newParticle.setSimulatorStatus(p.getSimulatorStatus() + 1); + newParticle.setCharge(p.getCharge() + 2); + newParticle.setTime(p.getTime() + 3); + newParticle.setMass(p.getMass() + 4); + } auto particleDW = DataWrapper(std::move(newParticlesColl)); counter->push_back(particlesColl->size()); - auto simTrackerHitsColl = dynamic_cast(simTrackerHits.getData()); counter->push_back(simTrackerHitsColl->size()); @@ -79,7 +88,6 @@ struct ExampleFunctionalTransformerMultiple final : Gaudi::Functional::MultiTran auto counterDW = DataWrapper>(std::move(counter)); return std::make_tuple(counterDW, particleDW); - } };