3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
9 from MuonConfig.MuonRecToolsConfig
import MuonEDMHelperSvcCfg
15 if "PullCalculator" not in kwargs:
16 from TrkConfig.TrkResidualPullCalculatorConfig
import (
17 ResidualPullCalculatorCfg)
18 kwargs.setdefault(
"PullCalculator", result.popToolsAndMerge(
21 alg = CompFactory.MuonCalib.MuonSegmentReader(**kwargs)
23 result.addEventAlgo(alg)
26 if __name__ ==
"__main__":
27 """Run a functional test if module is executed"""
29 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
30 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
31 from AthenaCommon.Logging
import logging
33 log = logging.getLogger(
'CalibStreamConfig')
38 flags.Concurrency.NumThreads = 1
42 inputdir =
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/MdtCalibration/'
43 flags.Input.Files = [f
'{inputdir}data23_calib.00456729.calibration_MuonAll.daq.RAW.0000_0004-0051.data']
48 flags.Input.TypedCollections =
'calibration_MuonAll'
49 flags.GeoModel.AtlasVersion =
'ATLAS-R3S-2021-03-02-00'
50 flags.IOVDb.GlobalTag =
'CONDBR2-ES1PA-2023-03'
51 flags.Input.isMC =
False
52 flags.Input.ProjectName=flags.Input.Files[0].
split(
'/')[-1].
split(
'.')[0]
54 if data[1][2:].isdigit():
55 flags.Input.RunNumbers = [
int(data[1][2:])]
57 flags.Input.RunNumbers = [0]
58 ntuplename = flags.Input.Files[0].
split(
'/')[-1][0:-4] +
"ntuple.root"
60 flags.Detector.GeometryMDT =
True
61 flags.Detector.GeometryTGC =
True
62 flags.Detector.GeometryRPC =
True
63 flags.Detector.GeometryCSC =
False
64 flags.Detector.GeometrysTGC =
False
65 flags.Detector.GeometryMM =
False
66 flags.Detector.GeometryCalo =
False
67 flags.Detector.GeometryID =
False
68 flags.Detector.GeometryPixel =
False
69 flags.Detector.GeometrySCT =
False
71 flags.Muon.makePRDs =
True
73 flags.Input.LumiBlockNumbers = [200]
75 from AthenaConfiguration.Enums
import BeamType, Format
76 flags.Beam.Type = BeamType.Collisions
77 flags.Input.Collections = []
78 flags.Input.Format = Format.BS
80 flags.Output.doWriteESD =
False
81 if flags.Output.ESDFileName ==
'':
82 flags.Output.ESDFileName=
'newESD.pool.root'
84 print(
'ESD = ', flags.Output.ESDFileName )
88 flags.Exec.OutputLevel = 3
90 flags.PerfMon.doFullMonMT =
True
91 flags.PerfMon.OutputJSON = flags.Input.Files[0].
split(
'/')[-1][0:-4] +
"perfmonmt.json"
96 histSvc = CompFactory.THistSvc(Output=[
"%s DATAFILE='%s', OPT='RECREATE'" % (
"CALIBNTUPLESTREAM", ntuplename)], AutoFlush= -10000000, AutoSave= -10000000)
97 acc.addService(histSvc, primary=
True)
100 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
104 from MuonConfig.MuonCalibrationConfig
import MdtCalibrationToolCfg
107 tool_kwargs[
"UseTwin"] =
True
108 tool_kwargs[
"CalibrationTool"] = acc.popToolsAndMerge(
MdtCalibrationToolCfg(flags, TimeWindowSetting = 3, DoPropagationCorrection =
True, DoSlewingCorrection =
True, DoMagneticFieldCorrection =
True))
111 from MuonCalibStreamCnv.MuonCalibStreamCnvConfig
import MuonCalibStreamReadCfg, MdtCalibRawDataProviderCfg, RpcCalibRawDataProviderCfg, TgcCalibRawDataProviderCfg
116 if flags.Detector.GeometryMDT:
118 acc.merge(mdtCalibRawDataProvider)
121 from MuonConfig.MuonRdoDecodeConfig
import RpcRDODecodeCfg,TgcRDODecodeCfg
122 if flags.Detector.GeometryRPC:
124 acc.merge(rpcCalibRawDataProvider)
126 if flags.Detector.GeometryTGC:
128 acc.merge(tgcCalibRawDataProvider)
132 from MuonConfig.MuonReconstructionConfig
import MuonSegmentFindingCfg, MuonTrackBuildingCfg, StandaloneMuonOutputCfg
135 if flags.Output.doWriteESD
or flags.Output.doWriteAOD:
146 reader =
MuonSegmentReaderCfg(flags, CalibrationTool = acc.popToolsAndMerge(
MdtCalibrationToolCfg(flags, TimeWindowSetting = 3, DoPropagationCorrection =
True, DoSlewingCorrection =
True, DoMagneticFieldCorrection =
True)))
149 acc.getCondAlgo(
"MdtCalibDbAlg").ReadKeyDCS=
""
151 acc.getService(
'Athena::DelayedConditionsCleanerSvc').RingSize=2
152 acc.getService(
'Athena::DelayedConditionsCleanerSvc').CleanDelay=1
153 acc.getService(
'Athena::DelayedConditionsCleanerSvc').LookAhead=1
155 acc.printConfig(withDetails=
True, summariseProps=
True)
157 log.info(
"Config OK")
160 with open(
'MuonCalibByteStreamConfig.pkl',
'wb')
as pkl:
167 sys.exit(acc.run(200).isFailure())