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