6 @file TileTBAANtupleConfig.py
7 @brief Python configuration of TileTBAANtuple algorithm for the Run III
10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory
import CompFactory
12 from TileConfiguration.TileConfigFlags
import TileRunType
18 ''' Function to get Tile TB period.'''
20 TBperiod = 2015
if (run // 100000 == 5)
else 2016
36 ''' Function to configure TileTBAANtuple algorithm.'''
40 cisRun = flags.Tile.RunType
is TileRunType.CIS
41 monoRun = flags.Tile.RunType
is TileRunType.MONOCIS
42 pedestalRun = flags.Tile.RunType
is TileRunType.PED
45 offlineUnits = 0
if cisRun
or monoRun
or pedestalRun
else 3
46 calibrateEnergy = (offlineUnits != 0)
48 run = flags.Input.RunNumbers[0]
51 useFELIX =
True if run > 2310438
else False
55 kwargs.setdefault(
'TileDigitsContainer',
'TileDigitsCnt')
56 kwargs.setdefault(
'TileBeamElemContainer',
'TileBeamElemCnt')
57 kwargs.setdefault(
'TileRawChannelContainerFlat',
"")
58 kwargs.setdefault(
'TileRawChannelContainerFit',
'TileRawChannelFit' if flags.Tile.doFit
else "")
59 kwargs.setdefault(
'TileRawChannelContainerOpt',
"TileRawChannelOpt2" if flags.Tile.doOpt2
else "")
60 kwargs.setdefault(
'TileRawChannelContainerDsp',
"")
61 kwargs.setdefault(
'TileRawChannelContainerFitCool',
'TileRawChannelFitCool' if flags.Tile.doFitCOOL
else "")
63 kwargs.setdefault(
'TileDigitsContainerFlx',
'TileDigitsFlxCnt' if useFELIX
else "")
64 kwargs.setdefault(
'TileRawChannelContainerFitFlx',
'TileRawChannelFlxFit' if useFELIX
and flags.Tile.doFit
else "")
65 kwargs.setdefault(
'TileRawChannelContainerOptFlx',
'TileRawChannelFlxOpt2' if useFELIX
and flags.Tile.doOpt2
else "")
67 kwargs.setdefault(
'TileHitContainer',
"")
68 kwargs.setdefault(
'TileHitVector',
"")
69 kwargs.setdefault(
'CaloCellContainer',
'AllCalo')
71 kwargs.setdefault(
'TileLaserObj',
"")
73 kwargs.setdefault(
'OfflineUnits', offlineUnits)
74 kwargs.setdefault(
'CalibrateEnergy', calibrateEnergy)
75 kwargs.setdefault(
'CalibMode', pedestalRun
or cisRun)
76 kwargs.setdefault(
'PMTOrder',
not (cisRun
or monoRun
or pedestalRun))
78 kwargs.setdefault(
'NSamples', -1)
79 kwargs.setdefault(
'NSamplesFelix', 16
if useFELIX
else 0)
81 kwargs.setdefault(
'TBperiod', TBperiod)
85 from TileGeoModel.TileGMConfig
import TileGMCfg
88 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
91 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
94 if 'TileCondToolEmscale' not in kwargs:
95 from TileConditions.TileEMScaleConfig
import TileCondToolEmscaleCfg
97 kwargs[
'TileCondToolEmscale'] = emScaleTool
99 from TileRecUtils.TileDQstatusConfig
import TileDQstatusAlgCfg
103 from TileConditions.TileSamplingFractionConfig
import TileSamplingFractionCondAlgCfg
106 kwargs[
'TileSamplingFraction'] =
""
109 outputFile = f
'tiletb_{run}.aan.root'
110 histsvc = CompFactory.THistSvc()
111 histsvc.Output += [
"%s DATAFILE='%s' OPT='RECREATE'" % (
'AANT', outputFile)]
112 acc.addService(histsvc)
114 alg = CompFactory.TileTBAANtuple(**kwargs)
115 from TileMonitoring.TileTBBeamChambersCalibration
import updateBeamChambersCalibrations
117 acc.addEventAlgo(alg, primary=
True)
122 if __name__ ==
'__main__':
125 from AthenaCommon.Logging
import log
129 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
130 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
133 parser = flags.getArgumentParser()
134 parser.add_argument(
'--postExec', help=
'Code to execute after setup')
135 args, _ = parser.parse_known_args()
137 flags.Exec.MaxEvents = 3
138 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
139 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
140 flags.Tile.doFit =
False
141 flags.Tile.doOpt2 =
False
142 flags.Tile.RunType = TileRunType.PHY
143 flags.Input.Files = defaultTestFiles.RAW_RUN2
145 flags.fillFromArgs(parser=parser)
148 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
151 from TileByteStream.TileByteStreamConfig
import TileRawDataReadingCfg
161 cfg.getCondAlgo(
'TileHid2RESrcIDCondAlg').RODStatusProxy =
None
165 log.info(
'Executing postExec: %s', args.postExec)
169 cfg.store(
open(
'TileTBAANtuple.pkl',
'wb'))
173 sys.exit(
not sc.isSuccess())