Skip to content

Commit

Permalink
Fix tests in parallel and fix the transformer multiple test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Aug 1, 2023
1 parent 169ff67 commit 7e86b11
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
) {}

Expand All @@ -61,12 +61,21 @@ struct ExampleFunctionalTransformerMultiple final : Gaudi::Functional::MultiTran
auto particlesColl = dynamic_cast<const edm4hep::MCParticleCollection*>(particles.getData());
auto newParticlesColl = std::make_unique<edm4hep::MCParticleCollection>();
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<edm4hep::MCParticleCollection>(std::move(newParticlesColl));
counter->push_back(particlesColl->size());


auto simTrackerHitsColl = dynamic_cast<const edm4hep::SimTrackerHitCollection*>(simTrackerHits.getData());
counter->push_back(simTrackerHitsColl->size());

Expand All @@ -79,7 +88,6 @@ struct ExampleFunctionalTransformerMultiple final : Gaudi::Functional::MultiTran
auto counterDW = DataWrapper<podio::UserDataCollection<int>>(std::move(counter));

return std::make_tuple(counterDW, particleDW);

}

};
Expand Down

0 comments on commit 7e86b11

Please sign in to comment.