ATLAS Offline Software
LArShapeDumperSkeleton.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.LArShapeDumperConfig import LArShapeDumperCfg
8 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
9 
10 
11 def fromRunArgs(runArgs):
12  from AthenaCommon.Logging import logging
13  mlog_SCD = logging.getLogger( 'LArShapeDumperSkeleton' )
14 
15  from AthenaConfiguration.AllConfigFlags import initConfigFlags
16 
17  flags=initConfigFlags()
18  from LArCafJobs.LArShapeDumperFlags import addShapeDumpFlags
19  addShapeDumpFlags(flags)
20 
21  commonRunArgsToFlags(runArgs, flags)
22 
23  processPreInclude(runArgs, flags)
24  processPreExec(runArgs, flags)
25 
26  from AthenaConfiguration.TestDefaults import defaultGeometryTags
27  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
28  flags.LAr.ROD.forceIter=True
29  flags.LAr.OFCShapeFolder="4samples3bins17phases"
30  flags.Input.Files=runArgs.inputBSFile
31  flags.LArShapeDump.outputNtup=runArgs.outputNTUP_SAMPLESMONFile
32 
33  flags.LArShapeDump.energySCCut = 500.
34 
35  #protection for LArPEB event:
36  flags.Trigger.triggerConfig = 'DB'
37  flags.Trigger.L1.doCTP = True
38  flags.Trigger.L1.doMuon=False
39  flags.Trigger.L1.doCalo=False
40  flags.Trigger.L1.doTopo=False
41 
42  if hasattr(runArgs,"outputNTUP_HECNOISEFile"):
43  flags.LArShapeDump.HECNoiseNtup=runArgs.outputNTUP_HECNOISEFile
44 
45  if runArgs.doSC:
46  from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun
47  try:
48  runinfo=getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2")
49  except Exception:
50  mlog_SCD.warning("Could not get DT run info, using defaults !")
51  flags.LArShapeDump.ndigitsSC=6
52  flags.LArShapeDump.nrawSC=1
53  flags.LArShapeDump.rawSCKey="SC_ET_ID"
54  flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
55  fw=5
56  else:
57  fw=runinfo.FWversion()
58  for i in range(0,len(runinfo.streamTypes())):
59  if runinfo.streamTypes()[i] == "SelectedEnergy":
60  flags.LArShapeDump.rawSCKey = "SC_ET_ID"
61  flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
62  elif runinfo.streamTypes()[i] == "Energy":
63  flags.LArShapeDump.rawSCKey = "SC_ET"
64  flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
65  elif runinfo.streamTypes()[i] == "RawADC":
66  flags.LArShapeDump.digitsKeySC="SC"
67  flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
68  elif runinfo.streamTypes()[i] == "ADC":
69  flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
70  flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
71 
72  # To respect --athenaopts
73  flags.fillFromArgs()
74 
75  flags.lock()
76 
77  cfg=MainServicesCfg(flags)
78  cfg.merge(LArShapeDumperCfg(flags))
79 
80  processPostInclude(runArgs, flags, cfg)
81  processPostExec(runArgs, flags, cfg)
82 
83  if runArgs.doSC and fw==6:
84  from IOVDbSvc.IOVDbSvcConfig import addOverride
85  cfg.merge(addOverride(flags,"/LAR/Identifier/LatomeMapping","LARIdentifierLatomeMapping-fw6"))
86 
87  # Run the final accumulator
88  sc = cfg.run()
89  sys.exit(not sc.isSuccess())
LArShapeDumperFlags.addShapeDumpFlags
def addShapeDumpFlags(flags)
Definition: LArShapeDumperFlags.py:5
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.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
LArShapeDumperSkeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: LArShapeDumperSkeleton.py:11
python.LArRunFormat.getLArDTInfoForRun
def getLArDTInfoForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:152
LArRunFormat
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
LArShapeDumperConfig.LArShapeDumperCfg
def LArShapeDumperCfg(flags)
Definition: LArShapeDumperConfig.py:6
python.IOVDbSvcConfig.addOverride
def addOverride(flags, folder, tag, tagType="tag", db=None)
Definition: IOVDbSvcConfig.py:238
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19