ATLAS Offline Software
PUTracks_Skeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
4 from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
5 
6 # force no legacy job properties
7 from AthenaCommon import JobProperties
8 JobProperties.jobPropertiesDisallowed = True
9 
10 
11 def fromRunArgs(runArgs):
12  from AthenaCommon.Logging import logging
13  log = logging.getLogger('PUTracks')
14  log.info('****************** STARTING Reconstruction (PUTracks) *****************')
15  import time
16  timeStart = time.time()
17  log.info('**** Setting-up configuration flags')
18  from AthenaConfiguration.AllConfigFlags import initConfigFlags
19  flags = initConfigFlags()
20  commonRunArgsToFlags(runArgs, flags)
21 
22  # Autoconfigure enabled subdetectors
23  if hasattr(runArgs, 'detectors'):
24  detectors = runArgs.detectors
25  else:
26  detectors = None
27 
28 
30  if hasattr(runArgs, 'inputRDOFile'):
31  flags.Input.Files = runArgs.inputRDOFile
32 
33 
34 
35  flags.Output.RDOFileName = runArgs.outputRDO_PUFile
36  log.info("---------- Configured BKG_RDO output")
37 
38  # Reconstruction flags should be parsed after inputs are set
39  from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags
40  recoRunArgsToFlags(runArgs, flags)
41 
42  from AthenaConfiguration.Enums import ProductionStep
43  flags.Common.ProductionStep = ProductionStep.PileUpPretracking
44  flags.Input.isMC = True # should be set from the input file?
45  flags.Tracking.doVertexFinding = False
46  flags.Overlay.SigPrefix = flags.Overlay.BkgPrefix # TODO: processing pileup background file, but perhapse we can just use BkgPrefix?
47 
48  # Setup detector flags
49  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
50  setupDetectorFlags(flags, detectors, use_metadata=True, toggle_geometry=True, keep_beampipe=True)
51  # Print reco domain status
52  from RecJobTransforms.RecoConfigFlags import printRecoFlags
53  printRecoFlags(flags)
54 
55  # Setup perfmon flags from runargs
56  from PerfMonComps.PerfMonConfigHelpers import setPerfmonFlagsFromRunArgs
57  setPerfmonFlagsFromRunArgs(flags, runArgs)
58 
59  # Pre-include
60  processPreInclude(runArgs, flags)
61 
62  # Pre-exec
63  processPreExec(runArgs, flags)
64 
65  # To respect --athenaopts
66  flags.fillFromArgs()
67 
68  # Lock flags
69  flags.lock()
70 
71  from FastChainPileup.PileUpPreTrackingConfig import PreTrackingCfg
72  cfg = PreTrackingCfg(flags) #it includes a MainServicesCfg
73  log.info("---------- Configured pileup tracks")
74 
75  # Post-include
76  processPostInclude(runArgs, flags, cfg)
77 
78  # Post-exec
79  processPostExec(runArgs, flags, cfg)
80 
81  timeConfig = time.time()
82  log.info("configured in %d seconds", timeConfig - timeStart)
83 
84  log.info("Configured according to flag values listed below")
85  flags.dump()
86 
87  # Print sum information about AccumulatorCache performance
88  from AthenaConfiguration.AccumulatorCache import AccumulatorDecorator
89  AccumulatorDecorator.printStats()
90 
91  # Run the final accumulator
92  sc = cfg.run()
93  timeFinal = time.time()
94  log.info("Run PUTracks_skeleton in %d seconds (running %d seconds)", timeFinal - timeStart, timeFinal - timeConfig)
95 
96  import sys
97  sys.exit(not sc.isSuccess())
python.TransformUtils.processPreExec
def processPreExec(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:41
python.TransformUtils.processPostExec
def processPostExec(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:50
python.RecoConfigFlags.printRecoFlags
def printRecoFlags(flags)
Definition: RecoConfigFlags.py:153
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.RecoConfigFlags.recoRunArgsToFlags
def recoRunArgsToFlags(runArgs, flags)
Definition: RecoConfigFlags.py:196
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.PUTracks_Skeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: PUTracks_Skeleton.py:11
python.PerfMonConfigHelpers.setPerfmonFlagsFromRunArgs
def setPerfmonFlagsFromRunArgs(flags, runArgs)
Definition: PerfMonConfigHelpers.py:3
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:289
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
PileUpPreTrackingConfig.PreTrackingCfg
def PreTrackingCfg(flags)
Definition: PileUpPreTrackingConfig.py:7