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

Some more test dependency management, add SignalHandler to ddsim #1342

Merged
merged 5 commits into from
Oct 24, 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 DDG4/lcio/LCIOConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace dd4hep {
lc_hit->setCellID0((hit->cellID >> 0 ) & 0xFFFFFFFF);
lc_hit->setCellID1((hit->cellID >> sizeof(int)*8) & 0xFFFFFFFF); // ????
lc_hit->setPosition(pos);
///No! Done when adding particle contrbutions: lc_hit->setEnergy( hit->energyDeposit );
///No! Done when adding particle contributions: lc_hit->setEnergy( hit->energyDeposit );
lc_coll->addElement(lc_hit);
/// Now add the individual track contributions to the LCIO hit structure
for(Contributions::const_iterator j=hit->truth.begin(); j!=hit->truth.end(); ++j) {
Expand Down
7 changes: 7 additions & 0 deletions DDG4/python/DDSim/DD4hepSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self):
self.vertexSigma = [0.0, 0.0, 0.0, 0.0]
self.vertexOffset = [0.0, 0.0, 0.0, 0.0]
self.enableDetailedShowerMode = False
self.disableSignalHandler = False

self._errorMessages = []
self._dumpParameter = False
Expand Down Expand Up @@ -208,6 +209,10 @@ def parseOptions(self, argv=None):
default=self.enableDetailedShowerMode,
help="use detailed shower mode")

parser.add_argument("--disableSignalHandler", action="store_true", dest="disableSignalHandler",
default=self.disableSignalHandler,
help="disable the Signal Handler of DD4hep")

parser.add_argument("--dumpSteeringFile", action="store_true", dest="dumpSteeringFile",
default=self._dumpSteeringFile, help="print an example steering file to stdout")

Expand Down Expand Up @@ -317,6 +322,8 @@ def run(self):
# simple = DDG4.Geant4( kernel, tracker='Geant4TrackerAction',calo='Geant4CalorimeterAction')
# geant4 = DDG4.Geant4( kernel, tracker='Geant4TrackerCombineAction',calo='Geant4ScintillatorCalorimeterAction')
geant4 = DDG4.Geant4(kernel, tracker=self.action.tracker, calo=self.action.calo)
if not self.disableSignalHandler:
geant4.registerInterruptHandler()

geant4.printDetectors()

Expand Down
48 changes: 26 additions & 22 deletions examples/DDCAD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ set(ClientTestsEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/ClientTests)
# Single shape tests:

#Reference for test depends on assimp version
if(assimp_VERSION VERSION_GREATER_EQUAL 5.2.0)
if(assimp_VERSION VERSION_GREATER_EQUAL 5.2.7)
set(assimp_duck_VERSION 5.2.7)
elseif(assimp_VERSION VERSION_GREATER_EQUAL 5.2.0)
set(assimp_duck_VERSION 5.2.0)
else()
set(assimp_duck_VERSION 5.0.0)
Expand Down Expand Up @@ -160,24 +162,26 @@ dd4hep_add_test_reg( DDCAD_Issue1134_overlap_check
REGEX_PASS "Number of illegal overlaps/extrusions : 0"
REGEX_FAIL "Exception;ERROR;FAILED"
)
#
# Overlap check of Armin Ilg's example
dd4hep_add_test_reg( DDCAD_Issue1134_g4overlap_check
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
EXEC_ARGS ddsim --compactFile ${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
--enableG4Gun --runType run
--macroFile ${DDCADEx_INSTALL}/scripts/overlap.mac
REGEX_PASS "Checking overlaps for volume AV_2.Shape_STL_0.0.tessellated_.* .G4TessellatedSolid. ... OK"
REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
)
#
# Geometry scan of Armin Ilg's example
dd4hep_add_test_reg( DDCAD_Issue1134_g4geometry_scan
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
EXEC_ARGS g4GeometryScan
--compact=file:${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
--position=-35,-35,-300 --direction=7,7,60
REGEX_PASS ". -1.29, -1.29, -11.06. Path:./world/AV_2.Shape_STL_0.0.tessellated_.* Shape:G4TessellatedSolid Mat:Gold"
REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
)
#
if(TARGET DD4hep::DDG4)
#
# Overlap check of Armin Ilg's example
dd4hep_add_test_reg( DDCAD_Issue1134_g4overlap_check
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
EXEC_ARGS ddsim --compactFile ${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
--enableG4Gun --runType run
--macroFile ${DDCADEx_INSTALL}/scripts/overlap.mac
REGEX_PASS "Checking overlaps for volume AV_2.Shape_STL_0.0.tessellated_.* .G4TessellatedSolid. ... OK"
REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
)
#
# Geometry scan of Armin Ilg's example
dd4hep_add_test_reg( DDCAD_Issue1134_g4geometry_scan
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
EXEC_ARGS g4GeometryScan
--compact=file:${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
--position=-35,-35,-300 --direction=7,7,60
REGEX_PASS ". -1.29, -1.29, -11.06. Path:./world/AV_2.Shape_STL_0.0.tessellated_.* Shape:G4TessellatedSolid Mat:Gold"
REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
)
#
endif()
Loading
Loading