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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 464 of file PhotonAnalysisConfig.py.

464 def __init__ (self) :
465 super (PhotonWorkingPointEfficiencyConfig, self).__init__ ()
466 self.setBlockName('PhotonWorkingPointEfficiency')
467 self.addDependency('PhotonWorkingPointSelection', required=True)
468 self.addDependency('EventSelection', required=False)
469 self.addDependency('EventSelectionMerger', required=False)
470 self.addOption ('containerName', '', type=str,
471 noneAction='error',
472 info="the name of the input container.",
473 meta={'role':'containerRef'})
474 self.addOption ('selectionName', '', type=str,
475 noneAction='error',
476 info="the name of the photon selection to define (e.g. `tight` or "
477 "`loose`).",
478 meta={'role':'selection'})
479 self.addOption ('postfix', None, type=str,
480 info="a postfix to apply to decorations and algorithm names. "
481 "Typically not needed here as `selectionName` is used internally.")
482 self.addOption ('qualityWP', None, type=str,
483 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`.",
484 meta={'choices':(['Tight','Medium','Loose'],1)})
485 self.addOption ('isolationWP', None, type=str,
486 info="the isolation WP to use. Supported isolation WPs: "
487 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.",
488 meta={'choices':(['FixedCutLoose','FixedCutTight','TightCaloOnly','NonIso'],1)})
489 self.addOption ('noEffSFForID', False, type=bool,
490 info="disables the calculation of ID efficiencies and scale factors. "
491 "Experimental! only useful to test a new WP for which scale "
492 "factors are not available.",
493 expertMode=True)
494 self.addOption ('noEffSFForIso', False, type=bool,
495 info="disables the calculation of isolation efficiencies and scale factors. "
496 "Experimental! only useful to test a new WP for which scale "
497 "factors are not available.",
498 expertMode=True)
499 self.addOption ('saveDetailedSF', True, type=bool,
500 info="save all the independent detailed object scale factors.")
501 self.addOption ('saveCombinedSF', False, type=bool,
502 info="save the combined object scale factor.")
503 self.addOption ('forceFullSimConfigForID', False, type=bool,
504 info="whether to force the ID tool to use the configuration meant "
505 "for full simulation samples. Only for testing purposes.")
506 self.addOption ('forceFullSimConfigForIso', False, type=bool,
507 info="whether to force the isolation tool to use the configuration meant "
508 "for full simulation samples. Only for testing purposes.")
509

Member Function Documentation

◆ instanceName()

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

Definition at line 510 of file PhotonAnalysisConfig.py.

510 def instanceName (self) :
511 """Return the instance name for this block"""
512 if self.postfix is not None :
513 return self.containerName + '_' + self.selectionName + self.postfix
514 return self.containerName + '_' + self.selectionName
515

◆ makeAlgs()

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

Definition at line 516 of file PhotonAnalysisConfig.py.

516 def makeAlgs (self, config) :
517
518 # The setup below is inappropriate for Run 1
519 if config.geometry() is LHCPeriod.Run1:
520 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
521
522 if self.forceFullSimConfigForID:
523 warnings.warn_explicit(
524 "You are running PhotonWorkingPointConfig forcing"
525 " full sim config for ID."
526 " This is only intended to be used for testing purposes.",
527 TestingOnlyWarning, filename='', lineno=0)
528
529 if self.forceFullSimConfigForIso:
530 warnings.warn_explicit(
531 "You are running PhotonWorkingPointConfig forcing"
532 " full sim config for Iso."
533 " This is only intended to be used for testing purposes.",
534 TestingOnlyWarning, filename='', lineno=0)
535
536 postfix = self.postfix
537 if postfix is None :
538 postfix = self.selectionName
539 if postfix != '' and postfix[0] != '_' :
540 postfix = '_' + postfix
541
542 sfList = []
543 # Set up the ID/reco photon efficiency correction algorithm:
544 if config.dataType() is not DataType.Data and not self.noEffSFForID:
545 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
546 'PhotonEfficiencyCorrectionAlgID' )
547 config.addPrivateTool( 'efficiencyCorrectionTool',
548 'AsgPhotonEfficiencyCorrectionTool' )
549 alg.scaleFactorDecoration = 'ph_id_effSF' + postfix + '_%SYS%'
550 if config.dataType() is DataType.FastSim:
551 alg.efficiencyCorrectionTool.ForceDataType = (
552 PATCore.ParticleDataType.Full if self.forceFullSimConfigForID else
553 PATCore.ParticleDataType.Fast)
554 elif config.dataType() is DataType.FullSim:
555 alg.efficiencyCorrectionTool.ForceDataType = \
556 PATCore.ParticleDataType.Full
557 if config.geometry() >= LHCPeriod.Run2:
558 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2026_Run3Consolidated_Recommendation_v1/map0.txt'
559 alg.outOfValidity = 2 #silent
560 alg.outOfValidityDeco = 'ph_id_bad_eff' + postfix
561 alg.photons = config.readName (self.containerName)
562 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
563 if self.saveDetailedSF:
564 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
565 'id_effSF' + postfix)
566 sfList += [alg.scaleFactorDecoration]
567
568 # Set up the ISO photon efficiency correction algorithm:
569 if config.dataType() is not DataType.Data and self.isolationWP != 'NonIso' and not self.noEffSFForIso:
570 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
571 'PhotonEfficiencyCorrectionAlgIsol' )
572 config.addPrivateTool( 'efficiencyCorrectionTool',
573 'AsgPhotonEfficiencyCorrectionTool' )
574 alg.scaleFactorDecoration = 'ph_isol_effSF' + postfix + '_%SYS%'
575 if config.dataType() is DataType.FastSim:
576 alg.efficiencyCorrectionTool.ForceDataType = (
577 PATCore.ParticleDataType.Full if self.forceFullSimConfigForIso else
578 PATCore.ParticleDataType.Fast)
579 elif config.dataType() is DataType.FullSim:
580 alg.efficiencyCorrectionTool.ForceDataType = \
581 PATCore.ParticleDataType.Full
582 alg.efficiencyCorrectionTool.IsoKey = self.isolationWP.replace("FixedCut","")
583 if config.geometry() >= LHCPeriod.Run2:
584 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map1.txt'
585 alg.outOfValidity = 2 #silent
586 alg.outOfValidityDeco = 'ph_isol_bad_eff' + postfix
587 alg.photons = config.readName (self.containerName)
588 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
589 if self.saveDetailedSF:
590 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
591 'isol_effSF' + postfix)
592 sfList += [alg.scaleFactorDecoration]
593
594 doCombEffSF = not self.noEffSFForID or not self.noEffSFForIso
595 if config.dataType() is not DataType.Data and doCombEffSF and self.saveCombinedSF:
596 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
597 'PhotonCombinedEfficiencyScaleFactorAlg' )
598 alg.particles = config.readName (self.containerName)
599 alg.inScaleFactors = sfList
600 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
601 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
602
603
604@groupBlocks
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312

Member Data Documentation

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.containerName

Definition at line 564 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 522 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 529 of file PhotonAnalysisConfig.py.

◆ noEffSFForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.noEffSFForID

Definition at line 544 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 595 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 563 of file PhotonAnalysisConfig.py.


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