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
 doFSRSelection
 containerName
 selectionName
 closeByCorrection

Detailed Description

the ConfigBlock for the photon working point selection

Definition at line 335 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 338 of file PhotonAnalysisConfig.py.

338 def __init__ (self) :
339 super (PhotonWorkingPointSelectionConfig, self).__init__ ()
340 self.setBlockName('PhotonWorkingPointSelection')
341 self.addOption ('containerName', '', type=str,
342 noneAction='error',
343 info="the name of the input container.",
344 meta={'role':'containerRef'})
345 self.addOption ('selectionName', '', type=str,
346 noneAction='error',
347 info="the name of the photon selection to define (e.g. `tight` or "
348 "`loose`).",
349 meta={'role':'selection'})
350 self.addOption ('postfix', None, type=str,
351 info="a postfix to apply to decorations and algorithm names. "
352 "Typically not needed here as `selectionName` is used internally.")
353 self.addOption ('qualityWP', None, type=str,
354 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`.",
355 meta={'choices':(['Tight','Medium','Loose'],1)})
356 self.addOption ('isolationWP', None, type=str,
357 info="the isolation WP to use. Supported isolation WPs: "
358 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.",
359 meta={'choices':(['FixedCutLoose','FixedCutTight','TightCaloOnly','NonIso'],1)})
360 self.addOption ('addSelectionToPreselection', True, type=bool,
361 info="whether to retain only photons satisfying the working point "
362 "requirements.")
363 self.addOption ('closeByCorrection', False, type=bool,
364 info="whether to use close-by-corrected isolation working points.")
365 self.addOption ('recomputeIsEM', False, type=bool,
366 info="whether to rerun the cut-based selection (`True`), or rely on derivation flags (`False`).")
367 self.addOption ('doFSRSelection', False, type=bool,
368 info="whether to accept additional photons close to muons for the "
369 "purpose of FSR corrections to these muons. Expert feature "
370 "requested by the H4l analysis running on PHYSLITE.",
371 expertMode=True)
372 self.addOption ('muonsForFSRSelection', None, type=str,
373 info="the name of the muon container to use for the FSR selection. "
374 "If not specified, AnalysisMuons is used.",
375 expertMode=True,
376 meta={'role':'containerRef'})
377

Member Function Documentation

◆ instanceName()

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

Definition at line 378 of file PhotonAnalysisConfig.py.

378 def instanceName (self) :
379 """Return the instance name for this block"""
380 if self.postfix is not None :
381 return self.containerName + '_' + self.selectionName + self.postfix
382 return self.containerName + '_' + self.selectionName
383

◆ makeAlgs()

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

Definition at line 384 of file PhotonAnalysisConfig.py.

384 def makeAlgs (self, config) :
385
386 # The setup below is inappropriate for Run 1
387 if config.geometry() is LHCPeriod.Run1:
388 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
389
390 postfix = self.postfix
391 if postfix is None :
392 postfix = self.selectionName
393 if postfix != '' and postfix[0] != '_' :
394 postfix = '_' + postfix
395
396 if self.qualityWP == 'Tight' :
397 quality = ROOT.egammaPID.PhotonTight
398 elif self.qualityWP == 'Medium' :
399 quality = ROOT.egammaPID.PhotonMedium
400 elif self.qualityWP == 'Loose' :
401 quality = ROOT.egammaPID.PhotonLoose
402 else :
403 raise Exception (f'unknown photon quality working point "{self.qualityWP}" should be Tight, Medium or Loose')
404
405 # Set up the photon selection algorithm:
406 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' )
407 alg.selectionDecoration = 'selectEM' + postfix + ',as_char'
408 if self.recomputeIsEM:
409 # Rerun the cut-based ID
410 config.addPrivateTool( 'selectionTool', 'AsgPhotonIsEMSelector' )
411 alg.selectionTool.isEMMask = quality
412 if config.geometry() is LHCPeriod.Run2:
413 if self.qualityWP == 'Tight':
414 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMTightSelectorCutDefs_pTdep_mc20_smooth.conf'
415 elif self.qualityWP == 'Loose':
416 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
417 elif self.qualityWP == 'Medium':
418 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMMediumSelectorCutDefs_pTdep_smooth.conf'
419 if config.geometry() is LHCPeriod.Run3:
420 if self.qualityWP == 'Tight':
421 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc23_20260924/PhotonIsEMTightSelectorCutDefs.conf'
422 elif self.qualityWP == 'Loose':
423 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
424 elif self.qualityWP == 'Medium':
425 raise ValueError('No Medium menu available for Run-3. Please get in contact with egamma')
426 else:
427 # Select from Derivation Framework flags
428 config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' )
429 dfFlag = 'DFCommonPhotonsIsEM' + self.qualityWP
430 alg.selectionTool.selectionFlags = [ dfFlag ]
431 alg.particles = config.readName (self.containerName)
432 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
433
434 # Set up the FSR selection
435 if self.doFSRSelection :
436 # wpSelection needs the ',as_char' suffix so SysReadSelectionHandle knows the type
437 wpDecoration = alg.selectionDecoration
438 wpDecorationName = wpDecoration.split(',')[0]
439 # Insert FSR before the postfix (e.g., selectEM_loose -> selectEMFSR_loose)
440 underscorePos = wpDecorationName.find('_')
441 if underscorePos < 0:
442 underscorePos = len(wpDecorationName)
443 outputDecorationName = wpDecorationName[:underscorePos] + 'FSR' + wpDecorationName[underscorePos:]
444
445 alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg')
446 alg.wpSelection = wpDecoration # Input: read the WP selection (with type suffix)
447 alg.selectionDecoration = outputDecorationName # Output: combined WP||FSR (name only for SysWriteDecorHandle)
448 alg.ElectronOrPhotonContKey = config.readName (self.containerName)
449 if self.muonsForFSRSelection is not None:
450 alg.MuonContKey = config.readName (self.muonsForFSRSelection)
451
452 # Register the FSR COMBINED selection
453 config.addSelection (self.containerName, self.selectionName,
454 alg.selectionDecoration + ',as_char',
455 preselection=self.addSelectionToPreselection)
456 else:
457 # No FSR - register the WP selection directly
458 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
459 preselection=self.addSelectionToPreselection)
460
461 # Set up the isolation selection algorithm:
462 if self.isolationWP != 'NonIso' :
463 alg = config.createAlgorithm( 'CP::EgammaIsolationSelectionAlg',
464 'PhotonIsolationSelectionAlg' )
465 alg.selectionDecoration = 'isolated' + postfix + ',as_char'
466 config.addPrivateTool( 'selectionTool', 'CP::IsolationSelectionTool' )
467 alg.selectionTool.PhotonWP = self.isolationWP
468 if self.closeByCorrection:
469 alg.selectionTool.IsoDecSuffix = "CloseByCorr"
470 alg.isPhoton = True
471 alg.egammas = config.readName (self.containerName)
472 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
473 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
474 preselection=self.addSelectionToPreselection)
475
476

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 468 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 453 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 435 of file PhotonAnalysisConfig.py.

◆ qualityWP

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

Definition at line 396 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 408 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 453 of file PhotonAnalysisConfig.py.


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