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, MenuSequenceCA
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 
38  return hypo
39 
40 
41 def TrackCountHypoToolGen(chainDict):
42  def ptToGeV(v):
43  if "p" in v:
44  sv = v.split("p")
45  return int(sv[0])+0.1*int(sv[1])
46  else:
47  return int(v)
48 
49  hypo = CompFactory.TrackCountHypoTool(chainDict["chainName"])
50  if "hmt" in chainDict["chainName"]:
51  hypo.minNtrks = int(chainDict["chainParts"][0]["hypoTrkInfo"].strip("trk"))
52  hypo.minPt = 200*Units.MeV
53  if "pusup" in chainDict["chainName"]:
54  hypo.maxVertexZ = 10*Units.mm
55  if "mb_sptrk" in chainDict["chainName"]:
56  hypo.minPt = 100*Units.MeV
57  hypo.maxZ0 = 401*Units.millimeter
58  if "mb_sptrk_pt" in chainDict["chainName"]:
59  hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
60  hypo.maxZ0 = 401*Units.millimeter
61  if "excl" in chainDict["chainName"]:
62  hypo.exclusive = True
63  hypo.minPt = ptToGeV(chainDict["chainParts"][0]["hypoPtInfo"].strip("pt"))*Units.GeV
64  trk = chainDict["chainParts"][0]["hypoTrkInfo"]
65  # this is string of the form 4trk6 - 'number'trk'number'
66  limits = trk[0:trk.index("trk")], trk[trk.index("trk")+3:]
67  hypo.minNtrks = int(limits[0])
68  hypo.maxNtrks = int(limits[1])
69 
70  # will set here cuts
71  return hypo
72 
73 def MbtsHypoToolGen(flags, chainDict):
74  hypo = CompFactory.MbtsHypoTool(chainDict["chainName"]) # to now no additional settings
75  if chainDict["chainParts"][0]["extra"] in ["vetombts2in", "vetospmbts2in"]:
76  hypo.MbtsCounters=2
77  hypo.MBTSMode=1
78  hypo.Veto=True
79  if '_all_' in chainDict["chainName"]:
80  hypo.AcceptAll = True
81  if "mbMon:online" in chainDict["monGroups"]:
82  hypo.MonTool = MbtsHypoToolMonitoring(flags)
83  else: #default, one counter on each side
84  hypo.MbtsCounters=1
85  return hypo
86 
87 
88 
89 def TrigZVertexHypoToolGen(chainDict):
90  hypo = CompFactory.TrigZVertexHypoTool(chainDict["chainName"])
91  if "pusup" in chainDict["chainName"]:
92  hypo.minWeight = int(chainDict["chainParts"][0]["pileupInfo"].removeprefix("pusup"))
93  else:
94  hypo.minWeight = -1 # pass always
95 
96  return hypo
97 
98 @AccumulatorCache
99 def MinBiasSPSel(flags):
100 
101  reco = InViewRecoCA("SPCountingReco")
102  minBiasFlags = flags.cloneAndReplace("Tracking.ActiveConfig","Trigger.InDetTracking.minBias")
103 
104  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
105  seq = InnerTrackingTrigSequence.create(minBiasFlags,
106  minBiasFlags.Tracking.ActiveConfig.input_name, # this is already in the flags, maybe we would not need to pass it in the future?
107  rois = str(reco.inputMaker().InViewRoIs),
108  inView = str(reco.inputMaker().Views))
109  spMakingCA = seq.sequence("spacePointFormation")
110 
111  reco.mergeReco(spMakingCA)
112 
113  # TODO, this is a dependancy of SPcounting
114  vdv = CompFactory.AthViews.ViewDataVerifier( "VDVSPCountingInputs",
115  DataObjects = {( 'PixelID' , 'DetectorStore+PixelID' ),
116  ( 'SCT_ID' , 'DetectorStore+SCT_ID' )} )
117  reco.addRecoAlgo(vdv)
118 
119  from TrigMinBias.MinBiasCountersConfig import SPCounterRecoAlgCfg
120  reco.mergeReco(SPCounterRecoAlgCfg(flags))
121 
122  selAcc = SelectionCA("MinBiasSPCounting")
123  selAcc.mergeReco(reco)
124  spCountHypo = CompFactory.SPCountHypoAlg(SpacePointsKey=recordable("HLT_SpacePointCounts"))
125  selAcc.addHypoAlgo(spCountHypo)
126  return selAcc
127 
129  selAcc = MinBiasSPSel(flags)
130  return MenuSequenceCA(flags, selAcc, HypoToolGen = SPCountHypoToolGen)
131 
133  recoAcc = InViewRecoCA(name="ZVertFinderReco", InViewRoIs="InputRoI", RequireParentView=True)
134  vdv = CompFactory.AthViews.ViewDataVerifier( "VDVZFinderInputs",
135  DataObjects = {( 'SpacePointContainer' , 'StoreGateSvc+PixelTrigSpacePoints'),
136  ( 'PixelID' , 'DetectorStore+PixelID' ) })
137 
138  recoAcc.addRecoAlgo(vdv)
139  from IDScanZFinder.ZFinderAlgConfig import MinBiasZFinderCfg
140  recoAcc.mergeReco( MinBiasZFinderCfg(flags) )
141  selAcc = SelectionCA("ZVertexFinderSel")
142  selAcc.mergeReco(recoAcc)
143  selAcc.addHypoAlgo( CompFactory.TrigZVertexHypoAlg("TrigZVertexHypoAlg", ZVertexKey=recordable("HLT_vtx_z")))
144  return MenuSequenceCA(flags, selAcc, HypoToolGen = TrigZVertexHypoToolGen)
145 
146 
148  recoAcc = InViewRecoCA(name="MBTrackReco", InViewRoIs="InputRoI", RequireParentView=True)
149 
150  from TrigInDetConfig.utils import getFlagsForActiveConfig
151  flagsWithTrk = getFlagsForActiveConfig(flags, "minBias", log)
152 
153  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
154  trkSeq = InnerTrackingTrigSequence.create(flagsWithTrk,
155  flagsWithTrk.Tracking.ActiveConfig.input_name,
156  rois = "InputRoI",
157  inView = "VDVMinBiasIDTracking") # here
158  recoAcc.mergeReco(trkSeq.sequence("OfflineNoDataPrep"))
159 
160  selAcc = SelectionCA("MBTrackCountSel")
161  selAcc.mergeReco(recoAcc)
162  from TrigMinBias.MinBiasCountersConfig import TrackCounterHypoAlgCfg
163  trackCountHypoAlgo = TrackCounterHypoAlgCfg(flagsWithTrk)
164  selAcc.mergeHypo(trackCountHypoAlgo)
165  return MenuSequenceCA(flagsWithTrk, selAcc, HypoToolGen = TrackCountHypoToolGen)
166 
168  recoAcc = InEventRecoCA(name="Mbts")
169  from TrigMinBias.MbtsConfig import MbtsFexCfg, MbtsSGInputCfg
170  fex = MbtsFexCfg(flags, MbtsBitsKey = recordable("HLT_MbtsBitsContainer"))
171  recoAcc.mergeReco(fex)
172  selAcc = SelectionCA("MbtsSel")
173  hypo = CompFactory.MbtsHypoAlg("MbtsHypoAlg", MbtsBitsKey = fex.getPrimary().MbtsBitsKey)
174  selAcc.mergeReco(recoAcc)
175  selAcc.addHypoAlgo(hypo)
176 
177  return MenuSequenceCA(flags,
178  selAcc,
179  HypoToolGen = MbtsHypoToolGen,
180  globalRecoCA = MbtsSGInputCfg(flags))
181 
182 
183 if __name__ == "__main__":
184  from AthenaConfiguration.AllConfigFlags import initConfigFlags
185  flags = initConfigFlags()
186  flags.lock()
188  zf.ca.printConfig(withDetails=True)
189 
191  mb.ca.printConfig()
192 
193 
python.HLT.MinBias.MinBiasMenuSequences.TrackCountHypoToolGen
def TrackCountHypoToolGen(chainDict)
Definition: MinBiasMenuSequences.py:41
SystemOfUnits
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.HLT.MinBias.MinBiasMenuSequences.MinBiasZVertexFinderSequenceGenCfg
def MinBiasZVertexFinderSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:132
python.HLT.MinBias.MinBiasMenuSequences.TrigZVertexHypoToolGen
def TrigZVertexHypoToolGen(chainDict)
Definition: MinBiasMenuSequences.py:89
python.HLT.MinBias.MinBiasMenuSequences.MinBiasTrkSequenceGenCfg
def MinBiasTrkSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:147
python.MbtsConfig.MbtsFexCfg
def MbtsFexCfg(flags, name="MbtsFex", MbtsBitsKey=None)
Definition: MbtsConfig.py:7
python.MinBiasCountersConfig.SPCounterRecoAlgCfg
def SPCounterRecoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:9
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:167
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:73
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSel
def MinBiasSPSel(flags)
Definition: MinBiasMenuSequences.py:99
python.HLT.MinBias.MinBiasMenuSequences.MinBiasSPSequenceGenCfg
def MinBiasSPSequenceGenCfg(flags)
Definition: MinBiasMenuSequences.py:128
python.MinBiasCountersConfig.TrackCounterHypoAlgCfg
def TrackCounterHypoAlgCfg(flags)
Definition: MinBiasCountersConfig.py:17
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:30
str
Definition: BTagTrackIpAccessor.cxx:11
python.TrigMinBiasMonitoring.MbtsHypoToolMonitoring
def MbtsHypoToolMonitoring(flags)
Definition: TrigMinBiasMonitoring.py:40