ATLAS Offline Software
MinBiasMenuSequences.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 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(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(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 "mb_sptrk_pt" in chainDict["chainName"]:
64  hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
65  hypo.maxZ0 = 401*Units.millimeter
66  if "excl" in chainDict["chainName"]:
67  hypo.exclusive = True
68  hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
69  trk = chainDict["chainParts"][0]["hypoTrkInfo"]
70  # this is string of the form 4trk6 - 'number'trk'number'
71  limits = trk[0:trk.index("trk")], trk[trk.index("trk")+3:]
72  hypo.minNtrks = int(limits[0])
73  hypo.maxNtrks = int(limits[1])
74  if "mb_pixsptrk" in chainDict["chainName"]: # to be adjusted
75  hypo.minPt = 100*Units.MeV
76  hypo.maxZ0 = 401*Units.millimeter
77 
78  # will set here cuts
79  return hypo
80 
81 def MbtsHypoToolGen(flags, chainDict):
82  hypo = CompFactory.MbtsHypoTool(chainDict["chainName"]) # to now no additional settings
83  if chainDict["chainParts"][0]["extra"] in ["vetombts2in", "vetospmbts2in"]:
84  hypo.MbtsCounters=2
85  hypo.MBTSMode=1
86  hypo.Veto=True
87  if '_all_' in chainDict["chainName"]:
88  hypo.AcceptAll = True
89  if "mbMon:online" in chainDict["monGroups"]:
90  hypo.MonTool = MbtsHypoToolMonitoring(flags)
91  else: #default, one counter on each side
92  hypo.MbtsCounters=1
93  return hypo
94 
95 
96 
97 def TrigZVertexHypoToolGen(chainDict):
98  hypo = CompFactory.TrigZVertexHypoTool(chainDict["chainName"])
99  if "pusup" in chainDict["chainName"]:
100  hypo.minWeight = int(chainDict["chainParts"][0]["pileupInfo"].removeprefix("pusup"))
101  else:
102  hypo.minWeight = -1 # pass always
103 
104  return hypo
105 
106 @AccumulatorCache
107 def MinBiasSPSel(flags):
108 
109  reco = InViewRecoCA("SPCountingReco")
110  minBiasFlags = flags.cloneAndReplace("Tracking.ActiveConfig","Trigger.InDetTracking.minBias")
111 
112  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
113  seq = InnerTrackingTrigSequence.create(minBiasFlags,
114  minBiasFlags.Tracking.ActiveConfig.input_name, # this is already in the flags, maybe we would not need to pass it in the future?
115  rois = str(reco.inputMaker().InViewRoIs),
116  inView = str(reco.inputMaker().Views))
117  spMakingCA = seq.sequence("spacePointFormation")
118 
119  reco.mergeReco(spMakingCA)
120 
121  # TODO, this is a dependancy of SPcounting
122  vdv = CompFactory.AthViews.ViewDataVerifier( "VDVSPCountingInputs",
123  DataObjects = {( 'PixelID' , 'DetectorStore+PixelID' ),
124  ( 'SCT_ID' , 'DetectorStore+SCT_ID' )} )
125  reco.addRecoAlgo(vdv)
126 
127  from TrigMinBias.MinBiasCountersConfig import SPCounterRecoAlgCfg
128  reco.mergeReco(SPCounterRecoAlgCfg(flags))
129 
130  selAcc = SelectionCA("MinBiasSPCounting")
131  selAcc.mergeReco(reco)
132  spCountHypo = CompFactory.SPCountHypoAlg(SpacePointsKey=recordable("HLT_SpacePointCounts"))
133  selAcc.addHypoAlgo(spCountHypo)
134  return selAcc
135 
137  selAcc = MinBiasSPSel(flags)
138  return MenuSequence(flags, selAcc, HypoToolGen = SPCountHypoToolGen)
139 
141  recoAcc = InViewRecoCA(name="ZVertFinderReco", InViewRoIs="InputRoI", RequireParentView=True)
142  vdv = CompFactory.AthViews.ViewDataVerifier( "VDVZFinderInputs",
143  DataObjects = {( 'SpacePointContainer' , 'StoreGateSvc+PixelTrigSpacePoints'),
144  ( 'PixelID' , 'DetectorStore+PixelID' ) })
145 
146  recoAcc.addRecoAlgo(vdv)
147  from IDScanZFinder.ZFinderAlgConfig import MinBiasZFinderCfg
148  recoAcc.mergeReco( MinBiasZFinderCfg(flags) )
149  selAcc = SelectionCA("ZVertexFinderSel")
150  selAcc.mergeReco(recoAcc)
151  selAcc.addHypoAlgo( CompFactory.TrigZVertexHypoAlg("TrigZVertexHypoAlg", ZVertexKey=recordable("HLT_vtx_z")))
152  return MenuSequence(flags, selAcc, HypoToolGen = TrigZVertexHypoToolGen)
153 
154 
156  recoAcc = InViewRecoCA(name="MBTrackReco", InViewRoIs="InputRoI", RequireParentView=True)
157 
158  from TrigInDetConfig.utils import getFlagsForActiveConfig
159  flagsWithTrk = getFlagsForActiveConfig(flags, "minBias", log)
160 
161  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
162  trkSeq = InnerTrackingTrigSequence.create(flagsWithTrk,
163  flagsWithTrk.Tracking.ActiveConfig.input_name,
164  rois = "InputRoI",
165  inView = "VDVMinBiasIDTracking") # here
166 
167  recoAcc.mergeReco(trkSeq.sequence("OfflineNoDataPrep"))
168 
169  selAcc = SelectionCA("MBTrackCountSel")
170  selAcc.mergeReco(recoAcc)
171  from TrigMinBias.MinBiasCountersConfig import TrackCounterHypoAlgCfg
172  trackCountHypoAlgo = TrackCounterHypoAlgCfg(flagsWithTrk)
173  selAcc.mergeHypo(trackCountHypoAlgo)
174  return MenuSequence(flagsWithTrk, selAcc, HypoToolGen = TrackCountHypoToolGen)
175 
176 
178  recoAcc = InViewRecoCA(name="MBPixelTrackReco", InViewRoIs="InputRoI", RequireParentView=True)
179 
180  from TrigInDetConfig.utils import getFlagsForActiveConfig
181  flagsWithTrk = getFlagsForActiveConfig(flags, "minBiasPixel", log)
182 
183  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
184  trkSeq = InnerTrackingTrigSequence.create(flagsWithTrk,
185  flagsWithTrk.Tracking.ActiveConfig.input_name,
186  rois = "InputRoI",
187  inView = "VDVMinBiasIDTracking") # here
188 
189  recoAcc.mergeReco(trkSeq.sequence("OfflineNoDataPrep"))
190 
191  selAcc = SelectionCA("MBPixelTrackCountSel")
192  selAcc.mergeReco(recoAcc)
193  from TrigMinBias.MinBiasCountersConfig import PixelTrackCounterHypoAlgCfg
194  trackCountHypoAlgo = PixelTrackCounterHypoAlgCfg(flagsWithTrk)
195  selAcc.mergeHypo(trackCountHypoAlgo)
196  return MenuSequence(flagsWithTrk, selAcc, HypoToolGen = TrackCountHypoToolGen)
197 
198 
199 
201  recoAcc = InEventRecoCA(name="Mbts")
202 
203  from TrigMinBias.MbtsConfig import MbtsFexCfg, MbtsSGInputCfg
204  recoAcc.mergeReco(MbtsSGInputCfg(flags))
205 
206  fex = MbtsFexCfg(flags, MbtsBitsKey = recordable("HLT_MbtsBitsContainer"))
207  recoAcc.mergeReco(fex)
208 
209  selAcc = SelectionCA("MbtsSel")
210  selAcc.mergeReco(recoAcc)
211 
212  hypo = CompFactory.MbtsHypoAlg("MbtsHypoAlg", MbtsBitsKey = fex.getPrimary().MbtsBitsKey)
213  selAcc.addHypoAlgo(hypo)
214 
215  return MenuSequence(flags,
216  selAcc,
217  HypoToolGen = MbtsHypoToolGen)
218 
219 
220 if __name__ == "__main__":
221  from AthenaConfiguration.AllConfigFlags import initConfigFlags
222  flags = initConfigFlags()
223  flags.lock()
225  zf.ca.printConfig(withDetails=True)
226 
228  mb.ca.printConfig()
229 
230 
python.HLT.MinBias.MinBiasMenuSequences.MinBiasPixelTrkSequenceGenCfg
def MinBiasPixelTrkSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:177
python.HLT.MinBias.MinBiasMenuSequences.TrackCountHypoToolGen
def TrackCountHypoToolGen(chainDict)
Definition: MinBiasMenuSequences.py:46
SystemOfUnits
python.MinBiasCountersConfig.PixelTrackCounterHypoAlgCfg
def PixelTrackCounterHypoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:33
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.HLT.MinBias.MinBiasMenuSequences.MinBiasZVertexFinderSequenceGenCfg
def MinBiasZVertexFinderSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:140
python.HLT.MinBias.MinBiasMenuSequences.TrigZVertexHypoToolGen
def TrigZVertexHypoToolGen(chainDict)
Definition: MinBiasMenuSequences.py:97
python.HLT.MinBias.MinBiasMenuSequences.MinBiasTrkSequenceGenCfg
def MinBiasTrkSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:155
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.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:200
python.HLT.MinBias.MinBiasMenuSequences.SPCountHypoToolGen
def SPCountHypoToolGen(chainDict)
Definition: MinBiasMenuSequences.py:17
python.MbtsConfig.MbtsSGInputCfg
def MbtsSGInputCfg(flags)
Definition: MbtsConfig.py:21
python.HLT.MinBias.MinBiasMenuSequences.MbtsHypoToolGen
def MbtsHypoToolGen(flags, chainDict)
Definition: MinBiasMenuSequences.py:81
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSel
def MinBiasSPSel(flags)
Definition: MinBiasMenuSequences.py:107
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSequenceGenCfg
def MinBiasSPSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:136
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:34
str
Definition: BTagTrackIpAccessor.cxx:11
python.TrigMinBiasMonitoring.MbtsHypoToolMonitoring
def MbtsHypoToolMonitoring(flags)
Definition: TrigMinBiasMonitoring.py:41