Skip to content

Commit

Permalink
Fix tests (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Feb 26, 2024
1 parent cf19790 commit 3bb7f77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
22 changes: 12 additions & 10 deletions gaudi_opts/clue_gaudi_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from Gaudi.Configuration import *
from Gaudi.Configuration import WARNING, DEBUG

from Configurables import LcioEvent, k4DataSvc, MarlinProcessorWrapper
from k4MarlinWrapper.parseConstants import *
algList = []
from Configurables import k4DataSvc, MarlinProcessorWrapper

from Configurables import PodioInput
from Configurables import ClueGaudiAlgorithmWrapper
from Configurables import CLUENtuplizer
from Configurables import THistSvc
from Configurables import PodioOutput
from Configurables import ApplicationMgr

algList = []


evtsvc = k4DataSvc('EventDataSvc')
evtsvc.input = 'https://key4hep.web.cern.ch/testFiles/k4clue/inputData/clic/20230825_gammaFromSurface_10GeV_uniform_500events_reco_edm4hep.root'
# evtsvc.input =

inp = PodioInput('InputReader')
inp.collections = [
Expand All @@ -44,7 +51,6 @@
}


from Configurables import ClueGaudiAlgorithmWrapper

MyClueGaudiAlgorithmWrapper = ClueGaudiAlgorithmWrapper("ClueGaudiAlgorithmWrapperName")
MyClueGaudiAlgorithmWrapper.BarrelCaloHitsCollection = "ECALBarrel"
Expand All @@ -54,22 +60,19 @@
MyClueGaudiAlgorithmWrapper.OutlierDeltaFactor = 3.00
MyClueGaudiAlgorithmWrapper.OutputLevel = DEBUG

from Configurables import CLUENtuplizer
MyCLUENtuplizer = CLUENtuplizer("CLUEAnalysis")
MyCLUENtuplizer.ClusterCollection = "CLUEClusters"
MyCLUENtuplizer.BarrelCaloHitsCollection = "ECALBarrel"
MyCLUENtuplizer.EndcapCaloHitsCollection = "ECALEndcap"
MyCLUENtuplizer.SingleMCParticle = True
MyCLUENtuplizer.OutputLevel = WARNING

from Configurables import THistSvc
THistSvc().Output = ["rec DATAFILE='k4clue_analysis_output.root' TYP='ROOT' OPT='RECREATE'"]
THistSvc().OutputLevel = WARNING
THistSvc().PrintAll = False
THistSvc().AutoSave = True
THistSvc().AutoFlush = True

from Configurables import PodioOutput
out = PodioOutput("out")
MyClueGaudiAlgorithmWrapper.BarrelCaloHitsCollection = "ECALBarrel"
MyClueGaudiAlgorithmWrapper.EndcapCaloHitsCollection = "ECALEndcap"
Expand All @@ -82,7 +85,6 @@
algList.append(MyCLUENtuplizer)
algList.append(out)

from Configurables import ApplicationMgr
ApplicationMgr( TopAlg = algList,
EvtSel = 'NONE',
EvtMax = 3,
Expand Down
15 changes: 11 additions & 4 deletions src/k4clue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ limitations under the License.

# CLUE as Gaudi algorithm

include(ExternalData)
set(ExternalData_URL_TEMPLATES
"https://key4hep.web.cern.ch:443/testFiles/k4clue/inputData/clic/%(hash)"
)

gaudi_add_module(ClueGaudiAlgorithmWrapper
SOURCES
${PROJECT_SOURCE_DIR}/src/ClueGaudiAlgorithmWrapper.cpp
Expand All @@ -36,12 +41,14 @@ gaudi_add_module(ClueGaudiAlgorithmWrapper
target_include_directories(ClueGaudiAlgorithmWrapper PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)

add_test(NAME gaudiWrapper
ExternalData_Add_Test(k4clue_tests NAME gaudiWrapper
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND bash -c "source k4clueenv.sh; \
k4run ${PROJECT_SOURCE_DIR}/gaudi_opts/clue_gaudi_wrapper.py --ClueGaudiAlgorithmWrapperName.OutputLevel 2 --CLUEAnalysis.OutputLevel 2")
COMMAND bash -c "k4run ${PROJECT_SOURCE_DIR}/gaudi_opts/clue_gaudi_wrapper.py --EventDataSvc.input DATA{${PROJECT_SOURCE_DIR}/test/input_files/20240226_gammaFromVertex_10GeV_uniform_10events_reco_edm4hep.root} --ClueGaudiAlgorithmWrapperName.OutputLevel 2 --CLUEAnalysis.OutputLevel 2")

set_tests_properties(gaudiWrapper PROPERTIES
FAIL_REGULAR_EXPRESSION "ERROR;Failed")

set_property(TEST gaudiWrapper APPEND PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}:${PROJECT_BINARY_DIR}/src/k4clue:$<$<TARGET_EXISTS:ROOT::Core>:$<TARGET_FILE_DIR:ROOT::Core>>:$<$<TARGET_EXISTS:EDM4HEP::edm4hep>:$<TARGET_FILE_DIR:EDM4HEP::edm4hep>>:$<$<TARGET_EXISTS:podio::podio>:$<TARGET_FILE_DIR:podio::podio>>:$ENV{LD_LIBRARY_PATH}")
set_property(TEST gaudiWrapper APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/genConfDir:${PROJECT_BINARY_DIR}/src/k4clue/genConfDir:$ENV{PYTHONPATH}")

ExternalData_Add_Target(k4clue_tests)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
534c086df3c125d3d0328b6565115729

0 comments on commit 3bb7f77

Please sign in to comment.