ATLAS Offline Software
Loading...
Searching...
No Matches
VGammaORConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
4from AnalysisAlgorithmsConfig.ConfigAccumulator import (
5 DataType, VGammaORSkipWarning)
6import warnings
7
8class VGammaORBlock(ConfigBlock):
9
10 def __init__(self):
11 super(VGammaORBlock, self).__init__()
12 self.addOption("dR_lepton_photon_cuts", [0.0, 0.05, 0.075, 0.1, 0.125, 0.15, 0.2], type=list,
13 info=r"list of cuts on $\Delta R$ between the leptons and the photon.")
14 self.addOption("photon_pT_cuts", [10e3], type=list,
15 info=r"list of $p_\mathrm{T}$ cuts (in MeV) on the photon.")
16 self.addOption("noFilter", False, type=bool,
17 info="do not apply an event filter, i.e. setting it to `False` "
18 "removes events not passing the overlap removal. If set to `True`, "
19 "all events are kept and the decision flag is written to the output ntuple instead.")
20 self.addOption("keepInOverlap", [700011, 700012, 700013, 700014, 700015, 700016, 700017], type=list,
21 info="list of DSIDs for which events are to be kept if found to be in the overlap region. "
22 r"For instance, V$\gamma$ samples in V+jets vs V$\gamma$+jets overlap removal. "
23 "The default list was taken from the PmgWeakBosonProcesses twiki but is not actively maintained!")
24 self.addOption("removeInOverlap", [700320, 700321, 700322, 700467, 700468, 700469, 700323, 700324, 700325, 700470, 700471, 700472, 700326, 700327, 700328, 700329, 700330, 700331, 700332, 700333, 700334, 700473, 700474, 700475, 700476, 700477, 700478, 700479, 700480, 700481, 700341, 700342, 700343, 700338, 700339, 700340, 700344, 700345, 700346, 700347, 700348, 700349, 700598, 700599, 700439, 700440, 700441], type=list,
25 info="list of DSIDs for which events are to be removed if found to be in the overlap region. "
26 r"For instance, V samples in V+jets vs V$\gamma$+jets overlap removal. "
27 "The default list was taken from the PmgWeakBosonProcesses twiki but is not actively maintained!")
28
29 def instanceName (self) :
30 """Return the instance name for this block"""
31 return '' # not sure if this is a singleton block, but I don't know what name to use if not
32
33 def makeAlgs(self, config):
34
35
36 if config.dataType() is DataType.Data: return
37 if config.dsid() not in self.keepInOverlap and config.dsid() not in self.removeInOverlap:
38 warnings.warn_explicit(
39 f"CP::VGammaORAlg --> this sample has DSID {config.dsid()}"
40 ", which is not set up for overlap removal."
41 " Will skip the configuration of the algorithm!",
42 VGammaORSkipWarning,
43 filename='', lineno=0)
44 return
45
46 alg = config.createAlgorithm('CP::VGammaORAlg', 'VGammaORAlg')
47 alg.affectingSystematicsFilter = '.*'
48 alg.noFilter = self.noFilter
49 alg.FilterDescription = 'events passing V/VGamma overlap removal'
50 alg.eventDecisionOutputDecoration = 'ignore_vgammaor_%SYS%'
51
52 if config.dsid() in self.keepInOverlap:
53 alg.keepOverlap = True
54 elif config.dsid() in self.removeInOverlap:
55 alg.keepOverlap = False
56
57 config.addPrivateTool('VGammaORTool', 'VGammaORTool')
58 alg.VGammaORTool.dR_lepton_photon_cuts = self.dR_lepton_photon_cuts
59 alg.VGammaORTool.photon_pT_cuts = self.photon_pT_cuts
60
61 if self.noFilter:
62 # if we don't apply the filter, we still want to study the output of the tool!
63 config.addOutputVar('EventInfo', 'in_vgamma_overlap_%SYS%', 'in_vgamma_overlap', noSys=True)