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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 340 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 381 of file PhotonAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 387 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 476 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 461 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 443 of file PhotonAnalysisConfig.py.

◆ qualityWP

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

Definition at line 399 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 407 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 461 of file PhotonAnalysisConfig.py.


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