Skip to content
Snippets Groups Projects
Commit 9044fdc7 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Feature: check overlaps with geant4

parent 25edacd4
No related branches found
No related tags found
No related merge requests found
......@@ -136,14 +136,23 @@ dump_constants:
script:
- npdet_info dump ${DETECTOR_PATH}/athena.xml | tee doc/constants.out
overlap_check:
overlap_check_tgeo:
stage: test
needs:
- ["common:detector"]
script:
- checkOverlaps -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check.out
- echo "$(cat doc/overlap_check.out | grep ovlp | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
- checkOverlaps -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_tgeo.out
- echo "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
overlap_check_geant4:
stage: test
needs:
- ["common:detector"]
script:
- python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_geant4.out
- echo "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l) overlaps..."
- if [[ "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
convert_to_gdml:
stage: test
......@@ -177,7 +186,7 @@ benchmarks:detector:
trigger:
project: EIC/benchmarks/detector_benchmarks
strategy: depend
needs: ["overlap_check","report"]
needs: ["overlap_check_tgeo","overlap_check_geant4","report"]
allow_failure: true
......@@ -189,7 +198,7 @@ benchmarks:detector:
# trigger:
# project: EIC/benchmarks/reconstruction_benchmarks
# strategy: depend
# needs: ["env","overlap_check","report"]
# needs: ["env","overlap_check_tgeo","overlap_check_geant4","report"]
#
#
#benchmarks:physics:
......@@ -200,5 +209,5 @@ benchmarks:detector:
# trigger:
# project: EIC/benchmarks/physics_benchmarks
# strategy: depend
# needs: ["env","overlap_check","report"]
# needs: ["env","overlap_check_tgeo","overlap_check_geant4","report"]
from __future__ import absolute_import, unicode_literals
import os
import time
import logging
import argparse
parser = argparse.ArgumentParser(
prog='convert_to_gdml.py',
description='''Convert DD4Hep description to GDML''',
epilog='''
This program converts the compact detector file to a single GDML file.
''')
parser.add_argument("-c", "--compact", help="compact detector file",default="athena.xml")
parser.add_argument("-r", "--resolution", help="number of points on surface",default="10000")
parser.add_argument("-t", "--tolerance", help="minimum distance (in mm) to report overlaps",default="0.1")
parser.add_argument("-v", "--verbose", help="print output", action='store_true')
args = parser.parse_args()
import DDG4
from g4units import keV, GeV, mm, ns, MeV
def run():
kernel = DDG4.Kernel()
description = kernel.detectorDescription()
kernel.loadGeometry(str("file:" + args.compact))
DDG4.importConstants(description)
geant4 = DDG4.Geant4(kernel)
ui = geant4.setupCshUI(ui=None)
ui.Commands = [
'/geometry/test/resolution {}'.format(args.resolution),
'/geometry/test/tolerance {}'.format(args.tolerance),
'/geometry/test/verbosity {}'.format(1 if args.verbose else 0),
'/geometry/test/run'
]
kernel.configure()
kernel.initialize()
kernel.run()
kernel.terminate()
if __name__ == "__main__":
run()
......@@ -10,8 +10,8 @@ parser = argparse.ArgumentParser(
epilog='''
This program converts the compact detector file to a single GDML file.
''')
parser.add_argument("--compact", help="compact detector file",default="athena.xml")
parser.add_argument("--output", help="gdml detector file",default="athena.gdml")
parser.add_argument("-c", "--compact", help="compact detector file",default="athena.xml")
parser.add_argument("-o", "--output", help="gdml detector file",default="athena.gdml")
args = parser.parse_args()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment