ATLAS Offline Software
Loading...
Searching...
No Matches
MuonConfigUtils Namespace Reference

Functions

 setupHistSvcCfg (flags, str outFile, str outStream)
 Configuration snippet to setup the THistSvc.
 executeTest (cfg)
 configureCondTag (flags)
 SetupMuonStandaloneConfigFlags ()
 SetupMuonStandaloneCA (flags)
 SetupMuonStandaloneOutput (cfg, flags, itemsToRecord)

Function Documentation

◆ configureCondTag()

MuonConfigUtils.configureCondTag ( flags)

Definition at line 23 of file MuonConfigUtils.py.

23def configureCondTag(flags):
24 if not flags.GeoModel.AtlasVersion:
25 raise ValueError("No ATLAS version is configured")
26
27 from AthenaConfiguration.Enums import LHCPeriod
28 from AthenaConfiguration.TestDefaults import defaultConditionsTags
29 if flags.GeoModel.Run == LHCPeriod.Run2:
30 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC if flags.Input.isMC else defaultConditionsTags.RUN2_DATA
31 elif flags.GeoModel.Run == LHCPeriod.Run3:
32 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC if flags.Input.isMC else defaultConditionsTags.RUN3_DATA
33 elif flags.GeoModel.Run == LHCPeriod.Run4:
34 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN4_MC
35 else:
36 raise ValueError(f"Invalid run period {flags.GeoModel.Run}")
37

◆ executeTest()

MuonConfigUtils.executeTest ( cfg)

Definition at line 19 of file MuonConfigUtils.py.

19def executeTest(cfg):
20 cfg.printConfig(withDetails=True, summariseProps=True)
21 if not cfg.run().isSuccess(): exit(1)
22

◆ setupHistSvcCfg()

MuonConfigUtils.setupHistSvcCfg ( flags,
str outFile,
str outStream )

Configuration snippet to setup the THistSvc.

Definition at line 5 of file MuonConfigUtils.py.

5def setupHistSvcCfg(flags, outFile: str, outStream: str):
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 result = ComponentAccumulator()
8 if len(outFile) == 0:
9 raise ValueError("The output file must not be empty")
10 if len(outStream) == 0:
11 raise ValueError("The outstream must not be empty")
12
13 from AthenaConfiguration.ComponentFactory import CompFactory
14 histSvc = CompFactory.THistSvc(Output=[f"{outStream} DATAFILE='{outFile}', OPT='RECREATE'"])
15 print(f"Register new stream {outStream} piped to {outFile}")
16 result.addService(histSvc, primary=True)
17 return result
18
void print(char *figname, TCanvas *c1)

◆ SetupMuonStandaloneCA()

MuonConfigUtils.SetupMuonStandaloneCA ( flags)

Definition at line 83 of file MuonConfigUtils.py.

83def SetupMuonStandaloneCA(flags):
84 # When running from a pickled file, athena inserts some services automatically. So only use this if running now.
85
86 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
87 cfg = MainServicesCfg(flags)
88 msgService = cfg.getService('MessageSvc')
89 msgService.Format = "S:%s E:%e % F%128W%S%7W%R%T %0W%M"
90 msgService.debugLimit = 2147483647
91 msgService.verboseLimit = 2147483647
92 msgService.infoLimit = 2147483647
93
94
95 from AthenaConfiguration.Enums import Format
96 if not flags.Input.Files:
97 # No input file --- skip setting up event reading.
98 pass
99 elif flags.Input.Format is Format.POOL:
100 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
101 cfg.merge(PoolReadCfg(flags))
102 elif flags.Input.Format == Format.BS:
103 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
104 cfg.merge(ByteStreamReadCfg(flags))
105
106 if flags.Input.isMC:
107 if ("TruthEvents" in flags.Input.Collections):
108 from xAODTruthCnv.RedoTruthLinksConfig import RedoTruthLinksAlgCfg
109 cfg.merge( RedoTruthLinksAlgCfg(flags) )
110 elif ("TruthEvent" in flags.Input.Collections):
111 from xAODTruthCnv.xAODTruthCnvConfig import GEN_AOD2xAODCfg
112 cfg.merge(GEN_AOD2xAODCfg(flags))
113
114
115 from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
116 cfg.merge(MuonGeoModelCfg(flags))
117 from MuonConfig.MuonGeometryConfig import MuonIdHelperSvcCfg
118 cfg.merge(MuonIdHelperSvcCfg(flags))
119
120 return cfg
121

◆ SetupMuonStandaloneConfigFlags()

MuonConfigUtils.SetupMuonStandaloneConfigFlags ( )
Setup flags necessary for Muon standalone.

Definition at line 38 of file MuonConfigUtils.py.

38def SetupMuonStandaloneConfigFlags():
39 """
40 Setup flags necessary for Muon standalone.
41 """
42 from AthenaConfiguration.AllConfigFlags import initConfigFlags
43 flags = initConfigFlags()
44 flags.Detector.GeometryMDT = True
45 flags.Detector.GeometryTGC = True
46
47 flags.Detector.GeometryRPC = True
48 # TODO: disable these for now, to be determined if needed
49 flags.Detector.GeometryCalo = False
50 flags.Detector.GeometryID = False
51
52 # FIXME This is temporary. I think it can be removed with some other refactoring
53 flags.Muon.makePRDs = False
54
55 flags.Exec.MaxEvents = 20 # Set default to 20 if not overridden
56 flags.Scheduler.ShowDataDeps = True
57 flags.Scheduler.CheckDependencies = True
58 flags.Scheduler.ShowDataFlow = True
59 flags.Scheduler.ShowControlFlow = True
60 flags.Concurrency.NumThreads = 1
61 flags.Concurrency.NumConcurrentEvents = 1
62 flags.Exec.FPE= 500
63
64 flags.fillFromArgs()
65
66 if flags.Input.Files == ['_ATHENA_GENERIC_INPUTFILE_NAME_'] or len(flags.Input.Files) == 0:
67 # If something is set from an arg (i.e. the command line), this takes priority
68 from AthenaConfiguration.TestDefaults import defaultTestFiles
69 flags.Input.Files = defaultTestFiles.ESD_RUN3_MC
70
71 configureCondTag(flags)
72
73 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
74 setupDetectorFlags(flags)
75
76 if flags.Output.ESDFileName == '':
77 flags.Output.ESDFileName='newESD.pool.root'
78
79 flags.lock()
80 flags.dump(evaluate = True)
81 return flags
82

◆ SetupMuonStandaloneOutput()

MuonConfigUtils.SetupMuonStandaloneOutput ( cfg,
flags,
itemsToRecord )

Definition at line 122 of file MuonConfigUtils.py.

122def SetupMuonStandaloneOutput(cfg, flags, itemsToRecord):
123 # Set up output
124 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg, outputStreamName
125
126 cfg.merge( OutputStreamCfg( flags, 'ESD', ItemList=itemsToRecord) )
127 outstream = cfg.getEventAlgo(outputStreamName("ESD"))
128 outstream.ForceRead = True
129
130 # Fix for ATLASRECTS-5151
131 from TrkEventCnvTools.TrkEventCnvToolsConfig import (
132 TrkEventCnvSuperToolCfg)
133 cfg.merge(TrkEventCnvSuperToolCfg(flags))
134