Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | List of all members
python.JetAnalysisConfig.LargeRJetAnalysisConfig Class Reference
Inheritance diagram for python.JetAnalysisConfig.LargeRJetAnalysisConfig:
Collaboration diagram for python.JetAnalysisConfig.LargeRJetAnalysisConfig:

Public Member Functions

def __init__ (self, containerName='', jetCollection='', jetInput='')
 
def getUncertaintyToolSettings (self, config)
 
def createUncertaintyTool (self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
 
def createFFSmearingTool (self, jetFFSmearingAlg, config)
 
def makeAlgs (self, config)
 

Public Attributes

 jetCollection
 
 jetInput
 

Detailed Description

the ConfigBlock for the large-r jet sequence

Definition at line 517 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__ (   self,
  containerName = '',
  jetCollection = '',
  jetInput = '' 
)

Definition at line 520 of file JetAnalysisConfig.py.

520  def __init__ (self, containerName='', jetCollection='', jetInput='') :
521  super (LargeRJetAnalysisConfig, self).__init__ ()
522  self.addOption ('containerName', containerName, type=str,
523  noneAction='error',
524  info="the name of the output container after calibration.")
525  self.addOption ('jetCollection', jetCollection, type=str,
526  noneAction='error',
527  info="the jet container to run on. It is interpreted to determine "
528  "the correct config blocks to call for small- or large-R jets.")
529  # TODO: add info string
530  self.addOption ('jetInput', jetInput, type=str,
531  noneAction='error',
532  info="")
533  # TODO: add info string
534  self.addOption ('largeRMass', "Comb", type=str,
535  info="")
536  self.addOption ('recalibratePhyslite', True, type=bool,
537  info="whether to run the CP::JetCalibrationAlg on PHYSLITE "
538  "derivations. The default is True.")
539  self.addOption ('systematicsModelJER', "Full", type=str)
540  self.addOption ('systematicsModelJMS', "Full", type=str)
541  self.addOption ('systematicsModelJMR', "Full", type=str,
542  info="the NP reduction scheme to use for JMR: Full, Simple. The default is Full.")
543  self.addOption ('runJERsystematicsOnData', False, type=bool,
544  info="whether to run the All/Full JER model variations also on data samples. Expert option!")
545  # Adding these options to override the jet uncertainty config file when we have new recommendations
546  # Calibration tool options
547  self.addOption ('calibToolConfigFile', None, type=str,
548  info="name (str) of the config file to use for the jet calibration "
549  "tool. Expert option to override JetETmiss recommendations. The "
550  "default is None.")
551  self.addOption ('calibToolCalibArea', None, type=str,
552  info="name (str) of the CVMFS area to use for the jet calibration "
553  "tool. Expert option to override JetETmiss recommendations. The "
554  "default is None.")
555  self.addOption ('calibToolCalibSeq', None, type=str,
556  info="name (str) of the sequence to use for the jet calibration "
557  "tool (e.g. 'JetArea_Residual_EtaJES_GSC'). Expert option to override "
558  "JetETmiss recommendations. The default is None.")
559  # Uncertainties tool options
560  self.addOption ('uncertToolConfigPath', None, type=str,
561  info="name (str) of the config file to use for the jet uncertainty "
562  "tool. Expert option to override JetETmiss recommendations. The "
563  "default is None.")
564  self.addOption ('uncertToolCalibArea', None, type=str,
565  info="name (str) of the CVMFS area to use for the jet uncertainty "
566  "tool. Expert option to override JetETmiss recommendations. The "
567  "default is None.")
568  self.addOption ('uncertToolMCType', None, type=str,
569  info="data type (str) to use for the jet uncertainty tool (e.g. "
570  "'AF3' or 'MC16'). Expert option to override JetETmiss "
571  "recommendations. The default is None.")
572  self.addOption ('minPt', 200.*GeV, type=float,
573  info="the minimum pt cut to apply to calibrated large-R jets. "
574  "The default is 200 GeV.")
575  self.addOption ('maxPt', 3000.*GeV, type=float,
576  info="the maximum pt cut to apply to calibrated large-R jets. "
577  "The default is 3000 GeV.")
578  self.addOption ('maxEta', 2., type=float,
579  info="the maximum |eta| cut to apply to calibrated large-R jets. "
580  "The default is 2.")
581  self.addOption ('minMass', 40.*GeV, type=float,
582  info="the minimum mass cut to apply to calibrated large-R jets. "
583  "The default is 40 GeV.")
584  self.addOption ('maxMass', 600.*GeV, type=float,
585  info="the maximum mass cut to apply to calibrated large-R jets. "
586  "The default is 600 GeV.")
587 

Member Function Documentation

◆ createFFSmearingTool()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.createFFSmearingTool (   self,
  jetFFSmearingAlg,
  config 
)

Definition at line 676 of file JetAnalysisConfig.py.

676  def createFFSmearingTool(self, jetFFSmearingAlg, config):
677  # Retrieve appropriate large-R jet mass resolution recommendations for the FFJetSmearingTool.
678 
679  log = logging.getLogger('LargeRJetAnalysisConfig')
680 
681  # Config file:
682  if self.systematicsModelJMR in ["Simple", "Full"]:
683  config_file = f"R10_{self.systematicsModelJMR}JMR.config"
684  else:
685  raise ValueError(
686  f"Invalid request for systematicsModelJMR settings: {self.systematicsModelJMR}"
687  )
688 
689  # Expert override for config path:
690  if self.uncertToolConfigPath is not None:
691  config_file = self.uncertToolConfigPath
692  else:
693  if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
694  config_file = "rel22/Fall2024_PreRec/" + config_file
695  else:
696  log.warning("Uncertainties for UFO jets are not for Run 4!")
697 
698  # MC type:
699  if config.geometry() is LHCPeriod.Run2:
700  if config.dataType() is DataType.FastSim:
701  mc_type = "MC20AF3"
702  else:
703  mc_type = "MC20"
704  elif config.geometry() is LHCPeriod.Run3:
705  mc_type = "MC23"
706 
707  # Set up the FF smearing tool
708  config.addPrivateTool( 'FFSmearingTool', 'CP::FFJetSmearingTool')
709  jetFFSmearingAlg.FFSmearingTool.MassDef = "UFO"
710  jetFFSmearingAlg.FFSmearingTool.MCType = mc_type
711  jetFFSmearingAlg.FFSmearingTool.ConfigFile = config_file
712 

◆ createUncertaintyTool()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.createUncertaintyTool (   self,
  jetUncertaintiesAlg,
  config,
  jetCollectionName,
  doPseudoData = False 
)
Create instance(s) of JetUncertaintiesTool following JetETmiss recommendations.

JER uncertainties under the "Full" scheme must be run on MC samples twice:
1. Normal (MC) mode,
2. Pseudodata (PD) mode, as if the events are Data.

Definition at line 638 of file JetAnalysisConfig.py.

638  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
639  '''
640  Create instance(s) of JetUncertaintiesTool following JetETmiss recommendations.
641 
642  JER uncertainties under the "Full" scheme must be run on MC samples twice:
643  1. Normal (MC) mode,
644  2. Pseudodata (PD) mode, as if the events are Data.
645  '''
646 
647  # Retrieve the common configuration settings
648  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
649 
650  # The main tool for all JER combinations
651  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
652  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
653  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
654  if calibArea is not None:
655  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
656  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
657  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
658  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
659 
660  # JER smearing on data
661  if config.dataType() is DataType.Data and not (config.isPhyslite() and doPseudoData and self.runJERsystematicsOnData):
662  # we don't want any systematics on data if we're not using the right JER model!
663  jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
664 
665  if config.dataType() is not (DataType.Data and config.isPhyslite()) and doPseudoData and not self.runJERsystematicsOnData:
666  # The secondary tool for pseudo-data JER smearing
667  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
668  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
669  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
670  if calibArea is not None:
671  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
672  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
673  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
674  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
675 

◆ getUncertaintyToolSettings()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.getUncertaintyToolSettings (   self,
  config 
)

Definition at line 588 of file JetAnalysisConfig.py.

588  def getUncertaintyToolSettings(self, config):
589  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
590  # We do this separately from the tool declaration, as we may need to set uo
591  # two such tools, but they have to be private.
592 
593  log = logging.getLogger('LargeRJetAnalysisConfig')
594 
595  # Config file:
596  config_file = None
597  if self.systematicsModelJER in ["Simple", "Full"] and self.systematicsModelJMS in ["Simple", "Full"]:
598  config_file = "R10_CategoryJES_{0}JER_{1}JMS.config".format(self.systematicsModelJER, self.systematicsModelJMS)
599  else:
600  raise ValueError(
601  "Invalid request for systematicsModelJER/JMS settings: "
602  "systematicsModelJER = '{0}', "
603  "systematicsModelJMS = '{1}'".format(self.systematicsModelJER, self.systematicsModelJMS) )
604  if self.uncertToolConfigPath is not None:
605  # Expert override
606  config_file = self.uncertToolConfigPath
607  else:
608  if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
609  config_file = "rel22/Winter2024_PreRec/" + config_file
610  else:
611  log.warning("Uncertainties for UFO jets are not for Run 4!")
612 
613  # Calibration area:
614  calib_area = None
615  if self.uncertToolCalibArea is not None:
616  calib_area = self.uncertToolCalibArea
617 
618  # MC type:
619  if self.uncertToolMCType is not None:
620  mc_type = self.uncertToolMCType
621  else:
622  if config.dataType() is DataType.FastSim:
623  # To be updated when FastSim recommendatiosn are released
624  log.warning("AF3 uncertainties for large-R jets are not yet released!")
625  log.warning("Using full-sim ones in the meantime!")
626  if config.geometry() is LHCPeriod.Run2:
627  mc_type = "MC20"
628  else:
629  mc_type = "MC23"
630  else:
631  if config.geometry() is LHCPeriod.Run2:
632  mc_type = "MC20"
633  else:
634  mc_type = "MC23"
635 
636  return config_file, calib_area, mc_type
637 

◆ makeAlgs()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.makeAlgs (   self,
  config 
)

Definition at line 713 of file JetAnalysisConfig.py.

713  def makeAlgs (self, config) :
714 
715  configFile = None
716  calibSeq = None
717  calibArea = None
718 
719  jetCollectionName=self.jetCollection
720  if(self.jetCollection=="AnalysisJets") :
721  jetCollectionName="AntiKt4EMPFlowJets"
722  if(self.jetCollection=="AnalysisLargeRJets") :
723  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
724 
725  if self.largeRMass not in ["Comb", "Calo", "TA"]:
726  raise ValueError("Invalid large-R mass defintion {0}!".format(self.largeRMass) )
727 
728  if self.jetInput not in ["LCTopo", "TrackCaloCluster", "UFO"]:
729  raise ValueError("Invalid input type '{0}' for large-R jets!".format(self.jetInput) )
730 
731  if self.jetInput == "TrackCaloCluster":
732  # Only one mass defintion supported
733  if self.largeRMass != "Calo":
734  raise ValueError("Invalid large-R TCC jet mass '{0}'!".format(self.largeRMass) )
735  configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"
736  if self.jetInput == "LCTopo":
737  configFile = _largeLCTopoConfigFile(config, self)
738  if self.jetInput == "UFO":
739  configFile = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_02Aug2024.config"
740  if self.calibToolConfigFile is not None:
741  configFile = self.calibToolConfigFile
742 
743  if self.jetInput == "TrackCaloCluster" or self.jetInput == "UFO" or config.dataType() is DataType.FullSim:
744  calibSeq = "EtaJES_JMS"
745  elif config.dataType() is DataType.Data:
746  calibSeq = "EtaJES_JMS_Insitu"
747  if self.calibToolCalibSeq is not None:
748  calibSeq = self.calibToolCalibSeq
749 
750  if self.calibToolCalibArea is not None:
751  calibArea = self.calibToolCalibArea
752 
753  if not config.isPhyslite() or self.recalibratePhyslite:
754  # Prepare the jet calibration algorithm
755  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+self.containerName )
756  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
757 
758  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
759 
760  if configFile is None:
761  raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
762  alg.calibrationTool.ConfigFile = configFile
763 
764  if calibSeq is None:
765  raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
766  alg.calibrationTool.CalibSequence = calibSeq
767 
768  if calibArea is not None:
769  alg.calibrationTool.CalibArea = calibArea
770 
771  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
772  alg.jets = config.readName(self.containerName)
773 
774  # Jet uncertainties
775  if self.jetInput == "UFO" and config.dataType() in [DataType.FullSim, DataType.FastSim]:
776  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+self.containerName )
777  self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
778 
779  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
780 
781  # R=1.0 jets have a validity range
782  alg.outOfValidity = 2 # SILENT
783  alg.outOfValidityDeco = 'outOfValidity'
784 
785  alg.jets = config.readName (self.containerName)
786  alg.jetsOut = config.copyName (self.containerName)
787  alg.preselection = config.getPreselection (self.containerName, '')
788 
789  if self.jetInput != "UFO":
790  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+self.containerName )
791 
792  # R=1.0 jets have a validity range
793  alg.outOfValidity = 2 # SILENT
794  alg.outOfValidityDeco = 'outOfValidity'
795  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
796 
797  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
798  alg.uncertaintiesTool.ConfigFile = \
799  "rel21/Moriond2018/R10_{0}Mass_all.config".format(self.largeRMass)
800  alg.uncertaintiesTool.MCType = "MC16a"
801  alg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
802 
803  alg.jets = config.readName (self.containerName)
804  alg.jetsOut = config.copyName (self.containerName)
805  alg.preselection = config.getPreselection (self.containerName, '')
806  config.addSelection (self.containerName, '', 'outOfValidity')
807 
808  if self.jetInput == "UFO" and config.dataType() is not DataType.Data:
809  # set up the FF smearing algorithm
810  alg = config.createAlgorithm( 'CP::JetFFSmearingAlg', 'JetFFSmearingAlg'+self.containerName )
811  self.createFFSmearingTool(alg, config)
812  alg.outOfValidity = 2 # SILENT
813  alg.outOfValidityDeco = 'outOfValidityJMR'
814  alg.jets = config.readName (self.containerName)
815  alg.jetsOut = config.copyName (self.containerName)
816  alg.preselection = config.getPreselection (self.containerName, '')
817 
818  if self.minPt > 0 or self.maxPt > 0 or self.maxEta > 0:
819  # Set up the the pt-eta selection
820  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetPtEtaCutAlg'+self.containerName )
821  alg.selectionDecoration = 'selectPtEta,as_bits'
822  config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
823  alg.selectionTool.minPt = self.minPt
824  alg.selectionTool.maxPt = self.maxPt
825  alg.selectionTool.maxEta = self.maxEta
826  alg.particles = config.readName (self.containerName)
827  alg.preselection = config.getPreselection (self.containerName, '')
828  config.addSelection (self.containerName, '', alg.selectionDecoration,
829  preselection=True)
830 
831  if self.minMass > 0 or self.maxMass > 0:
832  # Set up the the mass selection
833  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetMassCutAlg'+self.containerName )
834  alg.selectionDecoration = 'selectMass,as_bits'
835  config.addPrivateTool( 'selectionTool', 'CP::AsgMassSelectionTool' )
836  alg.selectionTool.minM = self.minMass
837  alg.selectionTool.maxM = self.maxMass
838  alg.particles = config.readName (self.containerName)
839  alg.preselection = config.getPreselection (self.containerName, '')
840  config.addSelection (self.containerName, '', alg.selectionDecoration,
841  preselection=True)
842 
843  config.addOutputVar (self.containerName, 'm', 'm')
844 
845 # These algorithms set up the jet recommendations as-of 04/02/2019.
846 # Jet calibration recommendations
847 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21
848 # Jet uncertainties recommendations
849 # Small-R
850 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR
851 # Large-R
852 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertaintiesRel21Moriond2018LargeR
853 # JVT recommendations
854 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibrationRel21
855 
856 @groupBlocks

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetCollection

Definition at line 720 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetInput

Definition at line 731 of file JetAnalysisConfig.py.


The documentation for this class was generated from the following file:
python.JetAnalysisConfig._largeLCTopoConfigFile
def _largeLCTopoConfigFile(config, self)
Definition: JetAnalysisConfig.py:497
vtune_athena.format
format
Definition: vtune_athena.py:14
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567