File indexing completed on 2025-04-02 08:02:48
0001 from DDSim.DD4hepSimulation import DD4hepSimulation
0002 from g4units import mm, GeV, MeV, m
0003 import DDG4
0004 import argparse
0005 import sys
0006
0007
0008
0009 print("== STARTED STEERING FILE ==")
0010 print(f"g4units: mm={mm}, GeV={GeV}, MeV={MeV}")
0011
0012
0013
0014
0015 parser = argparse.ArgumentParser()
0016 parser.add_argument('--outputFile', type=str, default="output", help='Output file name')
0017 args, _ = parser.parse_known_args()
0018
0019
0020 outputFile = args.outputFile if args.outputFile else "output"
0021 if outputFile.endswith('.edm4hep.root'):
0022 outputFile = outputFile[:-len('.edm4hep.root')] + '.evt.txt'
0023 else:
0024 outputFile += '.evt.txt'
0025
0026 print(f"Steering event display 'outputFile' = {outputFile}")
0027
0028
0029 SIM = DD4hepSimulation()
0030
0031
0032 kernel = DDG4.Kernel()
0033
0034
0035 stepping = DDG4.SteppingAction(kernel, 'TextDumpingSteppingAction/MyStepper')
0036 stepping.OutputFileName = outputFile
0037 stepping.OnlyPrimary = False
0038 stepping.MomentumMin = 150
0039 stepping.VertexCut = True
0040 stepping.VertexZMin = -5000
0041 stepping.VertexZMax = 5000
0042
0043 kernel.steppingAction().add(stepping)
0044
0045 print("== ENDED STEERING FILE ==")