Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | List of all members
python.TauAnalysisConfig.TauWorkingPointConfig Class Reference
Inheritance diagram for python.TauAnalysisConfig.TauWorkingPointConfig:
Collaboration diagram for python.TauAnalysisConfig.TauWorkingPointConfig:

Public Member Functions

def __init__ (self, containerName='', selectionName='')
 
def makeAlgs (self, config)
 

Public Attributes

 quality
 

Detailed Description

the ConfigBlock for the tau working point

This may at some point be split into multiple blocks (16 Mar 22).

Definition at line 105 of file TauAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TauAnalysisConfig.TauWorkingPointConfig.__init__ (   self,
  containerName = '',
  selectionName = '' 
)

Definition at line 110 of file TauAnalysisConfig.py.

110  def __init__ (self, containerName='', selectionName='') :
111  super (TauWorkingPointConfig, self).__init__ ()
112  self.addOption ('containerName', containerName, type=str,
113  noneAction='error',
114  info="the name of the input container.")
115  self.addOption ('selectionName', selectionName, type=str,
116  noneAction='error',
117  info="the name of the tau-jet selection to define (e.g. tight or "
118  "loose).")
119  self.addOption ('postfix', None, type=str,
120  info="a postfix to apply to decorations and algorithm names. "
121  "Typically not needed here as selectionName is used internally.")
122  self.addOption ('quality', None, type=str,
123  info="the ID WP (string) to use. Supported ID WPs: Tight, Medium, "
124  "Loose, VeryLoose, Baseline, BaselineForFakes.")
125  self.addOption ('use_eVeto', False, type=bool,
126  info="use selection with or without eVeto combined with tauID "
127  "recommendations: set it to True if electron mis-reconstructed as tau is a large background for your analysis")
128  self.addOption ('useGNTau', False, type=bool,
129  info="use GNTau based ID instead of RNNTau ID "
130  "recommendations: that's new experimental feature and might come default soon")
131  self.addOption ('noEffSF', False, type=bool,
132  info="disables the calculation of efficiencies and scale factors. "
133  "Experimental! only useful to test a new WP for which scale "
134  "factors are not available. The default is False.")
135  self.addOption ('saveDetailedSF', True, type=bool,
136  info="save all the independent detailed object scale factors. "
137  "The default is True.")
138  self.addOption ('saveCombinedSF', False, type=bool,
139  info="save the combined object scale factor. "
140  "The default is False.")
141  self.addOption ('addSelectionToPreselection', True, type=bool,
142  info="whether to retain only tau-jets satisfying the working point "
143  "requirements. The default is True.")
144 

Member Function Documentation

◆ makeAlgs()

def python.TauAnalysisConfig.TauWorkingPointConfig.makeAlgs (   self,
  config 
)

Definition at line 145 of file TauAnalysisConfig.py.

145  def makeAlgs (self, config) :
146 
147  selectionPostfix = self.selectionName
148  if selectionPostfix != '' and selectionPostfix[0] != '_' :
149  selectionPostfix = '_' + selectionPostfix
150 
151  postfix = self.postfix
152  if postfix is None :
153  postfix = self.selectionName
154  if postfix != '' and postfix[0] != '_' :
155  postfix = '_' + postfix
156 
157  if self.useGNTau:
158  nameFormat = 'TauAnalysisAlgorithms/tau_selection_gntau_{}_eleid.conf'
159  if not self.use_eVeto:
160  nameFormat = 'TauAnalysisAlgorithms/tau_selection_gntau_{}_noeleid.conf'
161  else:
162  nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}_eleid.conf'
163  if not self.use_eVeto:
164  nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}_noeleid.conf'
165 
166  if self.quality not in ['Tight', 'Medium', 'Loose', 'VeryLoose', 'Baseline', 'BaselineForFakes'] :
167  raise ValueError ("invalid tau quality: \"" + self.quality +
168  "\", allowed values are Tight, Medium, Loose, " +
169  "VeryLoose, Baseline, BaselineForFakes")
170  inputfile = nameFormat.format(self.quality.lower())
171 
172  # Set up the algorithm selecting taus:
173  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'TauSelectionAlg' + postfix )
174  config.addPrivateTool( 'selectionTool', 'TauAnalysisTools::TauSelectionTool' )
175  alg.selectionTool.ConfigPath = inputfile
176  alg.selectionDecoration = 'selected_tau' + selectionPostfix + ',as_char'
177  alg.particles = config.readName (self.containerName)
178  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
179  config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
180  preselection=self.addSelectionToPreselection)
181 
182  sfList = []
183  # Set up the algorithm calculating the efficiency scale factors for the
184  # taus:
185  if config.dataType() is not DataType.Data and not self.noEffSF and not self.useGNTau:
186  # need multiple instances of the TauEfficiencyCorrectionTool
187  # 1) Reco 2) TauID, 3) eVeto for fake tau 4) eVeto for true tau
188  # 3) and 4) are optional if eVeto is used in TauSelectionTool
189 
190  # TauEfficiencyCorrectionTool for Reco, this should be always enabled
191  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
192  'TauEfficiencyCorrectionsAlgReco' + postfix )
193  config.addPrivateTool( 'efficiencyCorrectionsTool',
194  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
195  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [0]
196  alg.efficiencyCorrectionsTool.Campaign = "mc23" if config.geometry() is LHCPeriod.Run3 else "mc20"
197  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
198  alg.scaleFactorDecoration = 'tau_Reco_effSF' + selectionPostfix + '_%SYS%'
199  alg.outOfValidity = 2 #silent
200  alg.outOfValidityDeco = 'bad_Reco_eff' + selectionPostfix
201  alg.taus = config.readName (self.containerName)
202  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
203  if self.saveDetailedSF:
204  config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
205  'Reco_effSF' + postfix)
206  sfList += [alg.scaleFactorDecoration]
207 
208  # TauEfficiencyCorrectionTool for Identification, use only in case TauID is requested in TauSelectionTool
209  if self.quality not in ('VeryLoose','Baseline','BaselineForFakes'):
210 
211  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
212  'TauEfficiencyCorrectionsAlgID' + postfix )
213  config.addPrivateTool( 'efficiencyCorrectionsTool',
214  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
215  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [4]
216  if self.quality=="Loose":
217  JetIDLevel = 7
218  elif self.quality=="Medium":
219  JetIDLevel = 8
220  elif self.quality=="Tight":
221  JetIDLevel = 9
222  else:
223  raise ValueError ("invalid tauID: \"" + self.quality + "\". Allowed values are loose, medium, tight")
224 
225  alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
226  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
227  alg.efficiencyCorrectionsTool.Campaign = "mc23" if config.geometry() is LHCPeriod.Run3 else "mc20"
228  alg.scaleFactorDecoration = 'tau_ID_effSF' + selectionPostfix + '_%SYS%'
229  alg.outOfValidity = 2 #silent
230  alg.outOfValidityDeco = 'bad_ID_eff' + selectionPostfix
231  alg.taus = config.readName (self.containerName)
232  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
233  if self.saveDetailedSF:
234  config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
235  'ID_effSF' + postfix)
236  sfList += [alg.scaleFactorDecoration]
237 
238  # TauEfficiencyCorrectionTool for eVeto both on true tau and fake tau, use only in case eVeto is requested in TauSelectionTool
239  if self.use_eVeto:
240 
241  # correction for fake tau
242  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
243  'TauEfficiencyCorrectionsAlgEvetoFakeTau' + postfix )
244  config.addPrivateTool( 'efficiencyCorrectionsTool',
245  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
246 
247  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [10]
248  # since all TauSelectionTool config files have loose eRNN, code only this option for now
249  alg.efficiencyCorrectionsTool.EleIDLevel = 2
250  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
251  alg.efficiencyCorrectionsTool.Campaign = "mc23" if config.geometry() is LHCPeriod.Run3 else "mc20"
252  alg.scaleFactorDecoration = 'tau_EvetoFakeTau_effSF' + selectionPostfix + '_%SYS%'
253  alg.outOfValidity = 2 #silent
254  alg.outOfValidityDeco = 'bad_EvetoFakeTau_eff' + selectionPostfix
255  alg.taus = config.readName (self.containerName)
256  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
257  if self.saveDetailedSF:
258  config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
259  'EvetoFakeTau_effSF' + postfix)
260  sfList += [alg.scaleFactorDecoration]
261 
262  # correction for true tau
263  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
264  'TauEfficiencyCorrectionsAlgEvetoTrueTau' + postfix )
265  config.addPrivateTool( 'efficiencyCorrectionsTool',
266  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
267 
268  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [8]
269  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
270  alg.efficiencyCorrectionsTool.Campaign = "mc23" if config.geometry() is LHCPeriod.Run3 else "mc20"
271  alg.scaleFactorDecoration = 'tau_EvetoTrueTau_effSF' + selectionPostfix + '_%SYS%'
272  alg.outOfValidity = 2 #silent
273  alg.outOfValidityDeco = 'bad_EvetoTrueTau_eff' + selectionPostfix
274  alg.taus = config.readName (self.containerName)
275  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
276  if self.saveDetailedSF:
277  config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
278  'EvetoTrueTau_effSF' + postfix)
279  sfList += [alg.scaleFactorDecoration]
280 
281  if self.saveCombinedSF:
282  alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
283  'TauCombinedEfficiencyScaleFactorAlg' + postfix )
284  alg.particles = config.readName (self.containerName)
285  alg.inScaleFactors = sfList
286  alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
287  config.addOutputVar (self.containerName, alg.outScaleFactor,
288  'effSF' + postfix)
289 
290 

Member Data Documentation

◆ quality

python.TauAnalysisConfig.TauWorkingPointConfig.quality

Definition at line 216 of file TauAnalysisConfig.py.


The documentation for this class was generated from the following file:
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18