ATLAS Offline Software
Loading...
Searching...
No Matches
CaloLCWSkeleton.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3import sys
4
5from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
6from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
7from CaloLocalHadCalib.CaloLCWConfig import GetLCWCfg
8from AthenaConfiguration.MainServicesConfig import MainServicesCfg
9from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
10
11
12def 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