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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 480 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 526 of file PhotonAnalysisConfig.py.

526 def instanceName (self) :
527 """Return the instance name for this block"""
528 if self.postfix is not None :
529 return self.containerName + '_' + self.selectionName + self.postfix
530 return self.containerName + '_' + self.selectionName
531

◆ makeAlgs()

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

Definition at line 532 of file PhotonAnalysisConfig.py.

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

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 538 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 545 of file PhotonAnalysisConfig.py.

◆ noEffSFForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.noEffSFForID

Definition at line 560 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 609 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 578 of file PhotonAnalysisConfig.py.


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