ATLAS Offline Software
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 100 of file TauAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 105 of file TauAnalysisConfig.py.

105  def __init__ (self, containerName='', selectionName='') :
106  super (TauWorkingPointConfig, self).__init__ ()
107  self.addOption ('containerName', containerName, type=str,
108  noneAction='error',
109  info="the name of the input container.")
110  self.addOption ('selectionName', selectionName, type=str,
111  noneAction='error',
112  info="the name of the tau-jet selection to define (e.g. tight or "
113  "loose).")
114  self.addOption ('postfix', None, type=str,
115  info="a postfix to apply to decorations and algorithm names. "
116  "Typically not needed here as selectionName is used internally.")
117  self.addOption ('quality', None, type=str,
118  info="the ID WP (string) to use. Supported ID WPs: Tight, Medium, "
119  "Loose, VeryLoose, Baseline.")
120  self.addOption ('use_eVeto', False, type=bool,
121  info="use selection with or without eVeto combined with tauID "
122  "recommendations: set it to True if electron mis-reconstructed as tau is a large background for your analysis")
123  self.addOption ('useGNTau', False, type=bool,
124  info="use GNTau based ID instead of RNNTau ID "
125  "recommendations: that's new experimental feature and might come default soon")
126  self.addOption ('noEffSF', False, type=bool,
127  info="disables the calculation of efficiencies and scale factors. "
128  "Experimental! only useful to test a new WP for which scale "
129  "factors are not available. The default is False.")
130 

Member Function Documentation

◆ makeAlgs()

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

Definition at line 131 of file TauAnalysisConfig.py.

131  def makeAlgs (self, config) :
132 
133  selectionPostfix = self.selectionName
134  if selectionPostfix != '' and selectionPostfix[0] != '_' :
135  selectionPostfix = '_' + selectionPostfix
136 
137  postfix = self.postfix
138  if postfix is None :
139  postfix = self.selectionName
140  if postfix != '' and postfix[0] != '_' :
141  postfix = '_' + postfix
142 
143  if self.useGNTau:
144  nameFormat = 'TauAnalysisAlgorithms/tau_selection_gntau_{}_eleid.conf'
145  if not self.use_eVeto:
146  nameFormat = 'TauAnalysisAlgorithms/tau_selection_gntau_{}_noeleid.conf'
147  else:
148  nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}_eleid.conf'
149  if not self.use_eVeto:
150  nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}_noeleid.conf'
151 
152  if self.quality not in ['Tight', 'Medium', 'Loose', 'VeryLoose', 'Baseline'] :
153  raise ValueError ("invalid tau quality: \"" + self.quality +
154  "\", allowed values are Tight, Medium, Loose, " +
155  "VeryLoose, Baseline")
156  inputfile = nameFormat.format(self.quality.lower())
157 
158  # Set up the algorithm selecting taus:
159  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'TauSelectionAlg' + postfix )
160  config.addPrivateTool( 'selectionTool', 'TauAnalysisTools::TauSelectionTool' )
161  alg.selectionTool.ConfigPath = inputfile
162  alg.selectionDecoration = 'selected_tau' + selectionPostfix + ',as_bits'
163  alg.particles = config.readName (self.containerName)
164  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
165  config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
166 
167  # Set up the algorithm calculating the efficiency scale factors for the
168  # taus:
169  if config.dataType() is not DataType.Data and not self.noEffSF and not self.useGNTau:
170  # need multiple instances of the TauEfficiencyCorrectionTool
171  # 1) Reco 2) TauID, 3) eVeto for fake tau 4) eVeto for true tau
172  # 3) and 4) are optional if eVeto is used in TauSelectionTool
173 
174  # TauEfficiencyCorrectionTool for Reco, this should be always enabled
175  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
176  'TauEfficiencyCorrectionsAlgReco' + postfix )
177  config.addPrivateTool( 'efficiencyCorrectionsTool',
178  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
179  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [0]
180  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
181  alg.scaleFactorDecoration = 'tau_Reco_effSF' + selectionPostfix + '_%SYS%'
182  alg.outOfValidity = 2 #silent
183  alg.outOfValidityDeco = 'bad_Reco_eff' + selectionPostfix
184  alg.taus = config.readName (self.containerName)
185  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
186  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'Reco_effSF' + postfix)
187 
188  # TauEfficiencyCorrectionTool for Identification, use only in case TauID is requested in TauSelectionTool
189  if self.quality not in ('VeryLoose','Baseline'):
190 
191  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
192  'TauEfficiencyCorrectionsAlgID' + postfix )
193  config.addPrivateTool( 'efficiencyCorrectionsTool',
194  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
195  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [4]
196  if self.quality=="Loose":
197  JetIDLevel = 7
198  elif self.quality=="Medium":
199  JetIDLevel = 8
200  elif self.quality=="Tight":
201  JetIDLevel = 9
202  else:
203  raise ValueError ("invalid tauID: \"" + self.quality + "\". Allowed values are loose, medium, tight")
204 
205  alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
206  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
207  alg.scaleFactorDecoration = 'tau_ID_effSF' + selectionPostfix + '_%SYS%'
208  alg.outOfValidity = 2 #silent
209  alg.outOfValidityDeco = 'bad_ID_eff' + selectionPostfix
210  alg.taus = config.readName (self.containerName)
211  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
212  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'ID_effSF' + postfix)
213 
214  # TauEfficiencyCorrectionTool for eVeto both on true tau and fake tau, use only in case eVeto is requested in TauSelectionTool
215  if self.use_eVeto:
216 
217  # correction for fake tau
218  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
219  'TauEfficiencyCorrectionsAlgEvetoFakeTau' + postfix )
220  config.addPrivateTool( 'efficiencyCorrectionsTool',
221  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
222 
223  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [10]
224  # since all TauSelectionTool config files have loose eRNN, code only this option for now
225  alg.efficiencyCorrectionsTool.EleIDLevel = 2
226  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
227  alg.scaleFactorDecoration = 'tau_EvetoFakeTau_effSF' + selectionPostfix + '_%SYS%'
228  alg.outOfValidity = 2 #silent
229  alg.outOfValidityDeco = 'bad_EvetoFakeTau_eff' + selectionPostfix
230  alg.taus = config.readName (self.containerName)
231  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
232  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'EvetoFakeTau_effSF' + postfix)
233 
234  # correction for true tau
235  alg = config.createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
236  'TauEfficiencyCorrectionsAlgEvetoTrueTau' + postfix )
237  config.addPrivateTool( 'efficiencyCorrectionsTool',
238  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
239 
240  alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [8]
241  alg.efficiencyCorrectionsTool.useFastSim = config.dataType() is DataType.FastSim
242  alg.scaleFactorDecoration = 'tau_EvetoTrueTau_effSF' + selectionPostfix + '_%SYS%'
243  alg.outOfValidity = 2 #silent
244  alg.outOfValidityDeco = 'bad_EvetoTrueTau_eff' + selectionPostfix
245  alg.taus = config.readName (self.containerName)
246  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
247  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'EvetoTrueTau_effSF' + postfix)
248 
249 

Member Data Documentation

◆ quality

python.TauAnalysisConfig.TauWorkingPointConfig.quality

Definition at line 196 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