ATLAS Offline Software
LArNoiseSkeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 import sys
4 
5 from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
6 from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
7 from LArCafJobs.LArNoiseConfig import LArNoiseCfg
8 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
9 
10 
11 def fromRunArgs(runArgs):
12  from AthenaConfiguration.AllConfigFlags import initConfigFlags
13 
14  flags=initConfigFlags()
15 
16  from LArCafJobs.LArNoiseFlags import addNoiseFlags
17  addNoiseFlags(flags)
18 
19  commonRunArgsToFlags(runArgs, flags)
20 
21  processPreInclude(runArgs, flags)
22  processPreExec(runArgs, flags)
23 
24  flags.Input.Files=runArgs.inputESDFile
25  if hasattr(runArgs,"outputNTUP_LARNOISEFile"):
26  flags.LArNoise.outNtupLAr=runArgs.outputNTUP_LARNOISEFile
27 
28  if hasattr(runArgs,"outputNTUP_HECNOISEFile"):
29  flags.LArNoise.HECNoiseNtup=runArgs.outputNTUP_HECNOISEFile
30 
31  if not hasattr(runArgs,"conditionsTag") or runArgs.conditionsTag=="CURRENT":
32  print("Resolving 'CURRENT' express conditions tag ...")
33  sys.path.append('/afs/cern.ch/user/a/atlcond/utils22/')
34  from CondUtilsLib.AtlCoolBKLib import resolveAlias
35  resolver=resolveAlias()
36  currentGlobalES=resolver.getCurrentES().replace("*","ST")
37  print("Found ",currentGlobalES)
38  flags.IOVDb.GlobalTag=currentGlobalES
39  else:
40  flags.IOVDb.GlobalTag=runArgs.conditionsTag
41 
42  if hasattr(runArgs,"skipEvents"):
43  flags.Exec.SkipEvents=runArgs.skipEvents
44 
45  if hasattr(runArgs,"maxEvents"):
46  flags.Exec.MaxEvents=runArgs.maxEvents
47 
48  flags.Trigger.doID=False
49 
50  # To respect --athenaopts
51  flags.fillFromArgs()
52 
53  flags.lock()
54 
55  cfg=MainServicesCfg(flags)
56  cfg.merge(LArNoiseCfg(flags))
57 
58  processPostInclude(runArgs, flags, cfg)
59  processPostExec(runArgs, flags, cfg)
60 
61  # Run the final accumulator
62  sc = cfg.run()
63  sys.exit(not sc.isSuccess())
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
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
LArNoiseFlags.addNoiseFlags
def addNoiseFlags(flags)
Definition: LArNoiseFlags.py:3
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
LArNoiseSkeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: LArNoiseSkeleton.py:11
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
LArNoiseConfig.LArNoiseCfg
def LArNoiseCfg(flags)
Definition: LArNoiseConfig.py:6