ATLAS Offline Software
OverlapAnalysisConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # AnaAlgorithm import(s):
4 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
5 
6 
7 class OverlapAnalysisConfig (ConfigBlock):
8  """the ConfigBlock for the OverlapRemoval configuration"""
9 
10  def __init__ (self) :
11  super (OverlapAnalysisConfig, self).__init__ ()
12  self.setBlockName('OverlapRemoval')
13  self.addOption ('inputLabel', '', type=str,
14  info="any possible label used to pick up the selected objects with. This should not be a label already used elsewhere, e.g. preselectOR.")
15  self.addOption ('outputLabel', 'passesOR', type=str,
16  info="decoration applied (internally) to the output objects, e.g. passesOR.")
17  # TODO: add info string
18  self.addOption ('selectionName', None, type=str,
19  info="")
20  self.addOption ('linkOverlapObjects', False, type=bool,
21  info="whether to set up an element link between overlapping objects. The default is False.")
22  self.addOption ('enableUserPriority', False, type=bool,
23  info="whether to use the user's custom priority ranking, instead of the recommended one. If set to True, will respect the priorities set with inputLabel (e.g. in SUSYTools, every object gets priority 2, but pre-selected jets get priority 1). The default is False.")
24  self.addOption ('bJetLabel', '', type=str,
25  info="flag to select b-jets with. If left empty, no b-jets are used in the overlap removal. The default is '' (empty string).")
26  self.addOption ('boostedLeptons', False, type=bool,
27  info="whether to enable boosted lepton overlap removal (toggles on the property UseSlidingDR of the ORUtils::EleJetOverlapTool and ORUtils::MuJetOverlapTool tools). The default is False.")
28  # TODO: add info string
29  self.addOption ('nominalOnly', False, type=bool,
30  info="")
31  # TODO: add info string
32  self.addOption ('nominalOnlyUnifiedSelection', False, type=bool,
33  info="")
34  self.addOption ('jets', "", type=str,
35  info="the input jet container.")
36  self.addOption ('fatJets', "", type=str,
37  info="the input large-R jet container.")
38  self.addOption ('electrons', "", type=str,
39  info="the input electron container.")
40  self.addOption ('muons', "", type=str,
41  info="the input muon container.")
42  self.addOption ('photons', "", type=str,
43  info="the input photon container.")
44  self.addOption ('taus', "", type=str,
45  info="the input tau-jet container.")
46  self.addOption ('antiTauIDTauLabel', '', type=str,
47  info="flag to select the ID tau-jet for the tau-antitau-jet overlap removal. The default is '' (empty string).")
48  self.addOption ('antiTauLabel', '', type=str,
49  info="flag to select the anti-tau-jet for the tau-antitau-jet overlap removal. The default is '' (empty string).")
50  self.addOption ('antiTauBJetLabel', '', type=str,
51  info="flag to select b-jets for the tau-antitau-jet overlap removal. The default is '' (empty string).")
52  self.addOption ('addToAllSelections', True, type=bool,
53  info="add OR selection decision into all object selections")
54  self.addOption ('addPreselection', False, type=bool,
55  info="add preselection decorations without systematics")
56  self.addOption ('preselectLabel', None, type=str,
57  info="label for preselection decorations")
58  self.addOption ('jetsSelectionName', None, type=str,
59  info="a possible selection on the jet container.")
60  self.addOption ('fatJetsSelectionName', None, type=str,
61  info="a possible selection on the large-R jet container.")
62  self.addOption ('electronsSelectionName', None, type=str,
63  info="a possible selection on the electron container.")
64  self.addOption ('muonsSelectionName', None, type=str,
65  info="a possible selection on the muon container.")
66  self.addOption ('photonsSelectionName', None, type=str,
67  info="a possible selection on the photon container.")
68  self.addOption ('tausSelectionName', None, type=str,
69  info="a possible selection on the tau-jet container.")
70  self.addOption ('doEleEleOR', False, type=bool,
71  info="whether to perform the overlap removal amongst electrons. The default is False.")
72  self.addOption ('doEleMuOR', True, type=bool,
73  info="whether to perform the overlap removal between electrons and muons. The default is True.")
74  self.addOption ('doEleJetOR', True, type=bool,
75  info="whether to perform the overlap removal between electrons and jets. The default is True.")
76  self.addOption ('doMuJetOR', True, type=bool,
77  info="whether to perform the overlap removal between muons and jets. The default is True.")
78  self.addOption ('doTauEleOR', True, type=bool,
79  info="whether to perform the overlap removal between tau-jets and electrons. The default is True.")
80  self.addOption ('doTauMuOR', True, type=bool,
81  info="whether to perform the overlap removal between tau-jets and muons. The default is True.")
82  self.addOption ('doTauJetOR', True, type=bool,
83  info="whether to perform the overlap removal between tau-jets and jets. The default is True.")
84  self.addOption ('doTauAntiTauJetOR', False, type=bool,
85  info="whether to perform the overlap removal between tau-jets and anti-tau-jets. The default is False.")
86  self.addOption ('doPhEleOR', True, type=bool,
87  info="whether to perform the overlap removal between photons and electrons. The default is True.")
88  self.addOption ('doPhMuOR', True, type=bool,
89  info="whether to perform the overlap removal between photons and muons. The default is True.")
90  self.addOption ('doPhJetOR', True, type=bool,
91  info="whether to perform the overlap removal between photons and jets. The default is True.")
92  self.addOption ('doEleFatJetOR', True, type=bool,
93  info="whether to perform the overlap removal between electrons and large-R jets. The default is True.")
94  self.addOption ('doJetFatJetOR', True, type=bool,
95  info="whether to perform the overlap removal between jets and large-R jets. The default is True.")
96 
97  def makeUnionPreselectionAlg(self, config, inputCollection):
98  """
99  Create a new selection for the inputCollection ('container.selection')
100  that is the union over all systematics of 'selection'. This allows us
101  to run nominal-only overlap removal while taking into account the impact
102  of systematics on object acceptance.
103  """
104  container, selection = config.readNameAndSelection( inputCollection )
105  alg = config.createAlgorithm( 'CP::AsgUnionSelectionAlg', 'UnionSelectionAlgForOR_' + inputCollection.split(".")[0] )
106  alg.preselection = selection
107  alg.particles = container
108  alg.selectionDecoration = 'unifiedSelectForOR'
109 
110  def makeAlgs (self, config) :
111 
112  if self.addToAllSelections and self.selectionName is not None:
113  raise Exception('When addToAllSelections=True, you cannot configure selectionName!')
114 
115  if self.selectionName is not None:
116  selectionName = self.selectionName
117  outputLabel = self.outputLabel + '_' + selectionName
118  inputLabel = self.inputLabel + '_' + selectionName
119  select_or_decoration = 'select_or_' + self.selectionName
120  postfix = '_' + self.selectionName
121  else:
122  if self.addToAllSelections:
123  selectionName = ""
124  else:
125  selectionName = self.outputLabel
126  outputLabel = self.outputLabel
127  inputLabel = self.inputLabel
128  select_or_decoration = 'select_or'
129  postfix = ''
130 
131  if self.jetsSelectionName is not None:
132  jetsSelectionName = self.jetsSelectionName
133  else:
134  jetsSelectionName = selectionName
135  if self.fatJetsSelectionName is not None:
136  fatJetsSelectionName = self.fatJetsSelectionName
137  else:
138  fatJetsSelectionName = selectionName
139  if self.electronsSelectionName is not None:
140  electronsSelectionName = self.electronsSelectionName
141  else:
142  electronsSelectionName = selectionName
143  if self.muonsSelectionName is not None:
144  muonsSelectionName = self.muonsSelectionName
145  else:
146  muonsSelectionName = selectionName
147  if self.photonsSelectionName is not None:
148  photonsSelectionName = self.photonsSelectionName
149  else:
150  photonsSelectionName = selectionName
151  if self.tausSelectionName is not None:
152  tausSelectionName = self.tausSelectionName
153  else:
154  tausSelectionName = selectionName
155 
156  # For now we have to decorate our selections on the objects in
157  # separate algorithms beforehand, so that the overlap
158  # algorithm can read them. This should probably be changed at
159  # some point. For one, this seems like an unnecessary
160  # complication in the configuration. For another, it requires
161  # that all selection systematics applied so far have dedicated
162  # shallow copies for all objects and systematics, i.e. be
163  # kinematic systematics. While that is technically the case
164  # right now, I'd prefer if I didn't force that.
165 
166  electrons = None
167  if self.electrons != "" :
168  if self.nominalOnlyUnifiedSelection:
169  self.makeUnionPreselectionAlg(config, self.electrons)
170  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORElectronsSelectAlg' + postfix )
171  electrons, alg.preselection = config.readNameAndSelection (self.electrons)
172  alg.particles = electrons
173  alg.selectionDecoration = inputLabel + ',as_char'
174  # if OR added to all selections, don't need standalone selection flag
175  if self.selectionName != '':
176  config.addOutputVar (self.electrons.split('.')[0],
177  outputLabel + '_%SYS%',
178  select_or_decoration,
179  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
180  if self.nominalOnlyUnifiedSelection:
181  alg.preselection = 'unifiedSelectForOR'
182 
183  photons = None
184  if self.photons != "" :
185  if self.nominalOnlyUnifiedSelection:
186  self.makeUnionPreselectionAlg(config, self.photons)
187  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORPhotonsSelectAlg' + postfix )
188  photons, alg.preselection = config.readNameAndSelection (self.photons)
189  alg.particles = photons
190  alg.selectionDecoration = inputLabel + ',as_char'
191  if self.selectionName != '':
192  config.addOutputVar (self.photons.split('.')[0],
193  outputLabel + '_%SYS%',
194  select_or_decoration,
195  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
196  if self.nominalOnlyUnifiedSelection:
197  alg.preselection = 'unifiedSelectForOR'
198 
199  muons = None
200  if self.muons != "" :
201  if self.nominalOnlyUnifiedSelection:
202  self.makeUnionPreselectionAlg(config, self.muons)
203  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORMuonsSelectAlg' + postfix )
204  muons, alg.preselection = config.readNameAndSelection (self.muons)
205  alg.particles = muons
206  alg.selectionDecoration = inputLabel + ',as_char'
207  if self.selectionName != '':
208  config.addOutputVar (self.muons.split('.')[0],
209  outputLabel + '_%SYS%',
210  select_or_decoration,
211  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
212  if self.nominalOnlyUnifiedSelection:
213  alg.preselection = 'unifiedSelectForOR'
214 
215  taus = None
216  if self.taus != "" :
217  if self.nominalOnlyUnifiedSelection:
218  self.makeUnionPreselectionAlg(config, self.taus)
219  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORTausSelectAlg' + postfix )
220  taus, alg.preselection = config.readNameAndSelection (self.taus)
221  alg.particles = taus
222  alg.selectionDecoration = inputLabel + ',as_char'
223  if self.selectionName != '':
224  config.addOutputVar (self.taus.split('.')[0],
225  outputLabel + '_%SYS%',
226  select_or_decoration,
227  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
228  if self.nominalOnlyUnifiedSelection:
229  alg.preselection = 'unifiedSelectForOR'
230 
231  jets = None
232  if self.jets != "" :
233  if self.nominalOnlyUnifiedSelection:
234  self.makeUnionPreselectionAlg(config, self.jets)
235  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORJetsSelectAlg' + postfix )
236  jets, alg.preselection = config.readNameAndSelection (self.jets)
237  alg.particles = jets
238  alg.selectionDecoration = inputLabel + ',as_char'
239  if self.selectionName != '':
240  config.addOutputVar (self.jets.split('.')[0],
241  outputLabel + '_%SYS%',
242  select_or_decoration,
243  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
244  if self.nominalOnlyUnifiedSelection:
245  alg.preselection = 'unifiedSelectForOR'
246 
247  fatJets = None
248  if self.fatJets != "" :
249  if self.nominalOnlyUnifiedSelection:
250  self.makeUnionPreselectionAlg(config, self.fatJets)
251  alg = config.createAlgorithm( 'CP::AsgSelectionAlg','ORFatJetsSelectAlg' + postfix )
252  fatJets, alg.preselection = config.readNameAndSelection (self.fatJets)
253  alg.particles = fatJets
254  alg.selectionDecoration = inputLabel + ',as_char'
255  if self.selectionName != '':
256  config.addOutputVar (self.fatJets.split('.')[0],
257  outputLabel + '_%SYS%',
258  select_or_decoration,
259  noSys=self.nominalOnly or self.nominalOnlyUnifiedSelection)
260  if self.nominalOnlyUnifiedSelection:
261  alg.preselection = 'unifiedSelectForOR'
262 
263 
264  # Create the overlap removal algorithm:
265  alg = config.createAlgorithm( 'CP::OverlapRemovalAlg', 'OverlapRemovalAlg' + postfix )
266  alg.OutputLabel = outputLabel
267  if self.nominalOnly or self.nominalOnlyUnifiedSelection :
268  alg.affectingSystematicsFilter = '.*'
269  if electrons :
270  alg.electrons = electrons
271  alg.electronsDecoration = outputLabel + '_%SYS%,as_char'
272  config.addSelection (self.electrons.split('.')[0], electronsSelectionName, alg.electronsDecoration, preselection=False, comesFrom='or')
273  if muons :
274  alg.muons = muons
275  alg.muonsDecoration = outputLabel + '_%SYS%,as_char'
276  config.addSelection (self.muons.split('.')[0], muonsSelectionName, alg.muonsDecoration, preselection=False, comesFrom='or')
277  if taus :
278  alg.taus = taus
279  alg.tausDecoration = outputLabel + '_%SYS%,as_char'
280  config.addSelection (self.taus.split('.')[0], tausSelectionName, alg.tausDecoration, preselection=False, comesFrom='or')
281  if jets :
282  alg.jets = jets
283  alg.jetsDecoration = outputLabel + '_%SYS%,as_char'
284  config.addSelection (self.jets.split('.')[0], jetsSelectionName, alg.jetsDecoration, preselection=False, comesFrom='or')
285  if photons :
286  alg.photons = photons
287  alg.photonsDecoration = outputLabel + '_%SYS%,as_char'
288  config.addSelection (self.photons.split('.')[0], photonsSelectionName, alg.photonsDecoration, preselection=False, comesFrom='or')
289  if fatJets :
290  alg.fatJets = fatJets
291  alg.fatJetsDecoration = outputLabel + '_%SYS%,as_char'
292  config.addSelection (self.fatJets.split('.')[0], fatJetsSelectionName, alg.fatJetsDecoration, preselection=False, comesFrom='or')
293 
294  # Create its main tool, and set its basic properties:
295  config.addPrivateTool( 'overlapTool', 'ORUtils::OverlapRemovalTool' )
296  alg.overlapTool.InputLabel = inputLabel
297  alg.overlapTool.OutputLabel = outputLabel
298 
299  # By default the OverlapRemovalTool would flag objects that need to be
300  # suppressed, with a "true" value. But since the analysis algorithms expect
301  # the opposite behaviour from selection flags, we need to tell the tool
302  # explicitly to use the "true" flag on objects that pass the overlap
303  # removal.
304  alg.overlapTool.OutputPassValue = True
305 
306  # Set up the electron-electron overlap removal, if requested.
307  if electrons and self.doEleEleOR:
308  config.addPrivateTool( 'overlapTool.EleEleORT',
309  'ORUtils::EleEleOverlapTool' )
310  alg.overlapTool.EleEleORT.InputLabel = inputLabel
311  alg.overlapTool.EleEleORT.OutputLabel = outputLabel
312  alg.overlapTool.EleEleORT.LinkOverlapObjects = self.linkOverlapObjects
313  alg.overlapTool.EleEleORT.OutputPassValue = True
314 
315  # Set up the electron-muon overlap removal.
316  if electrons and muons and self.doEleMuOR:
317  config.addPrivateTool( 'overlapTool.EleMuORT',
318  'ORUtils::EleMuSharedTrkOverlapTool' )
319  alg.overlapTool.EleMuORT.InputLabel = inputLabel
320  alg.overlapTool.EleMuORT.OutputLabel = outputLabel
321  alg.overlapTool.EleMuORT.LinkOverlapObjects = self.linkOverlapObjects
322  alg.overlapTool.EleMuORT.OutputPassValue = True
323 
324  # Set up the electron-(narrow-)jet overlap removal.
325  if electrons and jets and self.doEleJetOR:
326  config.addPrivateTool( 'overlapTool.EleJetORT',
327  'ORUtils::EleJetOverlapTool' )
328  alg.overlapTool.EleJetORT.InputLabel = inputLabel
329  alg.overlapTool.EleJetORT.OutputLabel = outputLabel
330  alg.overlapTool.EleJetORT.LinkOverlapObjects = self.linkOverlapObjects
331  alg.overlapTool.EleJetORT.BJetLabel = self.bJetLabel
332  alg.overlapTool.EleJetORT.UseSlidingDR = self.boostedLeptons
333  alg.overlapTool.EleJetORT.EnableUserPriority = self.enableUserPriority
334  alg.overlapTool.EleJetORT.OutputPassValue = True
335 
336  # Set up the muon-(narrow-)jet overlap removal.
337  if muons and jets and self.doMuJetOR:
338  config.addPrivateTool( 'overlapTool.MuJetORT',
339  'ORUtils::MuJetOverlapTool' )
340  alg.overlapTool.MuJetORT.InputLabel = inputLabel
341  alg.overlapTool.MuJetORT.OutputLabel = outputLabel
342  alg.overlapTool.MuJetORT.LinkOverlapObjects = self.linkOverlapObjects
343  alg.overlapTool.MuJetORT.BJetLabel = self.bJetLabel
344  alg.overlapTool.MuJetORT.UseSlidingDR = self.boostedLeptons
345  alg.overlapTool.MuJetORT.EnableUserPriority = self.enableUserPriority
346  alg.overlapTool.MuJetORT.OutputPassValue = True
347 
348  # Set up the tau-electron overlap removal.
349  if taus and electrons and self.doTauEleOR:
350  config.addPrivateTool( 'overlapTool.TauEleORT',
351  'ORUtils::DeltaROverlapTool' )
352  alg.overlapTool.TauEleORT.InputLabel = inputLabel
353  alg.overlapTool.TauEleORT.OutputLabel = outputLabel
354  alg.overlapTool.TauEleORT.LinkOverlapObjects = self.linkOverlapObjects
355  alg.overlapTool.TauEleORT.DR = 0.2
356  alg.overlapTool.TauEleORT.OutputPassValue = True
357 
358  # Set up the tau-muon overlap removal.
359  if taus and muons and self.doTauMuOR:
360  config.addPrivateTool( 'overlapTool.TauMuORT',
361  'ORUtils::DeltaROverlapTool' )
362  alg.overlapTool.TauMuORT.InputLabel = inputLabel
363  alg.overlapTool.TauMuORT.OutputLabel = outputLabel
364  alg.overlapTool.TauMuORT.LinkOverlapObjects = self.linkOverlapObjects
365  alg.overlapTool.TauMuORT.DR = 0.2
366  alg.overlapTool.TauMuORT.OutputPassValue = True
367 
368  # Set up the tau-(narrow-)jet overlap removal.
369  if taus and jets and self.doTauJetOR:
370  if self.doTauAntiTauJetOR:
371  config.addPrivateTool( 'overlapTool.TauJetORT',
372  'ORUtils::TauAntiTauJetOverlapTool' )
373  alg.overlapTool.TauJetORT.TauLabel = self.antiTauIDTauLabel
374  alg.overlapTool.TauJetORT.AntiTauLabel = self.antiTauLabel
375  alg.overlapTool.TauJetORT.BJetLabel = self.antiTauBJetLabel
376  else:
377  config.addPrivateTool( 'overlapTool.TauJetORT',
378  'ORUtils::DeltaROverlapTool' )
379 
380  alg.overlapTool.TauJetORT.InputLabel = inputLabel
381  alg.overlapTool.TauJetORT.OutputLabel = outputLabel
382  alg.overlapTool.TauJetORT.LinkOverlapObjects = self.linkOverlapObjects
383  alg.overlapTool.TauJetORT.DR = 0.2
384  alg.overlapTool.TauJetORT.EnableUserPriority = self.enableUserPriority
385  alg.overlapTool.TauJetORT.OutputPassValue = True
386 
387  # Set up the photon-electron overlap removal.
388  if photons and electrons and self.doPhEleOR:
389  config.addPrivateTool( 'overlapTool.PhoEleORT',
390  'ORUtils::DeltaROverlapTool' )
391  alg.overlapTool.PhoEleORT.InputLabel = inputLabel
392  alg.overlapTool.PhoEleORT.OutputLabel = outputLabel
393  alg.overlapTool.PhoEleORT.LinkOverlapObjects = self.linkOverlapObjects
394  alg.overlapTool.PhoEleORT.OutputPassValue = True
395 
396  # Set up the photon-muon overlap removal.
397  if photons and muons and self.doPhMuOR:
398  config.addPrivateTool( 'overlapTool.PhoMuORT',
399  'ORUtils::DeltaROverlapTool' )
400  alg.overlapTool.PhoMuORT.InputLabel = inputLabel
401  alg.overlapTool.PhoMuORT.OutputLabel = outputLabel
402  alg.overlapTool.PhoMuORT.LinkOverlapObjects = self.linkOverlapObjects
403  alg.overlapTool.PhoMuORT.OutputPassValue = True
404 
405  # Set up the photon-(narrow-)jet overlap removal.
406  if photons and jets and self.doPhJetOR:
407  config.addPrivateTool( 'overlapTool.PhoJetORT',
408  'ORUtils::DeltaROverlapTool' )
409  alg.overlapTool.PhoJetORT.InputLabel = inputLabel
410  alg.overlapTool.PhoJetORT.OutputLabel = outputLabel
411  alg.overlapTool.PhoJetORT.LinkOverlapObjects = self.linkOverlapObjects
412  alg.overlapTool.PhoJetORT.EnableUserPriority = self.enableUserPriority
413  alg.overlapTool.PhoJetORT.OutputPassValue = True
414 
415  # Set up the electron-fat-jet overlap removal.
416  if electrons and fatJets and self.doEleFatJetOR:
417  config.addPrivateTool( 'overlapTool.EleFatJetORT',
418  'ORUtils::DeltaROverlapTool' )
419  alg.overlapTool.EleFatJetORT.InputLabel = inputLabel
420  alg.overlapTool.EleFatJetORT.OutputLabel = outputLabel
421  alg.overlapTool.EleFatJetORT.LinkOverlapObjects = self.linkOverlapObjects
422  alg.overlapTool.EleFatJetORT.DR = 1.0
423  alg.overlapTool.EleFatJetORT.OutputPassValue = True
424 
425  # Set up the (narrow-)jet-fat-jet overlap removal.
426  if jets and fatJets and self.doJetFatJetOR:
427  config.addPrivateTool( 'overlapTool.JetFatJetORT',
428  'ORUtils::DeltaROverlapTool' )
429  alg.overlapTool.JetFatJetORT.InputLabel = inputLabel
430  alg.overlapTool.JetFatJetORT.OutputLabel = outputLabel
431  alg.overlapTool.JetFatJetORT.LinkOverlapObjects = self.linkOverlapObjects
432  alg.overlapTool.JetFatJetORT.DR = 1.0
433  alg.overlapTool.JetFatJetORT.OutputPassValue = True
434 
435  if self.nominalOnly or self.nominalOnlyUnifiedSelection :
436  if electrons :
437  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORElectronsCopyAlg' + postfix)
438  alg.particles = electrons
439  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
440  if muons :
441  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORMuonsCopyAlg' + postfix)
442  alg.particles = muons
443  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
444  if taus :
445  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORTausCopyAlg' + postfix)
446  alg.particles = taus
447  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
448  if jets :
449  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORJetsCopyAlg' + postfix)
450  alg.particles = jets
451  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
452  if photons :
453  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORPhotonsCopyAlg' + postfix)
454  alg.particles = photons
455  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
456  if fatJets :
457  alg = config.createAlgorithm( 'CP::CopyNominalSelectionAlg', 'ORFatJetsCopyAlg' + postfix)
458  alg.particles = fatJets
459  alg.selectionDecoration = outputLabel + '_%SYS%,as_char'
460 
461  # provide a preselection if requested
462  if self.addPreselection:
463  if self.preselectLabel is not None :
464  preselectLabel = self.preselectLabel
465  else :
466  preselectLabel = outputLabel
467 
468  if electrons :
469  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORElectronsPreselectionAlg' + postfix )
470  alg.particles = electrons
471  alg.preselection = '&&'.join (config.getPreselection (self.electrons.split('.')[0], electronsSelectionName, asList=True)
472  + [outputLabel + '_%SYS%,as_char'])
473  alg.selectionDecoration = preselectLabel
474  config.addSelection (self.electrons.split('.')[0], electronsSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
475  if muons :
476  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORMuonsPreselectionAlg' + postfix )
477  alg.particles = muons
478  alg.preselection = '&&'.join (config.getPreselection (self.muons.split('.')[0], muonsSelectionName, asList=True)
479  + [outputLabel + '_%SYS%,as_char'])
480  alg.selectionDecoration = preselectLabel
481  config.addSelection (self.muons.split('.')[0], muonsSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
482  if taus :
483  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORTausPreselectionAlg' + postfix )
484  alg.particles = taus
485  alg.preselection = '&&'.join (config.getPreselection (self.taus.split('.')[0], tausSelectionName, asList=True)
486  + [outputLabel + '_%SYS%,as_char'])
487  alg.selectionDecoration = preselectLabel
488  config.addSelection (self.taus.split('.')[0], tausSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
489  if jets :
490  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORJetsPreselectionAlg' + postfix )
491  alg.particles = jets
492  alg.preselection = '&&'.join (config.getPreselection (self.jets.split('.')[0], jetsSelectionName, asList=True)
493  + [outputLabel + '_%SYS%,as_char'])
494  alg.selectionDecoration = preselectLabel
495  config.addSelection (self.jets.split('.')[0], jetsSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
496  if photons :
497  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORPhotonsPreselectionAlg' + postfix )
498  alg.particles = photons
499  alg.preselection = '&&'.join (config.getPreselection (self.photons.split('.')[0], photonsSelectionName, asList=True)
500  + [outputLabel + '_%SYS%,as_char'])
501  alg.selectionDecoration = preselectLabel
502  config.addSelection (self.photons.split('.')[0], photonsSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
503  if fatJets :
504  alg = config.createAlgorithm( 'CP::AsgUnionPreselectionAlg','ORFatJetsPreselectionAlg' + postfix )
505  alg.particles = fatJets
506  alg.preselection = '&&'.join (config.getPreselection (self.fatJets.split('.')[0], fatJetsSelectionName, asList=True)
507  + [outputLabel + '_%SYS%,as_char'])
508  alg.selectionDecoration = preselectLabel
509  config.addSelection (self.fatJets.split('.')[0], fatJetsSelectionName, alg.selectionDecoration+',as_char', bits=1, preselection=True, comesFrom='or')
510 
511 
512 
514  inputLabel = None, outputLabel = None,
515  linkOverlapObjects = None,
516  doEleEleOR = None, electrons = None,
517  muons = None, jets = None,
518  taus = None, doTauAntiTauJetOR = None,
519  photons = None, fatJets = None,
520  enableUserPriority = None,
521  bJetLabel = None,
522  antiTauIDTauLabel = None, antiTauLabel = None,
523  antiTauBJetLabel = None,
524  boostedLeptons = None,
525  postfix = None):
526  """Function creating the overlap removal algorithm sequence
527 
528  The function sets up a multi-input/multi-output analysis algorithm sequnce,
529  which needs to be used in a quite particular way. First off you need to set
530  the arguments of this function correctly.
531 
532  Function keyword arguments:
533  inputLabel -- Any possible label used to pick up the selected objects
534  with. This should not be a label already used otherwise.
535  outputLabel -- Decoration put on the output variables. Set to "true" for
536  objects passing the overlap removal.
537  linkOverlapObjects -- Set up an element link between overlapping objects
538  doEleEleOR -- Set up electron-electron overlap removal
539  doTauAntiTauJetOR -- Set up Tau-AntiTau-Jet overlap removal
540  enableUserPriority -- If enabled, the Ele-, Mu-, Tau- and PhoJetOR tools
541  will respect the user priority in the inputLabel.
542  E.g. SUSYTools assigns all signal objects the
543  priority 2 and pre-selected jets the priority 1.
544  bJetLabel -- Flag to select b-jets with for lepton OR.
545  If left empty, no b-jets are used in the overlap removal.
546  antiTauIDTauLabel -- Flag to select ID tau with for Tau-AntiTau-Jet OR.
547  antiTauLabel -- Flag to select antiTau with. Required for Tau-AntiTau-Jet OR.
548  antiTauBJetLabel -- Flag to select b-jets with for Tau-AntiTau-Jet OR.
549  boostedLeptons -- Set to True to enable boosted lepton overlap removal
550  """
551 
552  config = OverlapAnalysisConfig()
553  config.setOptionValue ('inputLabel', inputLabel)
554  config.setOptionValue ('outputLabel', outputLabel)
555  config.setOptionValue ('linkOverlapObjects', linkOverlapObjects)
556  config.setOptionValue ('doEleEleOR', doEleEleOR)
557  config.setOptionValue ('electrons', electrons)
558  config.setOptionValue ('muons', muons)
559  config.setOptionValue ('jets', jets)
560  config.setOptionValue ('taus', taus)
561  config.setOptionValue ('doTauAntiTauJetOR', doTauAntiTauJetOR)
562  config.setOptionValue ('photons', photons)
563  config.setOptionValue ('fatJets', fatJets)
564  config.setOptionValue ('enableUserPriority', enableUserPriority)
565  config.setOptionValue ('bJetLabel', bJetLabel)
566  config.setOptionValue ('antiTauIDTauLabel', antiTauIDTauLabel)
567  config.setOptionValue ('antiTauLabel', antiTauLabel)
568  config.setOptionValue ('antiTauBJetLabel', antiTauBJetLabel)
569  config.setOptionValue ('boostedLeptons', boostedLeptons)
570  seq.append (config)
python.OverlapAnalysisConfig.OverlapAnalysisConfig.__init__
def __init__(self)
Definition: OverlapAnalysisConfig.py:10
python.OverlapAnalysisConfig.OverlapAnalysisConfig
Definition: OverlapAnalysisConfig.py:7
python.OverlapAnalysisConfig.OverlapAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: OverlapAnalysisConfig.py:110
python.OverlapAnalysisConfig.makeOverlapAnalysisConfig
def makeOverlapAnalysisConfig(seq, inputLabel=None, outputLabel=None, linkOverlapObjects=None, doEleEleOR=None, electrons=None, muons=None, jets=None, taus=None, doTauAntiTauJetOR=None, photons=None, fatJets=None, enableUserPriority=None, bJetLabel=None, antiTauIDTauLabel=None, antiTauLabel=None, antiTauBJetLabel=None, boostedLeptons=None, postfix=None)
Definition: OverlapAnalysisConfig.py:513
python.OverlapAnalysisConfig.OverlapAnalysisConfig.makeUnionPreselectionAlg
def makeUnionPreselectionAlg(self, config, inputCollection)
Definition: OverlapAnalysisConfig.py:97
Trk::split
@ split
Definition: LayerMaterialProperties.h:38