ATLAS Offline Software
Loading...
Searching...
No Matches
RHadronsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentFactory import CompFactory
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5
6def SG_StepNtupleTool(flags, name="G4UA::SG_StepNtupleTool", **kwargs):
7 result = ComponentAccumulator()
8 if flags.Concurrency.NumThreads >1:
9 from AthenaCommon import Logging
10 log=Logging.logging.getLogger(name)
11 log.fatal(' Attempt to run '+name+' with more than one thread, which is not supported')
12 return False
13 # Get the PDG IDs for RHadrons
14 from RHadronMasses import offset_options
15 kwargs.setdefault('RHadronPDGIDList',offset_options.keys())
16
19 result.setPrivateTools( CompFactory.G4UA__SG_StepNtupleTool(name, **kwargs) )
20 return result
21
22
23def RHadronsPhysicsToolCfg(flags, name='RHadronsPhysicsTool', **kwargs):
24 result = ComponentAccumulator()
25 result.setPrivateTools( CompFactory.RHadronsPhysicsTool(name,**kwargs) )
26 return result
27
28
30 print ("Start of RHadronsPreInclude")
31 if 'Py8' not in flags.Input.GeneratorsInfo and 'Pythia8' not in flags.Input.GeneratorsInfo:
32 raise RuntimeError('Pythia8 not found in generator metadata - will abort')
33
34
37 from RHadrons.GeneratePythiaCommands_RHadrons import generatePythia8Commands
38 generatePythia8Commands(flags)
39 #buildGeneratorConfigurationFiles(flags)
40
41 # Check for the presence of the other files needed at run-time
42 import os
43 if not os.path.isfile('ProcessList.txt'):
44 raise RuntimeError('ProcessList.txt (needed by G4ProcessHelper) is missing - will abort')
45 if not os.path.isfile('PhysicsConfiguration.txt'):
46 raise RuntimeError('PhysicsConfiguration.txt (needed by G4ProcessHelper) is missing - will abort')
47 if not os.path.isfile('PYTHIA8_COMMANDS.TXT'):
48 raise RuntimeError('PYTHIA8_COMMANDS.TXT (needed by Pythia8ForDecays) is missing - will abort')
49 print ("End of RHadronsPreInclude")
50
51
52def RHadronsCfg(flags):
53 result = ComponentAccumulator()
54 print("Running RHadronsCfg")
55
56 from AthenaConfiguration.Enums import ProductionStep
57 if flags.Common.ProductionStep == ProductionStep.Simulation:
58 from G4AtlasServices.G4AtlasServicesConfig import PhysicsListSvcCfg
59 result.merge(PhysicsListSvcCfg(flags))
60 physicsOptions = [ result.popToolsAndMerge(RHadronsPhysicsToolCfg(flags)) ]
61 result.getService("PhysicsListSvc").PhysOption += physicsOptions
62 return result
63
64def RHadrons_VerboseSelectorCfg(flags, name="G4UA::VerboseSelectorTool", **kwargs):
65 kwargs.setdefault('TargetEvent',1)
66 kwargs.setdefault('VerboseLevel',1)
67 kwargs.setdefault('TargetPdgIDs',
68 [
69 1000612,1000622,1000632,1000642,1000652,1006113,1006211,1006213,1006223,1006311,1006313,1006321,1006323,1006333,-1000612,-1000622,-1000632,-1000642,-1000652,-1006113,-1006211,-1006213,-1006223,-1006311,-1006313,-1006321,-1006323,-1006333
70 ])
71 from G4DebuggingTools.G4DebuggingToolsConfig import VerboseSelectorToolCfg
72 return VerboseSelectorToolCfg(flags, name, **kwargs)
void print(char *figname, TCanvas *c1)
SG_StepNtupleTool(flags, name="G4UA::SG_StepNtupleTool", **kwargs)
RHadronsPhysicsToolCfg(flags, name='RHadronsPhysicsTool', **kwargs)
RHadrons_VerboseSelectorCfg(flags, name="G4UA::VerboseSelectorTool", **kwargs)
RHadronsPreInclude(flags)