ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.PhotonAnalysisConfig.PhotonWorkingPointConfig Class Reference
Inheritance diagram for python.PhotonAnalysisConfig.PhotonWorkingPointConfig:
Collaboration diagram for python.PhotonAnalysisConfig.PhotonWorkingPointConfig:

Public Member Functions

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

Public Attributes

 qualityWP
 

Detailed Description

the ConfigBlock for the photon working point

This may at some point be split into multiple blocks (29 Aug 22).

Definition at line 260 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.PhotonAnalysisConfig.PhotonWorkingPointConfig.__init__ (   self,
  containerName = '',
  selectionName = '' 
)

Definition at line 265 of file PhotonAnalysisConfig.py.

265  def __init__ (self, containerName='', selectionName='') :
266  super (PhotonWorkingPointConfig, self).__init__ ()
267  self.addOption ('containerName', containerName, type=str,
268  noneAction='error',
269  info="the name of the input container.")
270  self.addOption ('selectionName', selectionName, type=str,
271  noneAction='error',
272  info="the name of the photon selection to define (e.g. tight or "
273  "loose).")
274  self.addOption ('postfix', selectionName, type=str,
275  info="a postfix to apply to decorations and algorithm names. "
276  "Typically not needed here as selectionName is used internally.")
277  self.addOption ('qualityWP', None, type=str,
278  info="the ID WP (string) to use. Supported ID WPs: Tight, Medium and Loose.")
279  self.addOption ('isolationWP', None, type=str,
280  info="the ID WP (string) to use. Supported isolation WPs: "
281  "FixedCutLoose, FixedCutTight, TightCaloOnly, NonIso.")
282  self.addOption ('closeByCorrection', False, type=bool,
283  info="whether to use close-by-corrected isolation working points")
284  self.addOption ('recomputeIsEM', False, type=bool,
285  info="whether to rerun the cut-based selection. The default is "
286  "False, i.e. to use derivation flags.")
287  self.addOption ('doFSRSelection', False, type=bool,
288  info="whether to accept additional photons close to muons for the "
289  "purpose of FSR corrections to these muons. Expert feature "
290  "requested by the H4l analysis running on PHYSLITE. "
291  "The default is False.")
292  self.addOption ('noEffSF', False, type=bool,
293  info="disables the calculation of efficiencies and scale factors. "
294  "Experimental! only useful to test a new WP for which scale "
295  "factors are not available. The default is False.")
296  self.addOption ('forceFullSimConfig', False, type=bool,
297  info="whether to force the tool to use the configuration meant "
298  "for full simulation samples. Only for testing purposes. "
299  "The default is False.")
300 

Member Function Documentation

◆ makeAlgs()

def python.PhotonAnalysisConfig.PhotonWorkingPointConfig.makeAlgs (   self,
  config 
)

Definition at line 301 of file PhotonAnalysisConfig.py.

301  def makeAlgs (self, config) :
302 
303  log = logging.getLogger('PhotonWorkingPointConfig')
304 
305  # The setup below is inappropriate for Run 1
306  if config.geometry() is LHCPeriod.Run1:
307  raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
308 
309  if self.forceFullSimConfig:
310  log.warning("You are running PhotonWorkingPointConfig forcing full sim config")
311  log.warning("This is only intended to be used for testing purposes")
312 
313  postfix = self.postfix
314  if postfix != '' and postfix[0] != '_' :
315  postfix = '_' + postfix
316 
317  if self.qualityWP == 'Tight' :
318  quality = ROOT.egammaPID.PhotonTight
319  elif self.qualityWP == 'Medium' :
320  quality = ROOT.egammaPID.PhotonMedium
321  elif self.qualityWP == 'Loose' :
322  quality = ROOT.egammaPID.PhotonLoose
323  else :
324  raise Exception ('unknown photon quality working point "' + self.qualityWP + '" should be Tight, Medium or Loose')
325 
326  # Set up the photon selection algorithm:
327  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' + postfix )
328  alg.selectionDecoration = 'selectEM' + postfix + ',as_bits'
329  if self.recomputeIsEM:
330  # Rerun the cut-based ID
331  config.addPrivateTool( 'selectionTool', 'AsgPhotonIsEMSelector' )
332  alg.selectionTool.isEMMask = quality
333  if config.geometry() is LHCPeriod.Run2:
334  if self.qualityWP == 'Tight':
335  alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMTightSelectorCutDefs_pTdep_mc20_smooth.conf'
336  elif self.qualityWP == 'Loose':
337  alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
338  elif self.qualityWP == 'Medium':
339  alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMMediumSelectorCutDefs_pTdep_smooth.conf'
340  if config.geometry() is LHCPeriod.Run3:
341  if self.qualityWP == 'Tight':
342  alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf'
343  elif self.qualityWP == 'Loose':
344  alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
345  elif self.qualityWP == 'Medium':
346  raise ValueError('No Medium menu available for Run-3. Please get in contact with egamma')
347  else:
348  # Select from Derivation Framework flags
349  config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' )
350  dfFlag = 'DFCommonPhotonsIsEM' + self.qualityWP
351  alg.selectionTool.selectionFlags = [ dfFlag ]
352  alg.particles = config.readName (self.containerName)
353  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
354  config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
355 
356  # Set up the FSR selection
357  if self.doFSRSelection :
358  # save the flag set for the WP
359  wpFlag = alg.selectionDecoration.split(",")[0]
360  alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg' + postfix + '_ph') # added extra postfix to avoid name clash with electrons
361  alg.selectionDecoration = wpFlag
362  alg.ElectronOrPhotonContKey = config.readName (self.containerName)
363 
364  # Set up the isolation selection algorithm:
365  if self.isolationWP != 'NonIso' :
366  alg = config.createAlgorithm( 'CP::EgammaIsolationSelectionAlg',
367  'PhotonIsolationSelectionAlg' + postfix )
368  alg.selectionDecoration = 'isolated' + postfix + ',as_bits'
369  config.addPrivateTool( 'selectionTool', 'CP::IsolationSelectionTool' )
370  alg.selectionTool.PhotonWP = self.isolationWP
371  if self.closeByCorrection:
372  alg.selectionTool.IsoDecSuffix = "CloseByCorr"
373  alg.isPhoton = True
374  alg.egammas = config.readName (self.containerName)
375  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
376  config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
377 
378  # Set up the ID/reco photon efficiency correction algorithm:
379  if config.dataType() is not DataType.Data and not self.noEffSF:
380  alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
381  'PhotonEfficiencyCorrectionAlgID' + postfix )
382  config.addPrivateTool( 'efficiencyCorrectionTool',
383  'AsgPhotonEfficiencyCorrectionTool' )
384  alg.scaleFactorDecoration = 'ph_id_effSF' + postfix + '_%SYS%'
385  if config.dataType() is DataType.FastSim:
386  alg.efficiencyCorrectionTool.ForceDataType = (
387  PATCore.ParticleDataType.Full if self.forceFullSimConfig else
388  PATCore.ParticleDataType.Fast)
389  elif config.dataType() is DataType.FullSim:
390  alg.efficiencyCorrectionTool.ForceDataType = \
391  PATCore.ParticleDataType.Full
392  if config.geometry() >= LHCPeriod.Run2:
393  alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2024_FinalRun2_Recommendation_v1/map0.txt'
394  alg.outOfValidity = 2 #silent
395  alg.outOfValidityDeco = 'ph_id_bad_eff' + postfix
396  alg.photons = config.readName (self.containerName)
397  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
398  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'id_effSF' + postfix)
399 
400  # Set up the ISO photon efficiency correction algorithm:
401  if config.dataType() is not DataType.Data and self.isolationWP != 'NonIso' and not self.noEffSF:
402  alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
403  'PhotonEfficiencyCorrectionAlgIsol' + postfix )
404  config.addPrivateTool( 'efficiencyCorrectionTool',
405  'AsgPhotonEfficiencyCorrectionTool' )
406  alg.scaleFactorDecoration = 'ph_isol_effSF' + postfix + '_%SYS%'
407  if config.dataType() is DataType.FastSim:
408  alg.efficiencyCorrectionTool.ForceDataType = (
409  PATCore.ParticleDataType.Full if self.forceFullSimConfig else
410  PATCore.ParticleDataType.Fast)
411  elif config.dataType() is DataType.FullSim:
412  alg.efficiencyCorrectionTool.ForceDataType = \
413  PATCore.ParticleDataType.Full
414  alg.efficiencyCorrectionTool.IsoKey = self.isolationWP.replace("FixedCut","")
415  if config.geometry() >= LHCPeriod.Run2:
416  alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map0.txt'
417  alg.outOfValidity = 2 #silent
418  alg.outOfValidityDeco = 'ph_isol_bad_eff' + postfix
419  alg.photons = config.readName (self.containerName)
420  alg.preselection = config.getPreselection (self.containerName, self.selectionName)
421  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'isol_effSF' + postfix)
422 
423 
424 
425 
426 

Member Data Documentation

◆ qualityWP

python.PhotonAnalysisConfig.PhotonWorkingPointConfig.qualityWP

Definition at line 317 of file PhotonAnalysisConfig.py.


The documentation for this class was generated from the following file:
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18