ATLAS Offline Software
BeamspotChainConfiguration.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 
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from TrigStreamerHypo.TrigStreamerHypoConfig import StreamerHypoToolGenerator
11 from TrigInDetConfig.utils import getFlagsForActiveConfig
12 from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg
13 from ..Config.MenuComponents import MenuSequenceCA, SelectionCA, InEventRecoCA, InViewRecoCA
14 
15 
16 def allTE_trkfastSequenceGenCfg( flags, signature="FS" ):
17 
18 
19 
20  _signature=signature
21  if(signature == "FS"):
22  _signature = "beamSpotFS"
23 
24  beamspotSequence = InViewRecoCA('beamspotSequence_'+signature)
25 
26  flagsWithTrk = getFlagsForActiveConfig(flags, _signature, log)
27  beamspotSequence.mergeReco(trigInDetFastTrackingCfg(flagsWithTrk,
28  roisKey=beamspotSequence.inputMaker().InViewRoIs,
29  signatureName=_signature))
30 
31  from TrigT2BeamSpot.T2VertexBeamSpotConfig import T2VertexBeamSpot_activeAllTE
32  vertexAlg = T2VertexBeamSpot_activeAllTE(flags, "vertex_"+_signature )
33  vertexAlg.TrackCollection = flagsWithTrk.Tracking.ActiveConfig.trkTracks_FTF
34 
35 
36  beamspotSequence.addRecoAlgo(vertexAlg)
37  beamspotViewsSequence = SelectionCA('beamspotViewsSequence'+_signature)
38  beamspotViewsSequence.mergeReco(beamspotSequence)
39 
40 
41  #hypo
42  beamspotHypoAlg = CompFactory.TrigStreamerHypoAlg("BeamspotHypoAlg_"+_signature)
43  beamspotHypoAlg.RuntimeValidation = False #Needed to avoid the ERROR ! Decision has no 'feature' ElementLink
44 
45  beamspotViewsSequence.addHypoAlgo(beamspotHypoAlg)
46 
47  # Accept every event
48  beamspotHypoToolGen = StreamerHypoToolGenerator
49 
50  return MenuSequenceCA( flags,
51  beamspotViewsSequence,
52  HypoToolGen = beamspotHypoToolGen )
53 
54 
56  signature = "BeamspotJet"
57 
58  # run at event level
59  inputMakerAlg = CompFactory.InputMakerForRoI("IM_beamspotJet_"+signature)
60  inputMakerAlg.RoITool = CompFactory.ViewCreatorInitialROITool()
61 
62  #-- Configuring Beamspot vertex alg
63  from TrigT2BeamSpot.T2VertexBeamSpotConfig import T2VertexBeamSpot_activeAllTE
64  vertexAlg = T2VertexBeamSpot_activeAllTE(flags, "vertex_"+signature )
65  vertexAlg.TrackCollection = flags.Trigger.InDetTracking.fullScan.trkTracks_FTF
66 
67  #-- Setting up beamspotSequence
68  beamspotSequence = InEventRecoCA('beamspotJetSequence_'+signature,inputMaker=inputMakerAlg)
69  beamspotSequence.addRecoAlgo(vertexAlg)
70  beamspotViewsSequence = SelectionCA('beamspotJetViewsSequence'+signature)
71  beamspotViewsSequence.mergeReco(beamspotSequence)
72 
73  #-- HypoAlg and Tool
74  beamspotHypoAlg = CompFactory.TrigStreamerHypoAlg("BeamspotHypoAlg_"+signature)
75 
76  beamspotViewsSequence.addHypoAlgo(beamspotHypoAlg)
77 
78  # Reject every event
79  def getRejectingHypoTool(chainDict):
80  return CompFactory.TrigStreamerHypoTool(chainDict['chainName'],Pass=False)
81 
82  return MenuSequenceCA( flags,
83  beamspotViewsSequence,
84  HypoToolGen = getRejectingHypoTool )
85 
86 
87 #----------------------------------------------------------------
88 # Class to configure chain
89 #----------------------------------------------------------------
91 
92  def __init__(self, chainDict, jc_name = None):
93  ChainConfigurationBase.__init__(self,chainDict)
94  self.jc_name=jc_name
95 
96 
97  def assembleChainImpl(self, flags):
98  chainSteps = []
99  log.debug("Assembling chain for %s", self.chainName)
100  stepDictionary = self.getStepDictionary()
101  key = ''
102 
103  if self.chainPart['beamspotChain'] != '':
104  stepName = f"Step4_{self.jc_name}_beamspotJet"
105  chainSteps = [self.getStep(flags, stepName, [getBeamspotVtxSequenceGenCfg])]
106 
107  else:
108  key = self.chainPart['addInfo'][0] + "_" + self.chainPart['l2IDAlg'][0] #TODO: hardcoded index
109 
110  steps=stepDictionary[key]
111  for step in steps:
112  chainstep = getattr(self, step)(flags)
113  chainSteps+=[chainstep]
114 
115  myChain = self.buildChain(chainSteps)
116  return myChain
117 
118  def getStepDictionary(self):
119  # --------------------
120  # define here the names of the steps and obtain the chainStep configuration
121  # --------------------
122  stepDictionary = {
123  "allTE_trkfast":['getAllTEStep'],
124  "trkFS_trkfast":['getTrkFSStep'],
125  }
126  return stepDictionary
127 
128  # --------------------
129  # Configuration TrkFS step
130  # --------------------
131  def getTrkFSStep(self, flags):
132  return self.getStep(flags, "trkFS_trkfast",[allTE_trkfastSequenceGenCfg],signature="FS")
133 
134  # --------------------
135  # Configuration of costmonitor (costmonitor ?? but isn't this is the actua chain configuration ??)
136  # --------------------
137  def getAllTEStep(self, flags):
138  return self.getStep(flags, "allTE_trkfast",[allTE_trkfastSequenceGenCfg],signature="beamSpot")
grepfile.info
info
Definition: grepfile.py:38
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.getAllTEStep
def getAllTEStep(self, flags)
Definition: BeamspotChainConfiguration.py:137
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration
Definition: BeamspotChainConfiguration.py:90
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.allTE_trkfastSequenceGenCfg
def allTE_trkfastSequenceGenCfg(flags, signature="FS")
Definition: BeamspotChainConfiguration.py:16
ChainConfigurationBase
Definition: ChainConfigurationBase.py:1
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.getStepDictionary
def getStepDictionary(self)
Definition: BeamspotChainConfiguration.py:118
python.utils.getFlagsForActiveConfig
AthConfigFlags getFlagsForActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
Definition: Trigger/TrigTools/TrigInDetConfig/python/utils.py:9
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.getBeamspotVtxSequenceGenCfg
def getBeamspotVtxSequenceGenCfg(flags)
Definition: BeamspotChainConfiguration.py:55
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.__init__
def __init__(self, chainDict, jc_name=None)
Definition: BeamspotChainConfiguration.py:92
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.jc_name
jc_name
Definition: BeamspotChainConfiguration.py:94
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.assembleChainImpl
def assembleChainImpl(self, flags)
Definition: BeamspotChainConfiguration.py:97
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
python.TrigInDetConfig.trigInDetFastTrackingCfg
def trigInDetFastTrackingCfg(inflags, roisKey="EMRoIs", signatureName='', in_view=True)
Definition: TrigInDetConfig.py:51
T2VertexBeamSpotConfig.T2VertexBeamSpot_activeAllTE
def T2VertexBeamSpot_activeAllTE(flags, name="T2VertexBeamSpot_activeAllTE")
Definition: T2VertexBeamSpotConfig.py:100
python.HLT.CalibCosmicMon.BeamspotChainConfiguration.BeamspotChainConfiguration.getTrkFSStep
def getTrkFSStep(self, flags)
Definition: BeamspotChainConfiguration.py:131