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