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