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