ATLAS Offline Software
runEgammaOnly.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 # Simple script to run a
4 # Calo/Tracking/Egamma job
5 #
6 # Usefull for quick testing
7 # run with
8 # python runEgammaOnly.py
9 # or
10 # python -m egammaConfig.runEgammaOnly
11 
12 import sys
13 
14 
15 def _run(args):
16  from AthenaConfiguration.AllConfigFlags import initConfigFlags
17 
18  flags = initConfigFlags()
19 
20  flags.Exec.MaxEvents = args.maxEvents
21 
22  from AthenaConfiguration.TestDefaults import defaultTestFiles
23 
24  if not args.inputFileList:
25  flags.Input.Files = defaultTestFiles.RDO_RUN2
26  else:
27  flags.Input.Files = args.inputFileList
28 
29  from AthenaConfiguration.Enums import ProductionStep
30 
31  flags.Common.ProductionStep = ProductionStep.Reconstruction
32 
33  # output
34  flags.Output.AODFileName = args.outputAODFile
35 
36  # uncomment given something like export ATHENA_CORE_NUMBER=2
37  # flags.Concurrency.NumThreads = 2
38 
39  # Setup detector flags
40  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
41 
43  flags, None, use_metadata=True, toggle_geometry=True, keep_beampipe=True
44  )
45 
46  # egamma Only
47  from egammaConfig.ConfigurationHelpers import egammaOnlyFromRaw
48 
49  egammaOnlyFromRaw(flags)
50 
51  flags.lock()
52 
53  # Run central test of egammaSteeringConfig
54  from egammaConfig.egammaSteeringConfig import egammaSteeringConfigTest
55 
56  statusCode = egammaSteeringConfigTest(flags)
57 
58  return statusCode
59 
60 
61 if __name__ == "__main__":
62  statusCode = None
63 
64  # Argument parsing
65  from argparse import ArgumentParser
66 
67  parser = ArgumentParser("egammaOnly")
68  parser.add_argument(
69  "-m",
70  "--maxEvents",
71  default=20,
72  type=int,
73  help="The number of events to run. -1 runs all events.",
74  )
75  parser.add_argument(
76  "-i", "--inputFileList", nargs="*", help="list of input ESD files"
77  )
78  parser.add_argument(
79  "-o", "--outputAODFile", default="myAOD.pool.root", help="Output file name"
80  )
81  args = parser.parse_args()
82 
83  statusCode = _run(args)
84 
85  assert statusCode is not None, "Issue while running"
86  sys.exit(not statusCode.isSuccess())
python.egammaSteeringConfig.egammaSteeringConfigTest
def egammaSteeringConfigTest(flags=None)
Definition: egammaSteeringConfig.py:56
python.ConfigurationHelpers.egammaOnlyFromRaw
def egammaOnlyFromRaw(flags)
Definition: Reconstruction/egamma/egammaConfig/python/ConfigurationHelpers.py:3
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
python.runEgammaOnly._run
def _run(args)
Definition: runEgammaOnly.py:15