ATLAS Offline Software
TrigMultiTrkComboHypoConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from TrigBphysHypo.TrigMultiTrkComboHypoMonitoringConfig import TrigMultiTrkComboHypoMonitoring, TrigMultiTrkComboHypoToolMonitoring
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaCommon.Logging import logging
7 log = logging.getLogger('TrigMultiTrkComboHypoConfig')
8 
9 trigMultiTrkComboHypoToolDict = {
10  'bJpsimumu' : { 'massRange' : (2500., 4300.), 'chi2' : 20. },
11  'bJpsi' : { 'massRange' : (2500., 4300.), 'chi2' : 20. },
12  'bJpsimutrk' : { 'massRange' : (2600., 3600.), 'chi2' : 20. },
13  'bUpsimumu' : { 'massRange' : (8000., 12000.), 'chi2' : 20. },
14  'bUpsi' : { 'massRange' : (8000., 12000.), 'chi2' : 20. },
15  'bDimu' : { 'massRange' : (1500., 14000.), 'chi2' : 20. },
16  'bDimu2700' : { 'massRange' : ( 100., 2700.), 'chi2' : 20. },
17  'bDimu6000' : { 'massRange' : ( 100., 6000.), 'chi2' : 20. },
18  'bBmumu' : { 'massRange' : (4000., 8500.), 'chi2' : 20. },
19  'bPhi' : { 'massRange' : ( 940., 1100.), 'chi2' : 10. },
20  'bTau' : { 'massRange' : ( 0., 2700.), 'chi2' : 50. },
21  'b3mu' : { 'massRange' : ( 100., 10000.), 'chi2' : 30., 'nTrk' : 3, 'charge' : 1 },
22  'bBeeM6000' : { 'massRange' : ( 100., 6000.), 'chi2' : 20. },
23  'b0dRAB12vtx20' : { 'massRange' : ( 0., 999999999.), 'chi2' : 20., 'deltaRMax' : 1.2 },
24  'b0dRAB207invmAB22vtx20': { 'massRange' : ( 7000., 22000.), 'chi2' : 20., 'deltaRMax' : 2.0 },
25  'b0dRAB127invmAB22vtx20': { 'massRange' : ( 7000., 22000.), 'chi2' : 20., 'deltaRMax' : 1.2 },
26  'b7invmAB22vtx20' : { 'massRange' : ( 7000., 22000.), 'chi2' : 20., 'charge' : -1 },
27  'b7invmAB9vtx20' : { 'massRange' : ( 7000., 9000.), 'chi2' : 20., 'charge' : -1 },
28  'b11invmAB60vtx20' : { 'massRange' : ( 11000., 60000.), 'chi2' : 20., 'charge' : -1 },
29  'b11invmAB24vtx20' : { 'massRange' : ( 11000., 24000.), 'chi2' : 20., 'charge' : -1 },
30  'b24invmAB60vtx20' : { 'massRange' : ( 24000., 60000.), 'chi2' : 20., 'charge' : -1 }
31 }
32 
33 
34 def StreamerDimuL2ComboHypoCfg(flags, name):
35  log.debug('DimuL2ComboHypoCfg.name = %s ', name)
36  kwargs = {"isStreamer" : True,
37  "trigSequenceName" : 'Dimu',
38  "trigLevel" : 'L2',
39  "TrackCollectionKey" : 'HLT_IDTrack_Muon_FTF'}
40  return ConfigurationComboHypo(flags, **kwargs)
41 
43  log.debug('DimuL2IOComboHypoCfg.name = %s ', name)
44  kwargs = {"isStreamer" : True,
45  "trigSequenceName" : 'Dimu',
46  "trigLevel" : 'L2IO' }
47  return ConfigurationComboHypo(flags, **kwargs)
48 
50  log.debug('DimuL2MTComboHypoCfg.name = %s ', name)
51  kwargs = { "isStreamer" : True,
52  "trigSequenceName" : 'Dimu',
53  "trigLevel" : 'L2MT' }
54  return ConfigurationComboHypo(flags, **kwargs)
55 
56 def DimuEFComboHypoCfg(flags, name):
57  log.debug('DimuEFComboHypoCfg.name = %s ', name)
58  kwargs = {"isStreamer" : False,
59  "trigSequenceName" : 'Dimu',
60  "trigLevel" : 'EF',
61  "checkMultiplicity" : True,
62  "TrigBphysCollectionKey" : 'HLT_DimuEF'}
63  return ConfigurationComboHypo(flags, **kwargs)
64 
65 def StreamerDimuEFComboHypoCfg(flags, name):
66  log.debug('StreamerDimuEFComboHypoCfg.name = %s ', name)
67  kwargs = {"isStreamer" : True,
68  "trigSequenceName" : 'StreamerDimu',
69  "nTracks" : [ 2 ],
70  "chi2" : 20.,
71  "massRange" : [ (100., 6000.) ],
72  "trackPtThresholds" : [ [ 100., 100. ] ],
73  "trigLevel" : 'EF'}
74  return ConfigurationComboHypo(flags, **kwargs)
75 
77  log.debug('DiElecPrecisionGSFComboHypoCfg.name = %s ', name)
78  kwargs = {"isStreamer" : False,
79  "trigSequenceName" : 'DiElecPrecisionGSF',
80  "trigLevel" : 'EF',
81  "doElectrons" : True,
82  "TrigBphysCollectionKey" : 'HLT_DiElecPrecisionGSF'}
83  return ConfigurationComboHypo(flags, **kwargs)
84 
86  log.debug('NoMuonDiElecPrecisionGSFComboHypoCfg.name = %s ', name)
87  kwargs = {"isStreamer" : False,
88  "trigSequenceName" : 'NoMuonDiElecPrecisionGSF',
89  "trigLevel" : 'EF',
90  "doElectrons" : True,
91  "TrigBphysCollectionKey" : 'HLT_NoMuonDiElecPrecisionGSF' }
92  return ConfigurationComboHypo(flags, **kwargs)
93 
94 def BmutrkComboHypoCfg(flags, name):
95  log.debug('BmutrkComboHypoCfg.name = %s ', name)
96  kwargs = {"isStreamer" : False,
97  "trigSequenceName" : 'Bmutrk',
98  "trigLevel" : 'EF',
99  "TrackCollectionKey" : 'HLT_IDTrack_Bmumux_IDTrig',
100  "isMuTrkMode" : True,
101  "chi2" : 20.,
102  "nTracks" : [ 2 ],
103  "totalCharge" : [ 0 ],
104  "massRange" : [ (2500., 4400.) ],
105  "trackPtThresholds" : [ [ 10000., 2000. ] ],
106  "TrigBphysCollectionKey" : 'HLT_Bmutrk'}
107  return ConfigurationComboHypo(flags, **kwargs)
108 
109 def DrellYanComboHypoCfg(flags, name):
110  log.debug('DrellYanComboHypoCfg.name = %s ', name)
111  kwargs = {"isStreamer" : False,
112  "trigSequenceName" : 'DrellYan',
113  "trigLevel" : 'EF',
114  "nTracks" : [ 2 ],
115  "totalCharge" : [ -1 ],
116  "massRange" : [ (7000., 60000.) ],
117  "trackPtThresholds" : [ [ 100., 100. ] ],
118  "chi2" : 20.,
119  "combineInputDecisionCollections" : True,
120  "applyOverlapRemoval" : False,
121  "useLeptonMomentum" : True,
122  "TrigBphysCollectionKey" : 'HLT_DrellYan'}
123  return ConfigurationComboHypo(flags, **kwargs)
124 
125 def TrigMultiTrkComboHypoToolFromDict(flags, chainDict):
126  return ConfigurationComboHypoTool(flags, chainDict)
127 
128 
129 def ConfigurationComboHypo(flags, trigSequenceName = 'Dimu', **kwargs):
130 
131  kwargs.setdefault("isStreamer", False)
132  kwargs.setdefault("trigLevel", 'L2')
133  kwargs.setdefault("TrackCollectionKey", '')
134  kwargs.setdefault("TrigBphysCollectionKey", 'TrigBphysContainer')
135  kwargs.setdefault("CheckMultiplicityMap", False)
136  kwargs.setdefault("doElectrons", False)
137  trigLevel = kwargs['trigLevel']
138  acc = ComponentAccumulator()
139  trigLevelDict = {'L2':0, 'L2IO':1, 'L2MT':2, 'EF':3}
140  try:
141  value = trigLevelDict[trigLevel]
142  log.debug('TrigMultiTrkComboHypo.trigLevel = %s ', value)
143  except KeyError:
144  raise Exception('TrigMultiTrkComboHypo.trigLevel should be L2, L2IO, L2MT or EF, but %s provided.', trigLevel)
145 
146  baseName = 'Streamer'+trigSequenceName+trigLevel if kwargs['isStreamer'] else trigSequenceName+trigLevel
147 
148  from TrigBphysHypo.TrigBPhyCommonConfig import TrigBPHY_TrkVKalVrtFitterCfg
149  from InDetConfig.InDetConversionFinderToolsConfig import BPHY_VertexPointEstimatorCfg
150  from TrkConfig.TrkVertexAnalysisUtilsConfig import V0ToolsCfg
151  if kwargs["doElectrons"]:
152  kwargs.setdefault("nTracks", [ 2 ])
153  kwargs.setdefault("trackPtThresholds", [ [ -1., -1. ] ])
154  kwargs.setdefault("massRange", [ (100., 20000.) ])
155  kwargs.setdefault("mergedElectronChains", [ 'BPH-0DR3-EM7J15', 'HLT_e5_lhvloose_bBeeM6000', 'HLT_e5_lhvloose_L1eEM5_bBeeM6000', 'HLT_e5_lhvloose_L1EM3_bBeeM6000' ])
156  kwargs.setdefault("caloClusterEtThreshold", 3.)
157  alg = CompFactory.TrigMultiTrkComboHypo(
158  name = baseName+'ComboHypo',
159  VertexFitter = acc.popToolsAndMerge(TrigBPHY_TrkVKalVrtFitterCfg(flags, baseName)),
160  VertexPointEstimator = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, 'VertexPointEstimator_'+baseName)),
161  V0Tools = acc.popToolsAndMerge(V0ToolsCfg(flags, 'V0Tools_'+baseName)),
162  MonTool = TrigMultiTrkComboHypoMonitoring(flags, 'TrigMultiTrkComboHypoMonitoring_'+baseName),
163  **kwargs)
164  acc.addEventAlgo(alg, primary=True)
165  return acc
166  else:
167  kwargs.setdefault("nTracks", [ 2, 3 ])
168  kwargs.setdefault("trackPtThresholds", [ [ 3650., 3650. ], [ 3650., 3650., 3650. ] ])
169  kwargs.setdefault("massRange", [ (100., 20000.), (0., 11000.) ])
170  alg = CompFactory.TrigMultiTrkComboHypo(
171  name = baseName+'ComboHypo',
172  VertexFitter = acc.popToolsAndMerge(TrigBPHY_TrkVKalVrtFitterCfg(flags, baseName)),
173  VertexPointEstimator = acc.popToolsAndMerge(BPHY_VertexPointEstimatorCfg(flags, 'VertexPointEstimator_'+baseName)),
174  V0Tools = acc.popToolsAndMerge(V0ToolsCfg(flags, 'V0Tools_'+baseName)),
175  MonTool = TrigMultiTrkComboHypoMonitoring(flags, 'TrigMultiTrkComboHypoMonitoring_'+baseName),
176  **kwargs)
177 
178  acc.addEventAlgo(alg, primary=True)
179  return acc
180 
181 def ConfigurationComboHypoTool(flags, chainDict):
182 
183  tool = CompFactory.TrigMultiTrkComboHypoTool(chainDict['chainName'])
184 
185  try:
186  topo = chainDict['topo'][0]
187  value = trigMultiTrkComboHypoToolDict[topo]
188  tool.massRange = value['massRange']
189  tool.chi2 = value['chi2']
190  tool.nTrk = value['nTrk'] if 'nTrk' in value else 2
191  tool.totalCharge = value['charge'] if 'charge' in value else 0
192  if 'deltaRMin' in value:
193  tool.deltaRMin = value['deltaRMin']
194  if 'deltaRMax' in value:
195  tool.deltaRMax = value['deltaRMax']
196  except LookupError:
197  raise Exception('TrigMultiTrkComboHypo misconfigured for \'%s\': topo \'%s\' is not supported.', chainDict['chainName'], topo)
198 
199  if 'nocut' in chainDict['topo']:
200  tool.AcceptAll = True
201 
202  if 'noos' in chainDict['topo']:
203  tool.totalCharge = -100 # negative number to indicate no charge cut
204 
205  if 'Lxy0' in chainDict['topo']:
206  tool.LxyCut = 0.0
207 
208  if 'sigmaLxy3' in chainDict['topo']:
209  tool.sigmaLxyCut = 3.
210 
211  electronMultiplicity = [int(chainPart['multiplicity']) for chainPart in chainDict['chainParts'] if chainPart['signature']=='Electron']
212  if len(electronMultiplicity) == 1 and electronMultiplicity[0] == 1:
213  tool.isMergedElectronChain = True
214 
215  if 'bJpsimutrk' in chainDict['topo']:
216  tool.isMuonTrkPEB = True
217  tool.totalCharge = 0
218  tool.trackPtThresholds = [-1., 2000.] if 'lowpt' in chainDict['topo'] else [-1., 3000.]
219 
220  if 'bTau' in chainDict['topo']:
221  tool.nTrk = sum(int(chainPart['multiplicity']) for chainPart in chainDict['chainParts'])
222  tool.totalCharge = 1 if tool.nTrk == 3 else -1
223 
224  signatures = chainDict['signatures']
225  tool.isCombinedChain = (signatures.count(signatures[0]) != len(signatures))
226  tool.legMultiplicities = chainDict['chainMultiplicities']
227 
228  monGroups = ['bphysMon:online']
229  if any(group in monGroups for group in chainDict['monGroups']):
230  tool.MonTool = TrigMultiTrkComboHypoToolMonitoring(flags, 'MonTool')
231  return tool
232 
TrigMultiTrkComboHypoConfig.DrellYanComboHypoCfg
def DrellYanComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:109
TrigMultiTrkComboHypoMonitoringConfig.TrigMultiTrkComboHypoToolMonitoring
def TrigMultiTrkComboHypoToolMonitoring(flags, name)
Definition: TrigMultiTrkComboHypoMonitoringConfig.py:36
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigMultiTrkComboHypoMonitoringConfig.TrigMultiTrkComboHypoMonitoring
def TrigMultiTrkComboHypoMonitoring(flags, name)
Definition: TrigMultiTrkComboHypoMonitoringConfig.py:5
python.TrkVertexAnalysisUtilsConfig.V0ToolsCfg
def V0ToolsCfg(flags, name="V0Tools", **kwargs)
Definition: TrkVertexAnalysisUtilsConfig.py:6
TrigMultiTrkComboHypoConfig.StreamerDimuL2IOComboHypoCfg
def StreamerDimuL2IOComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:42
TrigMultiTrkComboHypoConfig.DiElecPrecisionGSFComboHypoCfg
def DiElecPrecisionGSFComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:76
TrigMultiTrkComboHypoConfig.DimuEFComboHypoCfg
def DimuEFComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:56
TrigBPhyCommonConfig.TrigBPHY_TrkVKalVrtFitterCfg
def TrigBPHY_TrkVKalVrtFitterCfg(flags, suffix, **kwargs)
Definition: TrigBPhyCommonConfig.py:3
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
TrigMultiTrkComboHypoConfig.StreamerDimuEFComboHypoCfg
def StreamerDimuEFComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:65
TrigMultiTrkComboHypoConfig.TrigMultiTrkComboHypoToolFromDict
def TrigMultiTrkComboHypoToolFromDict(flags, chainDict)
Definition: TrigMultiTrkComboHypoConfig.py:125
TrigMultiTrkComboHypoConfig.StreamerDimuL2ComboHypoCfg
def StreamerDimuL2ComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:34
TrigMultiTrkComboHypoConfig.BmutrkComboHypoCfg
def BmutrkComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:94
TrigMultiTrkComboHypoConfig.NoMuonDiElecPrecisionGSFComboHypoCfg
def NoMuonDiElecPrecisionGSFComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:85
python.InDetConversionFinderToolsConfig.BPHY_VertexPointEstimatorCfg
def BPHY_VertexPointEstimatorCfg(flags, name="BPHY_VertexPointEstimator", **kwargs)
Definition: InDetConversionFinderToolsConfig.py:69
TrigMultiTrkComboHypoConfig.ConfigurationComboHypoTool
def ConfigurationComboHypoTool(flags, chainDict)
Definition: TrigMultiTrkComboHypoConfig.py:181
TrigMultiTrkComboHypoConfig.ConfigurationComboHypo
def ConfigurationComboHypo(flags, trigSequenceName='Dimu', **kwargs)
Definition: TrigMultiTrkComboHypoConfig.py:129
TrigMultiTrkComboHypoConfig.StreamerDimuL2MTComboHypoCfg
def StreamerDimuL2MTComboHypoCfg(flags, name)
Definition: TrigMultiTrkComboHypoConfig.py:49