ATLAS Offline Software
Loading...
Searching...
No Matches
AFPMenuSequence.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory import CompFactory
8from TriggerMenuMT.HLT.Config.MenuComponents import InEventRecoCA, SelectionCA, MenuSequence
9
10
11@AccumulatorCache
13 recoAcc = InEventRecoCA(name='AFPTrackingFS')
14
15 if not flags.Input.isMC:
16 acc = ComponentAccumulator()
17
18 # Bytestream converter
19 AFP_Raw = CompFactory.AFP_RawDataProvider("AFP_RawDataProvider")
20 acc.addEventAlgo(AFP_Raw)
21
22 # Digitalization
23 AFP_R2D = CompFactory.AFP_Raw2Digi("AFP_Raw2Digi")
24 acc.addEventAlgo(AFP_R2D)
25
26 recoAcc.mergeReco(acc)
27
28 # Cluster reconstruction
29 from AFP_SiClusterTools.AFP_SiClusterTools import AFP_SiClusterTools_HLT
30 AFP_SiCl = AFP_SiClusterTools_HLT(flags)
31 recoAcc.mergeReco(AFP_SiCl)
32
33 # Tracks reconstruction
34 from AFP_LocReco.AFP_LocReco import AFP_LocReco_SiD_HLT
35 AFP_SID = AFP_LocReco_SiD_HLT(flags)
36 recoAcc.mergeReco(AFP_SID)
37
38 return recoAcc
39
40
41@AccumulatorCache
43 def trigStreamerAFPHypoTool(flags, chainDict):
44 return CompFactory.TrigStreamerHypoTool(chainDict['chainName'])
45
46 recoAcc = AFPTrkRecoBaseSequenceCfg(flags)
47
48 hypo = CompFactory.TrigStreamerHypoAlg('AFPPassThroughHypo')
49
50 selAcc = SelectionCA('AFPPassThroughSequence')
51 selAcc.mergeReco(recoAcc)
52 selAcc.addHypoAlgo(hypo)
53
54 return MenuSequence(flags, selAcc, HypoToolGen=trigStreamerAFPHypoTool)
55
56
57def TrigAFPDijetComboHypoToolCfg(flags, chainDict):
58 name = chainDict['chainName']
59 tool = CompFactory.TrigAFPDijetComboHypoTool(name)
60
61 tool.maxProtonDiff_x = 2.5
62 tool.maxProtonDiff_y = 100.0
63 tool.maxProtonDist = 100.0
64
65 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
66 monTool = GenericMonitoringTool(flags, 'MonTool_' + name, HistPath='AFPComboHypo/' + tool.getName())
67 monTool.defineHistogram('DijetMass', type='TH1F', path='EXPERT', title="Dijet mass", xbins=100, xmin=0, xmax=2000)
68 monTool.defineHistogram('DijetRapidity', type='TH1F', path='EXPERT', title="Dijet rapidity", xbins=100, xmin=-5, xmax=5)
69
70 monTool.defineHistogram('XiJet1', type='TH1F', path='EXPERT', title="Jet 1 xi", xbins=100, xmin=0, xmax=1)
71 monTool.defineHistogram('XiJet2', type='TH1F', path='EXPERT', title="Jet 2 x1", xbins=100, xmin=0, xmax=1)
72
73 monTool.defineHistogram('PredictProtonAEnergy', type='TH1F', path='EXPERT', title="Predicted proton energy A", xbins=100, xmin=0, xmax=10000)
74 monTool.defineHistogram('PredictProtonCEnergy', type='TH1F', path='EXPERT', title="Predicted proton energy C", xbins=100, xmin=0, xmax=10000)
75
76 monTool.defineHistogram('SideA_predictX', type='TH1F', path='EXPERT', title="Predicted X side A", xbins=100, xmin=-100, xmax=100)
77 monTool.defineHistogram('SideA_predictY', type='TH1F', path='EXPERT', title="Predicted Y side A", xbins=100, xmin=-100, xmax=100)
78 monTool.defineHistogram('SideC_predictX', type='TH1F', path='EXPERT', title="Predicted X side C", xbins=100, xmin=-100, xmax=100)
79 monTool.defineHistogram('SideC_predictY', type='TH1F', path='EXPERT', title="Predicted Y side C", xbins=100, xmin=-100, xmax=100)
80
81 monTool.defineHistogram('XDiff', type='TH1F', path='EXPERT', title="X difference", xbins=100, xmin=-100, xmax=100)
82 monTool.defineHistogram('YDiff', type='TH1F', path='EXPERT', title="Y difference", xbins=100, xmin=-100, xmax=100)
83 monTool.defineHistogram('distance', type='TH1F', path='EXPERT', title="distance", xbins=100, xmin=0, xmax=50)
84
85 monTool.defineHistogram('SideA_trackX', type='TH1F', path='EXPERT', title="Track X side A", xbins=100, xmin=-100, xmax=100)
86 monTool.defineHistogram('SideA_trackY', type='TH1F', path='EXPERT', title="Track Y side A", xbins=100, xmin=-100, xmax=100)
87 monTool.defineHistogram('SideA_diffX', type='TH1F', path='EXPERT', title="Track X diff side A", xbins=100, xmin=-50, xmax=50)
88 monTool.defineHistogram('SideA_diffY', type='TH1F', path='EXPERT', title="Track Y diff side A", xbins=100, xmin=-50, xmax=50)
89
90 monTool.defineHistogram('SideC_trackX', type='TH1F', path='EXPERT', title="Track X side C", xbins=100, xmin=-100, xmax=100)
91 monTool.defineHistogram('SideC_trackY', type='TH1F', path='EXPERT', title="Track Y side C", xbins=100, xmin=-100, xmax=100)
92 monTool.defineHistogram('SideC_diffX', type='TH1F', path='EXPERT', title="Track X diff side C", xbins=100, xmin=-50, xmax=50)
93 monTool.defineHistogram('SideC_diffY', type='TH1F', path='EXPERT', title="Track Y diff side C", xbins=100, xmin=-50, xmax=50)
94
95 tool.MonTool = monTool
96
97 return tool
98
99
100@AccumulatorCache
102 recoAcc = InEventRecoCA(name='AFPGlobalFS')
103
104 # ToF Tracks reconstruction
105 from AFP_LocReco.AFP_LocReco import AFP_LocReco_TD_HLT
106 AFP_TD = AFP_LocReco_TD_HLT(flags)
107 recoAcc.mergeReco(AFP_TD)
108
109 # Protons reconstruction
110 from AFP_GlobReco.AFP_GlobReco import AFP_GlobReco_HLT
111 AFP_Pr = AFP_GlobReco_HLT(flags)
112 recoAcc.mergeReco(AFP_Pr)
113
114 # Vertex reconstruction
115 from AFP_VertexReco.AFP_VertexReco import AFP_VertexReco_HLT
116 AFP_Vtx = AFP_VertexReco_HLT(flags)
117 recoAcc.mergeReco(AFP_Vtx)
118
119 return recoAcc
120
121
122@AccumulatorCache
124 def trigStreamerAFPToFHypoTool(flags, chainDict):
125 return CompFactory.TrigStreamerHypoTool(chainDict['chainName'])
126
127 recoAcc = AFPGlobalRecoSequenceCfg(flags)
128
129 hypo = CompFactory.TrigStreamerHypoAlg('AFPToFPassThroughHypo')
130
131 selAcc = SelectionCA('AFPGlobalSequence')
132 selAcc.mergeReco(recoAcc)
133 selAcc.addHypoAlgo(hypo)
134
135 return MenuSequence(flags, selAcc, HypoToolGen=trigStreamerAFPToFHypoTool)
136
137def AFPToFDeltaZToolGen(flags, chainDict):
138 hypotool = CompFactory.TrigAFPToFHypoTool(chainDict['chainName'])
139 if "afpdz5" in chainDict["chainName"]:
140 hypotool.deltaZCut = 5.0
141 elif "afpdz10" in chainDict["chainName"]:
142 hypotool.deltaZCut = 10.0
143 return hypotool
144
145@AccumulatorCache
147
148 recoAcc = AFPGlobalRecoSequenceCfg(flags)
149
150 hypo = CompFactory.TrigAFPToFHypoAlg('TrigAFPToFHypoAlg', AFPVertexContainer='HLT_AFPVertexContainer', VertexContainer='HLT_IDVertex_FS')
151
152 # add monitoring
153 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
154 monTool = GenericMonitoringTool(flags, 'MonToolAFPToFHypo')
155 monTool.defineHistogram('afp_vtx_count', path='EXPERT', type='TH1F', title='AFP Vertex Counts',
156 xbins=6, xmin=-0.5, xmax=5.5 )
157 monTool.defineHistogram('id_vtx_count', path='EXPERT', type='TH1F', title='ID Vertex Counts',
158 xbins=6, xmin=-0.5, xmax=5.5 )
159 monTool.defineHistogram('skipHypoTool', path='EXPERT', type='TH1F', title='Reason of skipping the trigger',
160 xbins=6, xmin=-0.5, xmax=5.5 )
161 monTool.defineHistogram('afp_vtx_z', path='EXPERT', type='TH1F', title='AFP Vertex X',
162 xbins=401, xmin=-200, xmax=200 )
163 monTool.defineHistogram('id_vtx_z', path='EXPERT', type='TH1F', title='ID Vertex Z',
164 xbins=401, xmin=-200, xmax=200 )
165 monTool.defineHistogram('delta_z', path='EXPERT', type='TH1F', title='Delta Z',
166 xbins=201, xmin=-100, xmax=100 )
167 hypo.MonTool = monTool
168
169 selAcc = SelectionCA('AFPToFDeltaZSequence')
170 selAcc.mergeReco(recoAcc)
171 selAcc.addHypoAlgo(hypo)
172
173 return MenuSequence(flags, selAcc, HypoToolGen=AFPToFDeltaZToolGen)
174
175
176if __name__ == '__main__':
177 from AthenaConfiguration.AllConfigFlags import initConfigFlags
178 from AthenaConfiguration.TestDefaults import defaultTestFiles
179 flags = initConfigFlags()
180 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
181 flags.lock()
182
183
184 afp_trk = AFPTrkSequenceGenCfg(flags)
185 afp_trk.ca.printConfig(withDetails=True)
186
187 afp_glob = AFPGlobalSequenceGenCfg(flags)
188 afp_glob.ca.printConfig(withDetails=True)
TrigAFPDijetComboHypoToolCfg(flags, chainDict)