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

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__ (   self)

Definition at line 536 of file JetAnalysisConfig.py.

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

Member Function Documentation

◆ createFFSmearingTool()

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

Definition at line 700 of file JetAnalysisConfig.py.

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

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

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

◆ getUncertaintyToolSettings()

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

Definition at line 615 of file JetAnalysisConfig.py.

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

◆ instanceName()

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

Definition at line 611 of file JetAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 740 of file JetAnalysisConfig.py.

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

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetCollection

Definition at line 747 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetInput

Definition at line 758 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:513
vtune_athena.format
format
Definition: vtune_athena.py:14
python.processes.powheg.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.py:18
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567