ATLAS Offline Software
TileMuonReceiverDecisionConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 """Define method to construct configured Tile muon receiver decision algorithm"""
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import ProductionStep
8 from TileConfiguration.TileConfigFlags import TileRunType
9 
10 def TileMuonReceiverDecisionCfg(flags, **kwargs):
11  """Return component accumulator with configured Tile muon receiver decision algorithm
12 
13  Arguments:
14  flags -- Athena configuration flags
15  Keyword arguments:
16  Name -- name of TileMuonReceiverDecision algorithm. Defaults to TileMuonReceiverDecision.
17  """
18 
19  name = kwargs.get('Name', 'TileMuonReceiverDecision')
20 
21  acc = ComponentAccumulator()
22 
23  TileMuonReceiverDecision=CompFactory.TileMuonReceiverDecision
24  muRcvDecisionAlg = TileMuonReceiverDecision(name,
25  MuonReceiverEneThreshCellD6Low = 500,
26  MuonReceiverEneThreshCellD6andD5Low = 500,
27  MuonReceiverEneThreshCellD6High = 600,
28  MuonReceiverEneThreshCellD6andD5High = 600)
29 
30 
31  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
32  muRcvDecisionAlg.TileMuonReceiverContainer = flags.Overlay.BkgPrefix + 'TileMuRcvCnt'
33 
34  from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
35  acc.merge( TileInfoLoaderCfg(flags) )
36 
37  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
38  acc.merge(TileCablingSvcCfg(flags))
39 
40  from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
41  acc.merge( TileEMScaleCondAlgCfg(flags) )
42 
43  acc.addEventAlgo(muRcvDecisionAlg, primary = True)
44 
45  return acc
46 
47 
48 def TileMuonReceiverDecisionOutputCfg(flags, **kwargs):
49  """Return component accumulator with configured Tile muon receiver decision algorithm and Output stream
50 
51  Arguments:
52  flags -- Athena configuration flags
53  """
54 
55  acc = TileMuonReceiverDecisionCfg(flags, **kwargs)
56  muRcvDecisionAlg = acc.getPrimary()
57 
58  if hasattr(muRcvDecisionAlg, 'TileMuonReceiverContainer'):
59  muRcvContainer = muRcvDecisionAlg.TileMuonReceiverContainer
60  else:
61  muRcvContainer = muRcvDecisionAlg.getDefaultProperty('TileMuonReceiverContainer')
62  muRcvContainer = str(muRcvContainer).split('+').pop()
63  outputItemList = ['TileMuonReceiverContainer#' + muRcvContainer]
64 
65  if flags.Output.doWriteRDO:
66  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
67  acc.merge( OutputStreamCfg(flags, streamName = 'RDO', ItemList = outputItemList) )
68 
69  return acc
70 
71 
72 
73 if __name__ == "__main__":
74 
75  from AthenaConfiguration.AllConfigFlags import initConfigFlags
76  from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultTestFiles
77  from AthenaCommon.Logging import log
78  from AthenaCommon.Constants import DEBUG
79 
80  # Test setup
81  log.setLevel(DEBUG)
82 
83  flags = initConfigFlags()
84  flags.Input.Files = defaultTestFiles.RDO_RUN2
85  flags.Tile.RunType = TileRunType.PHY
86  flags.Output.RDOFileName = 'myRDO->TileMuonReceiverDecision.pool.root'
87  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC
88 
89  flags.fillFromArgs()
90  flags.lock()
91  flags.dump()
92 
93  # Construct our accumulator to run
94  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
95  acc = MainServicesCfg(flags)
96 
97  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
98  acc.merge(PoolReadCfg(flags))
99 
100  if 'EventInfo' not in flags.Input.Collections:
101  from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
102  acc.merge(EventInfoCnvAlgCfg(flags,
103  inputKey='McEventInfo',
104  outputKey='EventInfo'))
105 
106  acc.merge( TileMuonReceiverDecisionOutputCfg(flags, TileMuonReceiverContainer = 'TileMuRcvCntNew') )
107 
108  acc.printConfig(withDetails = True, summariseProps = True)
109  acc.store( open('TileMuonReceiverDecision.pkl','wb') )
110 
111  sc = acc.run(maxEvents=3)
112  # Success should be 0
113  import sys
114  sys.exit(not sc.isSuccess())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
TileMuonReceiverDecisionConfig.TileMuonReceiverDecisionOutputCfg
def TileMuonReceiverDecisionOutputCfg(flags, **kwargs)
Definition: TileMuonReceiverDecisionConfig.py:48
TileMuonReceiverDecision
Definition: TileMuonReceiverDecision.h:59
python.TileInfoLoaderConfig.TileInfoLoaderCfg
def TileInfoLoaderCfg(flags, **kwargs)
Definition: TileInfoLoaderConfig.py:12
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
Constants
some useful constants -------------------------------------------------—
python.TileEMScaleConfig.TileEMScaleCondAlgCfg
def TileEMScaleCondAlgCfg(flags, **kwargs)
Definition: TileEMScaleConfig.py:10
Trk::open
@ open
Definition: BinningType.h:40
TileMuonReceiverDecisionConfig.TileMuonReceiverDecisionCfg
def TileMuonReceiverDecisionCfg(flags, **kwargs)
Definition: TileMuonReceiverDecisionConfig.py:10
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11