ATLAS Offline Software
ISF_FatrasConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = "New configuration for the ISF_FatrasSimTool"
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from ISF_Algorithms.CollectionMergerConfig import CollectionMergerCfg
9 from ISF_Tools.ISF_ToolsConfig import ParticleHelperCfg
10 from ISF_Services.ISF_ServicesConfig import (
11  ATLFAST_ParticleBrokerSvcCfg, TruthServiceCfg
12 )
13 from ISF_Geant4Tools.ISF_Geant4ToolsConfig import G4RunManagerHelperCfg
14 from RngComps.RngCompsConfig import dSFMT, AthRNGSvcCfg
15 
16 def TrkExRndSvcCfg(flags):
17  seed = 'TrkExRnd OFFSET 0 12412330 37849324'
18  return dSFMT(seed)
19 
20 
21 def TrkExRndSvcMTCfg(flags):
22  return AthRNGSvcCfg(flags)
23 
24 
25 def FatrasRndSvcCfg(flags):
26  seed = 'FatrasRnd OFFSET 0 81234740 23474923'
27  return dSFMT(seed)
28 
29 
30 
33 
34 
35 # Fatras Hadronic Interaction Processor
36 # hadronic interaction creator
37 def fatrasHitCreatorPixelCfg(flags, name="ISF_FatrasHitCreatorPixel", **kwargs):
38  """Return ISF_FatrasHitCreatorPixel configured with ComponentAccumulator"""
39  mlog = logging.getLogger(name)
40  mlog.debug('Start configuration')
41 
42  bare_collection_name = "PixelHits"
43  mergeable_collection_suffix = "_Fatras"
44  merger_input_property = "PixelHits"
45  region = "ID"
46 
47  result, hits_collection_name = CollectionMergerCfg(flags,
48  bare_collection_name,
49  mergeable_collection_suffix,
50  merger_input_property,
51  region)
52 
53  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
54  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
55  kwargs.setdefault("IdHelperName", 'PixelID')
56  kwargs.setdefault("CollectionName", hits_collection_name)
57 
58  kwargs.setdefault("ConditionsTool", "")
59  kwargs.setdefault("UseConditionsTool", False)
60 
61  result.setPrivateTools(CompFactory.iFatras.HitCreatorSilicon(name=name, **kwargs))
62  return result
63 
64 
65 def fatrasHitCreatorSCTCfg(flags, name="ISF_FatrasHitCreatorSCT", **kwargs):
66  """Return ISF_FatrasHitCreatorSCT configured with ComponentAccumulator"""
67  mlog = logging.getLogger(name)
68  mlog.debug('Start configuration')
69 
70  bare_collection_name = "SCT_Hits"
71  mergeable_collection_suffix = "_Fatras"
72  merger_input_property = "SCTHits"
73  region = "ID"
74 
75  result, hits_collection_name = CollectionMergerCfg(flags,
76  bare_collection_name,
77  mergeable_collection_suffix,
78  merger_input_property,
79  region)
80 
81  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
82  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
83  kwargs.setdefault("IdHelperName", 'SCT_ID')
84  kwargs.setdefault("CollectionName", hits_collection_name)
85 
86  kwargs.setdefault("ConditionsTool", "")
87  kwargs.setdefault("UseConditionsTool", False)
88 
89  result.setPrivateTools(CompFactory.iFatras.HitCreatorSilicon(name=name, **kwargs))
90  return result
91 
92 
93 def fatrasHitCreatorTRTCfg(flags, name="ISF_FatrasHitCreatorTRT", **kwargs):
94  """Return ISF_FatrasHitCreatorTRT configured with ComponentAccumulator"""
95  mlog = logging.getLogger(name)
96  mlog.debug('Start configuration')
97 
98  bare_collection_name = "TRTUncompressedHits"
99  mergeable_collection_suffix = "_Fatras"
100  merger_input_property = "TRTUncompressedHits"
101  region = "ID"
102 
103  result, hits_collection_name = CollectionMergerCfg(flags,
104  bare_collection_name,
105  mergeable_collection_suffix,
106  merger_input_property,
107  region)
108 
109  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
110  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
111  kwargs.setdefault("CollectionName", hits_collection_name)
112 
113  kwargs.setdefault("StrawStatusSummaryTool", "")
114  result.setPrivateTools(CompFactory.iFatras.HitCreatorTRT(name=name, **kwargs))
115  return result
116 
117 
118 def fatrasPileupHitCreatorPixelCfg(flags, name="ISF_FatrasPileupHitCreatorPixel", **kwargs):
119  """Return ISF_FatrasHitCreatorPixel configured for pileup with ComponentAccumulator"""
120  kwargs.setdefault("CollectionName", "PileupPixelHits")
121  return fatrasHitCreatorPixelCfg(flags, name, **kwargs)
122 
123 
124 def fatrasPileupHitCreatorSCTCfg(flags, name="ISF_FatrasPileupHitCreatorSCT", **kwargs):
125  """Return ISF_FatrasHitCreatorSCT configured for pileup with ComponentAccumulator"""
126  kwargs.setdefault("CollectionName", "PileupSCT_Hits")
127  return fatrasHitCreatorSCTCfg(flags, name, **kwargs)
128 
129 
130 def fatrasPileupHitCreatorTRTCfg(flags, name="ISF_FatrasPileupHitCreatorTRT", **kwargs):
131  """Return ISF_FatrasHitCreatorTRT configured with ComponentAccumulator"""
132  kwargs.setdefault("CollectionName", "PileupTRTUncompressedHits")
133  return fatrasHitCreatorTRTCfg(flags, name, **kwargs)
134 
135 
136 
139 def fatrasSimHitCreatorIDCfg(flags, name="ISF_FatrasSimHitCreatorID", **kwargs):
140  """Return ISF_FatrasSimHitCreatorID configured with ComponentAccumulator"""
141 
142  mlog = logging.getLogger(name)
143  mlog.debug('Start configuration')
144 
145  result = ComponentAccumulator()
146  kwargs.setdefault("PixelHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasHitCreatorPixelCfg(flags))))
147  kwargs.setdefault("SctHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasHitCreatorSCTCfg(flags))))
148  kwargs.setdefault("TrtHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasHitCreatorTRTCfg(flags))))
149  kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)
150  result.setPrivateTools(CompFactory.iFatras.SimHitCreatorID(name=name, **kwargs))
151  return result
152 
153 
154 def fatrasPileupSimHitCreatorIDCfg(flags, name="ISF_FatrasPileupSimHitCreatorID", **kwargs):
155  """Return ISF_FatrasSimHitCreatorID configured for pileup with ComponentAccumulator"""
156 
157  mlog = logging.getLogger(name)
158  mlog.debug('Start configuration')
159 
160  result = ComponentAccumulator()
161  kwargs.setdefault("PixelHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasPileupHitCreatorPixelCfg(flags))))
162  kwargs.setdefault("SctHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasPileupHitCreatorSCTCfg(flags))))
163  kwargs.setdefault("TrtHitCreator", result.addPublicTool(result.popToolsAndMerge(fatrasPileupHitCreatorTRTCfg(flags))))
164  return fatrasSimHitCreatorIDCfg(flags, name, **kwargs)
165 
166 
167 def fatrasSimHitCreatorMSCfg(flags, name="ISF_FatrasSimHitCreatorMS", **kwargs):
168  """Return ISF_FatrasSimHitCreatorMS configured with ComponentAccumulator"""
169 
170  mlog = logging.getLogger(name)
171  mlog.debug('Start configuration')
172 
173 
174  result = ComponentAccumulator()
175  mergeable_collection_suffix = "_Fatras"
176  region = "MUON"
177 
178  mdt_bare_collection_name="MDT_Hits"
179  mdt_merger_input_property="MDTHits"
180  mdt_result, mdt_hits_collection_name = CollectionMergerCfg(flags,
181  mdt_bare_collection_name,
182  mergeable_collection_suffix,
183  mdt_merger_input_property,
184  region)
185  result.merge(mdt_result)
186 
187  rpc_bare_collection_name="RPC_Hits"
188  rpc_merger_input_property="RPCHits"
189  rpc_result, rpc_hits_collection_name = CollectionMergerCfg(flags,
190  rpc_bare_collection_name,
191  mergeable_collection_suffix,
192  rpc_merger_input_property,
193  region)
194  result.merge(rpc_result)
195 
196  tgc_bare_collection_name="TGC_Hits"
197  tgc_merger_input_property="TGCHits"
198  tgc_result, tgc_hits_collection_name = CollectionMergerCfg(flags,
199  tgc_bare_collection_name,
200  mergeable_collection_suffix,
201  tgc_merger_input_property,
202  region)
203  result.merge(tgc_result)
204 
205  csc_hits_collection_name = ""
206  if flags.Detector.EnableCSC:
207  csc_bare_collection_name="CSC_Hits"
208  csc_merger_input_property="CSCHits"
209  csc_result, csc_hits_collection_name = CollectionMergerCfg(flags,
210  csc_bare_collection_name,
211  mergeable_collection_suffix,
212  csc_merger_input_property,
213  region)
214  result.merge(csc_result)
215 
216  stgc_hits_collection_name = ""
217  if flags.Detector.EnablesTGC:
218  stgc_bare_collection_name="sTGC_Hits"
219  stgc_merger_input_property="sTGCHits"
220  stgc_result, stgc_hits_collection_name = CollectionMergerCfg(flags,
221  stgc_bare_collection_name,
222  mergeable_collection_suffix,
223  stgc_merger_input_property,
224  region)
225  result.merge(stgc_result)
226 
227  mm_hits_collection_name = ""
228  if flags.Detector.EnableMM:
229  mm_bare_collection_name="MM_Hits"
230  mm_merger_input_property="MMHits"
231  mm_result, mm_hits_collection_name = CollectionMergerCfg(flags,
232  mm_bare_collection_name,
233  mergeable_collection_suffix,
234  mm_merger_input_property,
235  region)
236  result.merge(mm_result)
237 
238  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
239  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
240 
241  kwargs.setdefault("Extrapolator" , result.addPublicTool(result.popToolsAndMerge(fatrasExtrapolatorCfg(flags))))
242 
243  kwargs.setdefault("MDTCollectionName", mdt_hits_collection_name)
244  kwargs.setdefault("RPCCollectionName", rpc_hits_collection_name)
245  kwargs.setdefault("TGCCollectionName", tgc_hits_collection_name)
246  kwargs.setdefault("CSCCollectionName", csc_hits_collection_name)
247  kwargs.setdefault("sTGCCollectionName", stgc_hits_collection_name)
248  kwargs.setdefault("MMCollectionName", mm_hits_collection_name)
249 
250  Muon__MuonTGMeasurementTool = CompFactory.Muon.MuonTGMeasurementTool
251  muon_tgmeasurement_tool = Muon__MuonTGMeasurementTool(name='MuonTGMeasurementTool',
252  UseDSManager=True)
253  kwargs.setdefault("MeasurementTool", muon_tgmeasurement_tool)
254 
255  result.setPrivateTools(CompFactory.iFatras.SimHitCreatorMS(name=name, **kwargs))
256  return result
257 
258 
259 def fatrasPdgG4ParticleCfg(flags, name="ISF_FatrasPdgG4Particle", **kwargs):
260  mlog = logging.getLogger(name)
261  mlog.debug('Start configuration')
262 
263  result = ComponentAccumulator()
264 
265  result.setPrivateTools(CompFactory.iFatras.PDGToG4Particle(name=name, **kwargs))
266  return result
267 
268 
271 
272 
273 def fatrasPhysicsValidationToolCfg(flags, name="ISF_FatrasPhysicsValidationTool", **kwargs):
274  mlog = logging.getLogger(name)
275  mlog.debug('Start configuration')
276 
277  result = ComponentAccumulator()
278  kwargs.setdefault("ValidationStreamName", "ISFFatras")
279 
280  result.setPrivateTools(CompFactory.iFatras.PhysicsValidationTool(name=name, **kwargs))
281  return result
282 
283 
284 def fatrasParticleDecayHelperCfg(flags, name="ISF_FatrasParticleDecayHelper", **kwargs):
285  mlog = logging.getLogger(name)
286  mlog.debug('Start configuration')
287 
288  result = ComponentAccumulator()
289 
290  seed = 'FatrasG4 OFFSET 0 23491234 23470291'
291  result.merge(dSFMT(seed))
292  kwargs.setdefault("RandomNumberService", result.getService("AtDSFMTGenSvc").name)
293  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
294  kwargs.setdefault("G4RandomStreamName", flags.Sim.Fatras.G4RandomStreamName)
295  kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
296  if flags.Sim.ISF.ValidationMode:
297  kwargs.setdefault("PhysicsValidationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags))))
298 
299  if "ParticleBroker" not in kwargs:
300  kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ATLFAST_ParticleBrokerSvcCfg(flags)).name)
301 
302  if "TruthRecordSvc" not in kwargs:
303  kwargs.setdefault("ParticleTruthSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
304 
305  kwargs.setdefault("PDGToG4ParticleConverter", result.addPublicTool(result.popToolsAndMerge(fatrasPdgG4ParticleCfg(flags))))
306  kwargs.setdefault("G4RunManagerHelper", result.addPublicTool(result.popToolsAndMerge(G4RunManagerHelperCfg(flags))))
307  result.setPrivateTools(CompFactory.iFatras.G4ParticleDecayHelper(name=name, **kwargs))
308  return result
309 
310 
311 
315 
316 def fatrasEnergyLossUpdatorCfg(flags, name="ISF_FatrasEnergyLossUpdator", **kwargs):
317  mlog = logging.getLogger(name)
318  mlog.debug('Start configuration')
319 
320  result = ComponentAccumulator()
321 
322  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
323  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
324 
325  kwargs.setdefault("UsePDG_EnergyLossFormula", True)
326  kwargs.setdefault("EnergyLossDistribution", 2)
327 
328  from TrkConfig.AtlasExtrapolatorToolsConfig import AtlasEnergyLossUpdatorCfg
329  kwargs.setdefault("EnergyLossUpdator", result.popToolsAndMerge(AtlasEnergyLossUpdatorCfg(flags)))
330 
331  result.setPrivateTools(CompFactory.iFatras.McEnergyLossUpdator(name=name, **kwargs))
332  return result
333 
334 
335 # Combining all in the MaterialEffectsUpdator
336 def fatrasMaterialUpdatorCfg(flags, name="ISF_FatrasMaterialUpdator", **kwargs):
337  mlog = logging.getLogger(name)
338  mlog.debug('Start configuration')
339 
340  result = ComponentAccumulator()
341 
342  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
343  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
344  if "ParticleBroker" not in kwargs:
345  kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ATLFAST_ParticleBrokerSvcCfg(flags)).name)
346 
347  if "TruthRecordSvc" not in kwargs:
348  kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
349 
350  # @TODO retire once migration to TrackingGeometry conditions data is complete
351  if not flags.Sim.ISF.UseTrackingGeometryCond:
352  if 'TrackingGeometrySvc' not in kwargs:
353  from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg
354  kwargs.setdefault("TrackingGeometrySvc", result.getPrimaryAndMerge(TrackingGeometrySvcCfg(flags)).name)
355  kwargs.setdefault("TrackingGeometryReadKey", '')
356  else:
357  if 'TrackingGeometryReadKey' not in kwargs:
358  from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig import TrackingGeometryCondAlgCfg
359  acc = TrackingGeometryCondAlgCfg(flags)
360  geom_cond_key = acc.getPrimary().TrackingGeometryWriteKey
361  result.merge(acc)
362  kwargs.setdefault("TrackingGeometryReadKey", geom_cond_key)
363 
364  # hadronic interactions
365  kwargs.setdefault("HadronicInteraction", True)
366 
367  kwargs.setdefault("HadronicInteractionProcessor", result.addPublicTool(result.popToolsAndMerge(fatrasG4HadIntProcessorCfg(flags))))
368 
369  # energy loss
370  kwargs.setdefault("EnergyLoss", True)
371  kwargs.setdefault("EnergyLossUpdator", result.addPublicTool(result.popToolsAndMerge(fatrasEnergyLossUpdatorCfg(flags))))
372 
373  # mutiple scattering
374  kwargs.setdefault("MultipleScattering", True)
375  from TrkConfig.AtlasExtrapolatorToolsConfig import fatrasMultipleScatteringUpdatorCfg
376  kwargs.setdefault("MultipleScatteringUpdator", result.addPublicTool(result.popToolsAndMerge(fatrasMultipleScatteringUpdatorCfg(flags))))
377 
378  # photon conversion
379  kwargs.setdefault("PhotonConversionTool", result.addPublicTool(result.popToolsAndMerge(fatrasConversionCreatorCfg(flags))))
380 
381  # the validation output
382  kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
383  kwargs.setdefault("BremPhotonValidation", False)
384  kwargs.setdefault("EnergyDepositValidation", False)
385 
386  kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)
387  kwargs.setdefault("MinimumBremPhotonMomentum", flags.Sim.Fatras.MomCutOffSec)
388 
389  if flags.Sim.ISF.ValidationMode:
390  kwargs.setdefault("PhysicsValidationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags))))
391 
392  kwargs.setdefault("ProcessSamplingTool", result.addPublicTool(result.popToolsAndMerge(fatrasProcessSamplingToolCfg(flags))))
393 
394  kwargs.setdefault("ParticleDecayHelper", result.addPublicTool(result.popToolsAndMerge(fatrasParticleDecayHelperCfg(flags))))
395 
396  # MCTruth Process Code
397  kwargs.setdefault("BremProcessCode", 3) # TODO: to be taken from central definition
398 
399  result.setPrivateTools(CompFactory.iFatras.McMaterialEffectsUpdator(name=name, **kwargs))
400  return result
401 
402 
403 def fatrasExtrapolatorCfg(flags, name="ISF_FatrasExtrapolator", **kwargs):
404  mlog = logging.getLogger(name)
405  mlog.debug('Start configuration')
406 
407  result = ComponentAccumulator()
408 
409  # Charged Transport Tool
410  # assign the tools
411  from TrkConfig.AtlasExtrapolatorToolsConfig import FastSimNavigatorCfg
412  kwargs.setdefault("Navigator", result.addPublicTool(result.popToolsAndMerge(FastSimNavigatorCfg(flags))))
413 
414  kwargs.setdefault("MaterialEffectsUpdators", [result.addPublicTool(result.popToolsAndMerge(fatrasMaterialUpdatorCfg(flags)))])
415 
416  from TrkConfig.TrkExRungeKuttaPropagatorConfig import RungeKuttaPropagatorCfg
417  kwargs.setdefault("Propagators",
418  [result.addPublicTool(result.popToolsAndMerge(RungeKuttaPropagatorCfg(flags, name="ISF_FatrasChargedPropagator")))])
419 
420  from TrkConfig.TrkExSTEP_PropagatorConfig import fatrasSTEP_PropagatorCfg
421  kwargs.setdefault("STEP_Propagator", result.addPublicTool(result.popToolsAndMerge(fatrasSTEP_PropagatorCfg(flags))))
422 
423  # Fatras specific: stop the trajectory
424  kwargs.setdefault("StopWithNavigationBreak", True)
425  kwargs.setdefault("StopWithUpdateKill", True)
426  kwargs.setdefault("RobustSampling", True)
427  kwargs.setdefault("ResolveMuonStation", True)
428  kwargs.setdefault("UseMuonMatApproximation", True)
429 
430  result.setPrivateTools(CompFactory.Trk.TimedExtrapolator(name=name, **kwargs))
431  return result
432 
433 
434 
437 def fatrasKinematicFilterCfg(flags, name="ISF_FatrasKinematicFilter", **kwargs):
438  mlog = logging.getLogger(name)
439  mlog.debug('Start configuration')
440 
441  result = ComponentAccumulator()
442 
443  kwargs.setdefault("MaxEtaSymmetric", 10.)
444  kwargs.setdefault("MinMomentum", flags.Sim.Fatras.MomCutOffSec)
445 
446  result.setPrivateTools(CompFactory.ISF.KinematicParticleFilter(name=name, **kwargs))
447  return result
448 
449 
450 def fatrasConversionCreatorCfg(flags, name="ISF_FatrasConversionCreator", **kwargs):
451  mlog = logging.getLogger(name)
452  mlog.debug('Start configuration')
453 
454  result = ComponentAccumulator()
455 
456  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
457  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
458 
459  if "ParticleBroker" not in kwargs:
460  kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ATLFAST_ParticleBrokerSvcCfg(flags)).name)
461 
462  if "TruthRecordSvc" not in kwargs:
463  kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
464 
465  if flags.Sim.ISF.ValidationMode:
466  kwargs.setdefault("PhysicsValidationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags))))
467 
468  kwargs.setdefault("PhysicsProcessCode", 14) # TODO: to be taken from central definition
469  kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
470 
471  result.setPrivateTools(CompFactory.iFatras.PhotonConversionTool(name=name, **kwargs))
472  return result
473 
474 
475 def fatrasG4HadIntProcessorCfg(flags, name="ISF_FatrasG4HadIntProcessor", **kwargs):
476  mlog = logging.getLogger(name)
477  mlog.debug('Start configuration')
478 
479  result = ComponentAccumulator()
480 
481  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
482  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
483 
484  if "ParticleBroker" not in kwargs:
485  kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ATLFAST_ParticleBrokerSvcCfg(flags)).name)
486 
487  if "TruthRecordSvc" not in kwargs:
488  kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
489 
490  kwargs.setdefault("MomentumCut", flags.Sim.Fatras.MomCutOffSec)
491 
492  kwargs.setdefault("G4RunManagerHelper", result.addPublicTool(result.popToolsAndMerge(G4RunManagerHelperCfg(flags))))
493 
494  result.setPrivateTools(CompFactory.iFatras.G4HadIntProcessor(name=name, **kwargs))
495  return result
496 
497 
498 # Fatras Hadronic Interaction Processor
499 def fatrasParametricHadIntProcessorCfg(flags, name="ISF_FatrasParametricHadIntProcessor", **kwargs):
500  mlog = logging.getLogger(name)
501  mlog.debug('Start configuration')
502 
503  result = ComponentAccumulator()
504 
505  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
506  kwargs.setdefault("RandomStreamName", flags.Sim.Fatras.RandomStreamName)
507 
508  if "ParticleBroker" not in kwargs:
509  kwargs.setdefault("ParticleBroker", result.getPrimaryAndMerge(ATLFAST_ParticleBrokerSvcCfg(flags)).name)
510 
511  if "TruthRecordSvc" not in kwargs:
512  kwargs.setdefault("TruthRecordSvc", result.getPrimaryAndMerge(TruthServiceCfg(flags)).name)
513 
514  kwargs.setdefault("HadronicInteractionScaleFactor", flags.Sim.Fatras.HadronIntProb)
515  kwargs.setdefault("MinimumHadronicInitialEnergy", flags.Sim.Fatras.MomCutOffSec)
516  kwargs.setdefault("MinimumHadronicOutEnergy", flags.Sim.Fatras.MomCutOffSec)
517  kwargs.setdefault("HadronicInteractionValidation", False)
518  kwargs.setdefault("PhysicsProcessCode", 121) # TODO: to be taken from central definition
519  kwargs.setdefault("ValidationMode", flags.Sim.ISF.ValidationMode)
520  if flags.Sim.ISF.ValidationMode:
521  kwargs.setdefault("PhysicsValidationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags))))
522  result.setPrivateTools(CompFactory.iFatras.HadIntProcessorParametric(name, **kwargs))
523  return result
524 
525 
526 def fatrasProcessSamplingToolCfg(flags, name="ISF_FatrasProcessSamplingTool", **kwargs):
527  mlog = logging.getLogger(name)
528  mlog.debug('Start configuration')
529  result = ComponentAccumulator()
530  result.setPrivateTools(CompFactory.iFatras.ProcessSamplingTool(name=name, **kwargs))
531  return result
532 
533 
534 def fatrasTransportToolCfg(flags, name="ISF_FatrasSimTool", **kwargs):
535  mlog = logging.getLogger(name)
536  mlog.debug('Start configuration')
537 
538  result = ComponentAccumulator()
539 
540  if "SimHitCreatorID" not in kwargs:
541  kwargs.setdefault("SimHitCreatorID", result.addPublicTool(result.popToolsAndMerge(fatrasSimHitCreatorIDCfg(flags))))
542 
543  kwargs.setdefault("SimHitCreatorMS", result.addPublicTool(result.popToolsAndMerge(fatrasSimHitCreatorMSCfg(flags))))
544 
545  kwargs.setdefault("ParticleDecayHelper", result.addPublicTool(result.popToolsAndMerge(fatrasParticleDecayHelperCfg(flags))))
546 
547  kwargs.setdefault("ParticleHelper", result.addPublicTool(result.popToolsAndMerge(ParticleHelperCfg(flags))))
548 
549  publicKinFilter = result.addPublicTool(result.popToolsAndMerge(fatrasKinematicFilterCfg(flags)))
550  kwargs.setdefault("TrackFilter", publicKinFilter)
551  kwargs.setdefault("NeutralFilter", publicKinFilter)
552  kwargs.setdefault("PhotonFilter", publicKinFilter)
553 
554  kwargs.setdefault("Extrapolator", result.addPublicTool(result.popToolsAndMerge(fatrasExtrapolatorCfg(flags))))
555 
556  if flags.Sim.ISF.ValidationMode:
557  kwargs.setdefault("PhysicsValidationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPhysicsValidationToolCfg(flags))))
558 
559  kwargs.setdefault("ProcessSamplingTool", result.addPublicTool(result.popToolsAndMerge(fatrasProcessSamplingToolCfg(flags))))
560 
561  kwargs.setdefault("OutputLevel", flags.Exec.OutputLevel)
562  kwargs.setdefault("ValidationOutput", flags.Sim.ISF.ValidationMode)
563 
564  kwargs.setdefault("RandomNumberService", result.getPrimaryAndMerge(FatrasRndSvcCfg(flags)).name)
565 
566  result.setPrivateTools(CompFactory.iFatras.TransportTool(name=name, **kwargs))
567  return result
568 
569 
570 def fatrasPileupSimToolCfg(flags, name="ISF_FatrasPileupSimTool", **kwargs):
571  mlog = logging.getLogger(name)
572  mlog.debug('Start configuration')
573 
574  result = ComponentAccumulator()
575 
576  kwargs.setdefault("SimHitCreatorID", result.addPublicTool(result.popToolsAndMerge(fatrasPileupSimHitCreatorIDCfg(flags))))
577 
578  result.setPrivateTools(result.popToolsAndMerge(fatrasTransportToolCfg(flags, name, **kwargs)))
579 
580  return result
581 
582 
583 # FatrasSimulatorTool
584 def fatrasSimulatorToolSTCfg(flags, name="ISF_FatrasSimulatorToolST", **kwargs):
585  mlog = logging.getLogger(name)
586  mlog.debug('Start configuration')
587 
588  result = ComponentAccumulator()
589 
590  if "IDSimulationTool" not in kwargs or "SimulationTool" not in kwargs:
591  publicTransportTool = result.addPublicTool(result.popToolsAndMerge(fatrasTransportToolCfg(flags, **kwargs)))
592  kwargs.setdefault("IDSimulationTool", publicTransportTool)
593  kwargs.setdefault("SimulationTool", publicTransportTool)
594 
595  result.setPrivateTools(CompFactory.ISF.FatrasSimTool(name, **kwargs))
596  return result
597 
598 
599 def fatrasPileupSimulatorToolSTCfg(flags, name="ISF_FatrasPileupSimulatorToolST", **kwargs):
600  mlog = logging.getLogger(name)
601  mlog.debug('Start configuration')
602 
603  result = ComponentAccumulator()
604 
605  kwargs.setdefault("IDSimulationTool", result.addPublicTool(result.popToolsAndMerge(fatrasPileupSimToolCfg(flags))))
606  kwargs.setdefault("SimulationTool", result.addPublicTool(result.popToolsAndMerge(fatrasTransportToolCfg(flags))))
607 
608  result.setPrivateTools(result.popToolsAndMerge(fatrasSimulatorToolSTCfg(flags, name, **kwargs)))
609  return result
610 
611 
612 # FatrasSimulationSvc
613 def fatrasSimServiceIDCfg(flags, name="ISF_FatrasSimSvc", **kwargs):
614  mlog = logging.getLogger(name)
615  mlog.debug('Start configuration')
616 
617  result = ComponentAccumulator()
618  kwargs.setdefault("Identifier", "Fatras")
619  kwargs.setdefault("SimulatorTool", result.addPublicTool(result.popToolsAndMerge(fatrasSimulatorToolSTCfg(flags))))
620  result.addService(CompFactory.ISF.LegacySimSvc(name, **kwargs), primary = True)
621  return result
622 
623 
624 def fatrasPileupSimServiceIDCfg(flags, name="ISF_FatrasPileupSimSvc", **kwargs):
625  mlog = logging.getLogger(name)
626  mlog.debug('Start configuration')
627 
628  toolAcc = ComponentAccumulator()
629  kwargs.setdefault("SimulatorTool", toolAcc.addPublicTool(toolAcc.popToolsAndMerge(fatrasPileupSimulatorToolSTCfg(flags))))
630  result = fatrasSimServiceIDCfg(flags, name, **kwargs)
631  result.merge(toolAcc)
632  return result
633 
634 
635 if __name__ == "__main__":
636  from AthenaConfiguration.AllConfigFlags import initConfigFlags
637  from AthenaCommon.Logging import log
638  from AthenaCommon.Constants import DEBUG
639  from AthenaConfiguration.TestDefaults import defaultTestFiles
640 
641  log.setLevel(DEBUG)
642 
643  flags = initConfigFlags()
644  flags.Input.isMC = True
645  flags.Input.Files = defaultTestFiles.HITS_RUN2
646  flags.Exec.MaxEvents = 3
647  flags.fillFromArgs()
648  flags.lock()
649 
650  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
651  acc = MainServicesCfg(flags)
652  acc.popToolsAndMerge(fatrasTransportToolCfg(flags))
653 
654  print("INFO_FatrasConfig: Dumping config flags")
655  flags.dump()
656  print("INFO_FatrasConfig: Print config details")
657  acc.printConfig(withDetails=True, summariseProps=True)
658  acc.store(open('fatrassimtool.pkl', 'wb'))
659 
660  sc = acc.run()
661 
662  import sys
663  # Success should be 0
664  sys.exit(not sc.isSuccess())
ISF_FatrasConfig.fatrasSimHitCreatorIDCfg
def fatrasSimHitCreatorIDCfg(flags, name="ISF_FatrasSimHitCreatorID", **kwargs)
TRACK CREATION SECTION.
Definition: ISF_FatrasConfig.py:139
ISF_FatrasConfig.fatrasPileupHitCreatorPixelCfg
def fatrasPileupHitCreatorPixelCfg(flags, name="ISF_FatrasPileupHitCreatorPixel", **kwargs)
Definition: ISF_FatrasConfig.py:118
RngCompsConfig.dSFMT
def dSFMT(seed, name="AtDSFMTGenSvc")
Definition: RngCompsConfig.py:19
python.TrkExSTEP_PropagatorConfig.fatrasSTEP_PropagatorCfg
def fatrasSTEP_PropagatorCfg(flags, name="ISF_FatrasSTEP_Propagator", **kwargs)
Definition: TrkExSTEP_PropagatorConfig.py:35
ISF_FatrasConfig.fatrasExtrapolatorCfg
def fatrasExtrapolatorCfg(flags, name="ISF_FatrasExtrapolator", **kwargs)
Definition: ISF_FatrasConfig.py:403
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.AtlasExtrapolatorToolsConfig.AtlasEnergyLossUpdatorCfg
def AtlasEnergyLossUpdatorCfg(flags, name='AtlasEnergyLossUpdator', **kwargs)
Definition: AtlasExtrapolatorToolsConfig.py:12
ISF_FatrasConfig.fatrasTransportToolCfg
def fatrasTransportToolCfg(flags, name="ISF_FatrasSimTool", **kwargs)
Definition: ISF_FatrasConfig.py:534
ISF_ServicesConfig.ATLFAST_ParticleBrokerSvcCfg
def ATLFAST_ParticleBrokerSvcCfg(flags, name="ISF_ATLFAST_ParticleBrokerSvc", **kwargs)
Definition: ISF_ServicesConfig.py:70
AtlasTrackingGeometryCondAlgConfig.TrackingGeometryCondAlgCfg
def TrackingGeometryCondAlgCfg(flags, name='AtlasTrackingGeometryCondAlg', doMaterialValidation=False, **kwargs)
Definition: AtlasTrackingGeometryCondAlgConfig.py:131
python.AtlasTrackingGeometrySvcConfig.TrackingGeometrySvcCfg
def TrackingGeometrySvcCfg(flags, name='AtlasTrackingGeometrySvc', doMaterialValidation=False, **kwargs)
Definition: AtlasTrackingGeometrySvcConfig.py:7
ISF_FatrasConfig.fatrasPileupSimulatorToolSTCfg
def fatrasPileupSimulatorToolSTCfg(flags, name="ISF_FatrasPileupSimulatorToolST", **kwargs)
Definition: ISF_FatrasConfig.py:599
python.AtlasExtrapolatorToolsConfig.FastSimNavigatorCfg
def FastSimNavigatorCfg(flags, name="AtlasNavigator", **kwargs)
Definition: AtlasExtrapolatorToolsConfig.py:89
ISF_FatrasConfig.fatrasHitCreatorPixelCfg
def fatrasHitCreatorPixelCfg(flags, name="ISF_FatrasHitCreatorPixel", **kwargs)
HIT CREATION SECTION.
Definition: ISF_FatrasConfig.py:37
ISF_FatrasConfig.fatrasG4HadIntProcessorCfg
def fatrasG4HadIntProcessorCfg(flags, name="ISF_FatrasG4HadIntProcessor", **kwargs)
Definition: ISF_FatrasConfig.py:475
ISF_FatrasConfig.fatrasSimHitCreatorMSCfg
def fatrasSimHitCreatorMSCfg(flags, name="ISF_FatrasSimHitCreatorMS", **kwargs)
Definition: ISF_FatrasConfig.py:167
ISF_FatrasConfig.fatrasSimServiceIDCfg
def fatrasSimServiceIDCfg(flags, name="ISF_FatrasSimSvc", **kwargs)
Definition: ISF_FatrasConfig.py:613
python.TrkExRungeKuttaPropagatorConfig.RungeKuttaPropagatorCfg
def RungeKuttaPropagatorCfg(flags, name='AtlasRungeKuttaPropagator', **kwargs)
Definition: TrkExRungeKuttaPropagatorConfig.py:9
ISF_FatrasConfig.fatrasPileupSimHitCreatorIDCfg
def fatrasPileupSimHitCreatorIDCfg(flags, name="ISF_FatrasPileupSimHitCreatorID", **kwargs)
Definition: ISF_FatrasConfig.py:154
ISF_FatrasConfig.fatrasHitCreatorTRTCfg
def fatrasHitCreatorTRTCfg(flags, name="ISF_FatrasHitCreatorTRT", **kwargs)
Definition: ISF_FatrasConfig.py:93
ISF_FatrasConfig.fatrasKinematicFilterCfg
def fatrasKinematicFilterCfg(flags, name="ISF_FatrasKinematicFilter", **kwargs)
SIMULATION TOOL and SERVICE.
Definition: ISF_FatrasConfig.py:437
python.ISF_Geant4ToolsConfig.G4RunManagerHelperCfg
def G4RunManagerHelperCfg(flags, name="G4RunManagerHelper", **kwargs)
Definition: ISF_Geant4ToolsConfig.py:23
ISF_FatrasConfig.fatrasPileupSimServiceIDCfg
def fatrasPileupSimServiceIDCfg(flags, name="ISF_FatrasPileupSimSvc", **kwargs)
Definition: ISF_FatrasConfig.py:624
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
ISF_FatrasConfig.fatrasPhysicsValidationToolCfg
def fatrasPhysicsValidationToolCfg(flags, name="ISF_FatrasPhysicsValidationTool", **kwargs)
validation & process sampling
Definition: ISF_FatrasConfig.py:273
Constants
some useful constants -------------------------------------------------—
ISF_FatrasConfig.fatrasPdgG4ParticleCfg
def fatrasPdgG4ParticleCfg(flags, name="ISF_FatrasPdgG4Particle", **kwargs)
Definition: ISF_FatrasConfig.py:259
ISF_FatrasConfig.fatrasPileupHitCreatorSCTCfg
def fatrasPileupHitCreatorSCTCfg(flags, name="ISF_FatrasPileupHitCreatorSCT", **kwargs)
Definition: ISF_FatrasConfig.py:124
ISF_FatrasConfig.FatrasRndSvcCfg
def FatrasRndSvcCfg(flags)
Definition: ISF_FatrasConfig.py:25
ISF_FatrasConfig.fatrasConversionCreatorCfg
def fatrasConversionCreatorCfg(flags, name="ISF_FatrasConversionCreator", **kwargs)
Definition: ISF_FatrasConfig.py:450
ISF_FatrasConfig.fatrasEnergyLossUpdatorCfg
def fatrasEnergyLossUpdatorCfg(flags, name="ISF_FatrasEnergyLossUpdator", **kwargs)
Extrapolator.
Definition: ISF_FatrasConfig.py:316
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
ISF_ServicesConfig.TruthServiceCfg
def TruthServiceCfg(flags, **kwargs)
Definition: ISF_ServicesConfig.py:80
ISF_FatrasConfig.fatrasSimulatorToolSTCfg
def fatrasSimulatorToolSTCfg(flags, name="ISF_FatrasSimulatorToolST", **kwargs)
Definition: ISF_FatrasConfig.py:584
Trk::open
@ open
Definition: BinningType.h:40
ISF_FatrasConfig.fatrasMaterialUpdatorCfg
def fatrasMaterialUpdatorCfg(flags, name="ISF_FatrasMaterialUpdator", **kwargs)
Definition: ISF_FatrasConfig.py:336
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
ISF_FatrasConfig.fatrasProcessSamplingToolCfg
def fatrasProcessSamplingToolCfg(flags, name="ISF_FatrasProcessSamplingTool", **kwargs)
Definition: ISF_FatrasConfig.py:526
ISF_FatrasConfig.TrkExRndSvcMTCfg
def TrkExRndSvcMTCfg(flags)
Definition: ISF_FatrasConfig.py:21
ISF_FatrasConfig.fatrasHitCreatorSCTCfg
def fatrasHitCreatorSCTCfg(flags, name="ISF_FatrasHitCreatorSCT", **kwargs)
Definition: ISF_FatrasConfig.py:65
ISF_FatrasConfig.fatrasParametricHadIntProcessorCfg
def fatrasParametricHadIntProcessorCfg(flags, name="ISF_FatrasParametricHadIntProcessor", **kwargs)
Definition: ISF_FatrasConfig.py:499
python.AtlasExtrapolatorToolsConfig.fatrasMultipleScatteringUpdatorCfg
def fatrasMultipleScatteringUpdatorCfg(flags, name="ISF_FatrasMultipleScatteringUpdator", **kwargs)
Definition: AtlasExtrapolatorToolsConfig.py:148
ISF_FatrasConfig.TrkExRndSvcCfg
def TrkExRndSvcCfg(flags)
Definition: ISF_FatrasConfig.py:16
ISF_FatrasConfig.fatrasPileupSimToolCfg
def fatrasPileupSimToolCfg(flags, name="ISF_FatrasPileupSimTool", **kwargs)
Definition: ISF_FatrasConfig.py:570
CollectionMergerConfig.CollectionMergerCfg
def CollectionMergerCfg(flags, bare_collection_name, mergeable_collection_suffix, merger_input_property, region)
Definition: CollectionMergerConfig.py:66
ISF_FatrasConfig.fatrasParticleDecayHelperCfg
def fatrasParticleDecayHelperCfg(flags, name="ISF_FatrasParticleDecayHelper", **kwargs)
Definition: ISF_FatrasConfig.py:284
ISF_FatrasConfig.fatrasPileupHitCreatorTRTCfg
def fatrasPileupHitCreatorTRTCfg(flags, name="ISF_FatrasPileupHitCreatorTRT", **kwargs)
Definition: ISF_FatrasConfig.py:130
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51