ATLAS Offline Software
Functions
MuonConfigUtils Namespace Reference

Functions

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

Function Documentation

◆ configureCondTag()

def MuonConfigUtils.configureCondTag (   flags)

Definition at line 23 of file MuonConfigUtils.py.

23 def 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()

def MuonConfigUtils.executeTest (   cfg)

Definition at line 19 of file MuonConfigUtils.py.

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

◆ setupHistSvcCfg()

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

Configuration snippet to setup the THistSvc.

Definition at line 5 of file MuonConfigUtils.py.

5 def 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 

◆ SetupMuonStandaloneCA()

def MuonConfigUtils.SetupMuonStandaloneCA (   flags)

Definition at line 83 of file MuonConfigUtils.py.

83 def 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()

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

Definition at line 38 of file MuonConfigUtils.py.

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()

def MuonConfigUtils.SetupMuonStandaloneOutput (   cfg,
  flags,
  itemsToRecord 
)

Definition at line 122 of file MuonConfigUtils.py.

122 def 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 
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=None, MetadataItemList=None, disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=None, HelperTools=None)
Definition: OutputStreamConfig.py:13
AthenaPoolExample_WriteCond.outputStreamName
string outputStreamName
Definition: AthenaPoolExample_WriteCond.py:21
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
MuonGeometryConfig.MuonIdHelperSvcCfg
def MuonIdHelperSvcCfg(flags)
Definition: MuonGeometryConfig.py:15
xAODTruthCnvConfig.GEN_AOD2xAODCfg
def GEN_AOD2xAODCfg(flags, name="GEN_AOD2xAOD", **kwargs)
Definition: xAODTruthCnvConfig.py:22
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
RedoTruthLinksConfig.RedoTruthLinksAlgCfg
def RedoTruthLinksAlgCfg(flags)
Definition: RedoTruthLinksConfig.py:5
python.TrkEventCnvToolsConfig.TrkEventCnvSuperToolCfg
def TrkEventCnvSuperToolCfg(flags, name='EventCnvSuperTool', **kwargs)
Definition: TrkEventCnvToolsConfig.py:51
MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:310
MuonConfigUtils.executeTest
def executeTest(cfg)
Definition: MuonConfigUtils.py:19
MuonConfigUtils.SetupMuonStandaloneConfigFlags
def SetupMuonStandaloneConfigFlags()
Definition: MuonConfigUtils.py:38
calibdata.exit
exit
Definition: calibdata.py:235
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26
MuonConfigUtils.configureCondTag
def configureCondTag(flags)
Definition: MuonConfigUtils.py:23
MuonConfigUtils.SetupMuonStandaloneCA
def SetupMuonStandaloneCA(flags)
Definition: MuonConfigUtils.py:83
MuonConfigUtils.SetupMuonStandaloneOutput
def SetupMuonStandaloneOutput(cfg, flags, itemsToRecord)
Definition: MuonConfigUtils.py:122
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:292
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
MuonConfigUtils.setupHistSvcCfg
def setupHistSvcCfg(flags, str outFile, str outStream)
Configuration snippet to setup the THistSvc.
Definition: MuonConfigUtils.py:5
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:71