ATLAS Offline Software
Loading...
Searching...
No Matches
python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig Class Reference
Inheritance diagram for python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig:
Collaboration diagram for python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

str qualityWP = 'Tight' :
 recomputeIsEM
 containerName
 selectionName
 doFSRSelection
 closeByCorrection

Detailed Description

the ConfigBlock for the photon working point selection

Definition at line 297 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 300 of file PhotonAnalysisConfig.py.

300 def __init__ (self) :
301 super (PhotonWorkingPointSelectionConfig, self).__init__ ()
302 self.setBlockName('PhotonWorkingPointSelection')
303 self.addOption ('containerName', '', type=str,
304 noneAction='error',
305 info="the name of the input container.")
306 self.addOption ('selectionName', '', type=str,
307 noneAction='error',
308 info="the name of the photon selection to define (e.g. `tight` or "
309 "`loose`).")
310 self.addOption ('postfix', None, type=str,
311 info="a postfix to apply to decorations and algorithm names. "
312 "Typically not needed here as `selectionName` is used internally.")
313 self.addOption ('qualityWP', None, type=str,
314 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`.")
315 self.addOption ('isolationWP', None, type=str,
316 info="the isolation WP to use. Supported isolation WPs: "
317 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.")
318 self.addOption ('addSelectionToPreselection', True, type=bool,
319 info="whether to retain only photons satisfying the working point "
320 "requirements.")
321 self.addOption ('closeByCorrection', False, type=bool,
322 info="whether to use close-by-corrected isolation working points.")
323 self.addOption ('recomputeIsEM', False, type=bool,
324 info="whether to rerun the cut-based selection (`True`), or rely on derivation flags (`False`).")
325 self.addOption ('doFSRSelection', False, type=bool,
326 info="whether to accept additional photons close to muons for the "
327 "purpose of FSR corrections to these muons. Expert feature "
328 "requested by the H4l analysis running on PHYSLITE.",
329 expertMode=True)
330

Member Function Documentation

◆ instanceName()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.instanceName ( self)
Return the instance name for this block

Definition at line 331 of file PhotonAnalysisConfig.py.

331 def instanceName (self) :
332 """Return the instance name for this block"""
333 if self.postfix is not None :
334 return self.containerName + '_' + self.selectionName + self.postfix
335 return self.containerName + '_' + self.selectionName
336

◆ makeAlgs()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.makeAlgs ( self,
config )

Definition at line 337 of file PhotonAnalysisConfig.py.

337 def makeAlgs (self, config) :
338
339 # The setup below is inappropriate for Run 1
340 if config.geometry() is LHCPeriod.Run1:
341 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
342
343 postfix = self.postfix
344 if postfix is None :
345 postfix = self.selectionName
346 if postfix != '' and postfix[0] != '_' :
347 postfix = '_' + postfix
348
349 if self.qualityWP == 'Tight' :
350 quality = ROOT.egammaPID.PhotonTight
351 elif self.qualityWP == 'Medium' :
352 quality = ROOT.egammaPID.PhotonMedium
353 elif self.qualityWP == 'Loose' :
354 quality = ROOT.egammaPID.PhotonLoose
355 else :
356 raise Exception ('unknown photon quality working point "' + self.qualityWP + '" should be Tight, Medium or Loose')
357
358 # Set up the photon selection algorithm:
359 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' )
360 alg.selectionDecoration = 'selectEM' + postfix + ',as_char'
361 if self.recomputeIsEM:
362 # Rerun the cut-based ID
363 config.addPrivateTool( 'selectionTool', 'AsgPhotonIsEMSelector' )
364 alg.selectionTool.isEMMask = quality
365 if config.geometry() is LHCPeriod.Run2:
366 if self.qualityWP == 'Tight':
367 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMTightSelectorCutDefs_pTdep_mc20_smooth.conf'
368 elif self.qualityWP == 'Loose':
369 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
370 elif self.qualityWP == 'Medium':
371 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMMediumSelectorCutDefs_pTdep_smooth.conf'
372 if config.geometry() is LHCPeriod.Run3:
373 if self.qualityWP == 'Tight':
374 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf'
375 elif self.qualityWP == 'Loose':
376 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
377 elif self.qualityWP == 'Medium':
378 raise ValueError('No Medium menu available for Run-3. Please get in contact with egamma')
379 else:
380 # Select from Derivation Framework flags
381 config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' )
382 dfFlag = 'DFCommonPhotonsIsEM' + self.qualityWP
383 alg.selectionTool.selectionFlags = [ dfFlag ]
384 alg.particles = config.readName (self.containerName)
385 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
386 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
387 preselection=self.addSelectionToPreselection)
388
389 # Set up the FSR selection
390 if self.doFSRSelection :
391 # save the flag set for the WP
392 wpFlag = alg.selectionDecoration.split(",")[0]
393 alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg')
394 alg.selectionDecoration = wpFlag
395 alg.ElectronOrPhotonContKey = config.readName (self.containerName)
396
397 # Set up the isolation selection algorithm:
398 if self.isolationWP != 'NonIso' :
399 alg = config.createAlgorithm( 'CP::EgammaIsolationSelectionAlg',
400 'PhotonIsolationSelectionAlg' )
401 alg.selectionDecoration = 'isolated' + postfix + ',as_char'
402 config.addPrivateTool( 'selectionTool', 'CP::IsolationSelectionTool' )
403 alg.selectionTool.PhotonWP = self.isolationWP
404 if self.closeByCorrection:
405 alg.selectionTool.IsoDecSuffix = "CloseByCorr"
406 alg.isPhoton = True
407 alg.egammas = config.readName (self.containerName)
408 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
409 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
410 preselection=self.addSelectionToPreselection)
411
412

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 404 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 386 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 390 of file PhotonAnalysisConfig.py.

◆ qualityWP

str python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.qualityWP = 'Tight' :

Definition at line 349 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 361 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 386 of file PhotonAnalysisConfig.py.


The documentation for this class was generated from the following file: