3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
6 from AthenaConfiguration.Enums
import ProductionStep
7 from AtlasGeoModel.GeoModelConfig
import GeoModelCfg
8 from AthenaConfiguration.Enums
import LHCPeriod
12 trackingVolSvc = CompFactory.Trk.TrackingVolumesSvc(name=name, **kwargs)
13 result.addService(trackingVolSvc, primary=
True)
18 acc.addService( CompFactory.Muon.MuonIdHelperSvc(
"MuonIdHelperSvc",
19 HasCSC=flags.Detector.GeometryCSC,
20 HasSTGC=flags.Detector.GeometrysTGC,
21 HasMM=flags.Detector.GeometryMM,
22 HasMDT=flags.Detector.GeometryMDT,
23 HasRPC=flags.Detector.GeometryRPC,
24 HasTGC=flags.Detector.GeometryTGC), primary=
True )
31 if flags.Muon.usePhaseIIGeoSetup:
32 from MuonGeoModelR4.MuonGeoModelConfig
import MuonGeoModelCfg
as MuonGeoModelCfgR4
33 result.merge(MuonGeoModelCfgR4(flags))
34 from MuonGeoModelR4.MuonGeoModelConfig
import MuonAlignStoreCfg
36 if flags.Common.ProductionStep != ProductionStep.Simulation:
37 from MuonGeometryCnv.MuonReadoutGeomCnvCfg
import MuonReadoutGeometryCnvAlgCfg
48 kwargs.setdefault(
"HasCSC", flags.Detector.GeometryCSC)
49 kwargs.setdefault(
"HasSTgc", flags.Detector.GeometrysTGC)
50 kwargs.setdefault(
"HasMM", flags.Detector.GeometryMM)
52 kwargs.setdefault(
"UseConditionDb", flags.Muon.enableAlignment)
53 kwargs.setdefault(
"UseAsciiConditionData", flags.Muon.enableAlignment)
55 UseIlinesFromGM =
False
56 EnableCscInternalAlignment =
False
58 if flags.Muon.enableAlignment:
59 if not flags.Input.isMC:
60 kwargs.setdefault(
"BEENoShift",
True)
62 if flags.Muon.Align.UseILines
and flags.Detector.GeometryCSC:
63 if 'HLT' in flags.IOVDb.GlobalTag:
65 UseIlinesFromGM =
True
66 EnableCscInternalAlignment =
False
69 if (flags.Common.isOnline
and not flags.Input.isMC):
70 EnableCscInternalAlignment =
True
72 UseIlinesFromGM =
False
73 EnableCscInternalAlignment =
True
75 kwargs.setdefault(
"UseIlinesFromGM", UseIlinesFromGM)
76 kwargs.setdefault(
"EnableCscInternalAlignment", EnableCscInternalAlignment)
78 if not flags.GeoModel.SQLiteDB:
80 AGDD2Geo = CompFactory.AGDDtoGeoSvc()
81 muonAGDDTool = CompFactory.MuonAGDDTool(
"MuonSpectrometer", BuildNSW=
False)
82 AGDD2Geo.Builders += [ muonAGDDTool ]
83 if (flags.Detector.GeometrysTGC
and flags.Detector.GeometryMM):
84 nswAGDDTool = CompFactory.NSWAGDDTool(
"NewSmallWheel", Locked=
False)
85 nswAGDDTool.Volumes = [
"NewSmallWheel"]
86 nswAGDDTool.DefaultDetector =
"Muon"
87 AGDD2Geo.Builders += [ nswAGDDTool ]
90 acc.addService(AGDD2Geo, create=
True)
95 detTool = CompFactory.MuonDetectorTool(name, **kwargs)
96 acc.setPrivateTools(detTool)
105 if flags.Muon.Align.UseAsBuilt:
109 if not flags.Muon.Align.UseALines
and not flags.Muon.Align.UseBLines:
111 from IOVDbSvc.IOVDbSvcConfig
import addFolders
113 onl =
"/Onl" if flags.Common.isOnline
and not flags.Input.isMC
else ""
114 ParlineFolders = [f
"/MUONALIGN{onl}/MDT/BARREL",
115 f
"/MUONALIGN{onl}/MDT/ENDCAP/SIDEA",
116 f
"/MUONALIGN{onl}/MDT/ENDCAP/SIDEC",
117 f
"/MUONALIGN{onl}/TGC/SIDEA",
118 f
"/MUONALIGN{onl}/TGC/SIDEC"]
119 acc.merge(
addFolders( flags, ParlineFolders,
'MUONALIGN' if len(onl)
else 'MUONALIGN_OFL', className=
'CondAttrListCollection'))
122 ParlineFolders = [ x[ :x.find(onl)] + x[x.find(onl) + len(onl): ]
for x
in ParlineFolders]
124 kwargs.setdefault(
"LoadALines",flags.Muon.Align.UseALines)
125 kwargs.setdefault(
"LoadBLines",flags.Muon.Align.UseBLines)
127 kwargs.setdefault(
"ParlineFolders", ParlineFolders)
128 MuonAlign = CompFactory.MuonAlignmentCondAlg(name, **kwargs)
129 acc.addCondAlgo(MuonAlign, primary =
True)
135 from IOVDbSvc.IOVDbSvcConfig
import addFolders
136 acc.merge(
addFolders(flags,
"/MUONALIGN/ERRS",
"MUONALIGN_OFL", className=
"CondAttrListCollection"))
137 acc.addCondAlgo(CompFactory.MuonAlignmentErrorDbAlg(
"MuonAlignmentErrorDbAlg"))
143 if flags.GeoModel.Run < LHCPeriod.Run3:
145 kwargs.setdefault(
"MicroMegaJSON",
"")
146 kwargs.setdefault(
"sTgcJSON",
"")
148 kwargs.setdefault(
"ReadMmAsBuiltParamsKey",
"/MUONALIGN/ASBUILTPARAMS/MM")
150 kwargs.setdefault(
"ReadSTgcAsBuiltParamsKey",
"")
153 from IOVDbSvc.IOVDbSvcConfig
import addFolders
154 if(
not (kwargs[
"MicroMegaJSON"]
or not kwargs[
"ReadMmAsBuiltParamsKey"]) ) :
155 result.merge(
addFolders( flags, kwargs[
"ReadMmAsBuiltParamsKey"] ,
'MUONALIGN_OFL', className=
'CondAttrListCollection', tag=
'MuonAlignAsBuiltParamsMm-RUN3-01-00'))
157 if(
not (kwargs[
"sTgcJSON"]
or not kwargs[
"ReadSTgcAsBuiltParamsKey"])):
158 result.merge(
addFolders( flags, kwargs[
"ReadSTgcAsBuiltParamsKey"],
'MUONALIGN_OFL', className=
'CondAttrListCollection', tag=
'MUONALIGN_STG_ASBUILT-001-03'))
159 the_alg = CompFactory.NswAsBuiltCondAlg(name, **kwargs)
160 result.addCondAlgo(the_alg, primary =
True)
166 if flags.GeoModel.Run < LHCPeriod.Run3
or not flags.Muon.Align.UsesTGCAsBuild2:
168 kwargs.setdefault(
"readFromJSON",
"")
169 if not kwargs[
"readFromJSON"]
and False:
170 kwargs.setdefault(
"ReadKey",
"/MUONALIGN/ASBUILTPARAMS/STGC")
171 from IOVDbSvc.IOVDbSvcConfig
import addFolders
172 result.merge(
addFolders( flags, kwargs[
"ReadKey"],
'MUONALIGN_OFL', className=
'CondAttrListCollection', tag=
''))
173 the_alg = CompFactory.sTGCAsBuiltCondAlg2(name,**kwargs)
174 result.addCondAlgo(the_alg, primary=
True)
182 from IOVDbSvc.IOVDbSvcConfig
import addFolders
183 if "readFromJSON" not in kwargs
or not kwargs[
"readFromJSON"]:
184 result.merge(
addFolders( flags,
'/MUONALIGN/MDT/ASBUILTPARAMS' ,
'MUONALIGN_OFL', className=
'CondAttrListCollection'))
185 the_alg = CompFactory.MdtAsBuiltCondAlg(name = name, **kwargs)
186 result.addCondAlgo(the_alg, primary =
True)
191 if not flags.Muon.Align.UseILines:
193 from IOVDbSvc.IOVDbSvcConfig
import addFolders
194 if (flags.Common.isOnline
and not flags.Input.isMC):
195 result.merge(
addFolders( flags, [
'/MUONALIGN/Onl/CSC/ILINES'],
'MUONALIGN', className=
'CondAttrListCollection'))
197 result.merge(
addFolders( flags, [
'/MUONALIGN/CSC/ILINES'],
'MUONALIGN_OFL', className=
'CondAttrListCollection'))
199 the_alg = CompFactory.CscILinesCondAlg(name, **kwargs)
200 result.addCondAlgo(the_alg, primary =
True)
209 kwargs.setdefault(
"applyMmPassivation", flags.Muon.applyMMPassivation)
211 if kwargs[
"applyMmPassivation"]:
212 from MuonConfig.MuonCondAlgConfig
import NswPassivationDbAlgCfg
214 if flags.Muon.enableAlignment:
216 kwargs.setdefault(
"applyALines", flags.Muon.Align.UseALines)
217 kwargs.setdefault(
"applyBLines", flags.Muon.Align.UseBLines)
218 kwargs.setdefault(
"applyILines", flags.Muon.Align.UseILines)
219 kwargs.setdefault(
"applyNswAsBuilt", len([alg
for alg
in result.getCondAlgos()
if alg.name ==
"NswAsBuiltCondAlg"])>0)
220 kwargs.setdefault(
"applysTGCAsBuilt2", len([alg
for alg
in result.getCondAlgos()
if alg.name ==
"sTGCAsBuiltCondAlg2"])>0)
221 kwargs.setdefault(
"applyMdtAsBuilt", len([alg
for alg
in result.getCondAlgos()
if alg.name ==
"MdtAsBuiltCondAlg"])>0)
225 MuonDetectorManagerCond = CompFactory.MuonDetectorCondAlg(name, **kwargs)
227 result.addCondAlgo(MuonDetectorManagerCond, primary =
True)
233 geoModelSvc = result.getPrimaryAndMerge(
GeoModelCfg(flags))