ATLAS Offline Software
RPC_DigitizationConfig.py
Go to the documentation of this file.
1 """Define methods to construct configured RPC Digitization tools and algorithms
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import LHCPeriod, ProductionStep
8 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
9 from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
10 from MuonConfig.MuonByteStreamCnvTestConfig import RpcDigitToRpcRDOCfg
11 from MuonConfig.MuonByteStreamCnvTestConfig import NrpcDigitToNrpcRDOCfg
12 from MuonConfig.MuonCablingConfig import RPCCablingConfigCfg
13 from DigitizationConfig.TruthDigitizationOutputConfig import TruthDigitizationOutputCfg
14 from DigitizationConfig.PileUpToolsConfig import PileUpToolsCfg
15 from DigitizationConfig.PileUpMergeSvcConfig import PileUpMergeSvcCfg, PileUpXingFolderCfg
16 
17 
18 # The earliest and last bunch crossing times for which interactions will be sent
19 # to the RpcDigitizationTool.
21  return -150
22 
23 
25  return 125
26 
27 
28 def RPC_RangeCfg(flags, name="RPC_Range", **kwargs):
29  """Return a PileUpXingFolder tool configured for RPC"""
30  kwargs.setdefault("FirstXing", RPC_FirstXing())
31  kwargs.setdefault("LastXing", RPC_LastXing())
32  kwargs.setdefault("CacheRefreshFrequency", 1.0)
33  if flags.Muon.usePhaseIIGeoSetup:
34  kwargs.setdefault("ItemList", ["xAOD::MuonSimHitContainer#xRpcSimHits",
35  "xAOD::MuonSimHitAuxContainer#xRpcSimHitsAux."])
36  else:
37  kwargs.setdefault("ItemList", ["RPCSimHitCollection#RPC_Hits"])
38 
39  return PileUpXingFolderCfg(flags, name, **kwargs)
40 
41 
42 
43 def RPC_DigitizationToolCommonCfg(flags, name="RpcDigitizationTool", **kwargs):
44  """Return ComponentAccumulator with configured RpcDigitizationTool"""
45  acc = ComponentAccumulator()
46 
47  if flags.GeoModel.Run < LHCPeriod.Run3: # Run 3 and later currently do not use conditions
48  from MuonConfig.MuonCondAlgConfig import RpcCondDbAlgCfg
49  acc.merge(RpcCondDbAlgCfg(flags))
50 
51  if flags.Digitization.DoXingByXingPileUp:
52  kwargs.setdefault("FirstXing", RPC_FirstXing())
53  kwargs.setdefault("LastXing", RPC_LastXing())
54  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
55  kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "RPC_SDO")
56  else:
57  kwargs.setdefault("OutputSDOName", "RPC_SDO")
58 
59  from RngComps.RngCompsConfig import AthRNGSvcCfg
60  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)))
61  kwargs.setdefault("OutputObjectName", "RPC_DIGITS")
62 
63 
64  if flags.Muon.usePhaseIIGeoSetup:
65  from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
66  acc.merge(ActsGeometryContextAlgCfg(flags))
67  kwargs.setdefault("StreamName", "RpcSimForklift")
68  kwargs.setdefault("SimHitKey", "xRpcSimHits")
69  kwargs.setdefault("EffiDataKey", "")
70  the_tool = CompFactory.MuonR4.RpcFastDigiTool(name="RpcDigitizationTool", **kwargs)
71  acc.setPrivateTools(the_tool)
72  return acc
73 
74  # config
75  kwargs.setdefault("DeadTime", 100)
76  kwargs.setdefault("PatchForRpcTime", True)
77  # kwargs.setdefault("PatchForRpcTimeShift", 9.6875)
78  kwargs.setdefault("PatchForRpcTimeShift", 12.5)
79  kwargs.setdefault("turnON_efficiency", True)
80  kwargs.setdefault("turnON_clustersize", True)
81  kwargs.setdefault("ClusterSize1_2uncorr", False)
82  kwargs.setdefault("CutProjectedTracks", 100)
83  kwargs.setdefault("RPCInfoFromDb", True)
84  kwargs.setdefault("Efficiency_fromCOOL", True)
85  kwargs.setdefault("EfficiencyPatchForBMShighEta", False)
86  kwargs.setdefault("ClusterSize_fromCOOL", True)
87  kwargs.setdefault("IgnoreRunDependentConfig", False)
88  kwargs.setdefault("PhiAndEtaEff_A",[0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938])
89  kwargs.setdefault("OnlyPhiEff_A" ,[0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022])
90  kwargs.setdefault("OnlyEtaEff_A" ,[0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022])
91  kwargs.setdefault("PhiAndEtaEff_C",[0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938, 0.938])
92  kwargs.setdefault("OnlyPhiEff_C" ,[0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022])
93  kwargs.setdefault("OnlyEtaEff_C" ,[0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022, 0.022])
94  kwargs.setdefault("FracClusterSize1_A", [0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664])
95  kwargs.setdefault("FracClusterSize2_A", [0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986])
96  kwargs.setdefault("FracClusterSizeTail_A",[0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035 ])
97  kwargs.setdefault("MeanClusterSizeTail_A",[0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598])
98  kwargs.setdefault("FracClusterSize1_C", [0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664, 0.609664])
99  kwargs.setdefault("FracClusterSize2_C", [0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986, 0.259986])
100  kwargs.setdefault("FracClusterSizeTail_C",[0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035, 0.13035 ])
101  kwargs.setdefault("MeanClusterSizeTail_C",[0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598, 0.548598])
102  RpcDigitizationTool = CompFactory.RpcDigitizationTool(name, **kwargs)
103  acc.setPrivateTools(RpcDigitizationTool)
104  return acc
105 
106 
107 def RPC_DigitizationToolCfg(flags, name="RpcDigitizationTool", **kwargs):
108  """Return ComponentAccumulator with configured RpcDigitizationTool"""
109  acc = ComponentAccumulator()
110  if flags.Digitization.PileUp:
111  intervals = []
112  if not flags.Digitization.DoXingByXingPileUp:
113  intervals += [acc.popToolsAndMerge(RPC_RangeCfg(flags))]
114  kwargs.setdefault("PileUpMergeSvc", acc.getPrimaryAndMerge(PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
115  else:
116  kwargs.setdefault("PileUpMergeSvc", '')
117  kwargs.setdefault("OnlyUseContainerName", flags.Digitization.PileUp)
118  kwargs.setdefault("OutputObjectName", "RPC_DIGITS")
119  if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
120  kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "RPC_SDO")
121  else:
122  kwargs.setdefault("OutputSDOName", "RPC_SDO")
123  tool = acc.popToolsAndMerge(RPC_DigitizationToolCommonCfg(flags, name, **kwargs))
124  acc.setPrivateTools(tool)
125  return acc
126 
127 
128 def RPC_OverlayDigitizationToolCfg(flags, name="Rpc_OverlayDigitizationTool", **kwargs):
129  """Return ComponentAccumulator with RpcDigitizationTool configured for Overlay"""
130  kwargs.setdefault("OnlyUseContainerName", False)
131  kwargs.setdefault("OutputObjectName", flags.Overlay.SigPrefix + "RPC_DIGITS")
132  kwargs.setdefault("OutputSDOName", flags.Overlay.SigPrefix + "RPC_SDO")
133  kwargs.setdefault("PileUpMergeSvc", '')
134  return RPC_DigitizationToolCommonCfg(flags, name, **kwargs)
135 
136 
137 def RPC_OutputCfg(flags):
138  """Return ComponentAccumulator with Output for RPC. Not standalone."""
139  acc = ComponentAccumulator()
140  if flags.Output.doWriteRDO:
141  ItemList = ["RpcPadContainer#*"]
142  if flags.Muon.enableNRPC:
143  ItemList += [ 'xAOD::NRPCRDOContainer#*' , 'xAOD::NRPCRDOAuxContainer#*' ]
144  if flags.Digitization.EnableTruth:
145  ItemList += ["MuonSimDataCollection#*"]
146  ItemList += ["xAOD::MuonSimHitContainer#*RPC_SDO",
147  "xAOD::MuonSimHitAuxContainer#*RPC_SDOAux."]
148  acc.merge(TruthDigitizationOutputCfg(flags))
149  acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
150  return acc
151 
152 
153 def RPC_DigitizationBasicCfg(flags, **kwargs):
154  """Return ComponentAccumulator for RPC digitization"""
155  acc = MuonGeoModelCfg(flags)
156  if "PileUpTools" not in kwargs:
157  PileUpTools = acc.popToolsAndMerge(RPC_DigitizationToolCfg(flags))
158  kwargs["PileUpTools"] = PileUpTools
159  acc.merge(PileUpToolsCfg(flags, **kwargs))
160  return acc
161 
162 
163 def RPC_OverlayDigitizationBasicCfg(flags, **kwargs):
164  """Return ComponentAccumulator with RPC Overlay digitization"""
165  acc = MuonGeoModelCfg(flags)
166 
167  if flags.Common.ProductionStep != ProductionStep.FastChain:
168  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
169  if flags.Muon.usePhaseIIGeoSetup:
170  acc.merge(SGInputLoaderCfg(flags,["xAOD::MuonSimHitContainer#xRpcSimHits",
171  "xAOD::MuonSimHitAuxContainer#xRpcSimHitsAux."]))
172  else:
173  acc.merge(SGInputLoaderCfg(flags, ["RPCSimHitCollection#RPC_Hits"]))
174 
175  kwargs.setdefault("DigitizationTool", acc.popToolsAndMerge(RPC_OverlayDigitizationToolCfg(flags)))
176 
177  if flags.Concurrency.NumThreads > 0:
178  kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
179 
180  # Set common overlay extra inputs
181  kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
182 
183  the_alg = CompFactory.MuonDigitizer(name="RPC_OverlayDigitizer", **kwargs)
184  acc.addEventAlgo(the_alg)
185  return acc
186 
187 
188 # with output defaults
189 def RPC_DigitizationCfg(flags, **kwargs):
190  """Return ComponentAccumulator for RPC digitization and Output"""
191  acc = RPC_DigitizationBasicCfg(flags, **kwargs)
192  acc.merge(RPC_OutputCfg(flags))
193  return acc
194 
195 
197  """Return ComponentAccumulator with RPC digitization and Digit to RPCPAD RDO"""
198  acc = RPC_DigitizationCfg(flags)
199  acc.merge(RPCCablingConfigCfg(flags))
200  if not flags.Muon.usePhaseIIGeoSetup:
201  acc.merge(RpcDigitToRpcRDOCfg(flags))
202  if flags.Muon.enableNRPC:
203  acc.merge(NrpcDigitToNrpcRDOCfg(flags))
204  return acc
205 
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
python.TruthDigitizationOutputConfig.TruthDigitizationOutputCfg
def TruthDigitizationOutputCfg(flags)
Definition: TruthDigitizationOutputConfig.py:9
python.RPC_DigitizationConfig.RPC_OutputCfg
def RPC_OutputCfg(flags)
Definition: RPC_DigitizationConfig.py:137
python.MuonCondAlgConfig.RpcCondDbAlgCfg
def RpcCondDbAlgCfg(flags, **kwargs)
Definition: MuonCondAlgConfig.py:78
python.MuonByteStreamCnvTestConfig.RpcDigitToRpcRDOCfg
def RpcDigitToRpcRDOCfg(flags, name="RpcDigitToRpcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:156
python.RPC_DigitizationConfig.RPC_OverlayDigitizationToolCfg
def RPC_OverlayDigitizationToolCfg(flags, name="Rpc_OverlayDigitizationTool", **kwargs)
Definition: RPC_DigitizationConfig.py:128
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
AlignmentAlgsConfig.ActsGeometryContextAlgCfg
def ActsGeometryContextAlgCfg(flags, name="GeometryContextAlg", **kwargs)
Setup the Geometry context algorithm.
Definition: AlignmentAlgsConfig.py:125
python.RPC_DigitizationConfig.RPC_DigitizationCfg
def RPC_DigitizationCfg(flags, **kwargs)
Definition: RPC_DigitizationConfig.py:189
python.RPC_DigitizationConfig.RPC_DigitizationToolCfg
def RPC_DigitizationToolCfg(flags, name="RpcDigitizationTool", **kwargs)
Definition: RPC_DigitizationConfig.py:107
python.PileUpToolsConfig.PileUpToolsCfg
def PileUpToolsCfg(flags, **kwargs)
Definition: PileUpToolsConfig.py:14
python.RPC_DigitizationConfig.RPC_OverlayDigitizationBasicCfg
def RPC_OverlayDigitizationBasicCfg(flags, **kwargs)
Definition: RPC_DigitizationConfig.py:163
python.MuonByteStreamCnvTestConfig.NrpcDigitToNrpcRDOCfg
def NrpcDigitToNrpcRDOCfg(flags, name="NrpcDigitToNrpcRDO", **kwargs)
Definition: MuonByteStreamCnvTestConfig.py:177
python.RPC_DigitizationConfig.RPC_RangeCfg
def RPC_RangeCfg(flags, name="RPC_Range", **kwargs)
Definition: RPC_DigitizationConfig.py:28
python.MuonCablingConfig.RPCCablingConfigCfg
def RPCCablingConfigCfg(flags)
Definition: MuonCablingConfig.py:33
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.RPC_DigitizationConfig.RPC_LastXing
def RPC_LastXing()
Definition: RPC_DigitizationConfig.py:24
python.RPC_DigitizationConfig.RPC_DigitizationBasicCfg
def RPC_DigitizationBasicCfg(flags, **kwargs)
Definition: RPC_DigitizationConfig.py:153
python.PileUpMergeSvcConfig.PileUpXingFolderCfg
def PileUpXingFolderCfg(flags, name="PileUpXingFolder", **kwargs)
Definition: PileUpMergeSvcConfig.py:35
python.RPC_DigitizationConfig.RPC_DigitizationDigitToRDOCfg
def RPC_DigitizationDigitToRDOCfg(flags)
Definition: RPC_DigitizationConfig.py:196
python.RPC_DigitizationConfig.RPC_DigitizationToolCommonCfg
def RPC_DigitizationToolCommonCfg(flags, name="RpcDigitizationTool", **kwargs)
Definition: RPC_DigitizationConfig.py:43
python.RPC_DigitizationConfig.RPC_FirstXing
def RPC_FirstXing()
Definition: RPC_DigitizationConfig.py:20
python.PileUpMergeSvcConfig.PileUpMergeSvcCfg
def PileUpMergeSvcCfg(flags, name="PileUpMergeSvc", Intervals=[], **kwargs)
Definition: PileUpMergeSvcConfig.py:10
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51