Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #15

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
SETUP: ['/cvmfs/sw.hsf.org/key4hep/setup.sh', '/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh']
SETUP: ['/cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh']
steps:
- uses: actions/checkout@v2
- uses: cvmfs-contrib/github-action-cvmfs@v2
Expand Down
5 changes: 3 additions & 2 deletions ARCdigi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ install(TARGETS ${PackageName}

install(FILES ${scripts} DESTINATION test)

SET(test_name "test_runARCdigitizer")
ADD_TEST(NAME t_${test_name} COMMAND k4run test/runARCdigitizer.py)
#SET(test_name "test_runARCdigitizer")
#ADD_TEST(NAME ${test_name} COMMAND k4run test/runARCdigitizer.py)
#set_test_env(${test_name})
1 change: 1 addition & 0 deletions ARCdigi/test/runARCdigitizer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from Gaudi.Configuration import *
from Configurables import ApplicationMgr

Expand Down
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
CMAKE_MINIMUM_REQUIRED(VERSION 3.12 FATAL_ERROR)

project(k4RecTracker)
set( PackageName k4RecTracker )
project(${PackageName})

# please keep this layout for version setting, used by the automatic tagging script
set(PACKAGE_VERSION_MAJOR 1)
set(PACKAGE_VERSION_MINOR 2)
set(PACKAGE_VERSION_PATCH 3)
set(${PackageName}_VERSION_MAJOR 0)
set(${PackageName}_VERSION_MINOR 1)
set(${PackageName}_VERSION_PATCH 0)

set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
set(${PackageName}_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")

# dependencies
# For some reason, the find_package with DD4hep must be the first one
Expand Down Expand Up @@ -52,6 +53,11 @@ if("${isSystemDir}" STREQUAL "-1")
endif("${isSystemDir}" STREQUAL "-1")

include(CTest)
function(set_test_env _testname)
set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT "ROOT_INCLUDE_PATH=$<$<TARGET_EXISTS:podio::podio>:$<TARGET_FILE_DIR:podio::podio>/../include>:$<$<TARGET_EXISTS:EDM4HEP::edm4hep>:$<TARGET_FILE_DIR:EDM4HEP::edm4hep>/../include>:$ENV{ROOT_INCLUDE_PATH}")
set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}:${PROJECT_BINARY_DIR}/genConfDir/${PackageName}:$<$<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 ${test_name} APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}:${PROJECT_BINARY_DIR}/genConfDir:$ENV{PYTHONPATH}")
endfunction()

add_subdirectory(DCHdigi)
add_subdirectory(ARCdigi)
Expand Down
21 changes: 14 additions & 7 deletions DCHdigi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
project(DCHdigi)
set(PackageName DCHdigi)

project(${PackageName})

# Build the extension data model and link it against the upstream model
PODIO_GENERATE_DATAMODEL(extension dataFormatExtension/driftChamberHit.yaml ext_headers ext_sources
Expand Down Expand Up @@ -40,7 +42,7 @@ file(GLOB headers
${PROJECT_SOURCE_DIR}/include/*.h
)

gaudi_add_module(DCHdigi
gaudi_add_module(${PackageName}
SOURCES ${sources}
LINK
Gaudi::GaudiKernel
Expand All @@ -50,21 +52,21 @@ gaudi_add_module(DCHdigi
DD4hep::DDRec
)

target_include_directories(DCHdigi PUBLIC
target_include_directories(${PackageName} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${CMAKE_INSTALL_PREFIX}/extension
)

set_target_properties(DCHdigi PROPERTIES PUBLIC_HEADER "${headers}")
set_target_properties(${PackageName} PROPERTIES PUBLIC_HEADER "${headers}")

file(GLOB scripts
${PROJECT_SOURCE_DIR}/test/*.py
)

file(COPY ${scripts} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test)

install(TARGETS DCHdigi
install(TARGETS ${PackageName}
EXPORT ${CMAKE_PROJECT_NAME}Targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
Expand All @@ -73,5 +75,10 @@ install(TARGETS DCHdigi

install(FILES ${scripts} DESTINATION test)

ADD_TEST(NAME "t_DCHsimpleDigitizer" COMMAND k4run test/runDCHsimpleDigitizer.py)
ADD_TEST(NAME "t_DCHsimpleDigitizerExtendedEdm" COMMAND k4run test/runDCHsimpleDigitizerExtendedEdm.py)
SET(test_name "test_DCHsimpleDigitizer")
ADD_TEST(NAME ${test_name} COMMAND k4run test/runDCHsimpleDigitizer.py)
set_test_env(${test_name})

SET(test_name "test_DCHsimpleDigitizerExtendedEdm")
ADD_TEST(NAME ${test_name} COMMAND k4run test/runDCHsimpleDigitizerExtendedEdm.py)
set_test_env(${test_name})
8 changes: 4 additions & 4 deletions DCHdigi/test/runDCHsimpleDigitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc")
# if FCC_DETECTORS is empty, this should use relative path to working directory
path_to_detector = os.environ.get("FCCDETECTORS", "")
path_to_detector = os.environ.get("K4GEO", "")
print(path_to_detector)
detectors_to_use=[
'Detector/DetFCCeeIDEA/compact/IDEA_o1_v01/FCCee_DectMaster_v01.xml'
'FCCee/IDEA/compact/IDEA_o1_v02/IDEA_o1_v02.xml'
]
# prefix all xmls with path_to_detector
geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
Expand Down Expand Up @@ -88,7 +88,7 @@
particle_converter.GenParticles.Path = genParticlesOutputName

from Configurables import SimG4SaveTrackerHits
savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutNames=["CDCHHits"])
savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutName="CDCHHits")
savetrackertool.SimTrackHits.Path = "DC_simTrackerHits"


Expand Down Expand Up @@ -144,7 +144,7 @@
out
],
EvtSel = 'NONE',
EvtMax = 100,
EvtMax = 10,
ExtSvc = [geoservice, podioevent, geantservice, audsvc],
StopOnSignal = True,
)
6 changes: 3 additions & 3 deletions DCHdigi/test/runDCHsimpleDigitizerExtendedEdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc")
# if FCC_DETECTORS is empty, this should use relative path to working directory
path_to_detector = os.environ.get("FCCDETECTORS", "")
path_to_detector = os.environ.get("K4GEO", "")
print(path_to_detector)
detectors_to_use=[
'Detector/DetFCCeeIDEA/compact/IDEA_o1_v01/FCCee_DectMaster_v01.xml'
'FCCee/IDEA/compact/IDEA_o1_v02/IDEA_o1_v02.xml'
]
# prefix all xmls with path_to_detector
geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
Expand Down Expand Up @@ -106,7 +106,7 @@
particle_converter.GenParticles.Path = genParticlesOutputName

from Configurables import SimG4SaveTrackerHits
savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutNames=["CDCHHits"])
savetrackertool = SimG4SaveTrackerHits("SimG4SaveTrackerHits", readoutName="CDCHHits")
savetrackertool.SimTrackHits.Path = "DC_simTrackerHits"


Expand Down
18 changes: 11 additions & 7 deletions Tracking/test/runGenFitTrackingOnSimplifiedDriftChamber.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc")
# if FCC_DETECTORS is empty, this should use relative path to working directory
path_to_detector = os.environ.get("FCCDETECTORS", "")
path_to_detector = os.environ.get("K4GEO", "")
print(path_to_detector)
detectors_to_use=[
'Detector/DetFCCeeIDEA/compact/FCCee_DectMaster.xml',
'FCCee/IDEA/compact/IDEA_o1_v02/IDEA_o1_v02.xml',
]
# prefix all xmls with path_to_detector
geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
Expand Down Expand Up @@ -88,16 +88,16 @@
particle_converter.GenParticles.Path = genParticlesOutputName

from Configurables import SimG4SaveTrackerHits
saveDCHsimHitTool = SimG4SaveTrackerHits("saveDCHsimHitTool", readoutNames=["SimplifiedDriftChamberCollection"])
saveDCHsimHitTool = SimG4SaveTrackerHits("saveDCHsimHitTool", readoutName="CDCHHits")
saveDCHsimHitTool.SimTrackHits.Path = "DC_simTrackerHits"

saveVTXIBsimHitTool = SimG4SaveTrackerHits("saveVTXIBsimHitTool", readoutNames=["VTXIBCollection"])
saveVTXIBsimHitTool = SimG4SaveTrackerHits("saveVTXIBsimHitTool", readoutName="VTXIBCollection")
saveVTXIBsimHitTool.SimTrackHits.Path = "VTXIB_simTrackerHits"

saveVTXOBsimHitTool = SimG4SaveTrackerHits("saveVTXOBsimHitTool", readoutNames=["VTXOBCollection"])
saveVTXOBsimHitTool = SimG4SaveTrackerHits("saveVTXOBsimHitTool", readoutName="VTXOBCollection")
saveVTXOBsimHitTool.SimTrackHits.Path = "VTXOB_simTrackerHits"

saveVTXDsimHitTool = SimG4SaveTrackerHits("saveVTXDsimHitTool", readoutNames=["VTXDCollection"])
saveVTXDsimHitTool = SimG4SaveTrackerHits("saveVTXDsimHitTool", readoutName="VTXDCollection")
saveVTXDsimHitTool.SimTrackHits.Path = "VTXD_simTrackerHits"

from Configurables import SimG4Alg
Expand All @@ -113,26 +113,30 @@
from Configurables import VTXdigitizer
vtxib_digitizer = VTXdigitizer("VTXIBdigitizer",
inputSimHits = saveVTXIBsimHitTool.SimTrackHits.Path,
readoutName = "VTXIBCollection",
outputDigiHits = vtxib_reco_hit_name
)

vtxob_reco_hit_name = saveVTXOBsimHitTool.SimTrackHits.Path.replace("sim", "reco")
from Configurables import VTXdigitizer
vtxob_digitizer = VTXdigitizer("VTXOBdigitizer",
inputSimHits = saveVTXOBsimHitTool.SimTrackHits.Path,
readoutName = "VTXOBCollection",
outputDigiHits = vtxob_reco_hit_name
)

vtxd_reco_hit_name = saveVTXDsimHitTool.SimTrackHits.Path.replace("sim", "reco")
vtxd_digitizer = VTXdigitizer("VTXDdigitizer",
inputSimHits = saveVTXDsimHitTool.SimTrackHits.Path,
readoutName = "VTXDCollection",
outputDigiHits = vtxd_reco_hit_name
)

dch_reco_hit_name = saveDCHsimHitTool.SimTrackHits.Path.replace("sim", "reco")
from Configurables import DCHsimpleDigitizer
dch_digitizer = DCHsimpleDigitizer("DCHsimpleDigitizer",
inputSimHits = saveDCHsimHitTool.SimTrackHits.Path,
readoutName = "CDCHHits",
outputDigiHits = dch_reco_hit_name
)

Expand Down Expand Up @@ -170,7 +174,7 @@
genAlg,
hepmc_converter,
geantsim,
vtxb_digitizer,
vtxib_digitizer,
vtxd_digitizer,
dch_digitizer,
genfitter,
Expand Down
3 changes: 2 additions & 1 deletion VTXdigi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ install(TARGETS ${PackageName}
install(FILES ${scripts} DESTINATION test)

SET(test_name "test_runVTXdigitizer")
ADD_TEST(NAME t_${test_name} COMMAND k4run test/runVTXdigitizer.py)
ADD_TEST(NAME ${test_name} COMMAND k4run test/runVTXdigitizer.py)
set_test_env(${test_name})
52 changes: 26 additions & 26 deletions VTXdigi/test/runVTXdigitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
# IDEA
geantsim = SimG4Alg("SimG4Alg",
outputs= [SimG4SaveTrackerHitsIB, SimG4SaveTrackerHitsOB, SimG4SaveTrackerHitsD,
SimG4SaveTrackerHitsSiWrB, SimG4SaveTrackerHitsSiWrD,
#SimG4SaveTrackerHitsSiWrB, SimG4SaveTrackerHitsSiWrD,
#saveHistTool
],
eventProvider=particle_converter,
Expand Down Expand Up @@ -221,29 +221,29 @@
OutputLevel = INFO
)

siwrb_digitizer = VTXdigitizer("SiWrBdigitizer",
inputSimHits = SimG4SaveTrackerHitsSiWrB.SimTrackHits.Path,
outputDigiHits = SimG4SaveTrackerHitsSiWrB.SimTrackHits.Path.replace("sim", "digi"),
detectorName = "SiliconWrapper",
readoutName = "SiWrBCollection",
xResolution = siWrapperResolution_x, # mm, r direction
yResolution = siWrapperResolution_y, # mm, phi direction
tResolution = siWrapperResolution_t, # ns
forceHitsOntoSurface = False,
OutputLevel = INFO
)

siwrd_digitizer = VTXdigitizer("SiWrDdigitizer",
inputSimHits = SimG4SaveTrackerHitsSiWrD.SimTrackHits.Path,
outputDigiHits = SimG4SaveTrackerHitsSiWrD.SimTrackHits.Path.replace("sim", "digi"),
detectorName = "SiliconWrapper",
readoutName = "SiWrDCollection",
xResolution = siWrapperResolution_x, # mm, r direction
yResolution = siWrapperResolution_y, # mm, phi direction
tResolution = siWrapperResolution_t, # ns
forceHitsOntoSurface = False,
OutputLevel = INFO
)
#siwrb_digitizer = VTXdigitizer("SiWrBdigitizer",
# inputSimHits = SimG4SaveTrackerHitsSiWrB.SimTrackHits.Path,
# outputDigiHits = SimG4SaveTrackerHitsSiWrB.SimTrackHits.Path.replace("sim", "digi"),
# detectorName = "SiliconWrapper",
# readoutName = "SiWrBCollection",
# xResolution = siWrapperResolution_x, # mm, r direction
# yResolution = siWrapperResolution_y, # mm, phi direction
# tResolution = siWrapperResolution_t, # ns
# forceHitsOntoSurface = False,
# OutputLevel = INFO
#)
#
#siwrd_digitizer = VTXdigitizer("SiWrDdigitizer",
# inputSimHits = SimG4SaveTrackerHitsSiWrD.SimTrackHits.Path,
# outputDigiHits = SimG4SaveTrackerHitsSiWrD.SimTrackHits.Path.replace("sim", "digi"),
# detectorName = "SiliconWrapper",
# readoutName = "SiWrDCollection",
# xResolution = siWrapperResolution_x, # mm, r direction
# yResolution = siWrapperResolution_y, # mm, phi direction
# tResolution = siWrapperResolution_t, # ns
# forceHitsOntoSurface = False,
# OutputLevel = INFO
#)

# run the genfit tracking
# from Configurables import GenFitter
Expand Down Expand Up @@ -298,11 +298,11 @@
hepmc_converter,
geantsim,
vtxib_digitizer, vtxob_digitizer, vtxd_digitizer,
siwrb_digitizer, siwrd_digitizer,
#siwrb_digitizer, siwrd_digitizer,
out
],
EvtSel = 'NONE',
EvtMax = 100000,
EvtMax = 10,
ExtSvc = [geoservice, podioevent, geantservice, audsvc],
StopOnSignal = True
)
Loading