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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 364 of file PhotonAnalysisConfig.py.

364 def __init__ (self) :
365 super (PhotonWorkingPointSelectionConfig, self).__init__ ()
366 self.setBlockName('PhotonWorkingPointSelection')
367 self.addOption ('containerName', '', type=str,
368 noneAction='error',
369 info="the name of the input container.",
370 meta={'role':'containerRef'})
371 self.addOption ('selectionName', '', type=str,
372 noneAction='error',
373 info="the name of the photon selection to define (e.g. `tight` or "
374 "`loose`).",
375 meta={'role':'selection'})
376 self.addOption ('postfix', None, type=str,
377 info="a postfix to apply to decorations and algorithm names. "
378 "Typically not needed here as `selectionName` is used internally.")
379 self.addOption ('qualityWP', None, type=str,
380 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`, `NoID`.",
381 expertMode=['NoID'],
382 meta={'choices':(['Tight','Medium','Loose','NoID'],1)})
383 self.addOption ('isolationWP', None, type=str,
384 info="the isolation WP to use. Supported isolation WPs: "
385 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.",
386 meta={'choices':(['FixedCutLoose','FixedCutTight','TightCaloOnly','NonIso'],1)})
387 self.addOption ('addSelectionToPreselection', True, type=bool,
388 info="whether to retain only photons satisfying the working point "
389 "requirements.")
390 self.addOption ('closeByCorrection', False, type=bool,
391 info="whether to use close-by-corrected isolation working points.")
392 self.addOption ('recomputeIsEM', False, type=bool,
393 info="whether to rerun the cut-based selection (`True`), or rely on derivation flags (`False`).")
394 self.addOption ('doFSRSelection', False, type=bool,
395 info="whether to accept additional photons close to muons for the "
396 "purpose of FSR corrections to these muons. Expert feature "
397 "requested by the H4l analysis running on PHYSLITE.",
398 expertMode=True)
399 self.addOption ('muonsForFSRSelection', None, type=str,
400 info="the name of the muon container to use for the FSR selection. "
401 "If not specified, AnalysisMuons is used.",
402 expertMode=True,
403 meta={'role':'containerRef'})
404

Member Function Documentation

◆ instanceName()

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

Definition at line 405 of file PhotonAnalysisConfig.py.

405 def instanceName (self) :
406 """Return the instance name for this block"""
407 if self.postfix is not None :
408 return self.containerName + '_' + self.selectionName + self.postfix
409 return self.containerName + '_' + self.selectionName
410

◆ makeAlgs()

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

Definition at line 411 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 500 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 485 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 467 of file PhotonAnalysisConfig.py.

◆ qualityWP

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

Definition at line 423 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 431 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 485 of file PhotonAnalysisConfig.py.


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