ATLAS Offline Software
Functions
python.OverlayTestHelpers Namespace Reference

Functions

def OverlayJobOptsDumperCfg (flags)
 
def CommonTestArgumentParser (prog)
 
def overlayTestFlags (flags, args)
 
def postprocessAndLockFlags (flags, args)
 
def printAndRun (accessor, flags, args)
 

Detailed Description

Overlay test helpers

Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration

Function Documentation

◆ CommonTestArgumentParser()

def python.OverlayTestHelpers.CommonTestArgumentParser (   prog)
Common overlay test argument parser

Definition at line 19 of file OverlayTestHelpers.py.

19 def CommonTestArgumentParser(prog):
20  """Common overlay test argument parser"""
21  parser = ArgumentParser(prog=prog)
22  parser.add_argument("-d", "--data", default=False,
23  action="store_true", help="Run data overlay")
24  parser.add_argument("-n", "--maxEvents", default=3, type=int,
25  help="The number of events to run. 0 skips execution")
26  parser.add_argument("-t", "--threads", default=1, type=int,
27  help="The number of concurrent threads to run. 0 uses serial Athena.")
28  parser.add_argument("-p", "--processes", default=0, type=int,
29  help="The number of concurrent processes to run. 0 uses serial Athena.")
30  parser.add_argument("-c", "--concurrent", default=0, type=int,
31  help="The number of concurrent events to run. 0 uses the same as number of threads.")
32  parser.add_argument("-V", "--verboseAccumulators", default=False, action="store_true",
33  help="Print full details of the AlgSequence for each accumulator")
34  parser.add_argument("-S", "--verboseStoreGate", default=False, action="store_true",
35  help="Dump the StoreGate(s) each event iteration")
36  parser.add_argument("-o", "--output", default='', type=str,
37  help="Output RDO file")
38  parser.add_argument("-s", "--outputSig", default='', type=str,
39  help="Output RDO_SGNL file")
40  parser.add_argument("-r", "--run", default=LHCPeriod.Run2,
41  type=LHCPeriod, choices=list(LHCPeriod))
42  parser.add_argument("--disableTruth", default=False, action="store_true",
43  help="Disable truth overlay")
44  parser.add_argument("--debug", default='', type=str,
45  choices=DbgStage.allowed_values,
46  help="Debugging flag: " + ','.join (DbgStage.allowed_values))
47  return parser
48 
49 

◆ OverlayJobOptsDumperCfg()

def python.OverlayTestHelpers.OverlayJobOptsDumperCfg (   flags)
Configure event loop for overlay

Definition at line 14 of file OverlayTestHelpers.py.

14 def OverlayJobOptsDumperCfg(flags):
15  """Configure event loop for overlay"""
16  return JobOptsDumperCfg(flags, FileName="OverlayTestConfig.txt")
17 
18 

◆ overlayTestFlags()

def python.OverlayTestHelpers.overlayTestFlags (   flags,
  args 
)
Fill default overlay flags for testing

Definition at line 50 of file OverlayTestHelpers.py.

50 def overlayTestFlags(flags, args):
51  """Fill default overlay flags for testing"""
52  if args.disableTruth:
53  flags.Digitization.EnableTruth = False
54 
55  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultConditionsTags
56  from AthenaConfiguration.Enums import ProductionStep
57  flags.Common.ProductionStep = ProductionStep.Overlay
58  if args.data:
59  flags.Input.isMC = False
60  flags.Input.Files = defaultTestFiles.HITS_DATA_OVERLAY
61  flags.Input.SecondaryFiles = defaultTestFiles.RAW_BKG
62  flags.Output.RDOFileName = "dataOverlayRDO.pool.root"
63  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
64  flags.IOVDb.DatabaseInstance = "CONDBR2"
65  flags.Overlay.DataOverlay = True
66  flags.Overlay.ByteStream = True
67  from Campaigns import DataOverlayPPTest
68  DataOverlayPPTest(flags)
69  else:
70  if args.run is LHCPeriod.Run2:
71  flags.Input.Files = defaultTestFiles.RDO_BKG_RUN2
72  flags.Input.SecondaryFiles = defaultTestFiles.HITS_RUN2
73  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC
74  from Campaigns import MC20e
75  MC20e(flags)
76  elif args.run is LHCPeriod.Run3:
77  flags.Input.Files = defaultTestFiles.RDO_BKG_RUN3
78  flags.Input.SecondaryFiles = defaultTestFiles.HITS_RUN3
79  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
80  from Campaigns import MC23a
81  MC23a(flags)
82  elif args.run is LHCPeriod.Run4:
83  flags.Input.Files = defaultTestFiles.RDO_BKG_RUN4
84  flags.Input.SecondaryFiles = defaultTestFiles.HITS_RUN4
85  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
86  from Campaigns import PhaseIIPileUp200
87  PhaseIIPileUp200(flags)
88  else:
89  raise ValueError("Run not supported")
90  flags.Input.MCChannelNumber = GetFileMD(flags.Input.SecondaryFiles, allowEmpty=False).get("mc_channel_number", 0)
91  flags.Output.RDOFileName = "mcOverlayRDO.pool.root"
92  flags.Overlay.DataOverlay = False
93 
94  if args.output:
95  if args.output == 'None':
96  flags.Output.RDOFileName = ''
97  else:
98  flags.Output.RDOFileName = args.output
99 
100  if args.outputSig:
101  flags.Output.RDO_SGNLFileName = args.outputSig
102 
103  if 'detectors' in args and args.detectors:
104  detectors = args.detectors
105  else:
106  detectors = None
107 
108  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
109  setupDetectorFlags(flags, detectors, toggle_geometry=True, use_metadata=True)
110 
111  # Moving here so that it is ahead of flags being locked. Need to
112  # iterate on exact best position w.r.t. above calls
113  from OverlayConfiguration.OverlayMetadata import overlayMetadataCheck
114  # Handle metadata correctly
115  overlayMetadataCheck(flags)
116 
117 

◆ postprocessAndLockFlags()

def python.OverlayTestHelpers.postprocessAndLockFlags (   flags,
  args 
)
Postprocess and lock config flags for overlay

Definition at line 118 of file OverlayTestHelpers.py.

118 def postprocessAndLockFlags(flags, args):
119  """Postprocess and lock config flags for overlay"""
120  flags.Concurrency.NumThreads = args.threads
121  flags.Concurrency.NumProcs = args.processes
122  if args.threads > 0:
123  flags.Scheduler.ShowDataDeps = True
124  flags.Scheduler.ShowDataFlow = True
125  flags.Scheduler.ShowControlFlow = True
126  flags.Concurrency.NumConcurrentEvents = args.concurrent if args.concurrent > 0 else args.threads
127 
128  flags.lock()
129 
130 

◆ printAndRun()

def python.OverlayTestHelpers.printAndRun (   accessor,
  flags,
  args 
)
Common debugging and execution for overlay tests

Definition at line 131 of file OverlayTestHelpers.py.

131 def printAndRun(accessor, flags, args):
132  """Common debugging and execution for overlay tests"""
133  # Dump config
134  accessor.printConfig(withDetails=args.verboseAccumulators)
135  if args.verboseStoreGate:
136  accessor.getService("StoreGateSvc").Dump = True
137  flags.dump()
138 
139  if args.debug:
140  accessor.setDebugStage (args.debug)
141 
142  # Execute and finish
143  sc = accessor.run(maxEvents=args.maxEvents)
144 
145  # Success should be 0
146  return not sc.isSuccess()
python.AutoConfigFlags.GetFileMD
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
Definition: AutoConfigFlags.py:65
python.MC23.MC23a
def MC23a(flags)
Definition: MC23.py:6
python.OverlayTestHelpers.postprocessAndLockFlags
def postprocessAndLockFlags(flags, args)
Definition: OverlayTestHelpers.py:118
python.JobOptsDumper.JobOptsDumperCfg
def JobOptsDumperCfg(flags, FileName="JobOptsConfig.txt")
Definition: JobOptsDumper.py:6
python.OverlayTestHelpers.OverlayJobOptsDumperCfg
def OverlayJobOptsDumperCfg(flags)
Definition: OverlayTestHelpers.py:14
python.OverlayMetadata.overlayMetadataCheck
def overlayMetadataCheck(flags)
Definition: OverlayMetadata.py:176
python.OverlayTestHelpers.printAndRun
def printAndRun(accessor, flags, args)
Definition: OverlayTestHelpers.py:131
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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.MC20.MC20e
def MC20e(flags)
Definition: MC20.py:63
python.DataOverlayRun2.DataOverlayPPTest
def DataOverlayPPTest(flags)
Definition: DataOverlayRun2.py:3
python.PhaseII.PhaseIIPileUp200
def PhaseIIPileUp200(flags)
Definition: PhaseII.py:81
python.OverlayTestHelpers.overlayTestFlags
def overlayTestFlags(flags, args)
Definition: OverlayTestHelpers.py:50
python.OverlayTestHelpers.CommonTestArgumentParser
def CommonTestArgumentParser(prog)
Definition: OverlayTestHelpers.py:19
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127