File indexing completed on 2025-04-02 08:02:48
0001 """
0002 Steering illustrates possible cuts and configurations for Firebird Dd4hep-Plugin
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')] + '.firebird.json'
0026 else:
0027 outputFile = outputFile+'.firebird.json' if outputFile else 'output.firebird.json'
0028
0029 print(f"Steering event display 'outputFile' = {outputFile}")
0030
0031
0032 SIM = DD4hepSimulation()
0033
0034
0035
0036
0037
0038
0039 SIM.ui.commandsConfigure = [
0040 f'/tracking/storeTrajectory 3',
0041 ]
0042
0043
0044 kernel = DDG4.Kernel()
0045
0046
0047 event_action = DDG4.EventAction(kernel, 'FirebirdTrajectoryWriterEventAction/TrajectoryWriter')
0048 event_action.ComponentName = "Geant4Trajectories"
0049 event_action.OutputFile = outputFile
0050
0051
0052
0053
0054 event_action.SaveParticles = [11, -11, 22, 211, -211, 321, -321, 2212, -2212]
0055 event_action.SaveOptical = False
0056
0057
0058 event_action.OnlyPrimary = False
0059
0060
0061
0062
0063 event_action.MomentumMin = 200
0064 event_action.MomentumMax = 15 * GeV
0065 event_action.TrackLengthMin = 50
0066
0067
0068
0069 event_action.VertexCut = True
0070 event_action.VertexZMin = -150
0071 event_action.VertexZMax = 150
0072
0073
0074
0075 event_action.StepCut = True
0076 event_action.StepZMin = -4000
0077 event_action.StepZMax = 4000
0078 event_action.StepRMax = 1800
0079
0080
0081 event_action.VerboseTimeExtraction = False
0082
0083
0084 kernel.eventAction().add(event_action)
0085
0086 print("== END OF STEERING FILE ==")