diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 77569e4b..f05706d9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -88,6 +88,8 @@ if (BASH_PROGRAM) # multiple processors add_test( global_converter_maps ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/global_converter_maps.sh ) + add_test( event_header ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/event_header.sh ) + set_tests_properties ( simple_processors simple_processors2 @@ -100,6 +102,7 @@ if (BASH_PROGRAM) clicRec_edm4hep_input clic_geo_test global_converter_maps + event_header PROPERTIES ENVIRONMENT "TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR};LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64:$ENV{LD_LIBRARY_PATH};PYTHONPATH=${CMAKE_INSTALL_PREFIX}/python:$ENV{PYTHONPATH};EXAMPLE_DIR=${PROJECT_SOURCE_DIR}/k4MarlinWrapper/examples;MARLIN_DLL=$ENV{MARLIN_DLL}:${CMAKE_CURRENT_BINARY_DIR}/libMarlinTestProcessors.so" ) diff --git a/test/gaudi_opts/createEventHeader.py b/test/gaudi_opts/createEventHeader.py new file mode 100644 index 00000000..d1ea0b9a --- /dev/null +++ b/test/gaudi_opts/createEventHeader.py @@ -0,0 +1,45 @@ +# +# Copyright (c) 2014-2023 Key4hep-Project. +# +# This file is part of Key4hep. +# See https://key4hep.github.io/key4hep-doc/ for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from Gaudi.Configuration import WARNING + +from Configurables import ( + EventHeaderCreator, + k4DataSvc, + MarlinProcessorWrapper, + ApplicationMgr, +) + +eventHeaderCreator = EventHeaderCreator("eventHeaderCreator", eventNumberOffset=42) + +podioevent = k4DataSvc("EventDataSvc") + +out = MarlinProcessorWrapper("out") +out.ProcessorType = "LCIOOutputProcessor" +out.Parameters = {"LCIOOutputFile": ["test.slcio"], "LCIOWriteMode": ["WRITE_NEW"]} + +ApplicationMgr( + TopAlg=[ + eventHeaderCreator, + out, + ], + EvtSel="NONE", + EvtMax=2, + ExtSvc=[podioevent], + OutputLevel=WARNING, +) diff --git a/test/scripts/event_header.sh b/test/scripts/event_header.sh new file mode 100644 index 00000000..0b50499d --- /dev/null +++ b/test/scripts/event_header.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +## +## Copyright (c) 2019-2023 Key4hep-Project. +## +## This file is part of Key4hep. +## See https://key4hep.github.io/key4hep-doc/ for further info. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +set -eu + +k4run $TEST_DIR/gaudi_opts/createEventHeader.py +anajob test.slcio | grep "EVENT: 42"