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
 saveDetailedSF
 containerName
 saveCombinedSF

Detailed Description

the ConfigBlock for the photon working point efficiency computation

Definition at line 509 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 512 of file PhotonAnalysisConfig.py.

512 def __init__ (self) :
513 super (PhotonWorkingPointEfficiencyConfig, self).__init__ ()
514 self.setBlockName('PhotonWorkingPointEfficiency')
515 self.addDependency('PhotonWorkingPointSelection', required=True)
516 self.addDependency('EventSelection', required=False)
517 self.addDependency('EventSelectionMerger', required=False)
518 self.addOption ('containerName', '', type=str,
519 noneAction='error',
520 info="the name of the input container.",
521 meta={'role':'containerRef'})
522 self.addOption ('selectionName', '', type=str,
523 noneAction='error',
524 info="the name of the photon selection to define (e.g. `tight` or "
525 "`loose`).",
526 meta={'role':'selection'})
527 self.addOption ('postfix', None, type=str,
528 info="a postfix to apply to decorations and algorithm names. "
529 "Typically not needed here as `selectionName` is used internally.")
530 self.addOption ('qualityWP', None, type=str,
531 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`, `NoID`.",
532 expertMode=['NoID'],
533 meta={'choices':(['Tight','Medium','Loose','NoID'],1)})
534 self.addOption ('isolationWP', None, type=str,
535 info="the isolation WP to use. Supported isolation WPs: "
536 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.",
537 meta={'choices':(['FixedCutLoose','FixedCutTight','TightCaloOnly','NonIso'],1)})
538 self.addOption ('noEffSFForID', False, type=bool,
539 info="disables the calculation of ID efficiencies and scale factors. "
540 "Experimental! only useful to test a new WP for which scale "
541 "factors are not available.",
542 expertMode=True)
543 self.addOption ('noEffSFForIso', False, type=bool,
544 info="disables the calculation of isolation efficiencies and scale factors. "
545 "Experimental! only useful to test a new WP for which scale "
546 "factors are not available.",
547 expertMode=True)
548 self.addOption ('saveDetailedSF', True, type=bool,
549 info="save all the independent detailed object scale factors.")
550 self.addOption ('saveCombinedSF', False, type=bool,
551 info="save the combined object scale factor.")
552 self.addOption ('forceFullSimConfigForID', False, type=bool,
553 info="whether to force the ID tool to use the configuration meant "
554 "for full simulation samples. Only for testing purposes.")
555 self.addOption ('forceFullSimConfigForIso', False, type=bool,
556 info="whether to force the isolation tool to use the configuration meant "
557 "for full simulation samples. Only for testing purposes.")
558

Member Function Documentation

◆ instanceName()

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

Definition at line 559 of file PhotonAnalysisConfig.py.

559 def instanceName (self) :
560 """Return the instance name for this block"""
561 if self.postfix is not None :
562 return self.containerName + '_' + self.selectionName + self.postfix
563 return self.containerName + '_' + self.selectionName
564

◆ makeAlgs()

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

Definition at line 565 of file PhotonAnalysisConfig.py.

565 def makeAlgs (self, config) :
566
567 # The setup below is inappropriate for Run 1
568 if config.geometry() is LHCPeriod.Run1:
569 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
570
571 if self.forceFullSimConfigForID:
572 warnings.warn_explicit(
573 "You are running PhotonWorkingPointConfig forcing"
574 " full sim config for ID."
575 " This is only intended to be used for testing purposes.",
576 TestingOnlyWarning, filename='', lineno=0)
577
578 if self.forceFullSimConfigForIso:
579 warnings.warn_explicit(
580 "You are running PhotonWorkingPointConfig forcing"
581 " full sim config for Iso."
582 " This is only intended to be used for testing purposes.",
583 TestingOnlyWarning, filename='', lineno=0)
584
585 postfix = self.postfix
586 if postfix is None :
587 postfix = self.selectionName
588 if postfix != '' and postfix[0] != '_' :
589 postfix = '_' + postfix
590
591 sfList = []
592 # Set up the ID/reco photon efficiency correction algorithm:
593 if config.dataType() is not DataType.Data and self.qualityWP != 'NoID' and not self.noEffSFForID:
594 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
595 'PhotonEfficiencyCorrectionAlgID' )
596 config.addPrivateTool( 'efficiencyCorrectionTool',
597 'CP::AsgPhotonEfficiencyCorrectionTool' )
598 alg.scaleFactorDecoration = 'ph_id_effSF' + postfix + '_%SYS%'
599 if config.dataType() is DataType.FastSim:
600 alg.efficiencyCorrectionTool.ForceDataType = (
601 PATCore.ParticleDataType.Full if self.forceFullSimConfigForID else
602 PATCore.ParticleDataType.Fast)
603 elif config.dataType() is DataType.FullSim:
604 alg.efficiencyCorrectionTool.ForceDataType = \
605 PATCore.ParticleDataType.Full
606 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2026_Run3Consolidated_Recommendation_v1/map0.txt'
607 alg.outOfValidity = 2 #silent
608 alg.outOfValidityDeco = 'ph_id_bad_eff' + postfix
609 alg.photons = config.readName (self.containerName)
610 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
611 if self.saveDetailedSF:
612 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
613 'id_effSF' + postfix, auxType='float')
614 sfList += [alg.scaleFactorDecoration]
615
616 # Set up the ISO photon efficiency correction algorithm:
617 if config.dataType() is not DataType.Data and self.isolationWP != 'NonIso' and not self.noEffSFForIso:
618 alg = config.createAlgorithm( 'CP::PhotonEfficiencyCorrectionAlg',
619 'PhotonEfficiencyCorrectionAlgIsol' )
620 config.addPrivateTool( 'efficiencyCorrectionTool',
621 'CP::AsgPhotonEfficiencyCorrectionTool' )
622 alg.scaleFactorDecoration = 'ph_isol_effSF' + postfix + '_%SYS%'
623 if config.dataType() is DataType.FastSim:
624 alg.efficiencyCorrectionTool.ForceDataType = (
625 PATCore.ParticleDataType.Full if self.forceFullSimConfigForIso else
626 PATCore.ParticleDataType.Fast)
627 elif config.dataType() is DataType.FullSim:
628 alg.efficiencyCorrectionTool.ForceDataType = \
629 PATCore.ParticleDataType.Full
630 alg.efficiencyCorrectionTool.IsoKey = self.isolationWP.replace("FixedCut","")
631 alg.efficiencyCorrectionTool.MapFilePath = 'PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map1.txt'
632 alg.outOfValidity = 2 #silent
633 alg.outOfValidityDeco = 'ph_isol_bad_eff' + postfix
634 alg.photons = config.readName (self.containerName)
635 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
636 if self.saveDetailedSF:
637 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
638 'isol_effSF' + postfix, auxType='float')
639 sfList += [alg.scaleFactorDecoration]
640
641 doCombEffSF = not self.noEffSFForID or not self.noEffSFForIso
642 if config.dataType() is not DataType.Data and doCombEffSF and self.saveCombinedSF:
643 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
644 'PhotonCombinedEfficiencyScaleFactorAlg' )
645 alg.particles = config.readName (self.containerName)
646 alg.inScaleFactors = sfList
647 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
648 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix, auxType='float')
649
650
651@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 612 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 571 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 578 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 642 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 611 of file PhotonAnalysisConfig.py.


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