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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 488 of file PhotonAnalysisConfig.py.

488 def __init__ (self) :
489 super (PhotonWorkingPointEfficiencyConfig, self).__init__ ()
490 self.setBlockName('PhotonWorkingPointEfficiency')
491 self.addDependency('PhotonWorkingPointSelection', required=True)
492 self.addDependency('EventSelection', required=False)
493 self.addDependency('EventSelectionMerger', required=False)
494 self.addOption ('containerName', '', type=str,
495 noneAction='error',
496 info="the name of the input container.",
497 meta={'role':'containerRef'})
498 self.addOption ('selectionName', '', type=str,
499 noneAction='error',
500 info="the name of the photon selection to define (e.g. `tight` or "
501 "`loose`).",
502 meta={'role':'selection'})
503 self.addOption ('postfix', None, type=str,
504 info="a postfix to apply to decorations and algorithm names. "
505 "Typically not needed here as `selectionName` is used internally.")
506 self.addOption ('qualityWP', None, type=str,
507 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`, `NoID`.",
508 expertMode=['NoID'],
509 meta={'choices':(['Tight','Medium','Loose','NoID'],1)})
510 self.addOption ('isolationWP', None, type=str,
511 info="the isolation WP to use. Supported isolation WPs: "
512 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.",
513 meta={'choices':(['FixedCutLoose','FixedCutTight','TightCaloOnly','NonIso'],1)})
514 self.addOption ('noEffSFForID', False, type=bool,
515 info="disables the calculation of ID efficiencies and scale factors. "
516 "Experimental! only useful to test a new WP for which scale "
517 "factors are not available.",
518 expertMode=True)
519 self.addOption ('noEffSFForIso', False, type=bool,
520 info="disables the calculation of isolation efficiencies and scale factors. "
521 "Experimental! only useful to test a new WP for which scale "
522 "factors are not available.",
523 expertMode=True)
524 self.addOption ('saveDetailedSF', True, type=bool,
525 info="save all the independent detailed object scale factors.")
526 self.addOption ('saveCombinedSF', False, type=bool,
527 info="save the combined object scale factor.")
528 self.addOption ('forceFullSimConfigForID', False, type=bool,
529 info="whether to force the ID tool to use the configuration meant "
530 "for full simulation samples. Only for testing purposes.")
531 self.addOption ('forceFullSimConfigForIso', False, type=bool,
532 info="whether to force the isolation tool to use the configuration meant "
533 "for full simulation samples. Only for testing purposes.")
534

Member Function Documentation

◆ instanceName()

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

Definition at line 535 of file PhotonAnalysisConfig.py.

535 def instanceName (self) :
536 """Return the instance name for this block"""
537 if self.postfix is not None :
538 return self.containerName + '_' + self.selectionName + self.postfix
539 return self.containerName + '_' + self.selectionName
540

◆ makeAlgs()

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

Definition at line 541 of file PhotonAnalysisConfig.py.

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

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 547 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 554 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 618 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 587 of file PhotonAnalysisConfig.py.


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