6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.Enums
import Format
10 @file TileD3PDConfig.py
11 @brief Python configuration of TileD3PD for the Run III
15 def _args(level, name, kwin, **kw):
18 for (k, v)
in kwin.items():
19 if k.startswith(name +
'_'):
20 kw[k[len(name)+1:]] = v
24 def TileD3PDCfg(flags, outputFile=None, saveCells=True, saveMBTS=True,
25 saveE4pr=False, saveClusters=False, saveMuId=False,
26 saveMuonFit=False, savePosition=True, saveEventInfo=False,
28 ''' Function to configure Tile D3PD.'''
32 from TileGeoModel.TileGMConfig
import TileGMCfg
35 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
38 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
41 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
45 runNumber = flags.Input.RunNumbers[0]
46 outputFile = f
'tile_{runNumber}.aan.root'
48 from D3PDMakerCoreComps.MakerAlgConfig
import MakerAlgConfig
49 alg =
MakerAlgConfig(flags, acc,
'caloD3PD', outputFile, ExistDataHeader=
False)
52 excludeEventInfoBlocks = [
'eventMu']
if flags.Input.Format
is Format.BS
else []
53 from EventCommonD3PDMaker.EventInfoD3PDObject
import EventInfoD3PDObject
56 from CaloSysD3PDMaker.TileDetailsD3PDObject
import TileDetailsD3PDObject
57 from CaloSysD3PDMaker.CaloInfoD3PDObject
import CaloInfoD3PDObject
58 from CaloD3PDMaker.MBTSD3PDObject
import MBTSD3PDObject
60 isBiGainRun = flags.Tile.RunType.isBiGain()
65 prefix=
'tile_', Kinematics_WriteEtaPhi=
True,
66 TileDetails_SavePositionInfo=savePosition))
72 alg +=
MBTSD3PDObject(**
_args(1,
'MBTS', kwargs, prefix=
'mbtsLG_', sgkey=
'MBTSContainerLG'))
76 sgkey=
'E4prContainerHG', MBTS_SaveEtaPhiInfo=
False))
79 sgkey=
'E4prContainerLG', MBTS_SaveEtaPhiInfo=
False))
83 prefix=
'tile_', Kinematics_WriteEtaPhi=
True,
84 TileDetails_SavePositionInfo=savePosition))
93 sgkey=
'E4prContainer', MBTS_SaveEtaPhiInfo=
False))
96 from CaloD3PDMaker.xAODClusterD3PDObject
import xAODClusterD3PDObject
100 from CaloSysD3PDMaker.TileMuD3PDObject
import TileMuD3PDObject
101 alg += TileMuD3PDObject(**
_args(0,
'TileMus', kwargs, sgkey=
'TileMuObj', prefix=
'tilemuid_'))
104 from CaloSysD3PDMaker.TileCosmicMuonD3PDObject
import TileCosmicMuonD3PDObject
105 alg += TileCosmicMuonD3PDObject(**
_args(2,
'TileCosMusHT', kwargs, sgkey=
'TileCosmicMuonHT', prefix=
'TileCosmicsHT_'))
107 acc.addEventAlgo(alg.alg)
111 if __name__ ==
'__main__':
114 from D3PDMakerConfig.D3PDMakerFlags
import configFlags
as flags
115 parser = flags.getArgumentParser()
116 parser.add_argument(
'--cells', action=
'store_true', help=
'Save Tile cells in D3PD')
117 parser.add_argument(
'--mbts', action=
'store_true', help=
'Save Tile MBTS in D3PD')
118 parser.add_argument(
'--e4pr', action=
'store_true', help=
'Save Tile E4pr in D3PD')
119 parser.add_argument(
'--muid', action=
'store_true', help=
'Save Tile MuID in D3PD')
120 parser.add_argument(
'--muonfit', action=
'store_true', help=
'Save Tile Muon Fitter in D3PD')
121 parser.add_argument(
'--clusters', action=
'store_true', help=
'Save Tile clusters in D3PD')
122 parser.add_argument(
'--postExec', help=
'Code to execute after setup')
123 args, _ = parser.parse_known_args()
126 from AthenaCommon.Logging
import log
130 from AthenaConfiguration.TestDefaults
import defaultTestFiles
131 flags.Input.Files = defaultTestFiles.ESD
132 flags.Exec.MaxEvents = 3
133 flags.fillFromArgs(parser=parser)
135 log.info(
'FINAL CONFIG FLAGS SETTINGS FOLLOW')
141 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
144 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
148 saveCells=args.cells,
152 saveMuonFitter=args.muonfit,
153 saveClusters=args.clusters,
154 saveEventInfo=
True) )
156 cfg.setAppProperty(
'CreateSvc', [cfg.getService(
'TileCablingSvc').getFullJobOptName()])
160 log.info(
'Executing postExec: %s', args.postExec)
163 cfg.printConfig(withDetails=
True, summariseProps=
True)
165 cfg.store(
open(
'TileD3PDConfig.pkl',
'wb') )
171 sys.exit(0
if sc.isSuccess()
else 1)