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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 449 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 491 of file PhotonAnalysisConfig.py.

491 def instanceName (self) :
492 """Return the instance name for this block"""
493 if self.postfix is not None :
494 return self.containerName + '_' + self.selectionName + self.postfix
495 return self.containerName + '_' + self.selectionName
496

◆ makeAlgs()

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

Definition at line 497 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.containerName

Definition at line 541 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForID

Definition at line 505 of file PhotonAnalysisConfig.py.

◆ forceFullSimConfigForIso

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.forceFullSimConfigForIso

Definition at line 509 of file PhotonAnalysisConfig.py.

◆ noEffSFForID

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.noEffSFForID

Definition at line 521 of file PhotonAnalysisConfig.py.

◆ saveCombinedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 572 of file PhotonAnalysisConfig.py.

◆ saveDetailedSF

python.PhotonAnalysisConfig.PhotonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 540 of file PhotonAnalysisConfig.py.


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