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 254 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 259 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ makeAlgs()

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

Definition at line 295 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ qualityWP

python.PhotonAnalysisConfig.PhotonWorkingPointConfig.qualityWP

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