ATLAS Offline Software
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)
 
def instanceName (self)
 
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 534 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__ (   self)

Definition at line 537 of file JetAnalysisConfig.py.

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

Member Function Documentation

◆ createFFSmearingTool()

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

Definition at line 701 of file JetAnalysisConfig.py.

701  def createFFSmearingTool(self, jetFFSmearingAlg, config):
702  # Retrieve appropriate large-R jet mass resolution recommendations for the FFJetSmearingTool.
703 
704  log = logging.getLogger('LargeRJetAnalysisConfig')
705 
706  # Config file:
707  if self.systematicsModelJMR in ["Simple", "Full"]:
708  config_file = f"R10_{self.systematicsModelJMR}JMR.config"
709  else:
710  raise ValueError(
711  f"Invalid request for systematicsModelJMR settings: {self.systematicsModelJMR}"
712  )
713 
714  # Expert override for config path:
715  if self.uncertToolConfigPathJMR is not None:
716  config_file = self.uncertToolConfigPathJMR
717  else:
718  if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
719  config_file = "rel22/Summer2025_PreRec/" + config_file
720  else:
721  log.warning("Uncertainties for UFO jets are not for Run 4!")
722 
723  # MC type:
724  if config.geometry() is LHCPeriod.Run2:
725  if config.dataType() is DataType.FastSim:
726  mc_type = "MC20AF3"
727  else:
728  mc_type = "MC20"
729  elif config.geometry() is LHCPeriod.Run3:
730  if config.dataType() is DataType.FastSim:
731  mc_type = "MC23AF3"
732  else:
733  mc_type = "MC23"
734 
735  # Set up the FF smearing tool
736  config.addPrivateTool( 'FFSmearingTool', 'CP::FFJetSmearingTool')
737  jetFFSmearingAlg.FFSmearingTool.MassDef = "UFO"
738  jetFFSmearingAlg.FFSmearingTool.MCType = mc_type
739  jetFFSmearingAlg.FFSmearingTool.ConfigFile = config_file
740 

◆ 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 663 of file JetAnalysisConfig.py.

663  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
664  '''
665  Create instance(s) of JetUncertaintiesTool following JetETmiss recommendations.
666 
667  JER uncertainties under the "Full" scheme must be run on MC samples twice:
668  1. Normal (MC) mode,
669  2. Pseudodata (PD) mode, as if the events are Data.
670  '''
671 
672  # Retrieve the common configuration settings
673  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
674 
675  # The main tool for all JER combinations
676  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
677  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
678  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
679  if calibArea is not None:
680  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
681  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
682  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
683  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
684 
685  # JER smearing on data
686  if config.dataType() is DataType.Data and not (config.isPhyslite() and doPseudoData and self.runJERsystematicsOnData):
687  # we don't want any systematics on data if we're not using the right JER model!
688  jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
689 
690  if config.dataType() is not (DataType.Data and config.isPhyslite()) and doPseudoData and not self.runJERsystematicsOnData:
691  # The secondary tool for pseudo-data JER smearing
692  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
693  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
694  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
695  if calibArea is not None:
696  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
697  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
698  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
699  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
700 

◆ getUncertaintyToolSettings()

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

Definition at line 616 of file JetAnalysisConfig.py.

616  def getUncertaintyToolSettings(self, config):
617  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
618  # We do this separately from the tool declaration, as we may need to set uo
619  # two such tools, but they have to be private.
620 
621  log = logging.getLogger('LargeRJetAnalysisConfig')
622 
623  # Config file:
624  config_file = None
625  if self.systematicsModelJER in ["Simple", "Full"] and self.systematicsModelJMS in ["Simple", "Full"]:
626  config_file = "R10_CategoryJES_{0}JER_{1}JMS.config".format(self.systematicsModelJER, self.systematicsModelJMS)
627  else:
628  raise ValueError(
629  "Invalid request for systematicsModelJER/JMS settings: "
630  "systematicsModelJER = '{0}', "
631  "systematicsModelJMS = '{1}'".format(self.systematicsModelJER, self.systematicsModelJMS) )
632  if self.uncertToolConfigPath is not None:
633  # Expert override
634  config_file = self.uncertToolConfigPath
635  else:
636  if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
637  config_file = "rel22/Summer2025_PreRec/" + config_file
638  else:
639  log.warning("Uncertainties for UFO jets are not for Run 4!")
640 
641  # Calibration area:
642  calib_area = None
643  if self.uncertToolCalibArea is not None:
644  calib_area = self.uncertToolCalibArea
645 
646  # MC type:
647  if self.uncertToolMCType is not None:
648  mc_type = self.uncertToolMCType
649  else:
650  if config.dataType() is DataType.FastSim:
651  if config.geometry() is LHCPeriod.Run2:
652  mc_type = "MC20AF3"
653  else:
654  mc_type = "MC23AF3"
655  else:
656  if config.geometry() is LHCPeriod.Run2:
657  mc_type = "MC20"
658  else:
659  mc_type = "MC23"
660 
661  return config_file, calib_area, mc_type
662 

◆ instanceName()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.instanceName (   self)
Return the instance name for this block

Definition at line 612 of file JetAnalysisConfig.py.

612  def instanceName (self) :
613  """Return the instance name for this block"""
614  return self.containerName
615 

◆ makeAlgs()

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

Definition at line 741 of file JetAnalysisConfig.py.

741  def makeAlgs (self, config) :
742 
743  configFile = None
744  calibSeq = None
745  calibArea = None
746 
747  jetCollectionName=self.jetCollection
748  if(self.jetCollection=="AnalysisJets") :
749  jetCollectionName="AntiKt4EMPFlowJets"
750  if(self.jetCollection=="AnalysisLargeRJets") :
751  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
752 
753  if self.largeRMass not in ["Comb", "Calo", "TA"]:
754  raise ValueError("Invalid large-R mass defintion {0}!".format(self.largeRMass) )
755 
756  if self.jetInput not in ["LCTopo", "TrackCaloCluster", "UFO"]:
757  raise ValueError("Invalid input type '{0}' for large-R jets!".format(self.jetInput) )
758 
759  if self.jetInput == "TrackCaloCluster":
760  # Only one mass defintion supported
761  if self.largeRMass != "Calo":
762  raise ValueError("Invalid large-R TCC jet mass '{0}'!".format(self.largeRMass) )
763  configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"
764  if self.jetInput == "LCTopo":
765  configFile = _largeLCTopoConfigFile(config, self)
766  if self.jetInput == "UFO":
767  configFile = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_26Nov2024.config"
768  calibArea = "00-04-83"
769  if self.calibToolConfigFile is not None:
770  configFile = self.calibToolConfigFile
771 
772  if self.jetInput == "TrackCaloCluster" or self.jetInput == "UFO" or config.dataType() is DataType.FullSim:
773  calibSeq = "EtaJES_JMS"
774  elif config.dataType() is DataType.Data:
775  calibSeq = "EtaJES_JMS_Insitu"
776  if self.calibToolCalibSeq is not None:
777  calibSeq = self.calibToolCalibSeq
778 
779  if self.calibToolCalibArea is not None:
780  calibArea = self.calibToolCalibArea
781 
782  if not config.isPhyslite() or self.recalibratePhyslite:
783  # Prepare the jet calibration algorithm
784  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
785  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
786 
787  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
788 
789  if configFile is None:
790  raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
791  alg.calibrationTool.ConfigFile = configFile
792 
793  if calibSeq is None:
794  raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
795  alg.calibrationTool.CalibSequence = calibSeq
796 
797  if calibArea is not None:
798  alg.calibrationTool.CalibArea = calibArea
799 
800  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
801  alg.jets = config.readName(self.containerName)
802 
803  # Jet uncertainties
804  if self.jetInput == "UFO" and config.dataType() in [DataType.FullSim, DataType.FastSim]:
805  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg' )
806  self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
807 
808  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
809 
810  # R=1.0 jets have a validity range
811  alg.outOfValidity = 2 # SILENT
812  alg.outOfValidityDeco = 'outOfValidity'
813 
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.jetInput != "UFO":
819  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg' )
820 
821  # R=1.0 jets have a validity range
822  alg.outOfValidity = 2 # SILENT
823  alg.outOfValidityDeco = 'outOfValidity'
824  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
825 
826  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
827  alg.uncertaintiesTool.ConfigFile = \
828  "rel21/Moriond2018/R10_{0}Mass_all.config".format(self.largeRMass)
829  alg.uncertaintiesTool.MCType = "MC16a"
830  alg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
831 
832  alg.jets = config.readName (self.containerName)
833  alg.jetsOut = config.copyName (self.containerName)
834  alg.preselection = config.getPreselection (self.containerName, '')
835  config.addSelection (self.containerName, '', 'outOfValidity')
836 
837  if self.jetInput == "UFO" and config.dataType() is not DataType.Data:
838  # set up the FF smearing algorithm
839  alg = config.createAlgorithm( 'CP::JetFFSmearingAlg', 'JetFFSmearingAlg' )
840  self.createFFSmearingTool(alg, config)
841  alg.outOfValidity = 2 # SILENT
842  alg.outOfValidityDeco = 'outOfValidityJMR'
843  alg.jets = config.readName (self.containerName)
844  alg.jetsOut = config.copyName (self.containerName)
845  alg.preselection = config.getPreselection (self.containerName, '')
846 
847  if self.minPt > 0 or self.maxPt > 0 or self.maxEta > 0 or self.maxRapidity > 0:
848  # Set up the the pt-eta selection
849  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetPtEtaCutAlg' )
850  alg.selectionDecoration = 'selectPtEta,as_bits'
851  config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
852  alg.selectionTool.minPt = self.minPt
853  alg.selectionTool.maxPt = self.maxPt
854  alg.selectionTool.maxEta = self.maxEta
855  alg.selectionTool.maxRapidity = self.maxRapidity
856  alg.particles = config.readName (self.containerName)
857  alg.preselection = config.getPreselection (self.containerName, '')
858  config.addSelection (self.containerName, '', alg.selectionDecoration,
859  preselection=True)
860 
861  if self.minMass > 0 or self.maxMass > 0:
862  # Set up the the mass selection
863  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetMassCutAlg' )
864  alg.selectionDecoration = 'selectMass,as_bits'
865  config.addPrivateTool( 'selectionTool', 'CP::AsgMassSelectionTool' )
866  alg.selectionTool.minM = self.minMass
867  alg.selectionTool.maxM = self.maxMass
868  alg.particles = config.readName (self.containerName)
869  alg.preselection = config.getPreselection (self.containerName, '')
870  config.addSelection (self.containerName, '', alg.selectionDecoration,
871  preselection=True)
872 
873  config.addOutputVar (self.containerName, 'm', 'm')
874 
875 # These algorithms set up the jet recommendations as-of 04/02/2019.
876 # Jet calibration recommendations
877 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21
878 # Jet uncertainties recommendations
879 # Small-R
880 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR
881 # Large-R
882 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertaintiesRel21Moriond2018LargeR
883 # JVT recommendations
884 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibrationRel21
885 
886 @groupBlocks

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetCollection

Definition at line 748 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetInput

Definition at line 759 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:514
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