ATLAS Offline Software
MinBiasMenuSequences.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 #
4 from TrigEDMConfig.TriggerEDM import recordable
5 import AthenaCommon.SystemOfUnits as Units
6 from TrigMinBias.TrigMinBiasMonitoring import MbtsHypoToolMonitoring
7 
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
10 
11 from ..Config.MenuComponents import InViewRecoCA, InEventRecoCA, SelectionCA, MenuSequence
12 
13 from AthenaCommon.Logging import logging
14 log = logging.getLogger(__name__)
15 
16 
17 def 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 
46 def 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 
82 def 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 
98 def 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
108 def 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 
221 if __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 
python.HLT.MinBias.MinBiasMenuSequences.MinBiasPixelTrkSequenceGenCfg
def MinBiasPixelTrkSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:178
SystemOfUnits
python.MinBiasCountersConfig.PixelTrackCounterHypoAlgCfg
def PixelTrackCounterHypoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:33
python.HLT.MinBias.MinBiasMenuSequences.MinBiasZVertexFinderSequenceGenCfg
def MinBiasZVertexFinderSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:141
python.HLT.MinBias.MinBiasMenuSequences.TrigZVertexHypoToolGen
def TrigZVertexHypoToolGen(flags, chainDict)
Definition: MinBiasMenuSequences.py:98
python.HLT.MinBias.MinBiasMenuSequences.MinBiasTrkSequenceGenCfg
def MinBiasTrkSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:156
python.MbtsConfig.MbtsFexCfg
def MbtsFexCfg(flags, name="MbtsFex", MbtsBitsKey=None)
Definition: MbtsConfig.py:7
python.MinBiasCountersConfig.SPCounterRecoAlgCfg
def SPCounterRecoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:10
python.HLT.MinBias.MinBiasMenuSequences.TrackCountHypoToolGen
def TrackCountHypoToolGen(flags, chainDict)
Definition: MinBiasMenuSequences.py:46
python.HLT.MinBias.MinBiasMenuSequences.SPCountHypoToolGen
def SPCountHypoToolGen(flags, chainDict)
Definition: MinBiasMenuSequences.py:17
python.utils.getFlagsForActiveConfig
AthConfigFlags getFlagsForActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
Definition: Trigger/TrigTools/TrigInDetConfig/python/utils.py:9
ZFinderAlgConfig.MinBiasZFinderCfg
def MinBiasZFinderCfg(flags)
Definition: ZFinderAlgConfig.py:7
python.HLT.MinBias.MinBiasMenuSequences.MinBiasMbtsSequenceGenCfg
def MinBiasMbtsSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:201
python.MbtsConfig.MbtsSGInputCfg
def MbtsSGInputCfg(flags)
Definition: MbtsConfig.py:21
python.HLT.MinBias.MinBiasMenuSequences.MbtsHypoToolGen
def MbtsHypoToolGen(flags, chainDict)
Definition: MinBiasMenuSequences.py:82
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSel
def MinBiasSPSel(flags)
Definition: MinBiasMenuSequences.py:108
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSequenceGenCfg
def MinBiasSPSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:137
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.MinBiasCountersConfig.TrackCounterHypoAlgCfg
def TrackCounterHypoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:20
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:37
str
Definition: BTagTrackIpAccessor.cxx:11
python.TrigMinBiasMonitoring.MbtsHypoToolMonitoring
def MbtsHypoToolMonitoring(flags)
Definition: TrigMinBiasMonitoring.py:41