ATLAS Offline Software
MonitorChainConfiguration.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaCommon.Logging import logging
4 logging.getLogger().info("Importing %s",__name__)
5 log = logging.getLogger(__name__)
6 
7 from TriggerMenuMT.HLT.Config.ChainConfigurationBase import ChainConfigurationBase
8 from TriggerMenuMT.HLT.Config.MenuComponents import MenuSequence, SelectionCA, InEventRecoCA
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from TrigGenericAlgs.TrigGenericAlgsConfig import TimeBurnerCfg, TimeBurnerHypoToolGen, L1CorrelationAlgCfg
11 from L1TopoOnlineMonitoring import L1TopoOnlineMonitoringConfig as TopoMonConfig
12 from L1TopoSimulation import L1TopoSimulationConfig as TopoSimConfig
13 from TrigHypoCommonTools.TrigHypoCommonTools import TrigGenericHypoToolFromDict
14 from TrigEDMConfig.TriggerEDM import recordable
15 from AthenaCommon.CFElements import seqAND
16 from TriggerMenuMT.HLT.CommonSequences.RejectSequences import RejectSequence
17 #----------------------------------------------------------------
18 # fragments generating configuration will be functions in New JO,
19 # so let's make them functions already now
20 #----------------------------------------------------------------
21 def timeBurnerCfg(flags):
22  # Input maker - required by the framework, but inputs don't matter for TimeBurner
23  inputMaker = CompFactory.InputMakerForRoI("IM_TimeBurner",
24  RoITool=CompFactory.ViewCreatorInitialROITool(),
25  RoIs="TimeBurnerInputRoIs",
26  )
27  reco = InEventRecoCA('TimeBurner_reco',inputMaker=inputMaker)
28  # TimeBurner alg works as a reject-all hypo
29  selAcc = SelectionCA('TimeBurnerSequence')
30  selAcc.mergeReco(reco)
31  selAcc.addHypoAlgo(
32  TimeBurnerCfg(flags,
33  name="TimeBurnerHypo",
34  SleepTimeMillisec=200
35  )
36  )
37 
38  msca = MenuSequence(flags, selAcc,
39  HypoToolGen=TimeBurnerHypoToolGen)
40  return msca
41 
42 
43 #----------------------------------------------------------------
44 def LArSuperCellMonitoringGenCfg(flags,appendName=""):
45  from LArMonitoring.LArSuperCellMonAlg import LArSuperCellMonConfigHLT
46  # Input maker - required by the framework, but inputs don't matter for LArSuperCell
47  inputMaker = CompFactory.InputMakerForRoI("IM_LArSuperCellMon"+appendName,
48  RoITool=CompFactory.ViewCreatorInitialROITool(),
49  RoIs="LArSuperCellMonRoIs"+appendName,
50  )
51  reco = InEventRecoCA('LArSuperCellMonitoring'+appendName,inputMaker=inputMaker)
52  reco.merge( LArSuperCellMonConfigHLT(flags,name="LArSuperCellMonConfigHLT"+appendName) )
53  selAcc = SelectionCA('LArSuperCellMonitoringSequence'+appendName)
54  selAcc.mergeReco(reco)
55  HypoName = "LArSuperCellMonHypoConfig"+appendName
56  msca = RejectSequence(flags, HypoName, selAcc)
57  return msca
58 
60 
61  # Input maker for FS initial RoI
62  inputMaker = CompFactory.InputMakerForRoI("IM_L1TopoOnlineMonitor")
63  inputMaker.RoITool = CompFactory.ViewCreatorInitialROITool()
64  inputMaker.RoIs="L1TopoOnlineMonitorInputRoIs"
65 
66  reco = InEventRecoCA('L1TopoPhase1OnlineMonitor_reco',inputMaker=inputMaker)
67 
68  readMuCTPI_local=True
69  if flags.Trigger.doLVL1:
70  readMuCTPI_local=False
71 
72  reco.addSequence(seqAND('L1TopoSimSeq'))
73  reco.merge(TopoSimConfig.L1TopoSimulationCfg(flags,doMonitoring=True,readMuCTPI=readMuCTPI_local,name="L1OnlineTopoSimulation"), sequenceName='L1TopoSimSeq')
74 
75  selAcc = SelectionCA("L1TopoOnlineMonitorSequence")
76  selAcc.mergeReco(reco)
77 
78  hypoAlg = TopoMonConfig.getL1TopoOnlineMonitorHypo(flags)
79  selAcc.addHypoAlgo(hypoAlg)
80 
81  return MenuSequence(flags, selAcc,
82  HypoToolGen = TopoMonConfig.L1TopoOnlineMonitorHypoToolGen)
83 
84 
86  inputMaker = CompFactory.InputMakerForRoI("IM_MistimeMon",
87  RoITool = CompFactory.ViewCreatorInitialROITool(),
88  RoIs="MistimeMonInputRoIs",
89  )
90 
91  outputName = recordable("HLT_TrigCompositeMistimeJ400")
92  reco = InEventRecoCA('Mistime_reco',inputMaker=inputMaker)
93  recoAlg = L1CorrelationAlgCfg(flags, "MistimeMonj400", ItemList=['L1_J400','L1_gJ400p0ETA25'],
94  TrigCompositeWriteHandleKey=outputName, trigCompPassKey=outputName+".pass",
95  l1AKey=outputName+".l1a_type", otherTypeKey=outputName+".other_type",
96  beforeAfterKey=outputName+".beforeafterflag",
97  otherTypeBeforeKey=outputName+".other_type_before",
98  otherTypeAfterKey=outputName+".other_type_after",
99  beforeOffsetKey=outputName+".offset_before",
100  afterOffsetKey=outputName+".offset_after")
101  reco.addRecoAlgo(recoAlg)
102  selAcc = SelectionCA("MistimeMonSequence")
103  selAcc.mergeReco(reco)
104 
105  # Hypo to select on trig composite pass flag
106  hypoAlg = CompFactory.TrigGenericHypoAlg("MistimeMonJ400HypoAlg", TrigCompositeContainer=outputName)
107  selAcc.addHypoAlgo(hypoAlg)
108 
109  return MenuSequence(flags, selAcc,
110  HypoToolGen = TrigGenericHypoToolFromDict)
111 
112 def CaloClusterMonitorCfg(flags, suffix = ""):
113  from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg
114 
115  reco = InEventRecoCA('CaloClusterMonitoring' + suffix)
116 
117  reco.merge( hltCaloTopoClusteringCfg(flags, namePrefix="CaloMon", nameSuffix="FS" + suffix, CellsName="CaloCellsFS" + suffix, monitorCells=False, clustersKey="HLT_MonitoringCaloClusters" + suffix) )
118 
119  selAcc = SelectionCA('CaloClusterMonitoringSequence' + suffix)
120 
121  selAcc.mergeReco(reco)
122 
123  HypoName = "CaloClusterMonHypoConfig"+ suffix
124  msca = RejectSequence(flags, HypoName, selAcc)
125 
126  return msca
127 
128 
129 #----------------------------------------------------------------
130 # Class to configure chain
131 #----------------------------------------------------------------
133 
134  def __init__(self, chainDict):
135  ChainConfigurationBase.__init__(self,chainDict)
136 
137  # ----------------------
138  # Assemble the chain depending on information from chainName
139  # ----------------------
140  def assembleChainImpl(self, flags):
141  chainSteps = []
142  log.debug("Assembling chain for %s", self.chainName)
143 
144  monTypeList = self.chainPart.get('monType')
145  if not monTypeList:
146  raise RuntimeError('No monType defined in chain ' + self.chainName)
147  if len(monTypeList) > 1:
148  raise RuntimeError('Multiple monType values defined in chain ' + self.chainName)
149  monType = monTypeList[0]
150 
151  if monType == 'timeburner':
152  chainSteps.append(self.getTimeBurnerStep(flags))
153  elif monType == 'larsupercellmon':
154  chainSteps.append(self.getLArSuperCellMonitoringGenCfg(flags))
155  elif monType == 'l1topoPh1debug':
156  chainSteps.append(self.getL1TopoOnlineMonitorStep(flags))
157  elif monType == 'mistimemonj400':
158  chainSteps.append(self.getMistimeMonStep(flags))
159  elif monType == 'caloclustermon':
160  chainSteps.append(self.getCaloClusterMonitorCfg(flags))
161  else:
162  raise RuntimeError('Unexpected monType '+monType+' in MonitorChainConfiguration')
163 
164  return self.buildChain(chainSteps)
165 
166  # --------------------
167  # TimeBurner configuration
168  # --------------------
169  def getTimeBurnerStep(self, flags):
170  return self.getStep(flags, 'TimeBurner',[timeBurnerCfg])
171 
172  # --------------------
173  # LArSuperCellMon configuration
174  # --------------------
176  appendName=""
177  if ( "_FILLED" in self.chainL1Item ):
178  appendName="_filled"
179  elif ( "_EMPTY" in self.chainL1Item ):
180  appendName="_empty"
181  elif ( "_FIRSTEMPTY" in self.chainL1Item ):
182  appendName="_firstempty"
183  else :
184  appendName="_dummy"
185  return self.getStep(flags, 'larsupercellmon'+appendName,[LArSuperCellMonitoringGenCfg],appendName=appendName)
186 
187  # --------------------
188  # L1TopoOnlineMonitor configuration
189  # --------------------
190  def getL1TopoOnlineMonitorStep(self, flags):
191 
192  sequenceCfg = L1TopoOnlineMonitorSequenceCfg
193  return self.getStep(flags, 'L1TopoOnlineMonitor',[sequenceCfg])
194 
195  # --------------------
196  # MistTimeMon configuration
197  # --------------------
198  def getMistimeMonStep(self, flags):
199  return self.getStep(flags, 'MistimeMon',[MistimeMonSequenceCfg])
200 
201  # --------------------
202  # CaloClusterMonitor configuration
203  # --------------------
204  def getCaloClusterMonitorCfg(self, flags):
205  this_suffix = ""
206  if "_FILLED" in self.chainL1Item:
207  this_suffix = "_filled"
208  elif "_EMPTY" in self.chainL1Item:
209  this_suffix = "_empty"
210  elif "_FIRSTEMPTY" in self.chainL1Item:
211  this_suffix = "_firstempty"
212  return self.getStep(flags, 'caloclustermon' + this_suffix, [CaloClusterMonitorCfg], suffix = this_suffix)
213 
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration
Definition: MonitorChainConfiguration.py:132
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getCaloClusterMonitorCfg
def getCaloClusterMonitorCfg(self, flags)
Definition: MonitorChainConfiguration.py:204
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.assembleChainImpl
def assembleChainImpl(self, flags)
Definition: MonitorChainConfiguration.py:140
python.HLT.CalibCosmicMon.MonitorChainConfiguration.CaloClusterMonitorCfg
def CaloClusterMonitorCfg(flags, suffix="")
Definition: MonitorChainConfiguration.py:112
ChainConfigurationBase
Definition: ChainConfigurationBase.py:1
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MistimeMonSequenceCfg
def MistimeMonSequenceCfg(flags)
Definition: MonitorChainConfiguration.py:85
TrigCaloRecConfig.hltCaloTopoClusteringCfg
def hltCaloTopoClusteringCfg(flags, namePrefix=None, nameSuffix=None, CellsName=None, monitorCells=False, roisKey="UNSPECIFIED", clustersKey=None, doLCFS=False, doTau=False)
Definition: TrigCaloRecConfig.py:363
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getTimeBurnerStep
def getTimeBurnerStep(self, flags)
Definition: MonitorChainConfiguration.py:169
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getMistimeMonStep
def getMistimeMonStep(self, flags)
Definition: MonitorChainConfiguration.py:198
LArSuperCellMonAlg.LArSuperCellMonConfigHLT
def LArSuperCellMonConfigHLT(flags, name='LArSuperCellMonAlgHLT', RemoveMasked=True)
Definition: LArSuperCellMonAlg.py:141
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getLArSuperCellMonitoringGenCfg
def getLArSuperCellMonitoringGenCfg(self, flags)
Definition: MonitorChainConfiguration.py:175
python.HLT.CalibCosmicMon.MonitorChainConfiguration.timeBurnerCfg
def timeBurnerCfg(flags)
Definition: MonitorChainConfiguration.py:21
python.TrigGenericAlgsConfig.L1CorrelationAlgCfg
def L1CorrelationAlgCfg(flags, name='L1CorrelationAlg', **kw)
Definition: TrigGenericAlgsConfig.py:220
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getL1TopoOnlineMonitorStep
def getL1TopoOnlineMonitorStep(self, flags)
Definition: MonitorChainConfiguration.py:190
python.CFElements.seqAND
def seqAND(name, subs=[], invert=False)
Definition: CFElements.py:27
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:37
python.HLT.CalibCosmicMon.MonitorChainConfiguration.L1TopoOnlineMonitorSequenceCfg
def L1TopoOnlineMonitorSequenceCfg(flags)
Definition: MonitorChainConfiguration.py:59
python.HLT.CalibCosmicMon.MonitorChainConfiguration.LArSuperCellMonitoringGenCfg
def LArSuperCellMonitoringGenCfg(flags, appendName="")
Definition: MonitorChainConfiguration.py:44
python.TrigGenericAlgsConfig.TimeBurnerCfg
def TimeBurnerCfg(flags, name="TimeBurner", **kwargs)
Definition: TrigGenericAlgsConfig.py:10
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.__init__
def __init__(self, chainDict)
Definition: MonitorChainConfiguration.py:134
python.ParticleTypeUtil.info
def info
Definition: ParticleTypeUtil.py:87
python.HLT.CommonSequences.RejectSequences.RejectSequence
def RejectSequence(flags, name, sequence)
Definition: RejectSequences.py:7