Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-02 08:02:48

0001 """
0002 This steering file uses
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 # This printout is to check this steering file is using
0012 print("== STARTED STEERING FILE ==")
0013 print(f"g4units: mm={mm}, GeV={GeV}, MeV={MeV}")
0014 
0015 
0016 # Determine output file name
0017 # Intercept  --outputFile flag
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 # Remove '.edm4hep.root' and append '.txtevt' or use default name (if no --outputFile is given)
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 # This is needed for stepping file
0032 SIM = DD4hepSimulation()
0033 
0034 # Need DDG4 kernel to add stepping
0035 kernel = DDG4.Kernel()
0036 
0037 # Instantiate the stepping action
0038 stepping = DDG4.SteppingAction(kernel, 'TextDumpingSteppingAction/MyStepper')
0039 stepping.OutputFile = outputFile
0040 stepping.OnlyPrimary = False
0041 stepping.MomentumMin = 150
0042 stepping.VertexCut = True              # Cut tracks which vertex is outside z_min-z_max range
0043 stepping.VertexZMin = -5000            # [mm] Min Z for Vertex Cut. Will work only if VertexCut = True
0044 stepping.VertexZMax = 5000             # [mm] Max Z for Vertex Cut. Will work only if VertexCut = True
0045 
0046 kernel.steppingAction().add(stepping)
0047 
0048 print("== ENDED STEERING FILE ==")