Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
python.AnalysisApp Namespace Reference

Functions

def initFlags ()
 
def initCfg (flags)
 
def launch (flags, ca)
 

Function Documentation

◆ initCfg()

def python.AnalysisApp.initCfg (   flags)
Creates a ComponentAccumulator appropriate for typical Analysis
type jobs.
:param flags:
:return:

Definition at line 83 of file AnalysisApp.py.

83 def initCfg(flags):
84  """
85  Creates a ComponentAccumulator appropriate for typical Analysis
86  type jobs.
87  :param flags:
88  :return:
89  """
90  flags.lock()
91  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
92  from AthenaConfiguration.ComponentFactory import CompFactory
93 
94  ca = MainServicesCfg(flags)
95 
96  if flags.args().accessMode == "POOLAccess":
97  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
98  ca.merge(PoolReadCfg(flags))
99  else:
100  from AthenaRootComps.xAODEventSelectorConfig import xAODReadCfg,xAODAccessMode
101  ca.merge(xAODReadCfg(flags, AccessMode = xAODAccessMode.CLASS_ACCESS))
102 
103  outputs = ["{} DATAFILE='{}' OPT='RECREATE'".format(*file.split(":",1)) for file in flags.Output.HISTOutputs]
104  if len(outputs): ca.addService(CompFactory.THistSvc(Output = outputs))
105 
106  ca.getService("MessageSvc").setWarning += ["ClassIDSvc","PoolSvc","AthDictLoaderSvc","AthenaPoolAddressProviderSvc",
107  "ProxyProviderSvc","DBReplicaSvc","MetaDataSvc","MetaDataStore","AthenaPoolCnvSvc",
108  "TagMetaDataStore","EventSelector",
109  #"ApplicationMgr", can't silence because otherwise ATN tests fail, see ATLINFR-1235
110  "CoreDumpSvc","AthMasterSeq","EventPersistencySvc","ActiveStoreSvc",
111  "AthenaEventLoopMgr","AthOutSeq","AthRegSeq"]
112 
113  return ca
114 

◆ initFlags()

def python.AnalysisApp.initFlags ( )
Creates a flag container (AthConfigFlags) appropriate for typical
Analysis athena applications.
:return: flags

Definition at line 22 of file AnalysisApp.py.

22 def initFlags():
23  """
24  Creates a flag container (AthConfigFlags) appropriate for typical
25  Analysis athena applications.
26  :return: flags
27  """
28  from AthenaConfiguration import AthConfigFlags
29  from AthenaConfiguration.AutoConfigFlags import GetFileMD
30  from Campaigns.Utils import Campaign
31  acf=AthConfigFlags.AthConfigFlags()
32 
33  #Flags steering the job execution:
34  from AthenaCommon.Constants import INFO
35  from AthenaConfiguration.Enums import ProductionStep
36  import argparse
37  acf.addFlag('Exec.OutputLevel',INFO) #Global Output Level
38  acf.addFlag('Exec.MaxEvents',-1)
39  acf.addFlag('Exec.SkipEvents',0)
40  acf.addFlag('Exec.DebugStage','', help=argparse.SUPPRESS)
41  acf.addFlag('Exec.FPE',-2) #-2: No FPE check at all, -1: Abort with core-dump, 0: FPE Auditor w/o stack-tace (default) , >0: number of stack-trace printed by the job
42 
43 
44  #Custom messaging for components, see Utils.setupLoggingLevels
45  acf.addFlag('Exec.VerboseMessageComponents',[])
46  acf.addFlag('Exec.DebugMessageComponents',[])
47  acf.addFlag('Exec.InfoMessageComponents',[])
48  acf.addFlag('Exec.WarningMessageComponents',[])
49  acf.addFlag('Exec.ErrorMessageComponents',[])
50 
51  acf.addFlag('Common.MsgSuppression',True) # Enable suppression of printout in MessageSvc
52  acf.addFlag('Common.MsgSourceLength',50) #Length of the source-field in the format str of MessageSvc
53  acf.addFlag('Common.ProductionStep', ProductionStep.Default, type=ProductionStep, help=argparse.SUPPRESS)
54  acf.addFlag('Common.isOverlay', False, help=argparse.SUPPRESS)
55 
56  #Flags describing the input data
57  acf.addFlag('Input.Files', ["_ATHENA_GENERIC_INPUTFILE_NAME_",]) # former global.InputFiles
58  acf.addFlag('Input.OverrideRunNumber', False, help=argparse.SUPPRESS )
59  acf.addFlag('Input.SecondaryFiles', [], help=argparse.SUPPRESS) # secondary input files for DoubleEventSelector
60  acf.addFlag('Input.ProcessingTags', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("processingTags", []), help="expert flag, do not override" ) # list of names of streams written to this file
61  acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name", "data17_13TeV"), help="expert flag, do not override") # former global.ProjectName
62  acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), type=Campaign, help="expert flag, do not override")
63 
64 
65  acf.addFlag('Concurrency.NumProcs', 0, help="0 = disables MP, otherwise is # of processes to use in MP mode")
66  acf.addFlag('Concurrency.NumThreads', 0, help="0 = disables MT, otherwise is # of threads to use in MT mode" )
67  acf.addFlag('Concurrency.NumConcurrentEvents', lambda prevFlags : prevFlags.Concurrency.NumThreads)
68  acf.addFlag('Concurrency.DebugWorkers', False )
69 
70  # output
71  acf.addFlag('Output.HISTOutputs', [],help="ROOT output files. Specify in form of 'STREAM:filename.root'")
72  acf.addFlag('Output.TreeAutoFlush', {}, help="{} = automatic for all streams, otherwise {'STREAM': 123}")
73 
74  acf.addFlag("PoolSvc.MaxFilesOpen", 0, help=argparse.SUPPRESS)
75 
76  # analysis-specific arguments
77  acf.parser().add_argument('--accessMode',default="POOLAccess",choices={"POOLAccess","ClassAccess"},help="Input file reading mode") # named arg
78  acf.parser().add_argument('--postExec',default=None,help="Any postconfig execution required")
79 
80 
81  return acf
82 

◆ launch()

def python.AnalysisApp.launch (   flags,
  ca 
)
Launches the job (includes executing any postExec)
:param flags:
:param ca:
:return:

Definition at line 115 of file AnalysisApp.py.

115 def launch(flags,ca):
116  """
117  Launches the job (includes executing any postExec)
118  :param flags:
119  :param ca:
120  :return:
121  """
122  from AthenaConfiguration.Utils import setupLoggingLevels
123  setupLoggingLevels(flags,ca)
124  if flags.args().postExec: eval(flags.args().postExec)
125  if ca.run().isFailure():
126  import sys
127  sys.exit(1)
128 
python.AutoConfigFlags.GetFileMD
def GetFileMD(filenames, allowEmpty=True, maxLevel='peeker')
Definition: AutoConfigFlags.py:65
xAODEventSelectorConfig.xAODReadCfg
def xAODReadCfg(flags, AccessMode=xAODAccessMode.CLASS_ACCESS)
Definition: xAODEventSelectorConfig.py:24
vtune_athena.format
format
Definition: vtune_athena.py:14
python.AnalysisApp.initFlags
def initFlags()
Definition: AnalysisApp.py:22
python.AnalysisApp.initCfg
def initCfg(flags)
Definition: AnalysisApp.py:83
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:50
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.AnalysisApp.launch
def launch(flags, ca)
Definition: AnalysisApp.py:115