ATLAS Offline Software
ISF_SimulationSelectorsConfig.py
Go to the documentation of this file.
1 """
2 ISF_SimulationSelectors for ComponentAccumulator configuration
3 
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 """
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from ISF_SimulationSelectors import SimulationFlavor
9 from ISF_Services.ISF_ServicesCoreConfig import ParticleKillerSvcCfg
10 from ISF_Geant4Services.ISF_Geant4ServicesConfig import (
11  Geant4SimCfg, ATLFAST_Geant4SimCfg,
12  FullGeant4SimCfg, PassBackGeant4SimCfg,
13 )
14 
15 
16 def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelector", **kwargs):
17  acc = ComponentAccumulator()
18  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
19  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(ParticleKillerSvcCfg(flags)).name)
20  kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
21  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
22  return acc
23 
24 
25 def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs):
26  acc = ComponentAccumulator()
27  if "Simulator" not in kwargs:
28  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
29  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(Geant4SimCfg(flags)).name)
30  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
31  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
32  return acc
33 
34 
35 def DefaultATLFAST_Geant4SelectorCfg(flags, name="ISF_DefaultATLFAST_Geant4Selector", **kwargs):
36  acc = ComponentAccumulator()
37  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
38  acc.merge(ATLFAST_Geant4SimCfg(flags))
39  kwargs.setdefault("Simulator", acc.getService("ISF_ATLFAST_Geant4SimSvc"))
40  tool = acc.popToolsAndMerge(DefaultGeant4SelectorCfg(flags, name, **kwargs))
41  acc.setPrivateTools(tool)
42  return acc
43 
44 
45 def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs):
46  acc = ComponentAccumulator()
47  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
48  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(FullGeant4SimCfg(flags)).name)
49  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
50  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
51  return acc
52 
53 
54 def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs):
55  acc = ComponentAccumulator()
56  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
57  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(PassBackGeant4SimCfg(flags)).name)
58  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
59  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
60  return acc
61 
62 
63 def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector", **kwargs):
64  acc = ComponentAccumulator()
65  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
66  from ISF_FastCaloSimServices.ISF_FastCaloSimServicesConfig import FastCaloSimSvcCfg
67  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(FastCaloSimSvcCfg(flags)).name)
68  kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
69  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
70  return acc
71 
72 
73 def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selector", **kwargs):
74  acc = ComponentAccumulator()
75  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
76  from ISF_FastCaloSimServices.ISF_FastCaloSimServicesConfig import FastCaloSimV2SvcCfg
77  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(FastCaloSimV2SvcCfg(flags)).name)
78  kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSimV2)
79  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
80  return acc
81 
82 
83 def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **kwargs):
84  acc = ComponentAccumulator()
85  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
86  from ISF_FastCaloSimServices.ISF_FastCaloSimServicesConfig import DNNCaloSimSvcCfg
87  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(DNNCaloSimSvcCfg(flags)).name)
88  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
89  return acc
90 
91 
92 def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCaloSimSelector", **kwargs):
93  acc = ComponentAccumulator()
94  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
95  from ISF_FastCaloSimServices.ISF_FastCaloSimServicesConfig import FastHitConvAlgFastCaloSimSvcCfg
96  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(FastHitConvAlgFastCaloSimSvcCfg(flags)).name)
97  kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
98  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
99  return acc
100 
101 
102 def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs):
103  acc = ComponentAccumulator()
104  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
105  from ISF_FatrasServices.ISF_FatrasConfig import fatrasSimServiceIDCfg
106  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(fatrasSimServiceIDCfg(flags)).name)
107  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
108  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
109  return acc
110 
111 
112 def DefaultActsSelectorCfg(flags, name="ISF_DefaultActsSelector", **kwargs):
113  acc = ComponentAccumulator()
114  if not flags.Sim.ISF.Simulator.isMT():
115  raise RuntimeError("SimulationSelector '%s' does not support running with SimKernel." % name)
116  kwargs.setdefault('SimulationFlavor', SimulationFlavor.Fatras)
117  acc.setPrivateTools(CompFactory.ISF.DefaultSimSelector(name, **kwargs))
118  return acc
119 
120 
121 
122 
123 # BASE METHODS
124 def BaseKinematicGeant4SelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs):
125  acc = ComponentAccumulator()
126  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
127  acc.merge(Geant4SimCfg(flags))
128  kwargs.setdefault("Simulator", acc.getService("ISFG4SimSvc"))
129  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
130  acc.setPrivateTools(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
131  return acc
132 
133 
134 def BaseKinematicATLFAST_Geant4SelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs):
135  acc = ComponentAccumulator()
136  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
137  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(ATLFAST_Geant4SimCfg(flags)).name)
138  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Geant4)
139  acc.setPrivateTools(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
140  return acc
141 
142 
143 def BaseKinematicFatrasSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs):
144  acc = ComponentAccumulator()
145  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
146  from ISF_FatrasServices.ISF_FatrasConfig import fatrasSimServiceIDCfg
147  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(fatrasSimServiceIDCfg(flags)).name)
148  kwargs.setdefault("SimulationFlavor", SimulationFlavor.Fatras)
149  acc.setPrivateTools(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
150  return acc
151 
152 
153 def BaseKinematicFastCaloSimSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs):
154  acc = ComponentAccumulator()
155  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
156  from ISF_FastCaloSimServices.ISF_FastCaloSimServicesConfig import FastCaloSimSvcCfg
157  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(FastCaloSimSvcCfg(flags)).name)
158  kwargs.setdefault("SimulationFlavor", SimulationFlavor.FastCaloSim)
159  acc.setPrivateTools(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
160  return acc
161 
162 
163 def BaseKinematicParticleKillerSimSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs):
164  acc = ComponentAccumulator()
165  if flags.Concurrency.NumThreads == 0 and not flags.Sim.ISF.Simulator.isMT():
166  kwargs.setdefault("Simulator", acc.getPrimaryAndMerge(ParticleKillerSvcCfg(flags)).name)
167  kwargs.setdefault("SimulationFlavor", SimulationFlavor.ParticleKiller)
168  acc.setPrivateTools(CompFactory.ISF.KinematicSimSelector(name, **kwargs))
169  return acc
170 
171 
172 #Protons
173 def ProtonATLFAST_Geant4SelectorCfg(flags, name="ISF_ProtonATLFAST_Geant4Selector", **kwargs):
174  kwargs.setdefault("MaxEkin", 400)
175  kwargs.setdefault("ParticlePDG", 2212)
176  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
177 
178 
179 #Pions
180 def PionATLFAST_Geant4SelectorCfg(flags, name="ISF_PionATLFAST_Geant4Selector", **kwargs):
181  kwargs.setdefault("MaxEkin", 200)
182  kwargs.setdefault("ParticlePDG", 211)
183  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
184 
185 
186 # Neutrons
187 def NeutronATLFAST_Geant4SelectorCfg(flags, name="ISF_NeutronATLFAST_Geant4Selector", **kwargs):
188  kwargs.setdefault("MaxEkin", 400)
189  kwargs.setdefault("ParticlePDG", 2112)
190  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
191 
192 
193 # Charged Kaons
194 def ChargedKaonATLFAST_Geant4SelectorCfg(flags, name="ISF_ChargedKaonATLFAST_Geant4Selector", **kwargs):
195  kwargs.setdefault("MaxEkin", 400)
196  kwargs.setdefault("ParticlePDG", 321)
197  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
198 
199 
200 # KLongs
201 def KLongATLFAST_Geant4SelectorCfg(flags, name="ISF_KLongATLFAST_Geant4Selector", **kwargs):
202  kwargs.setdefault("MaxEkin", 400)
203  kwargs.setdefault("ParticlePDG", 130)
204  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
205 
206 
207 #Muons
208 def MuonATLFAST_Geant4SelectorCfg(flags, name="ISF_MuonATLFAST_Geant4Selector", **kwargs):
209  kwargs.setdefault("ParticlePDG", 13)
210  return BaseKinematicATLFAST_Geant4SelectorCfg(flags, name, **kwargs)
211 
212 
213 # General Eta-based selectors
214 def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelector", **kwargs):
215  kwargs.setdefault('MinPosEta' , -5.0 )
216  kwargs.setdefault('MaxPosEta' , 5.0 )
217  return BaseKinematicFastCaloSimSelectorCfg(flags, name, **kwargs)
218 
219 
220 def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5ParticleKillerSimSelector", **kwargs):
221  kwargs.setdefault("MinPosEta", -5.0)
222  kwargs.setdefault("MaxPosEta", 5.0)
223  kwargs.setdefault("InvertCuts", True)
224  return BaseKinematicParticleKillerSimSelectorCfg(flags, name, **kwargs)
ISF_Geant4ServicesConfig.FullGeant4SimCfg
def FullGeant4SimCfg(flags, name="ISF_FullGeant4SimSvc", **kwargs)
Definition: ISF_Geant4ServicesConfig.py:32
ISF_FastCaloSimServicesConfig.FastCaloSimV2SvcCfg
def FastCaloSimV2SvcCfg(flags, name="ISF_FastCaloSimSvcV2", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:173
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
ISF_SimulationSelectorsConfig.PassBackGeant4SelectorCfg
def PassBackGeant4SelectorCfg(flags, name="ISF_PassBackGeant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:54
ISF_FastCaloSimServicesConfig.DNNCaloSimSvcCfg
def DNNCaloSimSvcCfg(flags, name="ISF_DNNCaloSimSvc", **kwargs)
Definition: ISF_FastCaloSimServicesConfig.py:181
ISF_SimulationSelectorsConfig.BaseKinematicGeant4SelectorCfg
def BaseKinematicGeant4SelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs)
KinematicSimSelector Configurations.
Definition: ISF_SimulationSelectorsConfig.py:124
ISF_SimulationSelectorsConfig.DefaultFastCaloSimSelectorCfg
def DefaultFastCaloSimSelectorCfg(flags, name="ISF_DefaultFastCaloSimSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:63
ISF_SimulationSelectorsConfig.KLongATLFAST_Geant4SelectorCfg
def KLongATLFAST_Geant4SelectorCfg(flags, name="ISF_KLongATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:201
ISF_SimulationSelectorsConfig.BaseKinematicParticleKillerSimSelectorCfg
def BaseKinematicParticleKillerSimSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:163
ISF_SimulationSelectorsConfig.NeutronATLFAST_Geant4SelectorCfg
def NeutronATLFAST_Geant4SelectorCfg(flags, name="ISF_NeutronATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:187
ISF_SimulationSelectorsConfig.DefaultActsSelectorCfg
def DefaultActsSelectorCfg(flags, name="ISF_DefaultActsSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:112
ISF_SimulationSelectorsConfig.PionATLFAST_Geant4SelectorCfg
def PionATLFAST_Geant4SelectorCfg(flags, name="ISF_PionATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:180
ISF_SimulationSelectorsConfig.DefaultGeant4SelectorCfg
def DefaultGeant4SelectorCfg(flags, name="ISF_DefaultGeant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:25
ISF_FatrasConfig.fatrasSimServiceIDCfg
def fatrasSimServiceIDCfg(flags, name="ISF_FatrasSimSvc", **kwargs)
Definition: ISF_FatrasConfig.py:613
ISF_SimulationSelectorsConfig.DefaultDNNCaloSimSelectorCfg
def DefaultDNNCaloSimSelectorCfg(flags, name="ISF_DefaultDNNCaloSimSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:83
ISF_Geant4ServicesConfig.Geant4SimCfg
def Geant4SimCfg(flags, name="ISFG4SimSvc", **kwargs)
Definition: ISF_Geant4ServicesConfig.py:14
ISF_SimulationSelectorsConfig.DefaultFastCaloSimV2SelectorCfg
def DefaultFastCaloSimV2SelectorCfg(flags, name="ISF_DefaultFastCaloSimV2Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:73
ISF_SimulationSelectorsConfig.DefaultFatrasSelectorCfg
def DefaultFatrasSelectorCfg(flags, name="ISF_DefaultFatrasSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:102
ISF_SimulationSelectorsConfig.ChargedKaonATLFAST_Geant4SelectorCfg
def ChargedKaonATLFAST_Geant4SelectorCfg(flags, name="ISF_ChargedKaonATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:194
ISF_SimulationSelectorsConfig.BaseKinematicATLFAST_Geant4SelectorCfg
def BaseKinematicATLFAST_Geant4SelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:134
ISF_SimulationSelectorsConfig.WithinEta5FastCaloSimSelectorCfg
def WithinEta5FastCaloSimSelectorCfg(flags, name="ISF_WithinEta5FastCaloSimSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:214
ISF_SimulationSelectorsConfig.BaseKinematicFatrasSelectorCfg
def BaseKinematicFatrasSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:143
ISF_SimulationSelectorsConfig.FastHitConvAlgFastCaloSimSelectorCfg
def FastHitConvAlgFastCaloSimSelectorCfg(flags, name="ISF_FastHitConvAlgFastCaloSimSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:92
ISF_Geant4ServicesConfig.ATLFAST_Geant4SimCfg
def ATLFAST_Geant4SimCfg(flags, name="ISF_ATLFAST_Geant4SimSvc", **kwargs)
Definition: ISF_Geant4ServicesConfig.py:50
ISF_ServicesCoreConfig.ParticleKillerSvcCfg
def ParticleKillerSvcCfg(flags, name="ISF_ParticleKillerSvc", **kwargs)
Definition: ISF_ServicesCoreConfig.py:47
ISF_SimulationSelectorsConfig.ProtonATLFAST_Geant4SelectorCfg
def ProtonATLFAST_Geant4SelectorCfg(flags, name="ISF_ProtonATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:173
ISF_SimulationSelectorsConfig.MuonATLFAST_Geant4SelectorCfg
def MuonATLFAST_Geant4SelectorCfg(flags, name="ISF_MuonATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:208
ISF_SimulationSelectorsConfig.EtaGreater5ParticleKillerSimSelectorCfg
def EtaGreater5ParticleKillerSimSelectorCfg(flags, name="ISF_EtaGreater5ParticleKillerSimSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:220
ISF_SimulationSelectorsConfig.DefaultParticleKillerSelectorCfg
def DefaultParticleKillerSelectorCfg(flags, name="ISF_DefaultParticleKillerSelector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:16
ISF_SimulationSelectorsConfig.FullGeant4SelectorCfg
def FullGeant4SelectorCfg(flags, name="ISF_FullGeant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:45
ISF_SimulationSelectorsConfig.DefaultATLFAST_Geant4SelectorCfg
def DefaultATLFAST_Geant4SelectorCfg(flags, name="ISF_DefaultATLFAST_Geant4Selector", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:35
ISF_SimulationSelectorsConfig.BaseKinematicFastCaloSimSelectorCfg
def BaseKinematicFastCaloSimSelectorCfg(flags, name="DONOTUSEDIRECTLY", **kwargs)
Definition: ISF_SimulationSelectorsConfig.py:153
ISF_Geant4ServicesConfig.PassBackGeant4SimCfg
def PassBackGeant4SimCfg(flags, name="ISF_PassBackGeant4SimSvc", **kwargs)
Definition: ISF_Geant4ServicesConfig.py:41