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, containerName='', jetCollection='', jetInput='')
 
def getUncertaintyToolSettings (self, config)
 
def createUncertaintyTool (self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
 
def makeAlgs (self, config)
 

Public Attributes

 jetCollection
 
 jetInput
 

Detailed Description

the ConfigBlock for the large-r jet sequence

Definition at line 502 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 505 of file JetAnalysisConfig.py.

505  def __init__ (self, containerName='', jetCollection='', jetInput='') :
506  super (LargeRJetAnalysisConfig, self).__init__ ()
507  self.addOption ('containerName', containerName, type=str,
508  noneAction='error',
509  info="the name of the output container after calibration.")
510  self.addOption ('jetCollection', jetCollection, type=str,
511  noneAction='error',
512  info="the jet container to run on. It is interpreted to determine "
513  "the correct config blocks to call for small- or large-R jets.")
514  # TODO: add info string
515  self.addOption ('jetInput', jetInput, type=str,
516  noneAction='error',
517  info="")
518  # TODO: add info string
519  self.addOption ('largeRMass', "Comb", type=str,
520  info="")
521  self.addOption ('recalibratePhyslite', True, type=bool,
522  info="whether to run the CP::JetCalibrationAlg on PHYSLITE "
523  "derivations. The default is True.")
524  # TODO: add info string
525  self.addOption ('configFileOverride', None, type=str,
526  info="")
527  self.addOption ('systematicsModelJER', "Full", type=str) # this is the test for JER
528  self.addOption ('runJERsystematicsOnData', False, type=bool,
529  info="whether to run the All/Full JER model variations also on data samples. Expert option!")
530  # Adding these options to override the jet uncertainty config file when we have new recommendations
531  # Calibration tool options
532  self.addOption ('calibToolConfigFile', None, type=str,
533  info="name (str) of the config file to use for the jet calibration "
534  "tool. Expert option to override JetETmiss recommendations. The "
535  "default is None.")
536  self.addOption ('calibToolCalibArea', None, type=str,
537  info="name (str) of the CVMFS area to use for the jet calibration "
538  "tool. Expert option to override JetETmiss recommendations. The "
539  "default is None.")
540  self.addOption ('calibToolCalibSeq', None, type=str,
541  info="name (str) of the sequence to use for the jet calibration "
542  "tool (e.g. 'JetArea_Residual_EtaJES_GSC'). Expert option to override "
543  "JetETmiss recommendations. The default is None.")
544  # Uncertainties tool options
545  self.addOption ('uncertToolConfigPath', None, type=str,
546  info="name (str) of the config file to use for the jet uncertainty "
547  "tool. Expert option to override JetETmiss recommendations. The "
548  "default is None.")
549  self.addOption ('uncertToolCalibArea', None, type=str,
550  info="name (str) of the CVMFS area to use for the jet uncertainty "
551  "tool. Expert option to override JetETmiss recommendations. The "
552  "default is None.")
553  self.addOption ('uncertToolMCType', None, type=str,
554  info="data type (str) to use for the jet uncertainty tool (e.g. "
555  "'AF3' or 'MC16'). Expert option to override JetETmiss "
556  "recommendations. The default is None.")
557 

Member Function Documentation

◆ createUncertaintyTool()

def python.JetAnalysisConfig.LargeRJetAnalysisConfig.createUncertaintyTool (   self,
  jetUncertaintiesAlg,
  config,
  jetCollectionName,
  doPseudoData = False 
)

Definition at line 602 of file JetAnalysisConfig.py.

602  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
603 
604  # Create an instance of JetUncertaintiesTool, following JetETmiss recommendations.
605  # To run Jet Energy Resolution (JER) uncertainties in the "Full" or "All" schemes,
606  # we need two sets of tools: one configured as normal (MC), the other with the
607  # exact same settings but pretending to run on data (pseudo-data).
608  # This is achieved by passing "isPseudoData=True" to the arguments.
609 
610  # Retrieve the common configuration settings
611  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
612 
613  # The main tool for all JER combinations
614  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
615  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
616  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
617  if calibArea is not None:
618  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
619  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
620  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
621  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
622 
623  # JER smearing on data
624  if config.dataType() is DataType.Data and not (config.isPhyslite() and doPseudoData and self.runJERsystematicsOnData):
625  # we don't want any systematics on data if we're not using the right JER model!
626  jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
627 
628  if config.dataType() is not (DataType.Data and config.isPhyslite()) and doPseudoData and not self.runJERsystematicsOnData:
629  # The secondary tool for pseudo-data JER smearing
630  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
631  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
632  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
633  if calibArea is not None:
634  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
635  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
636  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
637  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
638 

◆ getUncertaintyToolSettings()

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

Definition at line 558 of file JetAnalysisConfig.py.

558  def getUncertaintyToolSettings(self, config):
559  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
560  # We do this separately from the tool declaration, as we may need to set uo
561  # two such tools, but they have to be private.
562 
563  # Config file:
564  config_file = None
565  if self.systematicsModelJER in ["Simple", "Full"]:
566  config_file = "R10_CategoryJES_{0}JER_FullJMS.config".format(self.systematicsModelJER)
567  else:
568  raise ValueError(
569  "Invalid request for systematicsModelJER settings: "
570  "systematicsModelJER: {0}".format(self.systematicsModelJER) )
571 
572  # Calibration area:
573  calib_area = None
574  if self.uncertToolCalibArea is not None:
575  calib_area = self.uncertToolCalibArea
576 
577  # Expert override for config path:
578  if self.uncertToolConfigPath is not None:
579  config_file = self.uncertToolConfigPath
580  else:
581  if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
582  config_file = "rel22/Winter2024_PreRec/" + config_file
583  else:
584  log = logging.getLogger('LargeRJetAnalysisConfig')
585  log.warning("Uncertainties for UFO jets are not for Run 4!")
586 
587  # MC type:
588  if self.uncertToolMCType is not None:
589  mc_type = self.uncertToolMCType
590  else:
591  if config.dataType() is DataType.FastSim and config.geometry() is LHCPeriod.Run2:
592  # not supported for Run 3 yet!
593  mc_type = "AF3"
594  else:
595  if config.geometry() is LHCPeriod.Run2:
596  mc_type = "MC20"
597  else:
598  mc_type = "MC23"
599 
600  return config_file, calib_area, mc_type
601 

◆ makeAlgs()

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

Definition at line 639 of file JetAnalysisConfig.py.

639  def makeAlgs (self, config) :
640 
641  log = logging.getLogger('LargeRJetAnalysisConfig')
642 
643  configFile = None
644 
645  jetCollectionName=self.jetCollection
646  if(self.jetCollection=="AnalysisJets") :
647  jetCollectionName="AntiKt4EMPFlowJets"
648  if(self.jetCollection=="AnalysisLargeRJets") :
649  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
650 
651  if self.largeRMass not in ["Comb", "Calo", "TA"]:
652  raise ValueError ("Invalid large-R mass defintion {0}!".format(self.largeRMass) )
653 
654  if self.jetInput not in ["LCTopo", "TrackCaloCluster", "UFO"]:
655  raise ValueError (
656  "Unsupported input type '{0}' for large-R jets!".format(self.jetInput) )
657 
658  if self.jetInput == "TrackCaloCluster":
659  # Only one mass defintion supported
660  if self.largeRMass != "Calo":
661  raise ValueError(
662  "Unsupported large-R TCC jet mass '{0}'!".format(self.largeRMass) )
663  configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"
664 
665  if self.jetInput == "LCTopo":
666  configFile = _largeLCTopoConfigFile(config, self)
667 
668  if self.jetInput == "UFO":
669  configFile = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_02Aug2024.config"
670 
671  if not config.isPhyslite() or self.recalibratePhyslite:
672  # Prepare the jet calibration algorithm
673  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg'+self.containerName )
674  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
675  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
676  if self.configFileOverride is not None:
677  configFile = self.configFileOverride
678  if configFile is None:
679  raise ValueError(
680  f'Unsupported: {self.jetInput=}, {config.dataType()=}')
681  alg.calibrationTool.ConfigFile = configFile
682  if self.jetInput == "TrackCaloCluster" or self.jetInput == "UFO" or config.dataType() is DataType.FullSim:
683  alg.calibrationTool.CalibSequence = "EtaJES_JMS"
684  elif config.dataType() is DataType.Data:
685  alg.calibrationTool.CalibSequence = "EtaJES_JMS_Insitu"
686  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
687  alg.jets = config.readName (self.containerName)
688 
689  # Jet uncertainties
690  if self.jetInput == "UFO" and config.dataType() is (DataType.FullSim or DataType.FastSim):
691  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+self.containerName )
692  self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
693  # R=1.0 jets have a validity range
694  alg.outOfValidity = 2 # SILENT
695  alg.outOfValidityDeco = 'outOfValidity'
696  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
697  alg.uncertaintiesTool.ConfigFile = (
698  "rel22/Winter2024_PreRec/R10_CategoryJES_FullJER_FullJMS.config"
699  )
700 
701  log.warning("Uncertainties for UFO jets are test only! This {0} is not for physics analysis! ".format(alg.uncertaintiesTool.ConfigFile))
702  if config.dataType() is DataType.FastSim:
703  log.warning("You are applying UFO FS uncertainty on AF3! This {0} is only for test purpose and not for physics analysis! ".format(alg.uncertaintiesTool.ConfigFile))
704 
705  alg.uncertaintiesTool.MCType = "MC20"
706  alg.uncertaintiesTool.IsData = config.dataType() is DataType.Data
707 
708  alg.jets = config.readName (self.containerName)
709  alg.jetsOut = config.copyName (self.containerName)
710  alg.preselection = config.getPreselection (self.containerName, '')
711 
712  if self.jetInput != "UFO":
713  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg'+self.containerName )
714  # R=1.0 jets have a validity range
715  alg.outOfValidity = 2 # SILENT
716  alg.outOfValidityDeco = 'outOfValidity'
717  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
718 
719  alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
720  alg.uncertaintiesTool.ConfigFile = \
721  "rel21/Moriond2018/R10_{0}Mass_all.config".format(self.largeRMass)
722  alg.uncertaintiesTool.MCType = "MC16a"
723  alg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
724 
725  alg.jets = config.readName (self.containerName)
726  alg.jetsOut = config.copyName (self.containerName)
727  alg.preselection = config.getPreselection (self.containerName, '')
728  config.addSelection (self.containerName, '', 'outOfValidity')
729 
730  config.addOutputVar (self.containerName, 'm', 'm')
731 
732 # These algorithms set up the jet recommendations as-of 04/02/2019.
733 # Jet calibration recommendations
734 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21
735 # Jet uncertainties recommendations
736 # Small-R
737 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR
738 # Large-R
739 # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertaintiesRel21Moriond2018LargeR
740 # JVT recommendations
741 # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibrationRel21
742 
743 @groupBlocks

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetCollection

Definition at line 646 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetInput

Definition at line 658 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:482
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