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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 457 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 499 of file PhotonAnalysisConfig.py.

499 def instanceName (self) :
500 """Return the instance name for this block"""
501 if self.postfix is not None :
502 return self.containerName + '_' + self.selectionName + self.postfix
503 return self.containerName + '_' + self.selectionName
504

◆ makeAlgs()

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

Definition at line 505 of file PhotonAnalysisConfig.py.

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

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 511 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 518 of file PhotonAnalysisConfig.py.

◆ noEffSFForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.noEffSFForID

Definition at line 533 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 584 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 552 of file PhotonAnalysisConfig.py.


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