ATLAS Offline Software
TopoAlgoDef.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #
3 # *** IMPORTANT ***
4 # Menu parameter ordering must match that in the L1Topo
5 # firmware generation, document this for every algorithm
6 # and ensure that addvariable order matches
7 # Refer to https://gitlab.cern.ch/atlas-l1calo/l1topo/ph1topo/-/tree/master/src/algo
8 
9 # algorithm python base classes generated from C++ code
10 import L1TopoAlgorithms.L1TopoAlgConfig as AlgConf
11 import L1TopoHardware.L1TopoHardware as HW
12 from .L1CaloThresholdMapping import get_threshold_cut
13 from .L1TopoKFMETweights import KFMETweightParameters
14 
15 from AthenaCommon.Logging import logging
16 log = logging.getLogger(__name__)
17 
18 from collections import namedtuple
19 
21 
22  @staticmethod
24 
25  # constants and conversions:
26  _no_m_upper_threshold = 1024*1024*10*10*10 # a check against this number in L1Topo FW and sim will disable the upper threshold on MaxMSqr
27  _dr_conversion = 4 # factor 10 already included to remove . from name
28  _et_conversion = 10 # 1 GeV -> 100 MeV. This is to be applied also on the pt threholds for muons. A correction is then done L1/Base/TopoAlgos.py
29  _eta_conversion = 4 # factor 10 already included to remove . from name
30  _phi_conversion = 2 # factor 10 already included to remove . from name
31 
32  # eEM inputs
33  # ALL
34  # Parameter ordering:
35  # 1. REtaMin
36  # 2. RHadMin
37  # 3. WsTotMin
38  alg = AlgConf.eEmNoSort( name = 'eEMall', inputs = 'eEmTobs', outputs = 'eEMall' )
39  alg.addgeneric('InputWidth', HW.eEmInputWidth)
40  alg.addgeneric('OutputWidth', HW.eEmInputWidth)
41  alg.addvariable('REtaMin', 0)
42  alg.addvariable('RHadMin', 0)
43  alg.addvariable('WsTotMin', 0)
44  tm.registerTopoAlgo(alg)
45 
46  # SORT
47  # Inherited from NoSort
48  alg = AlgConf.eEmSort( name = 'eEMs', inputs = 'eEmTobs', outputs = 'eEMs' )
49  alg.addgeneric('InputWidth', HW.eEmInputWidth)
50  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSort)
51  alg.addvariable('REtaMin', 0)
52  alg.addvariable('RHadMin', 0)
53  alg.addvariable('WsTotMin', 0)
54  tm.registerTopoAlgo(alg)
55 
56  alg = AlgConf.eEmSort( name = 'eEMsl', inputs = 'eEmTobs', outputs = 'eEMsl' )
57  alg.addgeneric('InputWidth', HW.eEmInputWidth)
58  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSort)
59  alg.addvariable('REtaMin', 1)
60  alg.addvariable('RHadMin', 1)
61  alg.addvariable('WsTotMin', 1)
62  tm.registerTopoAlgo(alg)
63 
64  alg = AlgConf.eEmSort( name = 'eEMsm', inputs = 'eEmTobs', outputs = 'eEMsm' )
65  alg.addgeneric('InputWidth', HW.eEmInputWidth)
66  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSort)
67  alg.addvariable('REtaMin', 2)
68  alg.addvariable('RHadMin', 2)
69  alg.addvariable('WsTotMin', 2)
70  tm.registerTopoAlgo(alg)
71 
72  # SELECT
73  # Inherited from NoSort
74  alg = AlgConf.eEmSelect( name = 'eEMab', inputs = 'eEmTobs', outputs = 'eEMab' )
75  alg.addgeneric('InputWidth', HW.eEmInputWidth)
76  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSelect)
77  alg.addvariable('MinET', get_threshold_cut('eEM', 7)*_et_conversion)
78  alg.addvariable('REtaMin', 0)
79  alg.addvariable('RHadMin', 0)
80  alg.addvariable('WsTotMin', 0)
81  tm.registerTopoAlgo(alg)
82 
83  alg = AlgConf.eEmSelect( name = 'eEMabl', inputs = 'eEmTobs', outputs = 'eEMabl' )
84  alg.addgeneric('InputWidth', HW.eEmInputWidth)
85  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSelect)
86  alg.addvariable('MinET', get_threshold_cut('eEM', 10)*_et_conversion)
87  alg.addvariable('REtaMin', 1)
88  alg.addvariable('RHadMin', 1)
89  alg.addvariable('WsTotMin', 1)
90  tm.registerTopoAlgo(alg)
91 
92  alg = AlgConf.eEmSelect( name = 'eEMabm', inputs = 'eEmTobs', outputs = 'eEMabm' )
93  alg.addgeneric('InputWidth', HW.eEmInputWidth)
94  alg.addgeneric('OutputWidth', HW.eEmOutputWidthSelect)
95  alg.addvariable('MinET', get_threshold_cut('eEM', 10)*_et_conversion)
96  alg.addvariable('REtaMin', 2)
97  alg.addvariable('RHadMin', 2)
98  alg.addvariable('WsTotMin', 2)
99  tm.registerTopoAlgo(alg)
100 
101  # eTAU inputs
102  # all
103  # Parameter ordering:
104  # 1. RCoreMin
105  # 2. RHadMin
106  alg = AlgConf.eTauNoSort( name = 'eTAUall', inputs = 'eTauTobs', outputs = 'eTAUall')
107  alg.addgeneric('InputWidth', HW.eTauInputWidth)
108  alg.addgeneric('OutputWidth', HW.eTauInputWidth)
109  alg.addvariable('RCoreMin', 0)
110  alg.addvariable('RHadMin', 0)
111  tm.registerTopoAlgo(alg)
112 
113  # SORT
114  # Inherited from NoSort
115  alg = AlgConf.eTauSort( name = 'eTAUs', inputs = 'eTauTobs', outputs = 'eTAUs' )
116  alg.addgeneric('InputWidth', HW.eTauInputWidth)
117  alg.addgeneric('OutputWidth', HW.eTauOutputWidthSort)
118  alg.addvariable('RCoreMin', 0)
119  alg.addvariable('RHadMin', 0)
120  tm.registerTopoAlgo(alg)
121 
122  # SELECT
123  # Inherited from NoSort
124  alg = AlgConf.eTauSelect( name = 'eTAUab', inputs = 'eTauTobs', outputs = 'eTAUab' )
125  alg.addgeneric('InputWidth', HW.eTauInputWidth)
126  alg.addgeneric('OutputWidth', HW.eTauOutputWidthSelect)
127  alg.addvariable('MinET', get_threshold_cut('eTAU', 12)*_et_conversion)
128  alg.addvariable('RCoreMin', 0)
129  alg.addvariable('RHadMin', 0)
130  tm.registerTopoAlgo(alg)
131 
132  alg = AlgConf.eTauSelect( name = 'eTAUabm', inputs = 'eTauTobs', outputs = 'eTAUabm' )
133  alg.addgeneric('InputWidth', HW.eTauInputWidth)
134  alg.addgeneric('OutputWidth', HW.eTauOutputWidthSelect)
135  alg.addvariable('MinET', get_threshold_cut('eTAU', 12)*_et_conversion)
136  alg.addvariable('RCoreMin', 2)
137  alg.addvariable('RHadMin', 0)
138  tm.registerTopoAlgo(alg)
139 
140  # Muon inputs
141 
142  # SELECT
143  # Parameter order:
144  # 1. MinEtRPC
145  # 2. MinEtTGC
146  # 3. MinEta
147  # 4. MaxEta
148  # 5. InnerCoinCut
149  # 6. FullStationCut
150  # 7. GoodMFieldCut
151 
152  alg = AlgConf.MuonSelect( name = 'MU3Vab', inputs = 'MuonTobs', outputs = 'MU3Vab' )
153  alg.addgeneric('InputWidth', HW.muonInputWidth)
154  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
155  alg.addvariable('MinEtRPC', 4*_et_conversion)
156  alg.addvariable('MinEtTGC', 3*_et_conversion)
157  alg.addvariable('MinEta', 0*_eta_conversion)
158  alg.addvariable('MaxEta', 25*_eta_conversion)
159  alg.addvariable('InnerCoinCut', 0)
160  alg.addvariable('FullStationCut',0)
161  alg.addvariable('GoodMFieldCut', 0)
162  tm.registerTopoAlgo(alg)
163 
164  alg = AlgConf.MuonSelect( name = 'MU3VFab', inputs = 'MuonTobs', outputs = 'MU3VFab' )
165  alg.addgeneric('InputWidth', HW.muonInputWidth)
166  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
167  alg.addvariable('MinEtRPC', 4*_et_conversion)
168  alg.addvariable('MinEtTGC', 3*_et_conversion)
169  alg.addvariable('MinEta', 0*_eta_conversion)
170  alg.addvariable('MaxEta', 25*_eta_conversion)
171  alg.addvariable('InnerCoinCut', 0)
172  alg.addvariable('FullStationCut',1)
173  alg.addvariable('GoodMFieldCut', 0)
174  tm.registerTopoAlgo(alg)
175 
176  alg = AlgConf.MuonSelect( name = 'MU5VFab', inputs = 'MuonTobs', outputs = 'MU5VFab' )
177  alg.addgeneric('InputWidth', HW.muonInputWidth)
178  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
179  alg.addvariable('MinEtRPC', 6*_et_conversion)
180  alg.addvariable('MinEtTGC', 5*_et_conversion)
181  alg.addvariable('MinEta', 0*_eta_conversion)
182  alg.addvariable('MaxEta', 25*_eta_conversion)
183  alg.addvariable('InnerCoinCut', 0)
184  alg.addvariable('FullStationCut',1)
185  alg.addvariable('GoodMFieldCut', 0)
186  tm.registerTopoAlgo(alg)
187 
188  alg = AlgConf.MuonSelect( name = 'MU8Fab', inputs = 'MuonTobs', outputs = 'MU8Fab' )
189  alg.addgeneric('InputWidth', HW.muonInputWidth)
190  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
191  alg.addvariable('MinEtRPC', 8*_et_conversion)
192  alg.addvariable('MinEtTGC', 8*_et_conversion)
193  alg.addvariable('MinEta', 0*_eta_conversion)
194  alg.addvariable('MaxEta', 25*_eta_conversion)
195  alg.addvariable('InnerCoinCut', 0)
196  alg.addvariable('FullStationCut',1)
197  alg.addvariable('GoodMFieldCut', 0)
198  tm.registerTopoAlgo(alg)
199 
200  alg = AlgConf.MuonSelect( name = 'CMU3Vab', inputs = 'MuonTobs', outputs = 'CMU3Vab' )
201  alg.addgeneric('InputWidth', HW.muonInputWidth)
202  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
203  alg.addvariable('MinEtRPC', 4*_et_conversion)
204  alg.addvariable('MinEtTGC', 3*_et_conversion)
205  alg.addvariable('MinEta', 0*_eta_conversion)
206  alg.addvariable('MaxEta', 10*_eta_conversion)
207  alg.addvariable('InnerCoinCut', 0)
208  alg.addvariable('FullStationCut',0)
209  alg.addvariable('GoodMFieldCut', 0)
210  tm.registerTopoAlgo(alg)
211 
212  alg = AlgConf.MuonSelect( name = 'CMU5VFab', inputs = 'MuonTobs', outputs = 'CMU5VFab' )
213  alg.addgeneric('InputWidth', HW.muonInputWidth)
214  alg.addgeneric('OutputWidth', HW.muonOutputWidthSelect)
215  alg.addvariable('MinEtRPC', 6*_et_conversion)
216  alg.addvariable('MinEtTGC', 5*_et_conversion)
217  alg.addvariable('MinEta', 0*_eta_conversion)
218  alg.addvariable('MaxEta', 10*_eta_conversion)
219  alg.addvariable('InnerCoinCut', 0)
220  alg.addvariable('FullStationCut',1)
221  alg.addvariable('GoodMFieldCut', 0)
222  tm.registerTopoAlgo(alg)
223 
224  #Muon sort
225  alg = AlgConf.MuonSort( name = 'MUs', inputs = 'MuonTobs', outputs = 'MUs' )
226  alg.addgeneric('InputWidth', HW.muonInputWidth)
227  alg.addgeneric('OutputWidth', HW.muonOutputWidthSort)
228  # alg.addvariable('MinET', 4)
229  alg.addvariable('MinEta', 0*_eta_conversion)
230  alg.addvariable('MaxEta', 25*_eta_conversion)
231  alg.addvariable('InnerCoinCut', 0)
232  alg.addvariable('FullStationCut', 0)
233  alg.addvariable('GoodMFieldCut', 0)
234  tm.registerTopoAlgo(alg)
235 
236  #LATE
237  alg = AlgConf.MuonSort_1BC( name = 'LMUs', inputs = 'LateMuonTobArray', outputs = 'LMUs' )
238  alg.addgeneric('InputWidth', HW.muonInputWidth)
239  alg.addgeneric('OutputWidth', 1)
240  alg.addgeneric('nDelayedMuons', 1)
241  alg.addvariable('MinEta', 0*_eta_conversion)
242  alg.addvariable('MaxEta', 25*_eta_conversion)
243  alg.addvariable('InnerCoinCut', 0)
244  alg.addvariable('FullStationCut', 1)
245  alg.addvariable('GoodMFieldCut', 0)
246  tm.registerTopoAlgo(alg)
247 
248  #jJets inputs
249  alg = AlgConf.jJetNoSort( name = 'AjJall_1BC', inputs = 'jJetTobs', outputs = 'AjJall_1BC' )
250  alg.addgeneric('InputWidth', HW.jJetInputWidth)
251  alg.addgeneric('OutputWidth', HW.jJetInputWidth)
252  # reduce number of pipelining registers used in firmware to allow for more
253  # latency to be used inside the KFMET decision algorithm
254  alg.addgeneric('NumRegisters', 1)
255  tm.registerTopoAlgo(alg)
256 
257  #jJ lists
258  # No additional parameters
259  algoList = [
260  {"otype" : "jJ", "ocut" : 50, "olist" : "ab", "etamin" : 0, "etamax" : 32}, # jJab
261  {"otype" : "CjJ", "ocut" : 40, "olist" : "ab", "etamin" : 0, "etamax" : 26}, # CjJab
262  {"otype" : "FjJ", "ocut" : 40, "olist" : "ab", "etamin" : 30, "etamax" : 49}, # FjJab
263  ]
264  for x in algoList:
265  class d:
266  pass
267  for k in x:
268  setattr (d, k, x[k])
269  listname = "%s%s" % (d.otype,d.olist)
270  algoname = AlgConf.jJetSelect
271  alg = algoname( name = listname, inputs = 'jJetTobs', outputs = listname )
272  alg.addgeneric('InputWidth', HW.jJetInputWidth)
273  alg.addgeneric('OutputWidth', HW.jJetOutputWidthSelect)
274  if d.olist == "ab":
275  alg.addvariable('MinET', get_threshold_cut(d.otype, d.ocut)*_et_conversion)
276  alg.addvariable('MinEta', d.etamin*_eta_conversion)
277  alg.addvariable('MaxEta', d.etamax*_eta_conversion)
278  tm.registerTopoAlgo(alg)
279 
280  algoList = [
281  {"otype" : "FjJ", "ocut" : 0, "olist" : "s", "etamin" : 30, "etamax" : 49}, # FjJs
282  {"otype" : "jJ", "ocut" : 0, "olist" : "s", "etamin" : 0, "etamax" : 32}, # jJs
283  {"otype" : "CjJ", "ocut" : 0, "olist" : "s", "etamin" : 0, "etamax" : 26}, # CjJs
284  {"otype" : "AjJ", "ocut" : 0, "olist" : "s", "etamin" : 0, "etamax" : 49}, # AjJs
285  ]
286  for x in algoList:
287  class d:
288  pass
289  for k in x:
290  setattr (d, k, x[k])
291  listname = "%s%s" % (d.otype,d.olist)
292  algoname = AlgConf.jJetSort
293  alg = algoname( name = listname, inputs = 'jJetTobs', outputs = listname )
294  alg.addgeneric('InputWidth', HW.jJetInputWidth)
295  alg.addgeneric('OutputWidth', HW.jJetOutputWidthSort)
296  if d.olist == "ab":
297  alg.addvariable('MinET', d.ocut*_et_conversion)
298  alg.addvariable('MinEta', d.etamin*_eta_conversion)
299  alg.addvariable('MaxEta', d.etamax*_eta_conversion)
300  tm.registerTopoAlgo(alg)
301 
302 
303  #input list needed for ATR-18824
304  # Forward electrons
305  alg = AlgConf.jEmSort( name = 'jEMs25ETA49', inputs = 'jEmTobs', outputs = 'jEMs25ETA49' )
306  alg.addgeneric('InputWidth', HW.jEmInputWidth)
307  alg.addgeneric('OutputWidth', HW.jEmOutputWidthSort)
308  alg.addvariable('MinEta', 25*_eta_conversion)
309  alg.addvariable('MaxEta', 49*_eta_conversion)
310  # Setting no WP for now, use 0-3 for None/L/M/T when optimised
311  alg.addvariable('IsoMin', 0) # Placeholder, see TypeWideThresholdConfig
312  alg.addvariable('Frac1Min', 0)
313  alg.addvariable('Frac2Min', 0)
314  tm.registerTopoAlgo(alg)
315 
316  # jTAU inputs # for ATR-29784
317  # all
318  alg = AlgConf.jTauNoSort( name = 'jTAUall', inputs = 'jTauTobs', outputs = 'jTAUall')
319  alg.addgeneric('InputWidth', HW.jTauInputWidth)
320  alg.addgeneric('OutputWidth', HW.jTauInputWidth)
321  alg.addvariable('Isolation',0)
322  alg.addvariable('passIsolation', True) #if true, isolation requirement is ignored
323  tm.registerTopoAlgo(alg)
324 
325  # SORT
326  alg = AlgConf.jTauSort( name = 'jTAUs', inputs = 'jTauTobs', outputs = 'jTAUs' )
327  alg.addgeneric('InputWidth', HW.jTauInputWidth)
328  alg.addgeneric('OutputWidth', HW.jTauOutputWidthSort)
329  alg.addvariable('MinEta', 0*_eta_conversion)
330  alg.addvariable('MaxEta', 32*_eta_conversion)
331  alg.addvariable('Isolation',0)
332  alg.addvariable('passIsolation', True) #if true, isolation requirement is ignored
333  tm.registerTopoAlgo(alg)
334 
335  # MET
336  # No additional parameters
337  alg = AlgConf.jXENoSort( name = 'jXENoSort_1BC', inputs = 'jXETobs', outputs = 'jXENoSort_1BC' )
338  alg.addgeneric('InputWidth', HW.jMetInputWidth)
339  alg.addgeneric('OutputWidth', HW.metOutputWidth)
340  # reduce number of pipelining registers used in firmware to allow for more
341  # latency to be used inside the KFMET decision algorithm
342  alg.addgeneric('NumRegisters', 1)
343  tm.registerTopoAlgo(alg)
344 
345  alg = AlgConf.jXESort( name = 'jXEs', inputs = 'jXETobs', outputs = 'jXEs' )
346  alg.addgeneric('InputWidth', HW.jMetInputWidth)
347  alg.addgeneric('OutputWidth', HW.metOutputWidth)
348  tm.registerTopoAlgo(alg)
349 
350 
351  # Decision algorithms
352 
353  # LAR ZEE
354  # Parameter ordering:
355  # 1. MinEt1
356  # 2. MinEt2
357  # 3. MinInvariantMassSqr
358  # 4. MaxInvariantMassSqr
359  algoList = [
360  {"otype" : "eEM", "ocut1" : 24, "ocut2" : 24, "olist" : "sm", "nleading1" : 2, "minInvm" : 60, "maxInvm" : 100, "inputwidth": HW.eEmOutputWidthSort},
361  ]
362  for x in algoList:
363  class d:
364  pass
365  for k in x:
366  setattr (d, k, x[k])
367  toponame = 'ZEE-eEM24sm2'
368  log.debug("Define %s", toponame)
369  inputList = d.otype + d.olist
370  alg = AlgConf.InvariantMassInclusive1( name = toponame, inputs = inputList, outputs = toponame)
371  alg.addgeneric('InputWidth', d.inputwidth)
372  alg.addgeneric('MaxTob', d.nleading1)
373  alg.addgeneric('NumResultBits', 1)
374  alg.addvariable('MinET1', get_threshold_cut(d.otype, d.ocut1)*_et_conversion )
375  alg.addvariable('MinET2', get_threshold_cut(d.otype, d.ocut2)*_et_conversion )
376  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion )
377  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion )
378  tm.registerTopoAlgo(alg)
379 
380 
381 
382  #ATR-30179
383  #Mu+Tau dR cut
384  algolist = [
385  {"minDr": 3, "maxDr": 99, "mult": 1, "otype1" : "MU8Fab" , "otype2" : "eTAU", "ocut2" : 30, "olist2" : "ab", }, #3DR99-MU8Fab-eTAU30ab
386  {"minDr": 3, "maxDr": 35, "mult": 1, "otype1" : "MU8Fab" , "otype2" : "eTAU", "ocut2" : 30, "olist2" : "ab", }, #3DR35-MU8Fab-eTAU30ab
387  {"minDr": 3, "maxDr": 30, "mult": 1, "otype1" : "MU8Fab" , "otype2" : "eTAU", "ocut2" : 30, "olist2" : "ab", }, #3DR30-MU8Fab-eTAU30ab
388  {"minDr": 3, "maxDr": 28, "mult": 1, "otype1" : "MU8Fab" , "otype2" : "eTAU", "ocut2" : 30, "olist2" : "ab", }, #3DR28-MU8Fab-eTAU30ab
389  ]
390 
391  for x in algolist:
392  class d:
393  pass
394  for k in x:
395  setattr (d, k, x[k])
396  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
397  obj2 = "-%s%d%s" % (d.otype2, d.ocut2, d.olist2)
398  toponame = "%iDR%i-%s%s" % (d.minDr, d.maxDr, obj1, obj2)
399  log.debug("Define %s", toponame)
400  inputList = [ d.otype1, 'eTAUs']
401  algoname = AlgConf.DeltaRSqrIncl2
402  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
403  #alg = AlgConf.NotMatch( name = toponame, inputs = [ d.otype1, 'eTAUs'], outputs = [ toponame ] )
404  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
405  alg.addgeneric('InputWidth2', HW.eTauOutputWidthSort)
406  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
407  alg.addgeneric('MaxTob2', 1)
408  alg.addgeneric('NumResultBits', 1)
409  alg.addvariable('MinET1', 0*_et_conversion)
410  alg.addvariable('MinET2', get_threshold_cut('eTAU', d.ocut2)*_et_conversion)
411  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
412  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
413  tm.registerTopoAlgo(alg)
414 
415 
416  # dimu DR items
417  # Parameter ordering:
418  # 1. MinEt1
419  # 2. MinEt2
420  # 3. MinDeltaRSqr
421  # 4. MaxDeltaRSqr
422  listofalgos=[
423  {"minDr": 0, "maxDr": 15, "mult": 2, "otype1" : "MU3Vab" , "otype2" : "", }, #0DR15-2MU3Vab
424  {"minDr": 0, "maxDr": 24, "mult": 2, "otype1" : "MU3Vab" , "otype2" : "", }, #0DR24-2MU3Vab
425  # a min dR cut is needed when using muons from two lists. Maybe 0.1 is too large
426  {"minDr": 1, "maxDr": 15, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3Vab", }, #1DR15-MU5VFab-MU3Vab
427  {"minDr": 1, "maxDr": 22, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3Vab", }, #1DR22-MU5VFab-MU3Vab
428  {"minDr": 2, "maxDr": 15, "mult": 2, "otype1" : "MU5VFab", "otype2" : "", }, #2DR15-2MU5VFab
429  {"minDr": 0, "maxDr": 22, "mult": 2, "otype1" : "MU5VFab", "otype2" : "", }, #0DR22-2MU5VFab
430  {"minDr": 2, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab" , "otype2" : "", }, #2DR99-2MU3Vab
431  ]
432  for x in listofalgos:
433  class d:
434  pass
435  for k in x:
436  setattr (d, k, x[k])
437  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
438  obj2 = "-%s" % (d.otype2)
439  toponame = "%iDR%i-%s%s" % (d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
440  log.debug("Define %s", toponame)
441  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
442  algoname = AlgConf.DeltaRSqrIncl1 if (d.mult>1) else AlgConf.DeltaRSqrIncl2
443  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
444  if (d.mult>1):
445  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
446  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
447  else:
448  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
449  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
450  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
451  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
452  alg.addgeneric('NumResultBits', 1)
453  alg.addvariable('MinET1', 0*_et_conversion)
454  alg.addvariable('MinET2', 0*_et_conversion)
455  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
456  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
457  tm.registerTopoAlgo(alg)
458 
459  # dimu DR with opposite charge, ATR-23073
460  # Parameter ordering:
461  # 1. MinEt1
462  # 2. MinEt2
463  # 3. MinDeltaRSqr
464  # 4. MaxDeltaRSqr
465  listofalgos=[
466  {"minDr": 0, "maxDr": 12, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #0DR12C-2MU3Vab
467  ]
468  for x in listofalgos:
469  class d:
470  pass
471  for k in x:
472  setattr (d, k, x[k])
473  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
474  obj2 = "-%s" % (d.otype2)
475  toponame = "%iDR%iC-%s%s" % (d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
476  log.debug("Define %s", toponame)
477  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
478  algoname = AlgConf.DeltaRSqrIncl1Charge if (d.mult>1) else AlgConf.DeltaRSqrIncl2Charge
479  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
480  if (d.mult>1):
481  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
482  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
483  else:
484  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
485  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
486  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
487  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
488  alg.addgeneric('NumResultBits', 1)
489  alg.addvariable('MinET1', 0*_et_conversion)
490  alg.addvariable('MinET2', 0*_et_conversion)
491  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
492  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
493  tm.registerTopoAlgo(alg)
494 
495  # dimu INVM+DR with opposite charge, ATR-23073
496  # Parameter ordering:
497  # 1. MinEt1
498  # 2. MinEt2
499  # 3. MinInvariantMassSqr
500  # 4. MaxInvariantMassSqr
501  # 5. MinDeltaRSqr
502  # 6. MaxDeltaRSqr
503  listofalgos=[
504  {"minInvm":7, "maxInvm":22, "minDr": 0, "maxDr": 20, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #7INVM22-0DR20C-2MU3Vab
505  ]
506  for x in listofalgos:
507  class d:
508  pass
509  for k in x:
510  setattr (d, k, x[k])
511  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
512  obj2 = "-%s" % (d.otype2)
513  toponame = "%iINVM%i-%iDR%iC-%s%s" % (d.minInvm, d.maxInvm, d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
514  log.debug("Define %s", toponame)
515  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
516  algoname = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1Charge if (d.mult>1) else AlgConf.InvariantMassInclusiveDeltaRSqrIncl2Charge
517  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
518  if (d.mult>1):
519  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
520  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
521  else:
522  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
523  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
524  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
525  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
526  alg.addgeneric('NumResultBits', 1)
527  alg.addvariable('MinET1', 0*_et_conversion)
528  alg.addvariable('MinET2', 0*_et_conversion)
529  alg.addvariable('MinMSqr', d.minInvm * d.minInvm *_et_conversion*_et_conversion)
530  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm *_et_conversion*_et_conversion)
531  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
532  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
533  tm.registerTopoAlgo(alg)
534 
535  # deta-dphi with ab+ab
536  # Parameter ordering:
537  # 1. MinEt1
538  # 2. MinEt2
539  # 3. MinDeltaEta
540  # 4. MaxDeltaEta
541  # 5. DeltaPhiMin
542  # 6. DeltaPhiMax
543  algolist=[
544  {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 1,
545  "otype1" : "MU5VFab", "ocut1": "", "olist1": "", "nleading1": HW.muonOutputWidthSelect,
546  "otype2" : "MU3Vab" , "ocut2": "", "olist2": "", "nleading2": HW.muonOutputWidthSelect}, #5DETA99-5DPHI99-MU5VFab-MU3Vab
547  {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 2,
548  "otype1" : "MU5VFab", "ocut1": "", "olist1": "", "nleading1": HW.muonOutputWidthSelect,
549  "otype2" : "" , "ocut2": "", "olist2": "", "nleading2": HW.muonOutputWidthSelect}, #5DETA99-5DPHI99-2MU5VFab
550  {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 2,
551  "otype1" : "MU3Vab", "ocut1": "", "olist1": "", "nleading1": HW.muonOutputWidthSelect,
552  "otype2" : "" , "ocut2": "", "olist2": "", "nleading2": HW.muonOutputWidthSelect}, #5DETA99-5DPHI99-2MU3Vab
553  {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 2,
554  "otype1" : "MU3VFab", "ocut1": "", "olist1": "","nleading1": HW.muonOutputWidthSelect,
555  "otype2" : "" , "ocut2": "", "olist2": "","nleading2": HW.muonOutputWidthSelect}, #5DETA99-5DPHI99-2MU3VFab
556  { "minDeta": 0, "maxDeta": 24, "minDphi": 4, "maxDphi": 99, "mult": 1,
557  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect,
558  "otype2" : "eTAU", "ocut2": 20, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect},#0DETA24_4DPHI99_eTAU30ab_eTAU20ab
559  { "minDeta": 0, "maxDeta": 24, "minDphi": 4, "maxDphi": 99, "mult": 1,
560  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect,
561  "otype2" : "eTAU", "ocut2": 12, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect},#0DETA24_4DPHI99_eTAU30ab_eTAU12ab
562  { "minDeta": 0, "maxDeta": 24, "minDphi": 10, "maxDphi": 99, "mult": 1,
563  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect,
564  "otype2" : "eTAU", "ocut2": 12, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect},#0DETA24_10DPHI99_eTAU30ab_eTAU12ab
565  ]
566  for x in algolist:
567  class d:
568  pass
569  for k in x:
570  setattr (d, k, x[k])
571  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1+str(d.ocut1)+str(d.olist1))
572  obj2 = "-%s" % (d.otype2+str(d.ocut2)+str(d.olist2))
573  toponame = "%sDETA%s-%sDPHI%s-%s%s" % (d.minDeta, d.maxDeta, d.minDphi, d.maxDphi, obj1, "" if d.mult>1 else obj2)
574  log.debug("Define %s", toponame)
575  inputList = [d.otype1+d.olist1] if (d.mult>1) else [d.otype1+d.olist1, d.otype2+d.olist2]
576  algoname = AlgConf.DeltaEtaPhiIncl1 if (d.mult>1) else AlgConf.DeltaEtaPhiIncl2
577  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
578  alg.addgeneric('NumResultBits', 1)
579  if (d.mult>1):
580  alg.addgeneric('InputWidth', d.nleading1)
581  alg.addgeneric('MaxTob', d.nleading1)
582  alg.addvariable('MinET1', 0*_et_conversion)
583  alg.addvariable('MinET2', 0*_et_conversion)
584  alg.addvariable('MinDeltaEta', d.minDeta*_eta_conversion)
585  alg.addvariable('MaxDeltaEta', d.maxDeta*_eta_conversion)
586  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion)
587  alg.addvariable('MaxDeltaPhi', d.maxDphi*_phi_conversion)
588  else:
589  alg.addgeneric('InputWidth1', d.nleading1)
590  alg.addgeneric('InputWidth2', d.nleading2)
591  alg.addgeneric('MaxTob1', d.nleading1)
592  alg.addgeneric('MaxTob2', d.nleading2)
593  alg.addvariable('MinET1', 0*_et_conversion)
594  alg.addvariable('MinET2', 0*_et_conversion)
595  alg.addvariable('DeltaEtaMin', d.minDeta*_eta_conversion)
596  alg.addvariable('DeltaEtaMax', d.maxDeta*_eta_conversion)
597  alg.addvariable('DeltaPhiMin', d.minDphi*_phi_conversion)
598  alg.addvariable('DeltaPhiMax', d.maxDphi*_phi_conversion)
599  tm.registerTopoAlgo(alg)
600 
601 
602  # (ATR-8194) L1Topo HT Trigger
603  algoList = [
604  {"itemNameMinHT": 150, "minHT": 240, "otype" : "jJ", "ocut" : 50, "olist" : "s", "nleading" : 5, "inputwidth": HW.jJetOutputWidthSort, "oeta" : 32}, #HT150-jJ50s5pETA32
605  {"itemNameMinHT": 190, "minHT": 300, "otype" : "jJ", "ocut" : 40, "olist" : "s", "nleading" : 5, "inputwidth": HW.jJetOutputWidthSort, "oeta" : 21}, #HT190-jJ40s5pETA21
606  ]
607  for x in algoList:
608  class d:
609  pass
610  for k in x:
611  setattr (d, k, x[k])
612  toponame = "HT%d-%s%s%s%spETA%s" % (d.itemNameMinHT, d.otype, str(d.ocut), d.olist, str(d.nleading) if d.olist=="s" else "", str(d.oeta))
613  log.debug("Define %s", toponame)
614  inputList = d.otype + d.olist
615  alg = AlgConf.JetHT( name = toponame, inputs = inputList, outputs = [toponame] )
616  alg.addgeneric('InputWidth', d.inputwidth)
617  alg.addgeneric('MaxTob', d.nleading)
618  alg.addgeneric('NumRegisters', 2 if d.olist=="all" else 0)
619  alg.addgeneric('NumResultBits', 1)
620  alg.addvariable('MinET', get_threshold_cut(d.otype, d.ocut)*_et_conversion)
621  alg.addvariable('MinEta', 0*_eta_conversion)
622  alg.addvariable('MaxEta', d.oeta*_eta_conversion)
623  alg.addvariable('MinHt', d.minHT*_et_conversion)
624  tm.registerTopoAlgo(alg)
625 
626  #DR for 2MU5
627  # Covers chains: 0DR15-2MU5VFab
628  # 10DR99-2MU5VFab
629  DR_2MU5FMap = [
630  {
631  "algoname" : "DR_2MU5VFab",
632  "minDR" : [0 ,10],
633  "maxDR" : [15,99],
634  "otype1" : "MU5VFab",
635  "mult1" : [2]*2
636  }
637  ]
638 
639 
640  for x in DR_2MU5FMap:
641  class d:
642  pass
643  for k in x:
644  setattr (d, k, x[k])
645  inputList = [ d.otype1 ]
646  toponames = []
647  for bitId in range(len(d.minDR)):
648  toponames.append("%iDR%i-%s%s" % (d.minDR[bitId], d.maxDR[bitId], str(d.mult1[bitId]),
649  d.otype1 )
650  )
651  alg = AlgConf.DeltaRSqrIncl1( name = d.algoname, inputs = inputList, outputs = toponames)
652  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
653  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
654  alg.addgeneric('NumResultBits', len(toponames) )
655 
656  for bitId in range(len(toponames)):
657  alg.addvariable('MinET1', 0 * _et_conversion, bitId )
658  alg.addvariable('MinET2', 0 * _et_conversion, bitId )
659  alg.addvariable("DeltaRMin", d.minDR[bitId] * d.minDR[bitId] * _dr_conversion * _dr_conversion, bitId)
660  alg.addvariable("DeltaRMax", d.maxDR[bitId] * d.maxDR[bitId] * _dr_conversion * _dr_conversion, bitId)
661 
662  tm.registerTopoAlgo(alg)
663 
664 
665  # DM/DPHI for eEM
666  # output lines = 0INVM70-27DPHI32-eEM12sm1-eEM12sm6, 0INVM70-27DPHI32-eEM15sm1-eEM15sm6
667  # Parameter ordering
668  # 1. MinEt1
669  # 2. MinEt2
670  # 3. MinMSqr
671  # 4. MaxMSqr
672  # 5. MinDeltaPhi
673  # 6. MaxDeltaPhi
674  eINVM_DPHIMap = [
675  {
676  "algoname" : "INVM_DPHI_eEMsm6",
677  "minInvm" : 0,
678  "maxInvm" : 70,
679  "minDphi" : 27,
680  "maxDphi" : 32,
681  "otype1" : "eEM",
682  "olist1" : "sm",
683  "ocut1List" : [ 12, 15 ],
684  "nleading1" : 1,
685  "otype2" : "eEM",
686  "ocut2List" : [ 12, 15 ],
687  "olist2" : "sm",
688  "nleading2" : 6
689 
690  }
691  ]
692 
693  for x in eINVM_DPHIMap:
694  class d:
695  pass
696  for k in x:
697  setattr (d, k, x[k])
698  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
699  toponames=[]
700  for bitId, ocut1Value in enumerate(d.ocut1List):
701  toponames.append ("%iINVM%i-%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.minInvm, d.maxInvm, d.minDphi, d.maxDphi,
702  d.otype1, str(ocut1Value) , d.olist1, str(d.nleading1) if d.olist1=="sm" else "",
703  d.otype2, str(d.ocut2List[bitId]) , d.olist2, str(d.nleading2) if d.olist2=="sm" else ""))
704  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = d.algoname, inputs = inputList, outputs = toponames )
705  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
706  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
707  alg.addgeneric('MaxTob1', d.nleading1)
708  alg.addgeneric('MaxTob2', d.nleading2)
709  alg.addgeneric('NumResultBits', len(toponames))
710  for bitId in range(len(toponames)):
711  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1List[bitId]) * _et_conversion, bitId)
712  alg.addvariable('MinET2', get_threshold_cut(d.otype1, d.ocut2List[bitId]) * _et_conversion, bitId)
713  alg.addvariable('MinMSqr', d.minInvm * d.minInvm * _et_conversion * _et_conversion, bitId)
714  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm * _et_conversion * _et_conversion, bitId)
715  alg.addvariable('MinDeltaPhi', d.minDphi * _phi_conversion, bitId)
716  alg.addvariable('MaxDeltaPhi', d.maxDphi * _phi_conversion, bitId)
717 
718  tm.registerTopoAlgo(alg)
719 
720 
721  # Boosted DM/DPHI for eEM
722  # output lines = 0INVM70-0DPHI12-eEM9sl1-eEM9sl6,
723  # 0INVM70-0DPHI12-eEM12sl1-eEM12sl6,
724  # 0INVM70-0DPHI12-eEM15sl1-eEM15sl6
725  # Parameter ordering
726  # 1. MinEt1
727  # 2. MinEt2
728  # 3. MinMSqr
729  # 4. MaxMSqr
730  # 5. MinDeltaPhi
731  # 6. MaxDeltaPhi
732  eINVM_DPHIMap = [
733  {
734  "algoname" : "INVM_INVDPHI_eEMsl6",
735  "minInvm" : 0,
736  "maxInvm" : 70,
737  "minDphi" : 0,
738  "maxDphi" : 12,
739  "otype1" : "eEM",
740  "olist1" : "sl",
741  "ocut1List" : [ 9, 12],
742  "nleading1" : 1,
743  "otype2" : "eEM",
744  "ocut2List" : [ 9, 12 ],
745  "olist2" : "sl",
746  "nleading2" : 6
747  }
748  ]
749 
750  for x in eINVM_DPHIMap:
751  class d:
752  pass
753  for k in x:
754  setattr (d, k, x[k])
755  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
756  toponames=[]
757  for bitId, ocut1Value in enumerate(d.ocut1List):
758  toponames.append ("%iINVM%i-%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.minInvm, d.maxInvm, d.minDphi, d.maxDphi,
759  d.otype1, str(ocut1Value) , d.olist1, str(d.nleading1) if d.olist1=="sl" else "",
760  d.otype2, str(d.ocut2List[bitId]) , d.olist2, str(d.nleading2) if d.olist2=="sl" else ""))
761  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = d.algoname, inputs = inputList, outputs = toponames )
762 
763  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
764  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
765  alg.addgeneric('MaxTob1', d.nleading1)
766  alg.addgeneric('MaxTob2', d.nleading2)
767  alg.addgeneric('NumResultBits', len(toponames))
768  for bitId in range(len(toponames)):
769  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1List[bitId]) * _et_conversion, bitId)
770  alg.addvariable('MinET2', get_threshold_cut(d.otype1, d.ocut2List[bitId]) * _et_conversion, bitId)
771  alg.addvariable('MinMSqr', d.minInvm * d.minInvm * _et_conversion * _et_conversion, bitId)
772  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm * _et_conversion * _et_conversion, bitId)
773  alg.addvariable('MinDeltaPhi', d.minDphi * _phi_conversion, bitId)
774  alg.addvariable('MaxDeltaPhi', d.maxDphi * _phi_conversion, bitId)
775 
776  tm.registerTopoAlgo(alg)
777 
778 
779  # DM/DR for eEM
780  # output lines = 0INVM70-2DR15-eEM9sl1-eEM9sl6,
781  # 0INVM70-2DR15-eEM12sl1-eEM12sl6,
782  #
783  # Parameter ordering
784  # 1. MinEt1
785  # 2. MinEt2
786  # 3. MinMSqr
787  # 4. MaxMSqr
788  # 5. MinDeltaR
789  # 6. MaxDeltaR
790  eINVM_DRMap = [
791  {
792  "algoname" : "INVM_BOOSTDR_eEMsl6",
793  "minInvm" : 0,
794  "maxInvm" : 70,
795  "minDR" : 2,
796  "maxDR" : 15,
797  "otype1" : "eEM",
798  "olist1" : "sl",
799  "ocut1List" : [ 9, 12 ],
800  "nleading1" : 1,
801  "otype2" : "eEM",
802  "ocut2List" : [ 9, 12 ],
803  "olist2" : "sl",
804  "nleading2" : 6
805  }
806  ]
807 
808  for x in eINVM_DRMap:
809  class d:
810  pass
811  for k in x:
812  setattr (d, k, x[k])
813  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
814  toponames=[]
815  for bitId, ocut1Value in enumerate(d.ocut1List):
816  toponames.append ("%iINVM%i-%iDR%i-%s%s%s%s-%s%s%s%s" % (d.minInvm, d.maxInvm, d.minDR, d.maxDR,
817  d.otype1, str(ocut1Value) , d.olist1, str(d.nleading1) if d.olist1=="sl" else "",
818  d.otype2, str(d.ocut2List[bitId]) , d.olist2, str(d.nleading2) if d.olist2=="sl" else ""))
819 
820  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl2( name = d.algoname, inputs = inputList, outputs = toponames )
821  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
822  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
823  alg.addgeneric('MaxTob1', d.nleading1)
824  alg.addgeneric('MaxTob2', d.nleading2)
825  alg.addgeneric('NumResultBits', len(toponames))
826  for bitId in range(len(toponames)):
827  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1List[bitId]) * _et_conversion, bitId)
828  alg.addvariable('MinET2', get_threshold_cut(d.otype1, d.ocut2List[bitId]) * _et_conversion, bitId)
829  alg.addvariable('MinMSqr', d.minInvm * d.minInvm * _et_conversion * _et_conversion, bitId)
830  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm * _et_conversion * _et_conversion, bitId)
831  alg.addvariable('DeltaRMin', d.minDR*d.minDR*_dr_conversion*_dr_conversion, bitId)
832  alg.addvariable('DeltaRMax', d.maxDR*d.maxDR*_dr_conversion*_dr_conversion, bitId)
833 
834  tm.registerTopoAlgo(alg)
835 
836  # DM/DR Ranges for eEM12
837  # output lines = 0INVM30-2DR15-eEM12sl1-eEM12sl6,
838  # 25INVM70-13DR25-eEM12sl1-eEM12sl6,
839  #
840  # Parameter ordering
841  # 1. MinEt1
842  # 2. MinEt2
843  # 3. MinMSqr
844  # 4. MaxMSqr
845  # 5. MinDeltaR
846  # 6. MaxDeltaR
847  eINVM_Ranges_DRMap = [
848  {
849  "algoname" : "INVM_BOOSTDR_Ranges_eEM12sl6",
850  "minInvm" : [0, 25],
851  "maxInvm" : [30,70],
852  "minDR" : [2,13],
853  "maxDR" : [15,25],
854  "otype1" : "eEM",
855  "olist1" : "sl",
856  "ocut1List" : [12,12],
857  "nleading1" : 1,
858  "otype2" : "eEM",
859  "ocut2List" : [12,12],
860  "olist2" : "sl",
861  "nleading2" : 6
862  }
863  ]
864 
865  for x in eINVM_Ranges_DRMap:
866  class d:
867  pass
868  for k in x:
869  setattr (d, k, x[k])
870  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
871  toponames=[]
872  for bitId, ocut1Value in enumerate(d.ocut1List):
873  toponames.append ("%iINVM%i-%iDR%i-%s%s%s%s-%s%s%s%s" % (d.minInvm[bitId], d.maxInvm[bitId], d.minDR[bitId], d.maxDR[bitId],
874  d.otype1, str(ocut1Value) , d.olist1, str(d.nleading1) if d.olist1=="sl" else "",
875  d.otype2, str(d.ocut2List[bitId]) , d.olist2, str(d.nleading2) if d.olist2=="sl" else ""))
876 
877  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl2( name = d.algoname, inputs = inputList, outputs = toponames )
878  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
879  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
880  alg.addgeneric('MaxTob1', d.nleading1)
881  alg.addgeneric('MaxTob2', d.nleading2)
882  alg.addgeneric('NumResultBits', len(toponames))
883  for bitId in range(len(toponames)):
884  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1List[bitId]) * _et_conversion, bitId)
885  alg.addvariable('MinET2', get_threshold_cut(d.otype1, d.ocut2List[bitId]) * _et_conversion, bitId)
886  alg.addvariable('MinMSqr', d.minInvm[bitId] * d.minInvm[bitId] * _et_conversion * _et_conversion, bitId)
887  alg.addvariable('MaxMSqr', d.maxInvm[bitId] * d.maxInvm[bitId] * _et_conversion * _et_conversion, bitId)
888  alg.addvariable('DeltaRMin', d.minDR[bitId]*d.minDR[bitId]*_dr_conversion*_dr_conversion, bitId)
889  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
890 
891  tm.registerTopoAlgo(alg)
892 
893 
894  # DM/DR Ranges for asymmetric eEM12LeEM9L
895  # output lines = 0INVM30-2DR15-eEM12sl1-eEM9sl6,
896  # 25INVM70-13DR25-eEM12sl1-eEM9sl6,
897  #
898  # Parameter ordering
899  # 1. MinEt1
900  # 2. MinEt2
901  # 3. MinMSqr
902  # 4. MaxMSqr
903  # 5. MinDeltaR
904  # 6. MaxDeltaR
905  eINVM_Ranges_Asymm_DRMap = [
906  {
907  "algoname" : "INVM_BOOSTDR_Ranges_Asymm_eEMsl6",
908  "minInvm" : [0, 25],
909  "maxInvm" : [30,70],
910  "minDR" : [2,13],
911  "maxDR" : [15,25],
912  "otype1" : "eEM",
913  "olist1" : "sl",
914  "ocut1List" : [12,12],
915  "nleading1" : 1,
916  "otype2" : "eEM",
917  "ocut2List" : [9,9],
918  "olist2" : "sl",
919  "nleading2" : 6
920  }
921  ]
922 
923  for x in eINVM_Ranges_Asymm_DRMap:
924  class d:
925  pass
926  for k in x:
927  setattr (d, k, x[k])
928  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
929  toponames=[]
930  for bitId, ocut1Value in enumerate(d.ocut1List):
931  toponames.append ("%iINVM%i-%iDR%i-%s%s%s%s-%s%s%s%s" % (d.minInvm[bitId], d.maxInvm[bitId], d.minDR[bitId], d.maxDR[bitId],
932  d.otype1, str(ocut1Value) , d.olist1, str(d.nleading1) if d.olist1=="sl" else "",
933  d.otype2, str(d.ocut2List[bitId]) , d.olist2, str(d.nleading2) if d.olist2=="sl" else ""))
934 
935  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl2( name = d.algoname, inputs = inputList, outputs = toponames )
936  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
937  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
938  alg.addgeneric('MaxTob1', d.nleading1)
939  alg.addgeneric('MaxTob2', d.nleading2)
940  alg.addgeneric('NumResultBits', len(toponames))
941  for bitId in range(len(toponames)):
942  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1List[bitId]) * _et_conversion, bitId)
943  alg.addvariable('MinET2', get_threshold_cut(d.otype1, d.ocut2List[bitId]) * _et_conversion, bitId)
944  alg.addvariable('MinMSqr', d.minInvm[bitId] * d.minInvm[bitId] * _et_conversion * _et_conversion, bitId)
945  alg.addvariable('MaxMSqr', d.maxInvm[bitId] * d.maxInvm[bitId] * _et_conversion * _et_conversion, bitId)
946  alg.addvariable('DeltaRMin', d.minDR[bitId]*d.minDR[bitId]*_dr_conversion*_dr_conversion, bitId)
947  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
948 
949  tm.registerTopoAlgo(alg)
950 
951 
952  # INVM_DR for 2MU5VFab
953  # output lines = 2INVM9-2DR15-2MU5VFab and 8INVM15-0DR22-2MU5VFab
954  INVM_DR_2MU5VFabMap = [
955  {
956  "algoname": "INVM_DR_2MU5VFab",
957  "minInvm" : [2,8],
958  "maxInvm" : [9,15],
959  "minDR" : [2,0],
960  "maxDR" : [15,22],
961  "otype1" : "MU5VFab",
962  "mult1" : 2
963  }
964  ]
965  for x in INVM_DR_2MU5VFabMap:
966  class d:
967  pass
968  for k in x:
969  setattr(d,k,x[k])
970  inputList = d.otype1
971  toponames = []
972  for bitId in range(len(d.minDR)):
973  toponames.append("%iINVM%i-%iDR%i-%i%s" % ( d.minInvm[bitId], d.maxInvm[bitId],
974  d.minDR[bitId] , d.maxDR[bitId],
975  d.mult1, d.otype1
976  )
977  )
978  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1( name = d.algoname, inputs = inputList, outputs = toponames)
979  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
980  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
981  alg.addgeneric('NumResultBits', len(toponames))
982  for bitId in range(len(toponames)):
983  alg.addvariable('MinET1', 0*_et_conversion, bitId)
984  alg.addvariable('MinET2', 0*_et_conversion, bitId)
985  alg.addvariable('MinMSqr', d.minInvm[bitId]*d.minInvm[bitId]*_et_conversion*_et_conversion, bitId)
986  alg.addvariable('MaxMSqr', d.maxInvm[bitId]*d.maxInvm[bitId]*_et_conversion*_et_conversion, bitId)
987  alg.addvariable('DeltaRMin', d.minDR[bitId]*d.minDR[bitId]*_dr_conversion*_dr_conversion, bitId)
988  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
989  tm.registerTopoAlgo(alg)
990 
991 
992  # INVM for 2MU3VFab
993  # output lines = '7INVM14-2MU3VFab', '7INVM22-2MU3VFab'
994  INVM_2MU3VFab_Map = [
995  {
996  "algoname": "INVM_2MU3VFab",
997  "minInvm" : 7,
998  "maxInvm" : [14,22],
999  "otype1" : "MU3VFab",
1000  "mult1" : 2
1001  }
1002  ]
1003  for x in INVM_2MU3VFab_Map:
1004  class d:
1005  pass
1006  for k in x:
1007  setattr(d,k,x[k])
1008  inputList = d.otype1
1009  toponames = []
1010  for bitId in range(len(d.maxInvm)):
1011  toponames.append("%iINVM%i-%i%s" % ( d.minInvm, d.maxInvm[bitId],
1012  d.mult1, d.otype1
1013  )
1014  )
1015  alg = AlgConf.InvariantMassInclusive1( name = d.algoname, inputs = inputList, outputs = toponames)
1016  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
1017  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
1018  alg.addgeneric('NumResultBits', len(toponames))
1019  for bitId in range(len(toponames)):
1020  alg.addvariable('MinET1', 0*_et_conversion, bitId)
1021  alg.addvariable('MinET2', 0*_et_conversion, bitId)
1022  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion, bitId)
1023  alg.addvariable('MaxMSqr', d.maxInvm[bitId]*d.maxInvm[bitId]*_et_conversion*_et_conversion, bitId)
1024  tm.registerTopoAlgo(alg)
1025 
1026 
1027 
1028  # INVM_EM for Jpsi
1029  invm_map = { "algoname": 'INVM_eEMs6' , "ocutlist": [ 9, 15 ], "minInvm": 1, "maxInvm": 5, "otype" : "eEM", "olist" : "s",
1030  "nleading" : 1, "inputwidth": HW.eEmOutputWidthSort}
1031  for x in [ invm_map ]:
1032  class d:
1033  pass
1034  for k in x:
1035  setattr (d, k, x[k])
1036  inputList = d.otype + d.olist
1037  toponames=[]
1038  for ocut in d.ocutlist:
1039  toponame = "%iINVM%i-%s%s%s%s-eEMs6" % (d.minInvm, d.maxInvm, d.otype, str(ocut) if ocut > 0 else "", d.olist, str(d.nleading) if d.olist=="s" else "")
1040  toponames.append(toponame)
1041  alg = AlgConf.InvariantMassInclusive2( name = d.algoname, inputs = [inputList, 'eEMs'], outputs = toponames)
1042  alg.addgeneric('InputWidth1', d.inputwidth)
1043  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
1044  alg.addgeneric('MaxTob1', d.nleading)
1045  alg.addgeneric('MaxTob2', HW.eEmOutputWidthSort)
1046  alg.addgeneric('NumResultBits', len(toponames))
1047  for bitid, ocut in enumerate(d.ocutlist):
1048  alg.addvariable('MinET1', get_threshold_cut('eEM', ocut)*_et_conversion, bitid)
1049  alg.addvariable('MinET2', 0*_et_conversion, bitid)
1050  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion, bitid)
1051  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion, bitid)
1052  tm.registerTopoAlgo(alg)
1053 
1054 
1055  # added for muon-jet:
1056  algoList = [
1057  {"minDr": 0, "maxDr": 4, "otype1" : "MU5VFab", "otype2" : "CjJ", "ocut2": 30, "olist2" : "ab"}, #0DR04-MU5VFab-CjJ30ab
1058  {"minDr": 0, "maxDr": 4, "otype1" : "MU8Fab" , "otype2" : "CjJ", "ocut2": 30, "olist2" : "ab"}, #0DR04-MU8Fab-CjJ30ab
1059  {"minDr": 0, "maxDr": 4, "otype1" : "MU5VFab", "otype2" : "CjJ", "ocut2": 40, "olist2" : "ab"}, #0DR04-MU5VFab-CjJ40ab
1060  {"minDr": 0, "maxDr": 4, "otype1" : "MU8Fab" , "otype2" : "CjJ", "ocut2": 40, "olist2" : "ab"}, #0DR04-MU8Fab-CjJ40ab
1061  {"minDr": 0, "maxDr": 4, "otype1" : "MU3Vab" , "otype2" : "CjJ", "ocut2": 40, "olist2" : "ab"}, #0DR04-MU3Vab-CjJ40ab
1062  {"minDr": 0, "maxDr": 4, "otype1" : "MU5VFab", "otype2" : "CjJ", "ocut2": 80, "olist2" : "ab"}, #0DR04-MU5VFab-CjJ80ab
1063  {"minDr": 0, "maxDr": 4, "otype1" : "MU5VFab", "otype2" : "CjJ", "ocut2": 90, "olist2" : "ab"}, #0DR04-MU5VFab-CjJ90ab
1064  ]
1065  for x in algoList:
1066  class d:
1067  pass
1068  for k in x:
1069  setattr (d, k, x[k])
1070  toponame = "%iDR%02d-%s-%s%s%s" % (d.minDr, d.maxDr, d.otype1, d.otype2, str(d.ocut2), d.olist2)
1071  log.debug("Define %s", toponame)
1072  inputList = [d.otype1, d.otype2 + d.olist2]
1073  alg = AlgConf.DeltaRSqrIncl2( name = toponame, inputs = inputList, outputs = [ toponame ])
1074  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
1075  alg.addgeneric('InputWidth2', HW.jJetOutputWidthSelect)
1076  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
1077  alg.addgeneric('MaxTob2', HW.jJetOutputWidthSelect)
1078  alg.addgeneric('NumResultBits', 1)
1079  alg.addvariable('MinET1', 0*_et_conversion, 0)
1080  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, 0)
1081  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion, 0)
1082  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion, 0)
1083  tm.registerTopoAlgo(alg)
1084 
1085  # dimu INVM items
1086  # Parameter ordering
1087  # 1. MinEt1
1088  # 2. MinEt2
1089  # 3. MinMSqr
1090  # 4. MaxMSqr
1091  listofalgos = [
1092  {"minInvm": 2, "maxInvm": 8, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #2INVM8-2MU3Vab
1093  {"minInvm": 2, "maxInvm": 9, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #2INVM9-2MU3Vab
1094  {"minInvm": 8, "maxInvm": 15, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3Vab",}, #8INVM15-MU5VFab-MU3Vab
1095  {"minInvm": 2, "maxInvm": 8, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3Vab",}, #2INVM8-MU5VFab-MU3Vab
1096  {"minInvm": 2, "maxInvm": 9, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3Vab",}, #2INVM9-MU5VFab-MU3Vab
1097  {"minInvm": 8, "maxInvm": 15, "mult": 2, "otype1" : "MU5VFab", "otype2" : "", }, #8INVM15-2MU5VFab
1098  {"minInvm": 2, "maxInvm": 9, "mult": 2, "otype1" : "MU5VFab", "otype2" : "", }, #2INVM9-2MU5VFab
1099  {"minInvm": 7, "maxInvm": 15, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #7INVM15-2MU3Vab
1100  {"minInvm": 7, "maxInvm": 22, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3VFab",}, #7INVM22-MU5VFab-MU3VFab, ATR-21566
1101  {"minInvm": 7, "maxInvm": 14, "mult": 1, "otype1" : "MU5VFab", "otype2" : "MU3VFab",}, #7INVM14-MU5VFab-MU3VFab, ATR-22782
1102  {"minInvm": 7, "maxInvm": 14, "mult": 2, "otype1" : "MU3Vab", "otype2" : "", }, #7INVM14-2MU3Vab, ATR-22782
1103  ]
1104  for x in listofalgos:
1105  class d:
1106  pass
1107  for k in x:
1108  setattr (d, k, x[k])
1109  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
1110  obj2 = "-%s" % (d.otype2)
1111  toponame = "%iINVM%i-%s%s" % (d.minInvm, d.maxInvm, obj1, "" if d.mult>1 else obj2)
1112  log.debug("Define %s", toponame)
1113  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
1114  algoname = AlgConf.InvariantMassInclusive1 if (d.mult>1) else AlgConf.InvariantMassInclusive2
1115  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
1116  if (d.mult>1):
1117  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
1118  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
1119  else:
1120  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
1121  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
1122  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
1123  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
1124  alg.addgeneric('NumResultBits', 1)
1125  alg.addvariable('MinET1', 0*_et_conversion)
1126  alg.addvariable('MinET2', 0*_et_conversion)
1127  alg.addvariable('MinMSqr', d.minInvm * d.minInvm *_et_conversion*_et_conversion)
1128  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm *_et_conversion*_et_conversion)
1129  tm.registerTopoAlgo(alg)
1130 
1131  toponame = "8INVM15-2CMU3Vab"
1132  log.debug("Define %s", toponame)
1133  inputList = ['CMU3Vab']
1134  alg = AlgConf.InvariantMassInclusive1( name = toponame, inputs = inputList, outputs = toponame )
1135  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
1136  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
1137  alg.addgeneric('NumResultBits', 1)
1138  alg.addvariable('MinET1', 0*_et_conversion)
1139  alg.addvariable('MinET2', 0*_et_conversion)
1140  alg.addvariable('MinMSqr', 8*8*_et_conversion*_et_conversion)
1141  alg.addvariable('MaxMSqr', 15*15*_et_conversion*_et_conversion)
1142  tm.registerTopoAlgo(alg)
1143 
1144  algolist=[
1145  {"minInvm": 2, "maxInvm": 8, "mult": 1, "otype1" : "CMU3Vab", "otype2" :"MU3Vab"}, # 2INVM8-CMU3Vab-MU3Vab
1146  ]
1147  for x in algolist:
1148  class d:
1149  pass
1150  for k in x:
1151  setattr (d, k, x[k])
1152  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
1153  obj2 = "-%s" % (d.otype2)
1154  toponame = "%iINVM%i-%s%s" % (d.minInvm, d.maxInvm, obj1, "" if d.mult>1 else obj2)
1155  log.debug("Define %s", toponame)
1156  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
1157  algoname = AlgConf.InvariantMassInclusive1 if (d.mult>1) else AlgConf.InvariantMassInclusive2
1158  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
1159  if (d.mult>1):
1160  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
1161  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
1162  alg.addgeneric('RequireOneBarrel', d.onebarrel)
1163  else:
1164  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
1165  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
1166  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
1167  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
1168  alg.addgeneric('NumResultBits', 1)
1169  alg.addvariable('MinET1', 0*_et_conversion)
1170  alg.addvariable('MinET2', 0*_et_conversion)
1171  alg.addvariable('MinMSqr', d.minInvm * d.minInvm *_et_conversion*_et_conversion)
1172  alg.addvariable('MaxMSqr', d.maxInvm * d.maxInvm *_et_conversion*_et_conversion)
1173  tm.registerTopoAlgo(alg)
1174 
1175  # dimu DR items
1176  algolist = [
1177  {"minDr": 0, "maxDr": 24, "mult": 2, "otype1" : "CMU3Vab", "otype2" : "", }, #0DR24-2CMU3Vab
1178  {"minDr": 1, "maxDr": 24, "mult": 1, "otype1" : "CMU3Vab", "otype2" : "MU3Vab", }, #1DR24-CMU3Vab-MU3Vab
1179  ]
1180  for x in algolist:
1181  class d:
1182  pass
1183  for k in x:
1184  setattr (d, k, x[k])
1185  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
1186  obj2 = "-%s" % (d.otype2)
1187  toponame = "%iDR%i-%s%s" % (d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
1188  log.debug("Define %s", toponame)
1189  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
1190  algoname = AlgConf.DeltaRSqrIncl1 if (d.mult>1) else AlgConf.DeltaRSqrIncl2
1191  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
1192  if (d.mult>1):
1193  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
1194  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
1195  else:
1196  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
1197  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
1198  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
1199  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
1200  alg.addgeneric('NumResultBits', 1)
1201  alg.addvariable('MinET1', 0*_et_conversion)
1202  alg.addvariable('MinET2', 0*_et_conversion)
1203  alg.addvariable('DeltaRMin', d.minDr*d.minDr *_dr_conversion*_dr_conversion)
1204  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr *_dr_conversion*_dr_conversion)
1205  tm.registerTopoAlgo(alg)
1206 
1207 
1208  # RATIO MATCH dedicated to Exotic #TODO: are eTAU correct to use here (and below)?
1209  toponame = '100RATIO-0MATCH-eTAU40si2-eEMall'
1210  alg = AlgConf.RatioMatch( name = toponame, inputs = [ 'eTAUs', 'eEMall'], outputs = [ toponame ] )
1211  alg.addgeneric('InputWidth1', HW.eTauOutputWidthSort)
1212  alg.addgeneric('InputWidth2', HW.eEmInputWidth)
1213  alg.addgeneric('MaxTob1', 2)
1214  alg.addgeneric('MaxTob2', HW.eEmInputWidth)
1215  alg.addgeneric('NumResultBits', 1)
1216  alg.addvariable('MinET1', get_threshold_cut('eTAU', 40)*_et_conversion)
1217  alg.addvariable('MinET2', 0*_et_conversion)
1218  alg.addvariable('Ratio', 100, 0)
1219  tm.registerTopoAlgo(alg)
1220 
1221  # NOT MATCH dedicated to Exotic
1222  toponame = 'NOT-0MATCH-eTAU40si1-eEMall'
1223  alg = AlgConf.NotMatch( name = toponame, inputs = [ 'eTAUs', 'eEMall'], outputs = [ toponame ] )
1224  alg.addgeneric('InputWidth1', HW.eTauOutputWidthSort)
1225  alg.addgeneric('InputWidth2', HW.eEmInputWidth)
1226  alg.addgeneric('MaxTob1', 1)
1227  alg.addgeneric('MaxTob2', HW.eEmInputWidth)
1228  alg.addgeneric('NumResultBits', 1)
1229  alg.addvariable('MinET1', get_threshold_cut('eTAU', 40)*_et_conversion)
1230  alg.addvariable('MinET2', 0*_et_conversion)
1231  alg.addvariable('EtaMin1', 0*_eta_conversion)
1232  alg.addvariable('EtaMax1', 49*_eta_conversion)
1233  alg.addvariable('EtaMin2', 0*_eta_conversion)
1234  alg.addvariable('EtaMax2', 49*_eta_conversion)
1235  alg.addvariable('DRCut', 0) #TODO: conversion needed here?
1236  tm.registerTopoAlgo(alg)
1237 
1238  # TODO: to be updated with phase1 met, jets
1239  xemap = [{"etcut": 0, "Threlist": [ 40, 50, 55, 60, 65, 75 ]}]
1240  for x in xemap:
1241  class d:
1242  pass
1243  for k in x:
1244  setattr (d, k, x[k])
1245  log.debug("Define %s", toponame)
1246  inputList = ['jXENoSort_1BC', 'AjJall_1BC']
1247  toponames=[]
1248  for minxe in d.Threlist:
1249  toponames.append("KF-jXE%s-AjJall" % (minxe))
1250  alg = AlgConf.KalmanMETCorrection( name = "KF-jXE-AjJall", inputs = inputList, outputs = toponames )
1251  alg.addgeneric('InputWidth', HW.jJetInputWidth)
1252  alg.addgeneric('NumResultBits', len(toponames))
1253  for key, value in KFMETweightParameters.items():
1254  # add weight (scale factor) parameters
1255  # these weights are compacted into 32bit words in order to limit the number
1256  # of registers needed to load them in firmware
1257  alg.addvariable(key, value)
1258  alg.addvariable('MinET', 0)
1259  for bitid,minxe in enumerate(d.Threlist):
1260  alg.addvariable('KFXE', str(minxe*_et_conversion), bitid)
1261  tm.registerTopoAlgo(alg)
1262 
1263 
1264  # LATE MUON : LATE-MU10s1
1265  for x in [
1266  #{"otype" : "LATE-MU", "ocut" : 10, "inputwidth": HW.muonOutputWidthSort},
1267  {"otype" : "LATE-MU", "ocut" : 10, "inputwidth": HW.NumberOfDelayedMuons},
1268  ]:
1269 
1270  class d:
1271  pass
1272  for k in x:
1273  setattr (d, k, x[k])
1274 
1275  toponame = "%s%ss1" % ( d.otype, str(d.ocut) )
1276 
1277  log.debug("Define %s", toponame)
1278 
1279  inputList = 'LMUs'
1280 
1281  alg = AlgConf.EtCut( name = toponame, inputs = inputList, outputs = toponame )
1282  alg.addgeneric('InputWidth', d.inputwidth)
1283  alg.addgeneric('MaxTob', 1)
1284  alg.addgeneric('NumResultBits', 1)
1285  alg.addvariable('MinET', str(d.ocut*_et_conversion))
1286  tm.registerTopoAlgo(alg)
1287 
1288 
1289  # (ATR-12748) fat jet trigger with Simple Cone algo
1290  algoList = [
1291  {"itemNameMinHT": 111, "minHT": 166, "otype" : "CjJ", "ocut" : 40, "olist" : "ab", "nleading" : HW.jJetOutputWidthSelect, "inputwidth": HW.jJetOutputWidthSelect, "oeta" : 26}, #SC111-CjJ40abpETA26
1292  ]
1293  for x in algoList:
1294  class d:
1295  pass
1296  for k in x:
1297  setattr (d, k, x[k])
1298  toponame = "SC%d-%s%s%s%spETA%s" % (d.itemNameMinHT, d.otype, str(d.ocut), d.olist, str(d.nleading) if d.olist=="s" else "", str(d.oeta))
1299  log.debug("Define %s", toponame)
1300  inputList = d.otype + d.olist
1301  alg = AlgConf.SimpleCone( name = toponame, inputs = inputList, outputs = [toponame] )
1302  alg.addgeneric('InputWidth', d.inputwidth)
1303  alg.addgeneric('NumResultBits', 1)
1304  alg.addvariable('MinET', d.ocut*_et_conversion)
1305  alg.addvariable('MinSumET', d.minHT*_et_conversion)
1306  alg.addvariable('MaxRSqr', 10*10*_dr_conversion*_dr_conversion)
1307  tm.registerTopoAlgo(alg)
1308 
1309  # 0INVM9-eEM9ab-eEMab
1310  algoList = [
1311  {"minInvm" : 0, "maxInvm": 9, "otype" : "eEM", "ocut1" : 9, "olist" : "ab", "inputwidth": HW.eEmOutputWidthSelect, "ocut2" : 0},
1312  ]
1313  for x in algoList:
1314  class d:
1315  pass
1316  for k in x:
1317  setattr (d, k, x[k])
1318  inputList = d.otype + d.olist
1319  toponame = "%iINVM%i-%s%s%s-%s%s" % (d.minInvm, d.maxInvm,
1320  d.otype, str(d.ocut1) , d.olist,
1321  d.otype, d.olist)
1322  alg = AlgConf.InvariantMassInclusive1( name = toponame, inputs = inputList, outputs = toponame)
1323  alg.addgeneric('InputWidth', d.inputwidth)
1324  alg.addgeneric('MaxTob', HW.eEmOutputWidthSelect)
1325  alg.addgeneric('NumResultBits', 1)
1326  alg.addvariable('MinET1', get_threshold_cut(d.otype, d.ocut1)*_et_conversion)
1327  alg.addvariable('MinET2', get_threshold_cut(d.otype, d.ocut2)*_et_conversion)
1328  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion)
1329  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion)
1330  tm.registerTopoAlgo(alg)
1331 
1332 
1333  # added for b-phys, 0DR03-eEM9ab-CjJ40ab
1334  algoList = [
1335  {"minDr": 0, "maxDr": 3, "otype1" : "eEM" ,"ocut1": 9, "olist1" : "ab", "otype2" : "CjJ", "ocut2": 40, "olist2" : "ab"}
1336  ]
1337  for x in algoList:
1338  class d:
1339  pass
1340  for k in x:
1341  setattr (d, k, x[k])
1342  toponame = "%iDR%02d-%s%s%s-%s%s%s" % (d.minDr, d.maxDr, d.otype1, str(d.ocut1), d.olist1, d.otype2, str(d.ocut2), d.olist2)
1343  log.debug("Define %s", toponame)
1344  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2]
1345  alg = AlgConf.DeltaRSqrIncl2( name = toponame, inputs = inputList, outputs = [ toponame ])
1346  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSelect)
1347  alg.addgeneric('InputWidth2', HW.jJetOutputWidthSelect)
1348  alg.addgeneric('MaxTob1', HW.eEmOutputWidthSelect)
1349  alg.addgeneric('MaxTob2', HW.jJetOutputWidthSelect)
1350  alg.addgeneric('NumResultBits', 1)
1351  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, 0)
1352  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, 0)
1353  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion, 0)
1354  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion, 0)
1355  tm.registerTopoAlgo(alg)
1356 
1357 
1358  # Axion 2EM DPHI
1359  #27DPHI32-eEMs1-eEMs6
1360  algoList = [
1361  {"minDphi": 27, "maxDphi": 32, "otype" : "eEM", "ocut1" : 0, "olist" : "s", "nleading1" : 1, "inputwidth1": HW.eEmOutputWidthSort, "ocut2" : 0, "nleading2": 6},
1362  ]
1363  for x in algoList:
1364  class d:
1365  pass
1366  for k in x:
1367  setattr (d, k, x[k])
1368  toponame = "%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.minDphi, d.maxDphi,
1369  d.otype, str(d.ocut1) if d.ocut1 > 0 else "", d.olist, str(d.nleading1) if d.olist=="s" else "",
1370  d.otype, str(d.ocut2) if d.ocut2 > 0 else "", d.olist, str(d.nleading2) if d.olist=="s" else "")
1371  log.debug("Define %s", toponame)
1372  inputList = d.otype + d.olist
1373  alg = AlgConf.DeltaPhiIncl1( name = toponame, inputs = inputList, outputs = toponame )
1374  alg.addgeneric('InputWidth', d.inputwidth1)
1375  alg.addgeneric('MaxTob', d.nleading2)
1376  alg.addgeneric('NumResultBits', 1)
1377  alg.addvariable('MinET1', get_threshold_cut(d.otype, d.ocut1)*_et_conversion if d.ocut1 > 0 else get_threshold_cut(d.otype, 5)*_et_conversion, 0)
1378  alg.addvariable('MinET2', get_threshold_cut(d.otype, d.ocut2)*_et_conversion if d.ocut2 > 0 else get_threshold_cut(d.otype, 5)*_et_conversion, 0)
1379  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion, 0)
1380  alg.addvariable('MaxDeltaPhi', d.maxDphi*_phi_conversion, 0)
1381  tm.registerTopoAlgo(alg)
1382 
1383  # Tau dR chains
1384  algolist=[
1385  { "minDr": 0, "maxDr": 28, "otype1" : "eTAU" ,"ocut1": 30, "olist1" : "abm",
1386  "nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,"otype2" : "eTAU", "ocut2": 20, "olist2" : "abm",
1387  "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect}, # 0DR28-eTAU30abm-eTAU20abm
1388  ]
1389  for x in algolist:
1390  class d:
1391  pass
1392  for k in x:
1393  setattr (d, k, x[k])
1394  obj1 = "%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1395  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1396  toponame = "%iDR%i-%s%s" % (d.minDr, d.maxDr, obj1, obj2)
1397  log.debug("Define %s", toponame)
1398  inputList = [d.otype1 + d.olist1] if d.otype1==d.otype2 else [d.otype1 + d.olist1, d.otype2 + d.olist2]
1399  algoname = AlgConf.DeltaRSqrIncl1 if d.otype1==d.otype2 else AlgConf.DeltaRSqrIncl2
1400  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
1401  if d.otype1==d.otype2:
1402  alg.addgeneric('InputWidth', d.inputwidth1)
1403  alg.addgeneric('MaxTob', d.nleading1)
1404  else:
1405  alg.addgeneric('InputWidth1', d.inputwidth1)
1406  alg.addgeneric('InputWidth2', d.inputwidth2)
1407  alg.addgeneric('MaxTob1', d.nleading1)
1408  alg.addgeneric('MaxTob2', d.nleading2)
1409  alg.addgeneric('NumResultBits', 1)
1410  if d.otype1==d.otype2:
1411  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion )
1412  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion )
1413  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
1414  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
1415  else:
1416  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion , 0)
1417  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion , 0)
1418  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion, 0)
1419  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion, 0)
1420  tm.registerTopoAlgo(alg)
1421 
1422 
1423 
1424  # DISAMB Lines with DR Cut
1425  # output lines = '2DISAMB-jJ55ab-0DR25-eTAU30ab-eTAU20ab'
1426  # '2DISAMB-jJ55ab-0DR28-eTAU30ab-eTAU20ab'
1427  # '2DISAMB-jJ50ab-0DR25-eTAU30ab-eTAU20ab',
1428  # '2DISAMB-jJ50ab-0DR28-eTAU30ab-eTAU20ab',
1429  # '2DISAMB-jJ40ab-0DR25-eTAU30ab-eTAU20ab',
1430  # '2DISAMB-jJ40ab-0DR28-eTAU30ab-eTAU20ab',
1431  # '2DISAMB-jJ30ab-0DR25-eTAU30ab-eTAU20ab',
1432  # '2DISAMB-jJ30ab-0DR28-eTAU30ab-eTAU20ab']
1433  DISAMB_DR_jJ_eTau_eTau_Map = [
1434  {
1435  "algoname": "2DISAMB_jJ55ab_DR_eTAU_eTAU",
1436  "disamb" : 2,
1437  "minDR" : 0,
1438  "maxDR" : [25,28],
1439  "otype1" : "eTAU",
1440  "ocut1" : 30,
1441  "olist1": "ab",
1442  "nleading1": HW.eTauOutputWidthSelect,
1443  "inputwidth1": HW.eTauOutputWidthSelect,
1444  "otype2" : "eTAU",
1445  "ocut2" : 20,
1446  "nleading2": HW.eTauOutputWidthSelect,
1447  "inputwidth2": HW.eTauOutputWidthSelect,
1448  "olist2": "ab",
1449  "otype3" : "jJ",
1450  "ocut3" : 55,
1451  "nleading3": HW.jJetOutputWidthSelect,
1452  "inputwidth3": HW.jJetOutputWidthSelect,
1453  "olist3": "ab",
1454  },
1455  {
1456  "algoname": "2DISAMB_jJ50ab_DR_eTAU_eTAU",
1457  "disamb" : 2,
1458  "minDR" : 0,
1459  "maxDR" : [25,28],
1460  "otype1" : "eTAU",
1461  "ocut1" : 30,
1462  "olist1": "ab",
1463  "nleading1": HW.eTauOutputWidthSelect,
1464  "inputwidth1": HW.eTauOutputWidthSelect,
1465  "otype2" : "eTAU",
1466  "ocut2" : 20,
1467  "nleading2": HW.eTauOutputWidthSelect,
1468  "inputwidth2": HW.eTauOutputWidthSelect,
1469  "olist2": "ab",
1470  "otype3" : "jJ",
1471  "ocut3" : 50,
1472  "nleading3": HW.jJetOutputWidthSelect,
1473  "inputwidth3": HW.jJetOutputWidthSelect,
1474  "olist3": "ab",
1475  },
1476  {
1477  "algoname": "2DISAMB_jJ40ab_DR_eTAU_eTAU",
1478  "disamb" : 2,
1479  "minDR" : 0,
1480  "maxDR" : [25, 28],
1481  "otype1" : "eTAU",
1482  "ocut1" : 30,
1483  "olist1": "ab",
1484  "nleading1": HW.eTauOutputWidthSelect,
1485  "inputwidth1": HW.eTauOutputWidthSelect,
1486  "otype2" : "eTAU",
1487  "ocut2" : 20,
1488  "nleading2": HW.eTauOutputWidthSelect,
1489  "inputwidth2": HW.eTauOutputWidthSelect,
1490  "olist2": "ab",
1491  "otype3" : "jJ",
1492  "ocut3" : 40,
1493  "nleading3": HW.jJetOutputWidthSelect,
1494  "inputwidth3": HW.jJetOutputWidthSelect,
1495  "olist3": "ab",
1496  },
1497  {
1498  "algoname": "2DISAMB_jJ30ab_DR_eTAU_eTAU",
1499  "disamb" : 2,
1500  "minDR" : 0,
1501  "maxDR" : [25, 28],
1502  "otype1" : "eTAU",
1503  "ocut1" : 30,
1504  "olist1": "ab",
1505  "nleading1": HW.eTauOutputWidthSelect,
1506  "inputwidth1": HW.eTauOutputWidthSelect,
1507  "otype2" : "eTAU",
1508  "ocut2" : 20,
1509  "nleading2": HW.eTauOutputWidthSelect,
1510  "inputwidth2": HW.eTauOutputWidthSelect,
1511  "olist2": "ab",
1512  "otype3" : "jJ",
1513  "ocut3" : 30,
1514  "nleading3": HW.jJetOutputWidthSelect,
1515  "inputwidth3": HW.jJetOutputWidthSelect,
1516  "olist3": "ab",
1517  }
1518  ]
1519  for x in DISAMB_DR_jJ_eTau_eTau_Map:
1520  class d:
1521  pass
1522  for k in x:
1523  setattr(d,k,x[k])
1524  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2, d.otype3 + d.olist3]
1525  toponames = []
1526  for bitId in range(len(d.maxDR)):
1527  obj1 = "-%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1528  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1529  obj3 = "%s%s%s" % (d.otype3, str(d.ocut3), d.olist3)
1530  toponames.append("%sDISAMB-%s-%dDR%d%s%s" % ( str(d.disamb) if d.disamb>0 else "",
1531  obj3, d.minDR, d.maxDR[bitId], obj1, obj2))
1532 
1533  alg = AlgConf.DisambiguationDRIncl3( name = d.algoname, inputs = inputList, outputs = toponames )
1534  alg.addgeneric('InputWidth1', d.inputwidth1)
1535  alg.addgeneric('InputWidth2', d.inputwidth2)
1536  alg.addgeneric('InputWidth3', d.inputwidth3)
1537  alg.addgeneric('MaxTob1', d.nleading1)
1538  alg.addgeneric('MaxTob2', d.nleading2)
1539  alg.addgeneric('MaxTob3', d.nleading3)
1540  alg.addgeneric('NumResultBits', len(toponames))
1541 
1542  for bitId in range(len(toponames)):
1543  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, bitId)
1544  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, bitId)
1545  alg.addvariable('MinET3', get_threshold_cut(d.otype3, d.ocut3)*_et_conversion, bitId)
1546  alg.addvariable('DisambDRSqrMin', d.minDR*d.minDR*_dr_conversion*_dr_conversion, bitId)
1547  alg.addvariable('DisambDRSqrMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
1548  alg.addvariable('DisambDRSqr', d.disamb*d.disamb*_dr_conversion*_dr_conversion, bitId)
1549 
1550  tm.registerTopoAlgo(alg)
1551 
1552 
1553  # DR for eTAU30ab_eTAU20ab
1554  # output lines : '0DR25-eTAU30ab-eTAU20ab'
1555  # '0DR28-eTAU30ab-eTAU20ab'
1556  DR_eTau30_eTau20_Map = [
1557  {
1558  "algoname": "DR_eTAU30ab_eTAU20ab",
1559  "minDR" : 0,
1560  "maxDR" : [25,28],
1561  "otype1" : "eTAU",
1562  "ocut1" : 30,
1563  "olist1": "ab",
1564  "otype2" : "eTAU",
1565  "ocut2" : 20,
1566  "inputwidth": HW.eTauOutputWidthSelect,
1567  "olist2": "ab",
1568  }
1569  ]
1570  for x in DR_eTau30_eTau20_Map:
1571  class d:
1572  pass
1573  for k in x:
1574  setattr(d,k,x[k])
1575  inputList = [d.otype1 + d.olist1]
1576  toponames = []
1577  for bitId in range(len(d.maxDR)):
1578  obj1 = "-%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1579  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1580  toponames.append("%dDR%d%s%s" % ( d.minDR, d.maxDR[bitId], obj1, obj2))
1581 
1582  alg = AlgConf.DeltaRSqrIncl1( name = d.algoname, inputs = inputList, outputs = toponames )
1583 
1584  alg.addgeneric('InputWidth', d.inputwidth)
1585  alg.addgeneric('MaxTob', HW.eTauOutputWidthSelect)
1586  alg.addgeneric('NumResultBits', len(toponames) )
1587 
1588  for bitId in range(len(toponames)):
1589  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, bitId)
1590  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, bitId)
1591  alg.addvariable('DeltaRMin', d.minDR*d.minDR*_dr_conversion*_dr_conversion, bitId)
1592  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
1593 
1594 
1595  tm.registerTopoAlgo(alg)
1596 
1597  # DISAMB 3 lists with DR cut to 2nd and 3rd lists
1598  algolist=[
1599  { "disamb": 2,
1600  "otype1" : "eTAU", "ocut1": 30, "olist1": "abm", "nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1601  "otype2" : "eTAU", "ocut2": 20, "olist2": "abm", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1602  "otype3" : "jJ" , "ocut3": 55, "olist3": "ab" , "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1603  "drcutmin": 0, "drcutmax": 28}, # 2DISAMB-jJ55ab-0DR28-eTAU30abm-eTAU20abm
1604  { "disamb" : 2,
1605  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1606  "otype2" : "eTAU", "ocut2": 20, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1607  "otype3" : "jJ" , "ocut3": 55, "olist3": "ab" , "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1608  "drcutmin": 4 , "drcutmax": 28}, # 2DISAMB-jJ55ab-4DR28-eTAU30ab-eTAU20ab
1609  { "disamb" : 2,
1610  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1611  "otype2" : "eTAU", "ocut2": 20, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1612  "otype3" : "jJ" , "ocut3": 55, "olist3": "ab" , "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1613  "drcutmin": 4 , "drcutmax": 32}, # 2DISAMB-jJ55ab-4DR32-eTAU30ab-eTAU20ab
1614  { "disamb" : 2,
1615  "otype1" : "eTAU", "ocut1": 30, "olist1": "ab", "nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1616  "otype2" : "eTAU", "ocut2": 20, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1617  "otype3" : "jJ" , "ocut3": 55, "olist3": "ab" , "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1618  "drcutmin": 10 , "drcutmax": 32}, # 2DISAMB-jJ55ab-10DR32-eTAU30ab-eTAU20ab
1619  ]
1620  for x in algolist:
1621  class d:
1622  pass
1623  for k in x:
1624  setattr (d, k, x[k])
1625  obj1 = "-%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1626  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1627  obj3 = "%s%s%s" % (d.otype3, str(d.ocut3), d.olist3)
1628  toponame = "%sDISAMB-%s-%dDR%d%s%s" % ( str(d.disamb) if d.disamb>0 else "", obj3, d.drcutmin, d.drcutmax, obj1, obj2)
1629  log.debug("Define %s", toponame)
1630  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2, d.otype3 + d.olist3]
1631  alg = AlgConf.DisambiguationDRIncl3( name = toponame, inputs = inputList, outputs = [ toponame ])
1632  alg.addgeneric('InputWidth1', d.inputwidth1)
1633  alg.addgeneric('InputWidth2', d.inputwidth2)
1634  alg.addgeneric('InputWidth3', d.inputwidth3)
1635  alg.addgeneric('MaxTob1', d.nleading1)
1636  alg.addgeneric('MaxTob2', d.nleading2)
1637  alg.addgeneric('MaxTob3', d.nleading3)
1638  alg.addgeneric('NumResultBits', 1)
1639  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, 0)
1640  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, 0)
1641  alg.addvariable('MinET3', get_threshold_cut(d.otype3, d.ocut3)*_et_conversion, 0)
1642  alg.addvariable('DisambDRSqrMin', d.drcutmin*d.drcutmin*_dr_conversion*_dr_conversion, 0)
1643  alg.addvariable('DisambDRSqrMax', d.drcutmax*d.drcutmax*_dr_conversion*_dr_conversion, 0)
1644  alg.addvariable('DisambDRSqr', d.disamb*d.disamb*_dr_conversion*_dr_conversion, 0)
1645  tm.registerTopoAlgo(alg)
1646 
1647 
1648  #TLA deta
1649  algoList = [
1650  { "minDeta": 0, "maxDeta": 20, "otype" : "jJ", "ocut1" : 90, "olist" : "s",
1651  "nleading1" : 1, "inputwidth1": HW.jJetOutputWidthSort, "ocut2" : 0, "nleading2": 2}, #0DETA20-jJ90s1-jJs2
1652  { "minDeta": 0, "maxDeta" : 24, "otype" : "eTAU" , "olist" : "s", "inputwidth1": HW.eTauOutputWidthSort,
1653  "ocut1" : 30, "nleading1": 2,
1654  "ocut2" : 12, "nleading2": 2}, #0DETA24_eTAU30s2_eTAU12s2
1655  ]
1656  for x in algoList:
1657  class d:
1658  pass
1659  for k in x:
1660  setattr (d, k, x[k])
1661  toponame = "%iDETA%i-%s%s%s%s-%s%s%s%s" % (d.minDeta, d.maxDeta,
1662  d.otype, d.ocut1 if d.ocut1 > 0 else "", d.olist, d.nleading1,
1663  d.otype, d.ocut2 if d.ocut2 > 0 else "", d.olist, d.nleading2)
1664  log.debug("Define %s", toponame)
1665  inputList = d.otype + d.olist
1666  alg = AlgConf.DeltaEtaIncl1( name = toponame, inputs = inputList, outputs = toponame )
1667  alg.addgeneric('InputWidth', d.inputwidth1)
1668  alg.addgeneric('MaxTob', d.nleading2)
1669  alg.addgeneric('NumResultBits', 1)
1670  alg.addvariable('MinET1', get_threshold_cut(d.otype, d.ocut1)*_et_conversion, 0)
1671  alg.addvariable('MinET2', get_threshold_cut(d.otype, d.ocut2)*_et_conversion, 0)
1672  alg.addvariable('MinDeltaEta', d.minDeta*_eta_conversion, 0)
1673  alg.addvariable('MaxDeltaEta', d.maxDeta*_eta_conversion, 0)
1674  tm.registerTopoAlgo(alg)
1675 
1676  # ATR-30401
1677  # topoitems will be the follwoing:
1678  # 0DPHI10_jXE40delay_jJ40s
1679  # 0DPHI99_jXE40delay_jJ40s
1680  DPHI_jXE40delay_jJ40s_map = [
1681  {
1682  "algoname" : "DPHI_jXE40delay_jJ40s",
1683  "Delay1" : 1,
1684  "Delay2" : 0,
1685  "InputWidth1": HW.metOutputWidth,
1686  "InputWidth2": HW.jJetOutputWidthSort,
1687  "MaxTob1" : 1,
1688  "MaxTob2" : 6,
1689  "MinET1" : 40*_et_conversion,
1690  "MinET2" : 40*_et_conversion,
1691  "MinDeltaPhi": 0*_phi_conversion,
1692  "phi_thresholds": [10, 99],
1693  }
1694  ]
1695 
1696  for x in DPHI_jXE40delay_jJ40s_map:
1697  class d:
1698  pass
1699  for k in x:
1700  setattr(d,k,x[k])
1701  inputList = ['jXEs', 'jJs']
1702  toponames = []
1703  for bitId in range(len(d.phi_thresholds)):
1704  toponames.append("0DPHI%d-jXE40delay-jJ40s" % (d.phi_thresholds[bitId]))
1705 
1706  alg = AlgConf.DeltaPhiIncl2( name = d.algoname, inputs = inputList, outputs = toponames )
1707 
1708  alg.addgeneric('InputWidth1', d.InputWidth1)
1709  alg.addgeneric('InputWidth2', d.InputWidth2)
1710  alg.addgeneric('MaxTob1', d.MaxTob1)
1711  alg.addgeneric('MaxTob2', d.MaxTob2)
1712  alg.addgeneric('NumResultBits', len(toponames) )
1713 
1714  for bitId in range(len(toponames)):
1715  alg.addvariable('MinET1', d.MinET1, bitId)
1716  alg.addvariable('MinET2', d.MinET2, bitId)
1717  alg.addvariable('MinDeltaPhi', d.MinDeltaPhi, bitId)
1718  alg.addvariable('MaxDeltaPhi', d.phi_thresholds[bitId]*_phi_conversion, bitId)
1719  tm.registerTopoAlgo(alg)
1720 
1721  # DISAMB 3 lists with DR cut to 2nd and 3rd lists
1722  algolist=[
1723  { "disamb": 2,
1724  "otype1" : "eTAU", "ocut1": 20, "olist1": "ab","nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1725  "otype2" : "eTAU", "ocut2": 12, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1726  "otype3" : "jJ", "ocut3": 40, "olist3": "ab", "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1727  "drcutmin": 0, "drcutmax": 10}, # 2DISAMB-jJ40ab-0DR10-eTAU20ab-eTAU12ab
1728  ]
1729  for x in algolist:
1730  class d:
1731  pass
1732  for k in x:
1733  setattr (d, k, x[k])
1734  obj1 = "-%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1735  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1736  obj3 = "%s%s%s" % (d.otype3, str(d.ocut3), d.olist3)
1737  toponame = "%sDISAMB-%s-%dDR%d%s%s" % ( str(d.disamb) if d.disamb>0 else "", obj3, d.drcutmin, d.drcutmax, obj1, obj2)
1738  log.debug("Define %s", toponame)
1739  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2, d.otype3 + d.olist3]
1740  alg = AlgConf.DisambiguationDRIncl3( name = toponame, inputs = inputList, outputs = [ toponame ])
1741  alg.addgeneric('InputWidth1', d.inputwidth1)
1742  alg.addgeneric('InputWidth2', d.inputwidth2)
1743  alg.addgeneric('InputWidth3', d.inputwidth3)
1744  alg.addgeneric('MaxTob1', d.nleading1)
1745  alg.addgeneric('MaxTob2', d.nleading2)
1746  alg.addgeneric('MaxTob3', d.nleading3)
1747  alg.addgeneric('NumResultBits', 1)
1748  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, 0)
1749  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, 0)
1750  alg.addvariable('MinET3', get_threshold_cut(d.otype3, d.ocut3)*_et_conversion, 0)
1751  alg.addvariable('DisambDRSqrMin', d.drcutmin*d.drcutmin*_dr_conversion*_dr_conversion, 0)
1752  alg.addvariable('DisambDRSqrMax', d.drcutmax*d.drcutmax*_dr_conversion*_dr_conversion, 0)
1753  alg.addvariable('DisambDRSqr', d.disamb*d.disamb*_dr_conversion*_dr_conversion, 0)
1754  tm.registerTopoAlgo(alg)
1755 
1756  #VAE-based anomaly trigger
1757  # output lines: 'ADVAE2A-6jJ0s-4eTAU0s-4MU0s-jXE0s-Tight',
1758  # 'ADVAE2A-6jJ0s-4eTAU0s-4MU0s-jXE0s-Loose'
1759  #Ordering -
1760  #1. jJetx6
1761  #2. eTAUx4
1762  #3. MUx4
1763  #4. jXEx1
1764  algo = {
1765  "algoname" : "ADVAE2A-jJ0s-eTAU0s-MU0s-jXE0s",
1766  "otype1" : "jJ", "olist1": "s", "inputwidth1": 6, "nleading1": 6,
1767  "otype2" : "eTAU", "olist2": "s", "inputwidth2": 6, "nleading2": 4,
1768  "otype3" : "MU", "olist3": "s", "inputwidth3": 6, "nleading3": 4,
1769  "otype4" : "jXE", "olist4": "s", "inputwidth4": 1, "nleading4": 1,
1770  "WPList" : ["Tight", "Loose"],
1771  "AnomalyScoreThresh" : [3875, 3875], #corresponds to Tight and Loose WPs
1772  }
1773  class d:
1774  pass
1775  for k in algo:
1776  setattr (d, k, algo[k])
1777  toponames = []
1778  for WP in d.WPList:
1779  toponames.append("ADVAE2A-%s%s0%s-%s%s0%s-%s%s0%s-%s0%s-%s" %(str(d.nleading1), d.otype1, d.olist1,
1780  str(d.nleading2), d.otype2, d.olist2,
1781  str(d.nleading3), d.otype3, d.olist3,
1782  d.otype4, d.olist4,
1783  WP) )
1784  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2, d.otype3 + d.olist3, d.otype4 + d.olist4]
1785  alg = AlgConf.ADVAE_2A( name = d.algoname, inputs = inputList, outputs = toponames)
1786  alg.addgeneric('InputWidth1', d.inputwidth1)
1787  alg.addgeneric('InputWidth2', d.inputwidth2)
1788  alg.addgeneric('InputWidth3', d.inputwidth3)
1789  alg.addgeneric('InputWidth4', d.inputwidth4)
1790  alg.addgeneric('MaxTob1', d.nleading1)
1791  alg.addgeneric('MaxTob2', d.nleading2)
1792  alg.addgeneric('MaxTob3', d.nleading3)
1793  alg.addgeneric('MaxTob4', d.nleading4)
1794  alg.addgeneric('NumResultBits', len(toponames))
1795  alg.addgeneric('ADVAEVersion', 1)
1796  for bitId in range(len(toponames)):
1797  alg.addvariable('AnomalyScoreThresh', d.AnomalyScoreThresh[bitId], bitId)
1798  tm.registerTopoAlgo(alg)
1799 
1800  algolist=[
1801  { "disamb": 2,
1802  "otype1" : "eTAU", "ocut1": 20, "olist1": "ab","nleading1": HW.eTauOutputWidthSelect, "inputwidth1": HW.eTauOutputWidthSelect,
1803  "otype2" : "eTAU", "ocut2": 12, "olist2": "ab", "nleading2": HW.eTauOutputWidthSelect, "inputwidth2": HW.eTauOutputWidthSelect,
1804  "otype3" : "jJ", "ocut3": 30, "olist3": "ab", "nleading3": HW.jJetOutputWidthSelect, "inputwidth3": HW.jJetOutputWidthSelect,
1805  "drcutmin": 0, "drcutmax": 10}, # 2DISAMB-jJ30ab-0DR10-eTAU20ab-eTAU12ab
1806  ]
1807  for x in algolist:
1808  class d:
1809  pass
1810  for k in x:
1811  setattr (d, k, x[k])
1812  obj1 = "-%s%s%s" % (d.otype1, str(d.ocut1), d.olist1)
1813  obj2 = "-%s%s%s" % (d.otype2, str(d.ocut2), d.olist2)
1814  obj3 = "%s%s%s" % (d.otype3, str(d.ocut3), d.olist3)
1815  toponame = "%sDISAMB-%s-%dDR%d%s%s" % ( str(d.disamb) if d.disamb>0 else "", obj3, d.drcutmin, d.drcutmax, obj1, obj2)
1816  log.debug("Define %s", toponame)
1817  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2, d.otype3 + d.olist3]
1818  alg = AlgConf.DisambiguationDRIncl3( name = toponame, inputs = inputList, outputs = [ toponame ])
1819  alg.addgeneric('InputWidth1', d.inputwidth1)
1820  alg.addgeneric('InputWidth2', d.inputwidth2)
1821  alg.addgeneric('InputWidth3', d.inputwidth3)
1822  alg.addgeneric('MaxTob1', d.nleading1)
1823  alg.addgeneric('MaxTob2', d.nleading2)
1824  alg.addgeneric('MaxTob3', d.nleading3)
1825  alg.addgeneric('NumResultBits', 1)
1826  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, 0)
1827  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion, 0)
1828  alg.addvariable('MinET3', get_threshold_cut(d.otype3, d.ocut3)*_et_conversion, 0)
1829  alg.addvariable('DisambDRSqrMin', d.drcutmin*d.drcutmin*_dr_conversion*_dr_conversion, 0)
1830  alg.addvariable('DisambDRSqrMax', d.drcutmax*d.drcutmax*_dr_conversion*_dr_conversion, 0)
1831  alg.addvariable('DisambDRSqr', d.disamb*d.disamb*_dr_conversion*_dr_conversion, 0)
1832  tm.registerTopoAlgo(alg)
1833 
1834  # jINVM + DPHI
1835  NFFDphimap = [
1836  { "itemNameMinInvm": 400, "minInvm": 640 , "minDphi": 0, "maxDphiList": [26, 24, 22, 20],
1837  "otype1" : "AjJ", "ocut1" : 60, "olist1" : "s", "nleading1" : 6, "inputwidth": HW.jJetOutputWidthSort,
1838  "otype2" : "AjJ", "ocut2" : 50, "olist2" : "s", "nleading2" : 6 }
1839  ]
1840  for x in NFFDphimap:
1841  class d:
1842  pass
1843  for k in x:
1844  setattr (d, k, x[k])
1845  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
1846  toponames=[]
1847  for maxDphi in d.maxDphiList:
1848  toponames.append ("%iINVM-%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.itemNameMinInvm, d.minDphi, maxDphi,
1849  d.otype1, str(d.ocut1) , d.olist1, str(d.nleading1) if d.olist1=="s" else "",
1850  d.otype2, str(d.ocut2) , d.olist2, str(d.nleading2) if d.olist2=="s" else ""))
1851  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = 'jINVM_DPHI', inputs = inputList, outputs = toponames)
1852  alg.addgeneric('InputWidth1', d.inputwidth)
1853  alg.addgeneric('InputWidth2', d.inputwidth)
1854  alg.addgeneric('MaxTob1', d.nleading1)
1855  alg.addgeneric('MaxTob2', d.nleading2)
1856  alg.addgeneric('NumResultBits', len(toponames))
1857  for bitid,maxDphi in enumerate(d.maxDphiList):
1858  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion , bitid)
1859  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion , bitid)
1860  alg.addvariable('MinMSqr', d.minInvm*d.minInvm *_et_conversion*_et_conversion , bitid)
1861  alg.addvariable('MaxMSqr', _no_m_upper_threshold , bitid) # no upper threshold
1862  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion , bitid)
1863  alg.addvariable('MaxDeltaPhi', maxDphi*_phi_conversion, bitid)
1864  tm.registerTopoAlgo(alg)
1865 
1866 
1867  # jINVM_NFF + DPHI
1868  NFFDphimap = [
1869  { "itemNameMinInvm": 400, "minInvm": 640 , "minDphi": 0, "maxDphiList": [26, 24, 22, 20],
1870  "otype1" : "jJ", "ocut1" : 60, "olist1" : "s", "nleading1" : 6, "inputwidth": HW.jJetOutputWidthSort,
1871  "otype2" : "AjJ", "ocut2" : 50, "olist2" : "s", "nleading2" : 6 }
1872  ]
1873  for x in NFFDphimap:
1874  class d:
1875  pass
1876  for k in x:
1877  setattr (d, k, x[k])
1878  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
1879  toponames=[]
1880  for maxDphi in d.maxDphiList:
1881  toponames.append ("%iINVM-%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.itemNameMinInvm, d.minDphi, maxDphi,
1882  d.otype1, str(d.ocut1) , d.olist1, str(d.nleading1) if d.olist1=="s" else "",
1883  d.otype2, str(d.ocut2) , d.olist2, str(d.nleading2) if d.olist2=="s" else ""))
1884  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = 'jINVM_DPHI_NFF', inputs = inputList, outputs = toponames)
1885  alg.addgeneric('InputWidth1', d.inputwidth)
1886  alg.addgeneric('InputWidth2', d.inputwidth)
1887  alg.addgeneric('MaxTob1', d.nleading1)
1888  alg.addgeneric('MaxTob2', d.nleading2)
1889  alg.addgeneric('NumResultBits', len(toponames))
1890  for bitid,maxDphi in enumerate(d.maxDphiList):
1891  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion , bitid)
1892  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion , bitid)
1893  alg.addvariable('MinMSqr', d.minInvm*d.minInvm *_et_conversion*_et_conversion , bitid)
1894  alg.addvariable('MaxMSqr', _no_m_upper_threshold , bitid) # no upper threshold
1895  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion , bitid)
1896  alg.addvariable('MaxDeltaPhi', maxDphi*_phi_conversion, bitid)
1897  tm.registerTopoAlgo(alg)
1898 
1899 
1900  # CF
1901  algoList = [
1902  { "itemNameMinInvm": 400, "minInvm": 640, "otype1" : "AjJ", "ocut1": 60, "olist1" : "s", "nleading1" : 6, "inputwidth1": HW.jJetOutputWidthSort,
1903  "otype2" : "AjJ", "ocut2": 50, "olist2" : "s", "nleading2" : 6, "inputwidth2": HW.jJetOutputWidthSort, "applyEtaCut":1,
1904  "minEta1": 0 ,"maxEta1": 32 , "minEta2": 30 ,"maxEta2": 49 , }, #400INVM-AjJ60s6pETA32-AjJ50s6p30ETA49
1905  ]
1906  for x in algoList:
1907  class d:
1908  pass
1909  for k in x:
1910  setattr (d, k, x[k])
1911  obj1 = "%s%s%sp%sETA%i" % (d.otype1, str(d.ocut1), d.olist1 + (str(d.nleading1) if d.olist1.find('s')>=0 else ""),str(d.minEta1) if d.minEta1>0 else "", d.maxEta1)
1912  obj2 = "-%s%s%sp%sETA%i" % (d.otype2, str(d.ocut2), d.olist2 + (str(d.nleading2) if d.olist2.find('s')>=0 else ""),str(d.minEta2) if d.minEta2>0 else "", d.maxEta2)
1913  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist2]
1914  toponame = "%iINVM-%s%s" % (d.itemNameMinInvm, obj1, obj2)
1915  alg = AlgConf.InvariantMassInclusive2( name = toponame, inputs = inputList, outputs = toponame)
1916  alg.addgeneric('InputWidth1', d.inputwidth1)
1917  alg.addgeneric('InputWidth2', d.inputwidth2)
1918  alg.addgeneric('MaxTob1', d.nleading1)
1919  alg.addgeneric('MaxTob2', d.nleading2)
1920  alg.addgeneric('NumResultBits', 1)
1921  if (d.applyEtaCut>0):
1922  alg.addgeneric('ApplyEtaCut', d.applyEtaCut)
1923  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion )
1924  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion )
1925  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion )
1926  alg.addvariable('MaxMSqr', _no_m_upper_threshold )
1927  if (d.applyEtaCut>0):
1928  alg.addvariable('MinEta1', d.minEta1*_eta_conversion )
1929  alg.addvariable('MaxEta1', d.maxEta1*_eta_conversion )
1930  alg.addvariable('MinEta2', d.minEta2*_eta_conversion )
1931  alg.addvariable('MaxEta2', d.maxEta2*_eta_conversion )
1932  tm.registerTopoAlgo(alg)
1933 
1934  # jINVM
1935  NFFmap = [
1936  { "itemNameMinInvmList": [300, 400, 500, 700], "minInvmList": [480, 640, 800, 1100] ,
1937  "otype1" : "AjJ", "ocut1" : 60, "olist1" : "s", "nleading1" : 6, "inputwidth": HW.jJetOutputWidthSort,
1938  "otype2" : "AjJ", "ocut2" : 50, "olist2" : "s", "nleading2" : 6 }
1939  ]
1940  for x in NFFmap:
1941  class d:
1942  pass
1943  for k in x:
1944  setattr (d, k, x[k])
1945  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
1946  toponames=[]
1947  for minInvm in d.itemNameMinInvmList:
1948  toponames.append ("%iINVM-%s%s%s%s-%s%s%s%s" % (minInvm,
1949  d.otype1, str(d.ocut1) , d.olist1, str(d.nleading1) if d.olist1=="s" else "",
1950  d.otype2, str(d.ocut2) , d.olist2, str(d.nleading2) if d.olist2=="s" else ""))
1951  alg = AlgConf.InvariantMassInclusive2( name = 'jINVM', inputs = inputList, outputs = toponames)
1952  alg.addgeneric('InputWidth1', d.inputwidth)
1953  alg.addgeneric('InputWidth2', d.inputwidth)
1954  alg.addgeneric('MaxTob1', d.nleading1)
1955  alg.addgeneric('MaxTob2', d.nleading2)
1956  alg.addgeneric('NumResultBits', len(toponames))
1957  for bitid,minInvm in enumerate(d.minInvmList):
1958  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion , bitid)
1959  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion , bitid)
1960  alg.addvariable('MinMSqr', minInvm*minInvm*_et_conversion*_et_conversion , bitid)
1961  alg.addvariable('MaxMSqr', _no_m_upper_threshold , bitid) # no upper threshold
1962  tm.registerTopoAlgo(alg)
1963 
1964  # jINVM_NFF
1965  NFFmap = [
1966  { "itemNameMinInvmList": [300, 400, 500, 700], "minInvmList": [480, 640, 800, 1100] ,
1967  "otype1" : "jJ", "ocut1" : 60, "olist1" : "s", "nleading1" : 6, "inputwidth": HW.jJetOutputWidthSort,
1968  "otype2" : "AjJ", "ocut2" : 50, "olist2" : "s", "nleading2" : 6 }
1969  ]
1970  for x in NFFmap:
1971  class d:
1972  pass
1973  for k in x:
1974  setattr (d, k, x[k])
1975  inputList = [d.otype1 + d.olist1, d.otype2 + d.olist1]
1976  toponames=[]
1977  for minInvm in d.itemNameMinInvmList:
1978  toponames.append ("%iINVM-%s%s%s%s-%s%s%s%s" % (minInvm,
1979  d.otype1, str(d.ocut1) , d.olist1, str(d.nleading1) if d.olist1=="s" else "",
1980  d.otype2, str(d.ocut2) , d.olist2, str(d.nleading2) if d.olist2=="s" else ""))
1981  alg = AlgConf.InvariantMassInclusive2( name = 'jINVM_NFF', inputs = inputList, outputs = toponames)
1982  alg.addgeneric('InputWidth1', d.inputwidth)
1983  alg.addgeneric('InputWidth2', d.inputwidth)
1984  alg.addgeneric('MaxTob1', d.nleading1)
1985  alg.addgeneric('MaxTob2', d.nleading2)
1986  alg.addgeneric('NumResultBits', len(toponames))
1987  for bitid,minInvm in enumerate(d.minInvmList):
1988  alg.addvariable('MinET1', get_threshold_cut("CjJ", d.ocut1)*_et_conversion , bitid)
1989  alg.addvariable('MinET2', get_threshold_cut(d.otype2, d.ocut2)*_et_conversion , bitid)
1990  alg.addvariable('MinMSqr', minInvm*minInvm*_et_conversion*_et_conversion , bitid)
1991  alg.addvariable('MaxMSqr', _no_m_upper_threshold , bitid) # no upper threshold
1992  tm.registerTopoAlgo(alg)
1993 
1994  #ATR-19355
1995  # Parameter ordering
1996  # 1. MinEt
1997  # 2. MinMSqr
1998  # 3. MaxMSqr
1999  toponame = "0INVM10-3MU3Vab"
2000  log.debug("Define %s", toponame)
2001  inputList = 'MU3Vab'
2002  alg = AlgConf.InvariantMassThreeTOBsIncl1( name = toponame, inputs = inputList, outputs = toponame )
2003  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2004  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2005  alg.addgeneric('NumResultBits', 1)
2006  alg.addvariable('MinET1', 0*_et_conversion)
2007  alg.addvariable('MinMSqr', 0*_et_conversion*_et_conversion)
2008  alg.addvariable('MaxMSqr', 10*10*_et_conversion*_et_conversion)
2009  tm.registerTopoAlgo(alg)
2010 
2011  toponame = "0INVM10-3MU3VFab"
2012  log.debug("Define %s", toponame)
2013  inputList = 'MU3VFab'
2014  alg = AlgConf.InvariantMassThreeTOBsIncl1( name = toponame, inputs = inputList, outputs = toponame )
2015  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2016  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2017  alg.addgeneric('NumResultBits', 1)
2018  alg.addvariable('MinET1', 0*_et_conversion)
2019  alg.addvariable('MinMSqr', 0*_et_conversion*_et_conversion)
2020  alg.addvariable('MaxMSqr', 10*10*_et_conversion*_et_conversion)
2021  tm.registerTopoAlgo(alg)
2022 
2023  #ATR-19638, 3muon, not all with the same charge
2024  toponame = "0INVM10C-3MU3Vab"
2025  log.debug("Define %s", toponame)
2026  inputList = 'MU3Vab'
2027  alg = AlgConf.InvariantMassThreeTOBsIncl1Charge( name = toponame, inputs = inputList, outputs = toponame )
2028  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2029  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2030  alg.addgeneric('NumResultBits', 1)
2031  alg.addvariable('MinET1', 0*_et_conversion)
2032  alg.addvariable('MinMSqr', 0*_et_conversion*_et_conversion)
2033  alg.addvariable('MaxMSqr', 10*10*_et_conversion*_et_conversion)
2034  tm.registerTopoAlgo(alg)
2035 
2036 
2037  # LFV
2038  # output lines: 0INVM10-0DR15-eEM10abl-MU8Fab, 0INVM10-0DR15-eEM15abl-MU5VFab
2039  # Parameter ordering
2040  # 1. MinEt1
2041  # 2. MinEt2
2042  # 3. MinMSqr
2043  # 4. MaxMSqr
2044  # 5. MinEta1
2045  # 6. MaxEta1
2046  # 7. MinEta2
2047  # 8. MaxEta2
2048  # 9. DeltaRMin
2049  # 10. DeltaRMax
2050  INVM_DR_eEM_MU_Map = [{
2051  "algoname": "INVM_DR_eEM_MU",
2052  "minInvm" : 0,
2053  "maxInvm" : 10,
2054  "minDR" : 0,
2055  "maxDR" : 15,
2056  "otype1" : "eEM",
2057  "ocut1" : [10,15],
2058  "olist1": "abl",
2059  "otype2" : "MU",
2060  "olist2": ["Fab","VFab"],
2061  "ocut2" : 5,
2062  "ocut2Offset" : [3,0]
2063 
2064  }]
2065 
2066  for x in INVM_DR_eEM_MU_Map:
2067  class d:
2068  pass
2069  for k in x:
2070  setattr(d,k,x[k])
2071  inputList = [d.otype1 + d.olist1, d.otype2 + str(d.ocut2) + d.olist2[1] ]
2072  toponames = []
2073  for bitId in range(len(d.ocut1)):
2074  obj1 = "-%s%s%s" % (d.otype1, str( d.ocut1[bitId] ) , d.olist1)
2075  obj2 = "-%s%s%s" % (d.otype2, str( d.ocut2 + d.ocut2Offset[bitId] ) , d.olist2[bitId])
2076  toponames.append("%dINVM%d-%dDR%d%s%s" % ( d.minInvm, d.maxInvm, d.minDR, d.maxDR, obj1, obj2))
2077 
2078  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl2( name = d.algoname, inputs = inputList, outputs = toponames )
2079 
2080  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSelect)
2081  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
2082  alg.addgeneric('MaxTob1', HW.eEmOutputWidthSort)
2083  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
2084  alg.addgeneric('ApplyEtaCut', 1)
2085 
2086  alg.addgeneric('NumResultBits', len(toponames) )
2087 
2088  for bitId in range(len(toponames)):
2089  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1[bitId])*_et_conversion, bitId)
2090  alg.addvariable('MinET2', (d.ocut2 + d.ocut2Offset[bitId])*_et_conversion, bitId)
2091  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion, bitId)
2092  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion, bitId)
2093  alg.addvariable('MinEta1', 0*_eta_conversion, bitId)
2094  alg.addvariable('MaxEta1', 49*_eta_conversion, bitId)
2095  alg.addvariable('MinEta2', 0*_eta_conversion, bitId)
2096  alg.addvariable('MaxEta2', 49*_eta_conversion, bitId)
2097  alg.addvariable('DeltaRMin', d.minDR*d.minDR*_dr_conversion*_dr_conversion, bitId)
2098  alg.addvariable('DeltaRMax', d.maxDR*d.maxDR*_dr_conversion*_dr_conversion, bitId)
2099 
2100 
2101  tm.registerTopoAlgo(alg)
2102 
2103  #ATR-18824 ZAFB-DPHI
2104  # TODO: update with fwd electrons
2105  # Parameter ordering
2106  # 1. MinEt1
2107  # 2. MinEt2
2108  # 3. MinMSqr
2109  # 4. MaxMSqr
2110  # 5. MinEta1
2111  # 6. MaxEta1
2112  # 7. MinEta2
2113  # 8. MaxEta2
2114  # 9. MinDeltaPhi
2115  # 10. MaxDeltaPhi
2116  ZAFBDphimap = [
2117  { "minInvm": 60 , "minDphiList": [4, 25], "maxDphi": 32, "minEta2": 25, "maxEta2": 49,
2118  "inputwidth1": HW.eEmOutputWidthSelect, "otype1" : "eEM", "ocut1" : 18, "olist1" : "abm",
2119  "nleading1" : HW.eEmOutputWidthSelect, "inputwidth2": HW.jEmOutputWidthSort, "ocut2" : 20, "nleading2" : 6 }
2120  ]
2121  for x in ZAFBDphimap:
2122  class d:
2123  pass
2124  for k in x:
2125  setattr (d, k, x[k])
2126  inputList = [d.otype1 + d.olist1, 'jEMs25ETA49']
2127  toponames=[]
2128  for minDphi in d.minDphiList:
2129  toponames.append ("%iINVM-%02dDPHI%i-%s%s%s%s-jEM%ss%s%iETA%i" % (d.minInvm, minDphi, d.maxDphi,
2130  d.otype1, str(d.ocut1) , d.olist1, str(d.nleading1) if d.olist1=="s" else "",
2131  str(d.ocut2) , str(d.nleading2) , d.minEta2, d.maxEta2))
2132  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = 'ZAFB_DPHI', inputs = inputList, outputs = toponames)
2133  alg.addgeneric('InputWidth1', d.inputwidth1)
2134  alg.addgeneric('InputWidth2', d.inputwidth2)
2135  alg.addgeneric('MaxTob1', d.nleading1)
2136  alg.addgeneric('MaxTob2', d.nleading2)
2137  alg.addgeneric('NumResultBits', len(toponames))
2138  alg.addgeneric('ApplyEtaCut', 1)
2139  for bitid,minDphi in enumerate(d.minDphiList):
2140  alg.addvariable('MinET1', get_threshold_cut(d.otype1, d.ocut1)*_et_conversion, bitid)
2141  alg.addvariable('MinET2', get_threshold_cut('jEM', d.ocut2)*_et_conversion, bitid)
2142  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion, bitid)
2143  alg.addvariable('MaxMSqr', _no_m_upper_threshold, bitid)
2144  alg.addvariable('MinEta1', 0*_eta_conversion, bitid)
2145  alg.addvariable('MaxEta1', 49*_eta_conversion, bitid)
2146  alg.addvariable('MinEta2', d.minEta2*_eta_conversion, bitid)
2147  alg.addvariable('MaxEta2', d.maxEta2*_eta_conversion, bitid)
2148  alg.addvariable('MinDeltaPhi', minDphi*_phi_conversion, bitid)
2149  alg.addvariable('MaxDeltaPhi', d.maxDphi*_phi_conversion, bitid)
2150  tm.registerTopoAlgo(alg)
2151 
2152  # ATR-19302, ATR-21637
2153  listofalgos=[
2154  {"minInvm": 0,"maxInvm": 70,"minDphi": 27,"maxDphi": 32,"otype":"eEM","olist":"s","ocut1":9,"nleading1":1,"ocut2":9,"nleading2":6,}, #0INVM70-27DPHI32-eEM9s1-eEM9s6
2155  {"minInvm": 0,"maxInvm": 70,"minDphi": 27,"maxDphi": 32,"otype":"eEM","olist":"sl","ocut1":9,"nleading1":1,"ocut2":9,"nleading2":6,}, #0INVM70-27DPHI32-eEM9sl1-eEM9sl6
2156  ]
2157  for x in listofalgos:
2158  class d:
2159  pass
2160  for k in x:
2161  setattr (d, k, x[k])
2162  toponame = "%iINVM%i-%iDPHI%i-%s%s%s%s-%s%s%s%s" % (d.minInvm, d.maxInvm, d.minDphi, d.maxDphi, d.otype, str(d.ocut1), d.olist, str(d.nleading1), d.otype, str(d.ocut2), d.olist,str(d.nleading2))
2163  log.debug("Define %s", toponame)
2164  inputList = [d.otype + d.olist, d.otype + d.olist]
2165  alg = AlgConf.InvariantMassDeltaPhiInclusive2( name = toponame, inputs = inputList, outputs = toponame )
2166  alg.addgeneric('InputWidth1', HW.eEmOutputWidthSort)
2167  alg.addgeneric('InputWidth2', HW.eEmOutputWidthSort)
2168  alg.addgeneric('MaxTob1', d.nleading1)
2169  alg.addgeneric('MaxTob2', d.nleading2)
2170  alg.addgeneric('NumResultBits', 1)
2171  alg.addvariable('MinET1', get_threshold_cut(d.otype, d.ocut1)*_et_conversion)
2172  alg.addvariable('MinET2', get_threshold_cut(d.otype, d.ocut2)*_et_conversion)
2173  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion)
2174  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion)
2175  alg.addgeneric('ApplyEtaCut', 1)
2176  alg.addvariable('MinEta1', 0*_eta_conversion)
2177  alg.addvariable('MaxEta1',49*_eta_conversion)
2178  alg.addvariable('MinEta2', 0*_eta_conversion)
2179  alg.addvariable('MaxEta2',49*_eta_conversion)
2180  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion)
2181  alg.addvariable('MaxDeltaPhi', d.maxDphi*_phi_conversion)
2182  tm.registerTopoAlgo(alg)
2183 
2184 
2185  # DR Map for INVM_DR_2MU3 Trigger. Output lines:
2186  #'7INVM22-0DR20-2MU3Vab'
2187  #'7INVM22-0DR12-2MU3Vab'
2188  INVM_DR_2MU3Vab_Map = [
2189  {
2190  "algoname": "7INVM22_DR_2MU3Vab",
2191  "minInvm" : 7,
2192  "maxInvm" : 22,
2193  "minDR" : [0,0],
2194  "maxDR" : [12,20],
2195  "otype1" : "MU3Vab",
2196  "mult1" : 2
2197  }
2198  ]
2199  for x in INVM_DR_2MU3Vab_Map:
2200  class d:
2201  pass
2202  for k in x:
2203  setattr(d,k,x[k])
2204  inputList = d.otype1
2205  toponames = []
2206  for bitId in range(len(d.minDR)):
2207  toponames.append("%iINVM%i-%iDR%i-%i%s" % ( d.minInvm, d.maxInvm,
2208  d.minDR[bitId] , d.maxDR[bitId],
2209  d.mult1, d.otype1
2210  )
2211  )
2212  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1( name = d.algoname, inputs = inputList, outputs = toponames)
2213  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2214  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2215  alg.addgeneric('NumResultBits', len(toponames))
2216  for bitId in range(len(toponames)):
2217  alg.addvariable('MinET1', 0*_et_conversion, bitId)
2218  alg.addvariable('MinET2', 0*_et_conversion, bitId)
2219  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion, bitId)
2220  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion, bitId)
2221  alg.addvariable('DeltaRMin', d.minDR[bitId]*d.minDR[bitId]*_dr_conversion*_dr_conversion, bitId)
2222  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
2223  tm.registerTopoAlgo(alg)
2224 
2225 
2226  # INVM_DR_2MU3VFab
2227  # Output lines: '2INVM9-0DR15-2MU3VFab'
2228  # '7INVM11-25DR99-2MU3VFab',
2229 
2230 
2231  INVM_DR_2MU3VFab_Map = [
2232  {
2233  "algoname": "INVM_DR_2MU3VFab",
2234  "minInvm" : [2,7],
2235  "maxInvm" : [9,11,22],
2236  "minDR" : [0,25],
2237  "maxDR" : [15,99],
2238  "otype1" : "MU3VFab",
2239  "mult1" : 2
2240  }
2241  ]
2242  for x in INVM_DR_2MU3VFab_Map:
2243  class d:
2244  pass
2245  for k in x:
2246  setattr(d,k,x[k])
2247  inputList = d.otype1
2248  toponames = []
2249  for bitId in range(len(d.minDR)):
2250  toponames.append("%iINVM%i-%iDR%i-%i%s" % ( d.minInvm[bitId], d.maxInvm[bitId],
2251  d.minDR[bitId] , d.maxDR[bitId],
2252  d.mult1, d.otype1
2253  )
2254  )
2255  alg = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1( name = d.algoname, inputs = inputList, outputs = toponames)
2256  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2257  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2258  alg.addgeneric('NumResultBits', len(toponames))
2259  for bitId in range(len(toponames)):
2260  alg.addvariable('MinET1', 0*_et_conversion, bitId)
2261  alg.addvariable('MinET2', 0*_et_conversion, bitId)
2262  alg.addvariable('MinMSqr', d.minInvm[bitId]*d.minInvm[bitId]*_et_conversion*_et_conversion, bitId)
2263  alg.addvariable('MaxMSqr', d.maxInvm[bitId]*d.maxInvm[bitId]*_et_conversion*_et_conversion, bitId)
2264  alg.addvariable('DeltaRMin', d.minDR[bitId]*d.minDR[bitId]*_dr_conversion*_dr_conversion, bitId)
2265  alg.addvariable('DeltaRMax', d.maxDR[bitId]*d.maxDR[bitId]*_dr_conversion*_dr_conversion, bitId)
2266  tm.registerTopoAlgo(alg)
2267 
2268 
2269 
2270  #ATR-19720 and ATR-22782, BPH DR+M dimuon
2271  listofalgos=[
2272  {"minInvm": 2, "maxInvm": 9, "minDr": 0, "maxDr": 15, "mult": 1, "otype1" : "MU5VFab", "otype2": "MU3Vab", }, #2INVM9-0DR15-MU5VFab-MU3Vab
2273  {"minInvm": 8, "maxInvm": 15, "minDr": 0, "maxDr": 22, "mult": 1, "otype1" : "MU5VFab", "otype2": "MU3Vab", }, #8INVM15-0DR22-MU5VFab-MU3Vab
2274  {"minInvm": 2, "maxInvm": 9, "minDr": 0, "maxDr": 15, "mult": 2, "otype1" : "MU3Vab", "otype2": "", }, #2INVM9-0DR15-2MU3Vab
2275 
2276 
2277  {"minInvm": 0, "maxInvm": 16, "minDr": 20, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #0INVM16-20DR99-2MU3Vab
2278  {"minInvm": 0, "maxInvm": 16, "minDr": 15, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #0INVM16-15DR99-2MU3Vab
2279  {"minInvm": 8, "maxInvm": 15, "minDr": 20, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #8INVM15-20DR99-2MU3Vab
2280  {"minInvm": 8, "maxInvm": 15, "minDr": 15, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #8INVM15-15DR99-2MU3Vab
2281 
2282  {"minInvm": 7, "maxInvm": 22, "minDr": 0, "maxDr": 20, "mult": 2, "otype1" : "MU3VFab", "otype2": "",}, #7INVM22-0DR20-2MU3VFab, ATR-21566
2283 
2284  {"minInvm": 8, "maxInvm": 15, "minDr": 0, "maxDr": 22, "mult": 1, "otype1" : "CMU5VFab","otype2": "CMU3Vab",}, #8INVM15-0DR22-CMU5VFab-CMU3Vab
2285 
2286  {"minInvm": 7, "maxInvm": 14, "minDr": 0, "maxDr": 25, "mult": 1, "otype1" : "MU5VFab", "otype2": "MU3Vab", }, #7INVM14-0DR25-MU5VFab-MU3Vab
2287  {"minInvm": 7, "maxInvm": 11, "minDr": 25, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #7INVM11-25DR99-2MU3Vab
2288  {"minInvm": 7, "maxInvm": 14, "minDr": 0, "maxDr": 25, "mult": 1, "otype1" : "MU5VFab", "otype2": "MU3VFab", }, #7INVM14-0DR25-MU5VFab-MU3VFab
2289 
2290 
2291  ]
2292  for x in listofalgos:
2293  class d:
2294  pass
2295  for k in x:
2296  setattr (d, k, x[k])
2297  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
2298  obj2 = "-%s" % (d.otype2)
2299  toponame = "%iINVM%i-%iDR%i-%s%s" % (d.minInvm, d.maxInvm, d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
2300  log.debug("Define %s", toponame)
2301  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
2302  algoname = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1 if (d.mult>1) else AlgConf.InvariantMassInclusiveDeltaRSqrIncl2
2303  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
2304  if (d.mult>1):
2305  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2306  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2307  else:
2308  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
2309  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
2310  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
2311  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
2312  alg.addgeneric('NumResultBits', 1)
2313  alg.addvariable('MinET1', 0*_et_conversion)
2314  alg.addvariable('MinET2', 0*_et_conversion)
2315  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion)
2316  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion)
2317  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
2318  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
2319  tm.registerTopoAlgo(alg)
2320 
2321  #ATR-19639, BPH DR+M+OS dimuon
2322  listofalgos=[
2323  {"minInvm": 2, "maxInvm": 9, "minDr": 0, "maxDr": 15, "mult": 1, "otype1" : "MU5VFab", "otype2": "MU3Vab",}, #2INVM9-0DR15-C-MU5VFab-MU3Vab
2324  {"minInvm": 8, "maxInvm": 15, "minDr": 20, "maxDr": 99, "mult": 2, "otype1" : "MU3Vab", "otype2": "",}, #8INVM15-20DR99-C-2MU3Vab
2325  ]
2326  for x in listofalgos:
2327  class d:
2328  pass
2329  for k in x:
2330  setattr (d, k, x[k])
2331  obj1 = "%s%s" % ((str(d.mult) if d.mult>1 else ""), d.otype1)
2332  obj2 = "-%s" % (d.otype2)
2333  toponame = "%iINVM%i-%iDR%i-C-%s%s" % (d.minInvm, d.maxInvm, d.minDr, d.maxDr, obj1, "" if d.mult>1 else obj2)
2334  log.debug("Define %s", toponame)
2335  inputList = [d.otype1] if (d.mult>1) else [d.otype1, d.otype2]
2336  algoname = AlgConf.InvariantMassInclusiveDeltaRSqrIncl1Charge if (d.mult>1) else AlgConf.InvariantMassInclusiveDeltaRSqrIncl2Charge
2337  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
2338  if (d.mult>1):
2339  alg.addgeneric('InputWidth', HW.muonOutputWidthSelect)
2340  alg.addgeneric('MaxTob', HW.muonOutputWidthSelect)
2341  else:
2342  alg.addgeneric('InputWidth1', HW.muonOutputWidthSelect)
2343  alg.addgeneric('InputWidth2', HW.muonOutputWidthSelect)
2344  alg.addgeneric('MaxTob1', HW.muonOutputWidthSelect)
2345  alg.addgeneric('MaxTob2', HW.muonOutputWidthSelect)
2346  alg.addgeneric('NumResultBits', 1)
2347  alg.addvariable('MinET1', 0*_et_conversion)
2348  alg.addvariable('MinET2', 0*_et_conversion)
2349  alg.addvariable('MinMSqr', d.minInvm*d.minInvm*_et_conversion*_et_conversion)
2350  alg.addvariable('MaxMSqr', d.maxInvm*d.maxInvm*_et_conversion*_et_conversion)
2351  alg.addvariable('DeltaRMin', d.minDr*d.minDr*_dr_conversion*_dr_conversion)
2352  alg.addvariable('DeltaRMax', d.maxDr*d.maxDr*_dr_conversion*_dr_conversion)
2353  tm.registerTopoAlgo(alg)
2354 
2355 
2356  # CEP_CjJ
2357  CEPmap = [
2358  {"algoname": 'CEP_CjJ', "minETlist": [90, 100]}
2359  ]
2360  for x in CEPmap:
2361  class d:
2362  pass
2363  for k in x:
2364  setattr (d, k, x[k])
2365  inputList = ['CjJs']
2366  toponames=[]
2367  for minET in d.minETlist: # noqa: F821
2368  toponames.append ("CEP-CjJ%is6" % (minET)) # noqa: F821
2369  alg = AlgConf.ExclusiveJets( name = d.algoname, inputs = inputList, outputs = toponames) # noqa: F821
2370  alg.addgeneric('InputWidth', HW.jJetOutputWidthSort) # noqa: F821
2371  alg.addgeneric('MaxTob', HW.jJetOutputWidthSort) # noqa: F821
2372  alg.addgeneric('NumResultBits', len(toponames)) # noqa: F821
2373  alg.addvariable('PtScale', 1.4*10) # noqa: F821
2374  alg.addvariable('PtShift', 20*_et_conversion) # noqa: F821
2375  for bitid,minET in enumerate(d.minETlist): # noqa: F821
2376  alg.addvariable('MinET1', get_threshold_cut('CjJ', minET)*_et_conversion, bitid)# noqa: F821
2377  alg.addvariable('MinXi', 13600.0*_et_conversion*0.02, bitid) # noqa: F821
2378  alg.addvariable('MaxXi', 13600.0*_et_conversion*0.05, bitid) # noqa: F821
2379  tm.registerTopoAlgo(alg)
2380 
2381  # dphi with s+s #ATR-29784
2382  # Parameter ordering:
2383  # 1. MinEt1
2384  # 2. MinEt2
2385  # 3. DeltaPhiMin
2386  # 4. DeltaPhiMax
2387  algolist=[
2388  { "minDphi": 23, "maxDphi": 32, "mult": 2, "otype1" : "eEM",
2389  "ocut1": 1, "olist1": "s", "nleading1": HW.eEmOutputWidthSort, "minET1":0.9, "otype2" : "", "minET2":0.8},#23DPHI32_2eEM1s
2390  { "minDphi": 23, "maxDphi": 32, "mult": 2, "otype1" : "eTAU",
2391  "ocut1": 1, "olist1": "s", "nleading1": HW.eTauOutputWidthSort,"minET1":0.8,"otype2" : "","minET2":0.8},#23DPHI32_2eTAU1s
2392  { "minDphi": 23, "maxDphi": 32, "mult": 2, "otype1" : "jTAU",
2393  "ocut1": 1, "olist1": "s", "nleading1": HW.jTauOutputWidthSort,"minET1":1.4,"otype2" : "","minET2":1.4},#23DPHI32_2jTAU1s
2394  ]
2395  for x in algolist:
2396  class d:
2397  pass
2398  for k in x:
2399  setattr (d, k, x[k])
2400  obj = "%s" % (str(d.mult)+d.otype1+str(d.ocut1)+str(d.olist1))
2401  toponame = "%sDPHI%s-%s" % (d.minDphi, d.maxDphi, obj)
2402  log.debug("Define %s", toponame)
2403  inputList = [d.otype1+d.olist1]
2404  algoname = AlgConf.DeltaPhiIncl1
2405  alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ])
2406  alg.addgeneric('NumResultBits', 1)
2407  alg.addgeneric('InputWidth', d.nleading1)
2408  alg.addgeneric('MaxTob', d.nleading1)
2409  alg.addvariable('MinET1', d.minET1*_et_conversion)
2410  alg.addvariable('MinET2', d.minET2*_et_conversion)
2411  alg.addvariable('MinDeltaPhi', d.minDphi*_phi_conversion)
2412  alg.addvariable('MaxDeltaPhi', d.maxDphi*_phi_conversion)
2413  tm.registerTopoAlgo(alg)
2414 
2415  # g-2 tau (ATR-30638)
2416  Algo = namedtuple('Algo', ['dPhiMin', 'dPhiMax', 'otype', 'olist', 'ocut1', 'ocut2', 'nTOB'])
2417  algolist=[
2418  Algo(dPhiMin=30, dPhiMax=32, otype='eTAU', olist='s', ocut1=60, ocut2=60, nTOB=HW.eTauOutputWidthSort), #30DPHI32-2eTAU60s
2419  ]
2420  for x in algolist:
2421  name = f'{x.dPhiMin}DPHI{x.dPhiMax}-'
2422  name += f'2{x.otype}{x.ocut1}{x.olist}' if x.ocut1 == x.ocut2 else f'{x.otype}{x.ocut1}{x.olist}-{x.otype}{x.ocut2}{x.olist}'
2423 
2424  alg = AlgConf.DeltaPhiIncl1(name=name, inputs=[x.otype+x.olist], outputs=[name])
2425  alg.addgeneric('NumResultBits', 1)
2426  alg.addgeneric('InputWidth', x.nTOB)
2427  alg.addgeneric('MaxTob', x.nTOB)
2428  alg.addvariable('MinET1', get_threshold_cut(x.otype, x.ocut1)*_et_conversion)
2429  alg.addvariable('MinET2', get_threshold_cut(x.otype, x.ocut2)*_et_conversion)
2430  alg.addvariable('MinDeltaPhi', x.dPhiMin*_phi_conversion)
2431  alg.addvariable('MaxDeltaPhi', x.dPhiMax*_phi_conversion)
2432  tm.registerTopoAlgo(alg)
hist_file_dump.d
d
Definition: hist_file_dump.py:137
python.L1.Config.TopoAlgoDef.TopoAlgoDef.registerTopoAlgos
def registerTopoAlgos(tm)
Definition: TopoAlgoDef.py:23
python.L1.Config.L1CaloThresholdMapping.get_threshold_cut
def get_threshold_cut(threshold_type, threshold_val)
Definition: L1CaloThresholdMapping.py:159
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
str
Definition: BTagTrackIpAccessor.cxx:11
python.L1.Config.TopoAlgoDef.TopoAlgoDef
Definition: TopoAlgoDef.py:20