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

Public Member Functions

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

Public Attributes

 forceFullSimConfigForID
 forceFullSimConfigForIso
 noEffSFForID
 saveDetailedSF
 containerName
 saveCombinedSF

Detailed Description

the ConfigBlock for the photon working point efficiency computation

Definition at line 413 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 416 of file PhotonAnalysisConfig.py.

416 def __init__ (self) :
417 super (PhotonWorkingPointEfficiencyConfig, self).__init__ ()
418 self.setBlockName('PhotonWorkingPointEfficiency')
419 self.addDependency('PhotonWorkingPointSelection', required=True)
420 self.addDependency('EventSelection', required=False)
421 self.addDependency('EventSelectionMerger', required=False)
422 self.addOption ('containerName', '', type=str,
423 noneAction='error',
424 info="the name of the input container.")
425 self.addOption ('selectionName', '', type=str,
426 noneAction='error',
427 info="the name of the photon selection to define (e.g. `tight` or "
428 "`loose`).")
429 self.addOption ('postfix', None, type=str,
430 info="a postfix to apply to decorations and algorithm names. "
431 "Typically not needed here as `selectionName` is used internally.")
432 self.addOption ('qualityWP', None, type=str,
433 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`.")
434 self.addOption ('isolationWP', None, type=str,
435 info="the isolation WP to use. Supported isolation WPs: "
436 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.")
437 self.addOption ('noEffSFForID', False, type=bool,
438 info="disables the calculation of ID efficiencies and scale factors. "
439 "Experimental! only useful to test a new WP for which scale "
440 "factors are not available.",
441 expertMode=True)
442 self.addOption ('noEffSFForIso', False, type=bool,
443 info="disables the calculation of isolation efficiencies and scale factors. "
444 "Experimental! only useful to test a new WP for which scale "
445 "factors are not available.",
446 expertMode=True)
447 self.addOption ('saveDetailedSF', True, type=bool,
448 info="save all the independent detailed object scale factors.")
449 self.addOption ('saveCombinedSF', False, type=bool,
450 info="save the combined object scale factor.")
451 self.addOption ('forceFullSimConfigForID', False, type=bool,
452 info="whether to force the ID tool to use the configuration meant "
453 "for full simulation samples. Only for testing purposes.")
454 self.addOption ('forceFullSimConfigForIso', False, type=bool,
455 info="whether to force the isolation tool to use the configuration meant "
456 "for full simulation samples. Only for testing purposes.")
457

Member Function Documentation

◆ instanceName()

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

Definition at line 458 of file PhotonAnalysisConfig.py.

458 def instanceName (self) :
459 """Return the instance name for this block"""
460 if self.postfix is not None :
461 return self.containerName + '_' + self.selectionName + self.postfix
462 return self.containerName + '_' + self.selectionName
463

◆ makeAlgs()

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

Definition at line 464 of file PhotonAnalysisConfig.py.

464 def makeAlgs (self, config) :
465
466 log = logging.getLogger('PhotonWorkingPointEfficiencyConfig')
467
468 # The setup below is inappropriate for Run 1
469 if config.geometry() is LHCPeriod.Run1:
470 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
471
472 if self.forceFullSimConfigForID:
473 log.warning("You are running PhotonWorkingPointConfig forcing full sim config for ID")
474 log.warning("This is only intended to be used for testing purposes")
475
476 if self.forceFullSimConfigForIso:
477 log.warning("You are running PhotonWorkingPointConfig forcing full sim config for Iso")
478 log.warning("This is only intended to be used for testing purposes")
479
480 postfix = self.postfix
481 if postfix is None :
482 postfix = self.selectionName
483 if postfix != '' and postfix[0] != '_' :
484 postfix = '_' + postfix
485
486 sfList = []
487 # Set up the ID/reco photon efficiency correction algorithm:
488 if config.dataType() is not DataType.Data and not self.noEffSFForID:
489 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
490 'PhotonEfficiencyCorrectionAlgID' )
491 config.addPrivateTool( 'efficiencyCorrectionTool',
492 'AsgPhotonEfficiencyCorrectionTool' )
493 alg.scaleFactorDecoration = 'ph_id_effSF' + postfix + '_%SYS%'
494 if config.dataType() is DataType.FastSim:
495 alg.efficiencyCorrectionTool.ForceDataType = (
496 PATCore.ParticleDataType.Full if self.forceFullSimConfigForID else
497 PATCore.ParticleDataType.Fast)
498 elif config.dataType() is DataType.FullSim:
499 alg.efficiencyCorrectionTool.ForceDataType = \
500 PATCore.ParticleDataType.Full
501 if config.geometry() >= LHCPeriod.Run2:
502 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2024_FinalRun2_Recommendation_v1/map1.txt'
503 alg.outOfValidity = 2 #silent
504 alg.outOfValidityDeco = 'ph_id_bad_eff' + postfix
505 alg.photons = config.readName (self.containerName)
506 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
507 if self.saveDetailedSF:
508 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
509 'id_effSF' + postfix)
510 sfList += [alg.scaleFactorDecoration]
511
512 # Set up the ISO photon efficiency correction algorithm:
513 if config.dataType() is not DataType.Data and self.isolationWP != 'NonIso' and not self.noEffSFForIso:
514 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
515 'PhotonEfficiencyCorrectionAlgIsol' )
516 config.addPrivateTool( 'efficiencyCorrectionTool',
517 'AsgPhotonEfficiencyCorrectionTool' )
518 alg.scaleFactorDecoration = 'ph_isol_effSF' + postfix + '_%SYS%'
519 if config.dataType() is DataType.FastSim:
520 alg.efficiencyCorrectionTool.ForceDataType = (
521 PATCore.ParticleDataType.Full if self.forceFullSimConfigForIso else
522 PATCore.ParticleDataType.Fast)
523 elif config.dataType() is DataType.FullSim:
524 alg.efficiencyCorrectionTool.ForceDataType = \
525 PATCore.ParticleDataType.Full
526 alg.efficiencyCorrectionTool.IsoKey = self.isolationWP.replace("FixedCut","")
527 if config.geometry() >= LHCPeriod.Run2:
528 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map1.txt'
529 alg.outOfValidity = 2 #silent
530 alg.outOfValidityDeco = 'ph_isol_bad_eff' + postfix
531 alg.photons = config.readName (self.containerName)
532 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
533 if self.saveDetailedSF:
534 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
535 'isol_effSF' + postfix)
536 sfList += [alg.scaleFactorDecoration]
537
538 doCombEffSF = not self.noEffSFForID or not self.noEffSFForIso
539 if config.dataType() is not DataType.Data and doCombEffSF and self.saveCombinedSF:
540 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
541 'PhotonCombinedEfficiencyScaleFactorAlg' )
542 alg.particles = config.readName (self.containerName)
543 alg.inScaleFactors = sfList
544 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
545 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
546
547
548@groupBlocks
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310

Member Data Documentation

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.containerName

Definition at line 508 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 472 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 476 of file PhotonAnalysisConfig.py.

◆ noEffSFForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.noEffSFForID

Definition at line 488 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 539 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 507 of file PhotonAnalysisConfig.py.


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