ATLAS Offline Software
Loading...
Searching...
No Matches
MinBiasMenuSequences.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4from TrigEDMConfig.TriggerEDM import recordable
5import AthenaCommon.SystemOfUnits as Units
6from TrigMinBias.TrigMinBiasMonitoring import MbtsHypoToolMonitoring
7
8from AthenaConfiguration.ComponentFactory import CompFactory
9from AthenaConfiguration.AccumulatorCache import AccumulatorCache
10
11from ..Config.MenuComponents import InViewRecoCA, InEventRecoCA, SelectionCA, MenuSequence
12
13from AthenaCommon.Logging import logging
14log = logging.getLogger(__name__)
15
16
17def SPCountHypoToolGen(flags, chainDict):
18 hypo = CompFactory.SPCountHypoTool(chainDict["chainName"])
19 if "hmt" in chainDict["chainName"]:
20 hypo.sctSP = int(chainDict["chainParts"][0]["hypoSPInfo"].strip("sp"))
21 if "mb_sptrk_" in chainDict["chainName"] or "mb_sp_" in chainDict["chainName"]:
22 hypo.pixCL = 2
23 hypo.sctSP = 3
24 if "mb_excl" in chainDict["chainName"]:
25 hypo.pixCLMax = 150 # TODO revisit tightening those
26 hypo.sctSPMax = 150 # as above
27 if "sp_pix" in chainDict["chainName"]:
28 hypo.pixCL = int(chainDict["chainParts"][0]["hypoSPInfo"].removeprefix("pix"))
29 if "sp_vpix" in chainDict["chainName"]:
30 hypo.pixCL = -1 # Remove any cut on mininum number of Pixel and SCT SpacePoints
31 hypo.sctSP = -1
32 hypo.pixCLMax = int(chainDict["chainParts"][0]["hypoSPInfo"].removeprefix("vpix"))
33 if "nototpix" in chainDict["chainName"]:
34 hypo.pixCL = -1 # Remove any cut on mininum number of Pixel and SCT SpacePoints
35 hypo.sctSP = -1
36 hypo.pixCLnoToT = int(chainDict["chainParts"][0]["hypoSPInfo"].removeprefix("nototpix"))
37 if "q2" in chainDict["chainName"]:
38 hypo.pixQ2mod = 0.4 # to be adjusted
39 if "mb_pixsptrk_" in chainDict["chainName"]: #to be adjusted
40 hypo.pixCL = 2
41 hypo.sctSP = 0
42
43 return hypo
44
45
46def TrackCountHypoToolGen(flags, chainDict):
47 def ptToGeV(v):
48 if "p" in v:
49 sv = v.split("p")
50 return int(sv[0])+0.1*int(sv[1])
51 else:
52 return int(v)
53
54 hypo = CompFactory.TrackCountHypoTool(chainDict["chainName"])
55 if "hmt" in chainDict["chainName"]:
56 hypo.minNtrks = int(chainDict["chainParts"][0]["hypoTrkInfo"].strip("trk"))
57 hypo.minPt = 200*Units.MeV
58 if "pusup" in chainDict["chainName"]:
59 hypo.maxVertexZ = 10*Units.mm
60 if "mb_sptrk" in chainDict["chainName"]:
61 hypo.minPt = 100*Units.MeV
62 hypo.maxZ0 = 401*Units.millimeter
63 if "_pt" in chainDict["chainName"]:
64 hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
65 if "_trk" in chainDict["chainName"]:
66 hypo.minNtrks = int(chainDict["chainParts"][0]["hypoTrkInfo"].strip("trk"))
67 if "excl" in chainDict["chainName"]:
68 hypo.exclusive = True
69 hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
70 trk = chainDict["chainParts"][0]["hypoTrkInfo"]
71 # this is string of the form 4trk6 - 'number'trk'number'
72 limits = trk[0:trk.index("trk")], trk[trk.index("trk")+3:]
73 hypo.minNtrks = int(limits[0])
74 hypo.maxNtrks = int(limits[1])
75 if "mb_pixsptrk" in chainDict["chainName"]: # to be adjusted
76 hypo.minPt = 100*Units.MeV
77 hypo.maxZ0 = 401*Units.millimeter
78
79 # will set here cuts
80 return hypo
81
82def MbtsHypoToolGen(flags, chainDict):
83 hypo = CompFactory.MbtsHypoTool(chainDict["chainName"]) # to now no additional settings
84 if chainDict["chainParts"][0]["extra"] in ["vetombts2in", "vetospmbts2in"]:
85 hypo.MbtsCounters=2
86 hypo.MBTSMode=1
87 hypo.Veto=True
88 if '_all_' in chainDict["chainName"]:
89 hypo.AcceptAll = True
90 if "mbMon:online" in chainDict["monGroups"]:
91 hypo.MonTool = MbtsHypoToolMonitoring(flags)
92 else: #default, one counter on each side
93 hypo.MbtsCounters=1
94 return hypo
95
96
97
98def TrigZVertexHypoToolGen(flags, chainDict):
99 hypo = CompFactory.TrigZVertexHypoTool(chainDict["chainName"])
100 if "pusup" in chainDict["chainName"]:
101 hypo.minWeight = int(chainDict["chainParts"][0]["pileupInfo"].removeprefix("pusup"))
102 else:
103 hypo.minWeight = -1 # pass always
104
105 return hypo
106
107@AccumulatorCache
108def MinBiasSPSel(flags):
109
110 reco = InViewRecoCA("SPCountingReco")
111 minBiasFlags = flags.cloneAndReplace("Tracking.ActiveConfig","Trigger.InDetTracking.minBias")
112
113 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
114 seq = InnerTrackingTrigSequence.create(minBiasFlags,
115 minBiasFlags.Tracking.ActiveConfig.input_name, # this is already in the flags, maybe we would not need to pass it in the future?
116 rois = str(reco.inputMaker().InViewRoIs),
117 inView = str(reco.inputMaker().Views))
118 spMakingCA = seq.sequence("spacePointFormation")
119
120 reco.mergeReco(spMakingCA)
121
122 # TODO, this is a dependancy of SPcounting
123 vdv = CompFactory.AthViews.ViewDataVerifier( "VDVSPCountingInputs",
124 DataObjects = {( 'PixelID' , 'DetectorStore+PixelID' ),
125 ( 'SCT_ID' , 'DetectorStore+SCT_ID' )} )
126 reco.addRecoAlgo(vdv)
127
128 from TrigMinBias.MinBiasCountersConfig import SPCounterRecoAlgCfg
129 reco.mergeReco(SPCounterRecoAlgCfg(flags))
130
131 selAcc = SelectionCA("MinBiasSPCounting")
132 selAcc.mergeReco(reco)
133 spCountHypo = CompFactory.SPCountHypoAlg(SpacePointsKey=recordable("HLT_SpacePointCounts"))
134 selAcc.addHypoAlgo(spCountHypo)
135 return selAcc
136
138 selAcc = MinBiasSPSel(flags)
139 return MenuSequence(flags, selAcc, HypoToolGen = SPCountHypoToolGen)
140
142 recoAcc = InViewRecoCA(name="ZVertFinderReco", InViewRoIs="InputRoI", RequireParentView=True)
143 vdv = CompFactory.AthViews.ViewDataVerifier( "VDVZFinderInputs",
144 DataObjects = {( 'SpacePointContainer' , 'StoreGateSvc+PixelTrigSpacePoints'),
145 ( 'PixelID' , 'DetectorStore+PixelID' ) })
146
147 recoAcc.addRecoAlgo(vdv)
148 from IDScanZFinder.ZFinderAlgConfig import MinBiasZFinderCfg
149 recoAcc.mergeReco( MinBiasZFinderCfg(flags) )
150 selAcc = SelectionCA("ZVertexFinderSel")
151 selAcc.mergeReco(recoAcc)
152 selAcc.addHypoAlgo( CompFactory.TrigZVertexHypoAlg("TrigZVertexHypoAlg", ZVertexKey=recordable("HLT_vtx_z")))
153 return MenuSequence(flags, selAcc, HypoToolGen = TrigZVertexHypoToolGen)
154
155
157 recoAcc = InViewRecoCA(name="MBTrackReco", InViewRoIs="InputRoI", RequireParentView=True)
158
159 from TrigInDetConfig.utils import getFlagsForActiveConfig
160 flagsWithTrk = getFlagsForActiveConfig(flags, "minBias", log)
161
162 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
163 trkSeq = InnerTrackingTrigSequence.create(flagsWithTrk,
164 flagsWithTrk.Tracking.ActiveConfig.input_name,
165 rois = "InputRoI",
166 inView = "VDVMinBiasIDTracking") # here
167
168 recoAcc.mergeReco(trkSeq.sequence("OfflineNoDataPrep"))
169
170 selAcc = SelectionCA("MBTrackCountSel")
171 selAcc.mergeReco(recoAcc)
172 from TrigMinBias.MinBiasCountersConfig import TrackCounterHypoAlgCfg
173 trackCountHypoAlgo = TrackCounterHypoAlgCfg(flagsWithTrk)
174 selAcc.mergeHypo(trackCountHypoAlgo)
175 return MenuSequence(flagsWithTrk, selAcc, HypoToolGen = TrackCountHypoToolGen)
176
177
179 recoAcc = InViewRecoCA(name="MBPixelTrackReco", InViewRoIs="InputRoI", RequireParentView=True)
180
181 from TrigInDetConfig.utils import getFlagsForActiveConfig
182 flagsWithTrk = getFlagsForActiveConfig(flags, "minBiasPixel", log)
183
184 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
185 trkSeq = InnerTrackingTrigSequence.create(flagsWithTrk,
186 flagsWithTrk.Tracking.ActiveConfig.input_name,
187 rois = "InputRoI",
188 inView = "VDVMinBiasIDTracking") # here
189
190 recoAcc.mergeReco(trkSeq.sequence("OfflineNoDataPrep"))
191
192 selAcc = SelectionCA("MBPixelTrackCountSel")
193 selAcc.mergeReco(recoAcc)
194 from TrigMinBias.MinBiasCountersConfig import PixelTrackCounterHypoAlgCfg
195 trackCountHypoAlgo = PixelTrackCounterHypoAlgCfg(flagsWithTrk)
196 selAcc.mergeHypo(trackCountHypoAlgo)
197 return MenuSequence(flagsWithTrk, selAcc, HypoToolGen = TrackCountHypoToolGen)
198
199
200
202 recoAcc = InEventRecoCA(name="Mbts")
203
204 from TrigMinBias.MbtsConfig import MbtsFexCfg, MbtsSGInputCfg
205 recoAcc.mergeReco(MbtsSGInputCfg(flags))
206
207 fex = MbtsFexCfg(flags, MbtsBitsKey = recordable("HLT_MbtsBitsContainer"))
208 recoAcc.mergeReco(fex)
209
210 selAcc = SelectionCA("MbtsSel")
211 selAcc.mergeReco(recoAcc)
212
213 hypo = CompFactory.MbtsHypoAlg("MbtsHypoAlg", MbtsBitsKey = fex.getPrimary().MbtsBitsKey)
214 selAcc.addHypoAlgo(hypo)
215
216 return MenuSequence(flags,
217 selAcc,
218 HypoToolGen = MbtsHypoToolGen)
219
220
221if __name__ == "__main__":
222 from AthenaConfiguration.AllConfigFlags import initConfigFlags
223 flags = initConfigFlags()
224 flags.lock()
226 zf.ca.printConfig(withDetails=True)
227
229 mb.ca.printConfig()
230
231