ATLAS Offline Software
CalibChainConfiguration.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 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 MenuSequenceCA, SelectionCA, InViewRecoCA, InEventRecoCA
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from TrigT2CaloCommon.CaloDef import fastCaloRecoSequenceCfg
11 from TrigGenericAlgs.TrigGenericAlgsConfig import TimeBurnerCfg, TimeBurnerHypoToolGen
12 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
13 
14 from TrigTrackingHypo.IDCalibHypoConfig import IDCalibHypoToolFromDict, createIDCalibHypoAlg
15 from ..CommonSequences.FullScanInDetConfig import commonInDetFullScanCfg
16 from TriggerMenuMT.HLT.Jet.JetMenuSequencesConfig import getTrackingInputMaker
17 
18 from TrigCaloRec.TrigCaloRecConfig import hltCaloCellMakerCfg
19 from TrigCaloHypo.TrigCaloHypoConfig import TrigLArNoiseBurstRecoAlgCfg
20 from TrigCaloHypo.TrigCaloHypoConfig import TrigLArNoiseBurstHypoToolGen
21 from TrigT2CaloCommon.CaloDef import clusterFSInputMaker
22 
23 
25  acc = InEventRecoCA("LArNoiseBurstRecoSequence", inputMaker=clusterFSInputMaker())
26  cells_name = 'CaloCellsFS'
27  acc.mergeReco(hltCaloCellMakerCfg(flags=flags, name="HLTCaloCellMakerFS", roisKey=''))
28  acc.mergeReco(TrigLArNoiseBurstRecoAlgCfg(flags, cells_name))
29  return acc
30 
31 
32 # --------------------
33 # LArNoiseBurst configuration
34 # --------------------
35 @AccumulatorCache
37 
38  hypoAlg = CompFactory.TrigLArNoiseBurstAlg("NoiseBurstAlg")
39  InEventReco = InEventRecoCA("LArNoiseBurstRecoSequence", inputMaker=clusterFSInputMaker())
40 
41  noiseBurstRecoSeq = getLArNoiseBurstRecoCfg(flags)
42 
43  InEventReco.mergeReco(noiseBurstRecoSeq)
44  selAcc = SelectionCA("LArNoiseBurstMenuSequence")
45  selAcc.mergeReco(InEventReco)
46  selAcc.addHypoAlgo(hypoAlg)
47 
48  return MenuSequenceCA(flags,selAcc,HypoToolGen=TrigLArNoiseBurstHypoToolGen)
49 
50 
51 # --------------------
52 # LArPS Noise Detection EM configuration
53 # --------------------
54 @AccumulatorCache
55 def getCaloAllEMLayersPSSequenceGenCfg(flags,doAllorAllEM=False):
56 
57  from TrigT2CaloCommon.CaloDef import fastCaloVDVCfg
58  nameselAcc = "LArPSSequence_All"
59  namerecoAcc = "fastCaloInViewSequenceAllEM"
60  hypoAlgName = "TrigL2CaloLayersAlg_AllEM"
61  output = "HLT_LArPS_AllCaloEMClusters"
62  if doAllorAllEM :
63  nameselAcc = "LArPSSequence_AllEM"
64  namerecoAcc = "fastCaloInViewSequenceAll"
65  hypoAlgName = "TrigL2CaloLayersAlg_All"
66  output = "HLT_LArPS_AllCaloClusters"
67  selAcc = SelectionCA(nameselAcc)
68  InViewRoIs="EMCaloRoIs"
69  reco = InViewRecoCA(namerecoAcc,InViewRoIs=InViewRoIs)
70  reco.mergeReco(fastCaloVDVCfg(InViewRoIs=InViewRoIs))
71  reco.mergeReco(fastCaloRecoSequenceCfg(flags, inputEDM=InViewRoIs,ClustersName=output,doAllEm=not doAllorAllEM,doAll=doAllorAllEM))
72 
73  selAcc.mergeReco(reco)
74 
75  from TrigCaloHypo.TrigCaloHypoConfig import TrigL2CaloLayersHypoToolGen
76  TrigL2CaloLayersAlg = CompFactory.TrigL2CaloLayersAlg(hypoAlgName)
77  TrigL2CaloLayersAlg.TrigClusterContainerKey = output
78  selAcc.addHypoAlgo(TrigL2CaloLayersAlg)
79  return MenuSequenceCA(flags,selAcc,HypoToolGen=TrigL2CaloLayersHypoToolGen)
80 
81 
82 #----------------------------------------------------------------
83 
85 
86  def __init__(self, chainDict):
87  ChainConfigurationBase.__init__(self,chainDict)
88 
89  # ----------------------
90  # Assemble the chain depending on information from chainName
91  # ----------------------
92  def assembleChainImpl(self, flags):
93 
94  chainSteps = []
95  log.debug("Assembling chain for %s", self.chainName)
96 
97  stepDictionary = self.getStepDictionary()
98 
99  if 'acceptedevts' in self.chainPart['purpose']:
100  steps=stepDictionary['AcceptedEvents']
101  elif self.chainPart['purpose'][0] == 'larnoiseburst':
102  steps=stepDictionary['LArNoiseBurst']
103  elif self.chainPart['purpose'][0] == 'larpsallem':
104  steps=stepDictionary['LArPSAllEM']
105  elif self.chainPart['purpose'][0] == 'larpsall':
106  steps=stepDictionary['LArPSAll']
107  elif self.chainPart['purpose'][0] == 'idcalib':
108  steps=stepDictionary['IDCalib']
109  for i, step in enumerate(steps):
110  chainstep = getattr(self, step)(flags, i)
111  chainSteps+=[chainstep]
112 
113  myChain = self.buildChain(chainSteps)
114  return myChain
115 
116 
117  def getStepDictionary(self):
118  # --------------------
119  # define here the names of the steps and obtain the chainStep configuration
120  # --------------------
121  stepDictionary = {
122  "AcceptedEvents": ['getAcceptedEventsStep'],
123  "LArNoiseBurst": ['getAllTEStep'],
124  "LArPSAllEM" : ['getCaloAllEMStep'],
125  "LArPSAll" : ['getCaloAllStep'],
126  "IDCalib": ['getIDCalibEmpty', 'getIDCalibEmpty', 'getIDCalibFTFReco', 'getIDCalibTrigger']
127  }
128  return stepDictionary
129 
130 
131  def getAcceptedEventsStep(self, flags, i):
132  return self.getStep(flags, 'AcceptedEvents', [acceptedEventsSequenceGenCfg])
133 
134  def getAllTEStep(self, flags, i):
135  return self.getStep(flags, 'LArNoiseBurst', [getLArNoiseBurstSequenceGenCfg])
136 
137  def getCaloAllEMStep(self, flags, i):
138  return self.getStep(flags, 'LArPSALLEM', [getCaloAllEMLayersPSSequenceGenCfg], doAllorAllEM=False)
139 
140  def getCaloAllStep(self, flags, i):
141  return self.getStep(flags, 'LArPSALL', [getCaloAllEMLayersPSSequenceGenCfg], doAllorAllEM=True)
142 
143  def getIDCalibEmpty(self, flags, i):
144  return self.getEmptyStep(1, 'IDCalibEmptyStep')
145 
146  def getIDCalibFTFReco(self, flags, i):
147  return self.getStep(flags, 'IDCalibFTFCfg',[IDCalibFTFSequenceGenCfg])
148 
149  def getIDCalibTrigger(self, flags, i):
150  return self.getStep(flags, 'IDCalibTriggerCfg',[IDCalibTriggerSequenceGenCfg])
151 
152 #----------------------------------------------------------------
153 
154 # --------------------
155 # IDCalib trigger configurations
156 # --------------------
157 
158 @AccumulatorCache
160  DummyInputMakerAlg = CompFactory.InputMakerForRoI( "IM_IDCalib_HypoOnlyStep" )
161  DummyInputMakerAlg.RoITool = CompFactory.ViewCreatorInitialROITool()
162 
163  reco = InEventRecoCA('IDCalibEmptySeq_reco',inputMaker=DummyInputMakerAlg)
164 
165  theHypoAlg = createIDCalibHypoAlg(flags, "IDCalibHypo")
166  theHypoAlg.tracksKey = flags.Trigger.InDetTracking.fullScan.tracks_FTF
167 
168  selAcc = SelectionCA('IDCalibEmptySeq_sel')
169  selAcc.mergeReco(reco)
170  selAcc.addHypoAlgo(theHypoAlg)
171 
172  msca = MenuSequenceCA(
173  flags, selAcc,
174  HypoToolGen=IDCalibHypoToolFromDict,
175  )
176  return msca
177 
178 
179 # --------------------
180 
181 @AccumulatorCache
183  reco = InEventRecoCA('IDCalibTrkrecoSeq_reco',inputMaker=getTrackingInputMaker(flags, "ftf"))
184  reco.mergeReco(commonInDetFullScanCfg(flags))
185 
186  selAcc = SelectionCA('IDCalibTrkrecoSeq')
187  selAcc.mergeReco(reco)
188  selAcc.addHypoAlgo(CompFactory.TrigStreamerHypoAlg("IDCalibTrkDummyStream"))
189 
190  msca = MenuSequenceCA(
191  flags, selAcc,
192  HypoToolGen = lambda chainDict: CompFactory.TrigStreamerHypoTool(chainDict['chainName'])
193  )
194  return msca
195 
196 
197 #----------------------------------------------------------------
198 
199 # --------------------
200 # HLT step for the AcceptedEvents chains
201 # --------------------
202 @AccumulatorCache
204  '''
205  Return MenuSequenceCA for an HLT step used by the AcceptedEvents chains. This step is a trivial
206  always-reject hypo with no reco. The step itself should be noop as only the HLTSeeding and the
207  end-of-event sequence parts of AcceptedEvents chains are actually used.
208  '''
209  # Implementation identical to the timeburner chain but with zero sleep time
210 
211  inputMaker = CompFactory.InputMakerForRoI(
212  "IM_AcceptedEvents",
213  RoITool = CompFactory.ViewCreatorInitialROITool(),
214  RoIs="AcceptedEventsRoIs",
215  )
216  reco = InEventRecoCA('AcceptedEvents_reco',inputMaker=inputMaker)
217  # TimeBurner alg works as a reject-all hypo
218  selAcc = SelectionCA('AcceptedEventsSequence')
219  selAcc.mergeReco(reco)
220  selAcc.addHypoAlgo(
222  flags,
223  name="AcceptedEventsHypo",
224  SleepTimeMillisec = 0,
225  )
226  )
227 
228  msca = MenuSequenceCA(
229  flags, selAcc,
230  HypoToolGen=TimeBurnerHypoToolGen
231  )
232  return msca
233 
python.HLT.Jet.JetMenuSequencesConfig.getTrackingInputMaker
def getTrackingInputMaker(AthConfigFlags flags, str trkopt)
Definition: JetMenuSequencesConfig.py:39
grepfile.info
info
Definition: grepfile.py:38
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getIDCalibEmpty
def getIDCalibEmpty(self, flags, i)
Definition: CalibChainConfiguration.py:143
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getAllTEStep
def getAllTEStep(self, flags, i)
Definition: CalibChainConfiguration.py:134
python.HLT.CalibCosmicMon.CalibChainConfiguration.acceptedEventsSequenceGenCfg
def acceptedEventsSequenceGenCfg(flags)
Definition: CalibChainConfiguration.py:203
python.HLT.CommonSequences.FullScanInDetConfig.commonInDetFullScanCfg
ComponentAccumulator commonInDetFullScanCfg(AthConfigFlags flags)
Definition: FullScanInDetConfig.py:20
python.IDCalibHypoConfig.createIDCalibHypoAlg
def createIDCalibHypoAlg(flags, name)
Definition: IDCalibHypoConfig.py:9
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getIDCalibFTFReco
def getIDCalibFTFReco(self, flags, i)
Definition: CalibChainConfiguration.py:146
ChainConfigurationBase
Definition: ChainConfigurationBase.py:1
TrigCaloRecConfig.hltCaloCellMakerCfg
def hltCaloCellMakerCfg(flags, name=None, roisKey='UNSPECIFIED', CellsName=None, monitorCells=False, doTau=False)
Definition: TrigCaloRecConfig.py:53
CaloDef.fastCaloRecoSequenceCfg
def fastCaloRecoSequenceCfg(flags, inputEDM="", ClustersName="HLT_FastCaloEMClusters", RingerKey="HLT_FastCaloRinger", doForward=False, doAllEm=False, doAll=False)
Definition: CaloDef.py:14
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getIDCalibTrigger
def getIDCalibTrigger(self, flags, i)
Definition: CalibChainConfiguration.py:149
CaloDef.clusterFSInputMaker
def clusterFSInputMaker()
cluster maker functions
Definition: CaloDef.py:51
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.assembleChainImpl
def assembleChainImpl(self, flags)
Definition: CalibChainConfiguration.py:92
CaloDef.fastCaloVDVCfg
def fastCaloVDVCfg(name="fastCaloVDV", InViewRoIs="EMCaloRoIs")
Definition: CaloDef.py:39
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getCaloAllStep
def getCaloAllStep(self, flags, i)
Definition: CalibChainConfiguration.py:140
python.HLT.CalibCosmicMon.CalibChainConfiguration.getLArNoiseBurstSequenceGenCfg
def getLArNoiseBurstSequenceGenCfg(flags)
Definition: CalibChainConfiguration.py:36
python.HLT.CalibCosmicMon.CalibChainConfiguration.getLArNoiseBurstRecoCfg
def getLArNoiseBurstRecoCfg(flags)
Definition: CalibChainConfiguration.py:24
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getStepDictionary
def getStepDictionary(self)
Definition: CalibChainConfiguration.py:117
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.__init__
def __init__(self, chainDict)
Definition: CalibChainConfiguration.py:86
python.HLT.CalibCosmicMon.CalibChainConfiguration.IDCalibTriggerSequenceGenCfg
def IDCalibTriggerSequenceGenCfg(flags)
Definition: CalibChainConfiguration.py:159
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getAcceptedEventsStep
def getAcceptedEventsStep(self, flags, i)
Definition: CalibChainConfiguration.py:131
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration
Definition: CalibChainConfiguration.py:84
TrigCaloHypoConfig.TrigLArNoiseBurstRecoAlgCfg
def TrigLArNoiseBurstRecoAlgCfg(flags, cells_name)
Definition: TrigCaloHypoConfig.py:9
python.HLT.CalibCosmicMon.CalibChainConfiguration.getCaloAllEMLayersPSSequenceGenCfg
def getCaloAllEMLayersPSSequenceGenCfg(flags, doAllorAllEM=False)
Definition: CalibChainConfiguration.py:55
python.HLT.CalibCosmicMon.CalibChainConfiguration.CalibChainConfiguration.getCaloAllEMStep
def getCaloAllEMStep(self, flags, i)
Definition: CalibChainConfiguration.py:137
python.TrigGenericAlgsConfig.TimeBurnerCfg
def TimeBurnerCfg(flags, name="TimeBurner", **kwargs)
Definition: TrigGenericAlgsConfig.py:10
python.HLT.CalibCosmicMon.CalibChainConfiguration.IDCalibFTFSequenceGenCfg
def IDCalibFTFSequenceGenCfg(flags)
Definition: CalibChainConfiguration.py:182