ATLAS Offline Software
CaloLCWSkeleton.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 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 CaloLocalHadCalib.CaloLCWConfig import GetLCWCfg
8 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
9 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
10 
11 
12 def fromRunArgs(runArgs):
13  from AthenaConfiguration.AllConfigFlags import initConfigFlags
14  flags = initConfigFlags()
15 
16  from CaloLocalHadCalib.LCWConfigFlags import addLCWFlags
17  addLCWFlags(flags)
18 
19  commonRunArgsToFlags(runArgs, flags)
20 
21  processPreInclude(runArgs, flags)
22  processPreExec(runArgs, flags)
23 
24  # general flags
25  flags.Input.Files=runArgs.inputESDFile
26 
27  # redo topo clusters on EM scale
28  flags.Calo.TopoCluster.doTopoClusterLocalCalib = runArgs.doLocalCalib
29  flags.Calo.TopoCluster.doCellWeightCalib = runArgs.doCellWeight
30  flags.Calo.TopoCluster.doCalibHitMoments = runArgs.doHitMoments
31 
32  # choose which part to do
33  flags.LCW.doClassification = runArgs.doClassification
34  flags.LCW.doWeighting = runArgs.doWeighting
35  flags.LCW.doOutOfCluster = runArgs.doOOC
36  flags.LCW.doDeadMaterial = runArgs.doDeadM
37 
38  flags.lock()
39 
40  cfg=MainServicesCfg(flags)
41  cfg.merge(PoolReadCfg(flags))
42 
43  from CaloRec.CaloTopoClusterConfig import CaloTopoClusterCfg
44 
45  topoAcc=CaloTopoClusterCfg(flags,clustersnapname=runArgs.ClusKey)
46  topoAlg = topoAcc.getPrimary()
47  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").MatchDmType = 1 # 1=loose, 2=medium (default), 3=tight
48  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").CalibrationHitContainerNames = ["LArCalibrationHitInactive","LArCalibrationHitActive","TileCalibHitActiveCell","TileCalibHitInactiveCell"]
49  topoAlg.ClusterCorrectionTools.__getitem__("TopoCalibMoments").DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial_DEAD","LArCalibrationHitInactive_DEAD","LArCalibrationHitActive_DEAD","TileCalibHitDeadMaterial"]
50 
51  cfg.merge(topoAcc)
52 
53  cfg.merge(GetLCWCfg(flags))
54 
55  processPostInclude(runArgs, flags, cfg)
56  processPostExec(runArgs, flags, cfg)
57 
58  # Run the final accumulator
59  sc = cfg.run()
60  sys.exit(not sc.isSuccess())
61 
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
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:259
python.CommonRunArgsToFlags.commonRunArgsToFlags
def commonRunArgsToFlags(runArgs, configFlags)
Definition: CommonRunArgsToFlags.py:12
CaloLCWConfig.GetLCWCfg
def GetLCWCfg(flags)
Definition: CaloLCWConfig.py:5
python.CaloTopoClusterConfig.CaloTopoClusterCfg
def CaloTopoClusterCfg(flags, cellsname="AllCalo", clustersname=None, clustersnapname="CaloTopoClusters")
Definition: CaloTopoClusterConfig.py:318
LCWConfigFlags.addLCWFlags
def addLCWFlags(flags)
Definition: LCWConfigFlags.py:3
CaloLCWSkeleton.fromRunArgs
def fromRunArgs(runArgs)
Definition: CaloLCWSkeleton.py:12
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69