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  reco.addRecoAlgo(recoAlg)
98  selAcc = SelectionCA("MistimeMonSequence")
99  selAcc.mergeReco(reco)
100 
101  # Hypo to select on trig composite pass flag
102  hypoAlg = CompFactory.TrigGenericHypoAlg("MistimeMonJ400HypoAlg", TrigCompositeContainer=outputName)
103  selAcc.addHypoAlgo(hypoAlg)
104 
105  return MenuSequence(flags, selAcc,
106  HypoToolGen = TrigGenericHypoToolFromDict)
107 
108 def CaloClusterMonitorCfg(flags, suffix = ""):
109  from TrigCaloRec.TrigCaloRecConfig import hltCaloTopoClusteringCfg
110 
111  reco = InEventRecoCA('CaloClusterMonitoring' + suffix)
112 
113  reco.merge( hltCaloTopoClusteringCfg(flags, namePrefix="CaloMon", nameSuffix="FS" + suffix, CellsName="CaloCellsFS" + suffix, monitorCells=False, clustersKey="HLT_MonitoringCaloClusters" + suffix) )
114 
115  selAcc = SelectionCA('CaloClusterMonitoringSequence' + suffix)
116 
117  selAcc.mergeReco(reco)
118 
119  HypoName = "CaloClusterMonHypoConfig"+ suffix
120  msca = RejectSequence(flags, HypoName, selAcc)
121 
122  return msca
123 
124 
125 #----------------------------------------------------------------
126 # Class to configure chain
127 #----------------------------------------------------------------
129 
130  def __init__(self, chainDict):
131  ChainConfigurationBase.__init__(self,chainDict)
132 
133  # ----------------------
134  # Assemble the chain depending on information from chainName
135  # ----------------------
136  def assembleChainImpl(self, flags):
137  chainSteps = []
138  log.debug("Assembling chain for %s", self.chainName)
139 
140  monTypeList = self.chainPart.get('monType')
141  if not monTypeList:
142  raise RuntimeError('No monType defined in chain ' + self.chainName)
143  if len(monTypeList) > 1:
144  raise RuntimeError('Multiple monType values defined in chain ' + self.chainName)
145  monType = monTypeList[0]
146 
147  if monType == 'timeburner':
148  chainSteps.append(self.getTimeBurnerStep(flags))
149  elif monType == 'larsupercellmon':
150  chainSteps.append(self.getLArSuperCellMonitoringGenCfg(flags))
151  elif monType == 'l1topoPh1debug':
152  chainSteps.append(self.getL1TopoOnlineMonitorStep(flags))
153  elif monType == 'mistimemonj400':
154  chainSteps.append(self.getMistimeMonStep(flags))
155  elif monType == 'caloclustermon':
156  chainSteps.append(self.getCaloClusterMonitorCfg(flags))
157  else:
158  raise RuntimeError('Unexpected monType '+monType+' in MonitorChainConfiguration')
159 
160  return self.buildChain(chainSteps)
161 
162  # --------------------
163  # TimeBurner configuration
164  # --------------------
165  def getTimeBurnerStep(self, flags):
166  return self.getStep(flags, 'TimeBurner',[timeBurnerCfg])
167 
168  # --------------------
169  # LArSuperCellMon configuration
170  # --------------------
172  appendName=""
173  if ( "_FILLED" in self.chainL1Item ):
174  appendName="_filled"
175  elif ( "_EMPTY" in self.chainL1Item ):
176  appendName="_empty"
177  elif ( "_FIRSTEMPTY" in self.chainL1Item ):
178  appendName="_firstempty"
179  else :
180  appendName="_dummy"
181  return self.getStep(flags, 'larsupercellmon'+appendName,[LArSuperCellMonitoringGenCfg],appendName=appendName)
182 
183  # --------------------
184  # L1TopoOnlineMonitor configuration
185  # --------------------
186  def getL1TopoOnlineMonitorStep(self, flags):
187 
188  sequenceCfg = L1TopoOnlineMonitorSequenceCfg
189  return self.getStep(flags, 'L1TopoOnlineMonitor',[sequenceCfg])
190 
191  # --------------------
192  # MistTimeMon configuration
193  # --------------------
194  def getMistimeMonStep(self, flags):
195  return self.getStep(flags, 'MistimeMon',[MistimeMonSequenceCfg])
196 
197  # --------------------
198  # CaloClusterMonitor configuration
199  # --------------------
200  def getCaloClusterMonitorCfg(self, flags):
201  this_suffix = ""
202  if "_FILLED" in self.chainL1Item:
203  this_suffix = "_filled"
204  elif "_EMPTY" in self.chainL1Item:
205  this_suffix = "_empty"
206  elif "_FIRSTEMPTY" in self.chainL1Item:
207  this_suffix = "_firstempty"
208  return self.getStep(flags, 'caloclustermon' + this_suffix, [CaloClusterMonitorCfg], suffix = this_suffix)
209 
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration
Definition: MonitorChainConfiguration.py:128
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getCaloClusterMonitorCfg
def getCaloClusterMonitorCfg(self, flags)
Definition: MonitorChainConfiguration.py:200
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.assembleChainImpl
def assembleChainImpl(self, flags)
Definition: MonitorChainConfiguration.py:136
python.HLT.CalibCosmicMon.MonitorChainConfiguration.CaloClusterMonitorCfg
def CaloClusterMonitorCfg(flags, suffix="")
Definition: MonitorChainConfiguration.py:108
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:165
python.CFElements.seqAND
def seqAND(name, subs=[])
Definition: CFElements.py:25
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getMistimeMonStep
def getMistimeMonStep(self, flags)
Definition: MonitorChainConfiguration.py:194
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:171
python.HLT.CalibCosmicMon.MonitorChainConfiguration.timeBurnerCfg
def timeBurnerCfg(flags)
Definition: MonitorChainConfiguration.py:21
python.HLT.CalibCosmicMon.MonitorChainConfiguration.MonitorChainConfiguration.getL1TopoOnlineMonitorStep
def getL1TopoOnlineMonitorStep(self, flags)
Definition: MonitorChainConfiguration.py:186
python.TrigGenericAlgsConfig.L1CorrelationAlgCfg
def L1CorrelationAlgCfg(flags, name, **kwargs)
Definition: TrigGenericAlgsConfig.py:45
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:130
python.ParticleTypeUtil.info
def info
Definition: ParticleTypeUtil.py:87
python.HLT.CommonSequences.RejectSequences.RejectSequence
def RejectSequence(flags, name, sequence)
Definition: RejectSequences.py:7