ATLAS Offline Software
JetAnalysisConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 
4 from __future__ import print_function
5 
6 # AnaAlgorithm import(s):
7 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
8 from AnalysisAlgorithmsConfig.ConfigSequence import groupBlocks
9 from AnalysisAlgorithmsConfig.ConfigAccumulator import DataType
10 from AthenaCommon.SystemOfUnits import GeV
11 from AthenaConfiguration.Enums import LHCPeriod
12 from AthenaCommon.Logging import logging
13 import re
14 
15 
16 class PreJetAnalysisConfig (ConfigBlock) :
17  """the ConfigBlock for the common preprocessing of jet sequences"""
18 
19  def __init__ (self) :
20  super (PreJetAnalysisConfig, self).__init__ ()
21  self.addOption ('containerName', '', type=str,
22  noneAction='error',
23  info="the name of the output container after calibration.")
24  self.addOption ('jetCollection', '', type=str,
25  noneAction='error',
26  info="the jet container to run on. It is interpreted to determine "
27  "the correct config blocks to call for small- or large-R jets.")
28  self.addOption('outputTruthLabelIDs', False, type=bool,
29  info='Enable or disable HadronConeExclTruthLabelID and PartonTruthLabelID decorations')
30  # TODO: add info string
31  self.addOption ('runOriginalObjectLink', False, type=bool,
32  info="")
33  self.addOption ('runGhostMuonAssociation', None, type=bool,
34  info="whether to set up the jet-ghost-muon association algorithm "
35  "CP::JetGhostMuonAssociationAlg. The default is True for non-PHYSLITE and False for PHYSLITE.")
36  self.addOption ('runTruthJetTagging', None, type=bool,
37  info="whether to set up the jet truth tagging algorithm "
38  "CP::JetTruthTagAlg. The default is True.")
39 
40  def instanceName (self) :
41  """Return the instance name for this block"""
42  return self.containerName
43 
44  def makeAlgs (self, config) :
45 
46 
47  if config.isPhyslite() and self.jetCollection == 'AntiKt4EMPFlowJets' :
48  config.setSourceName (self.containerName, "AnalysisJets", originalName = self.jetCollection)
49  elif config.isPhyslite() and self.jetCollection == 'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets' :
50  config.setSourceName (self.containerName, "AnalysisLargeRJets", originalName = self.jetCollection)
51  else :
52  config.setSourceName (self.containerName, self.jetCollection, originalName = self.jetCollection)
53 
54  # Relink original jets in case of b-tagging calibration
55  if self.runOriginalObjectLink :
56  alg = config.createAlgorithm( 'CP::AsgOriginalObjectLinkAlg',
57  'JetOriginalObjectLinkAlg',
58  reentrant=True )
59  alg.baseContainerName = self.jetCollection
60  alg.particles = config.readName (self.containerName)
61  if config.wantCopy (self.containerName) :
62  alg.particlesOut = config.copyName (self.containerName)
63  alg.preselection = config.getPreselection (self.containerName, '')
64 
65  # Set up the jet ghost muon association algorithm:
66  if (self.runGhostMuonAssociation is None and not config.isPhyslite()) or \
67  (self.runGhostMuonAssociation is True):
68  alg = config.createAlgorithm( 'CP::JetGhostMuonAssociationAlg',
69  'JetGhostMuonAssociationAlg' )
70  alg.jets = config.readName (self.containerName)
71  if config.isPhyslite():
72  alg.muons = "AnalysisMuons"
73  if config.wantCopy (self.containerName) :
74  alg.jetsOut = config.copyName (self.containerName)
75 
76  # NB: I'm assuming that the truth tagging is done in PHYSLITE, if not this will
77  # need to change
78  if self.runTruthJetTagging or (
79  self.runTruthJetTagging is None
80  and config.dataType() is not DataType.Data
81  ):
82  # Decorate jets with isHS labels (required to retrieve Jvt SFs)
83  alg = config.createAlgorithm( 'CP::JetDecoratorAlg', 'JetPileupLabelAlg' )
84  config.addPrivateTool( 'decorator', 'JetPileupLabelingTool' )
85  alg.jets = config.readName (self.containerName)
86  alg.jetsOut = config.copyName (self.containerName)
87  alg.decorator.RecoJetContainer = alg.jetsOut.replace ('%SYS%', 'NOSYS')
88  alg.decorator.SuppressOutputDependence=True
89 
90  # Set up shallow copy if needed and not yet done
91  if config.wantCopy (self.containerName) :
92  alg = config.createAlgorithm( 'CP::AsgShallowCopyAlg', 'JetShallowCopyAlg' )
93  alg.input = config.readName (self.containerName)
94  alg.output = config.copyName (self.containerName)
95 
96  config.addOutputVar (self.containerName, 'pt', 'pt')
97  config.addOutputVar (self.containerName, 'eta', 'eta', noSys=True)
98  config.addOutputVar (self.containerName, 'phi', 'phi', noSys=True)
99  config.addOutputVar (self.containerName, 'charge', 'charge', noSys=True, enabled=False)
100 
101  if self.outputTruthLabelIDs and config.dataType() is not DataType.Data:
102  config.addOutputVar (self.containerName, 'HadronConeExclTruthLabelID', 'HadronConeExclTruthLabelID', noSys=True)
103  config.addOutputVar (self.containerName, 'PartonTruthLabelID', 'PartonTruthLabelID', noSys=True)
104 
105 
106 
107 class SmallRJetAnalysisConfig (ConfigBlock) :
108  """the ConfigBlock for the small-r jet sequence"""
109 
110  def __init__ (self) :
111  super (SmallRJetAnalysisConfig, self).__init__ ()
112  self.addOption ('containerName', '', type=str,
113  noneAction='error',
114  info="the name of the output container after calibration.")
115  self.addOption ('jetCollection', '', type=str,
116  noneAction='error',
117  info="the jet container to run on. It is interpreted to determine "
118  "the correct config blocks to call for small- or large-R jets.")
119  # TODO: add info string
120  self.addOption ('jetInput', '', type=str,
121  noneAction='error',
122  info="")
123  self.addOption ('runJvtUpdate', False, type=bool,
124  info="whether to update the JVT. The default is False.")
125  self.addOption ('runNNJvtUpdate', False, type=bool,
126  info="whether to update the NN-JVT. The default is False.")
127  self.addOption ('runJvtSelection', True, type=bool,
128  info="whether to run JVT selection. The default is True.")
129  self.addOption ('runFJvtSelection', False, type=bool,
130  info="whether to run forward JVT selection. The default is False.")
131  self.addOption ('jvtWP', "FixedEffPt", type=str,
132  info="which Jvt WP to apply. The default is FixedEffPt.")
133  self.addOption ('fJvtWP', "Loose", type=str,
134  info="which fJvt WP to apply. The default is Loose.")
135  self.addOption ('runJvtEfficiency', True, type=bool,
136  info="whether to calculate the JVT efficiency. The default is True.")
137  self.addOption ('runFJvtEfficiency', False, type=bool,
138  info="whether to calculate the forward JVT efficiency. The default is False.")
139  self.addOption ('systematicsModelJES', "Category", type=str,
140  info="the NP reduction scheme to use for JES: All, Global, Category, "
141  "Scenario. The default is Category.")
142  self.addOption ('systematicsModelJER', "Full", type=str,
143  info="the NP reduction scheme to use for JER: All, Full, Simple. The "
144  "default is Full.")
145  self.addOption ('runJERsystematicsOnData', False, type=bool,
146  info="whether to run the All/Full JER model variations also on data samples. Expert option!")
147  self.addOption ('recalibratePhyslite', True, type=bool,
148  info="whether to run the CP::JetCalibrationAlg on PHYSLITE derivations. "
149  "The default is True.")
150  # Calibration tool options
151  self.addOption ('calibToolConfigFile', None, type=str,
152  info="name (str) of the config file to use for the jet calibration "
153  "tool. Expert option to override JetETmiss recommendations. The "
154  "default is None.")
155  self.addOption ('calibToolCalibArea', None, type=str,
156  info="name (str) of the CVMFS area to use for the jet calibration "
157  "tool. Expert option to override JetETmiss recommendations. The "
158  "default is None.")
159  self.addOption ('calibToolCalibSeq', None, type=str,
160  info="name (str) of the sequence to use for the jet calibration "
161  "tool (e.g. 'JetArea_Residual_EtaJES_GSC'). Expert option to override "
162  "JetETmiss recommendations. The default is None.")
163  # Uncertainties tool options
164  self.addOption ('uncertToolConfigPath', None, type=str,
165  info="name (str) of the config file to use for the jet uncertainty "
166  "tool. Expert option to override JetETmiss recommendations. The "
167  "default is None.")
168  self.addOption ('uncertToolCalibArea', None, type=str,
169  info="name (str) of the CVMFS area to use for the jet uncertainty "
170  "tool. Expert option to override JetETmiss recommendations. The "
171  "default is None.")
172  self.addOption ('uncertToolMCType', None, type=str,
173  info="data type (str) to use for the jet uncertainty tool (e.g. "
174  "'AF3' or 'MC16'). Expert option to override JetETmiss "
175  "recommendations. The default is None.")
176 
177  def instanceName (self) :
178  """Return the instance name for this block"""
179  return self.containerName
180 
181  def getUncertaintyToolSettings(self, config):
182 
183  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
184  # We do this separately from the tool declaration, as we may need to set uo
185  # two such tools, but they have to be private.
186 
187  # Config file:
188  config_file = None
189  if self.systematicsModelJES == "All" and self.systematicsModelJER == "All":
190  config_file = "R4_AllNuisanceParameters_AllJERNP.config"
191  elif "Scenario" in self.systematicsModelJES:
192  if self.systematicsModelJER != "Simple":
193  raise ValueError(
194  "Invalid uncertainty configuration - Scenario* systematicsModelJESs can "
195  "only be used together with the Simple systematicsModelJER")
196  config_file = "R4_{0}_SimpleJER.config".format(self.systematicsModelJES)
197  elif self.systematicsModelJES in ["Global", "Category"] and self.systematicsModelJER in ["Simple", "Full"]:
198  config_file = "R4_{0}Reduction_{1}JER.config".format(self.systematicsModelJES, self.systematicsModelJER)
199  else:
200  raise ValueError(
201  "Invalid combination of systematicsModelJES and systematicsModelJER settings: "
202  "systematicsModelJES: {0}, systematicsModelJER: {1}".format(self.systematicsModelJES, self.systematicsModelJER) )
203 
204  # Calibration area:
205  calib_area = None
206  if self.uncertToolCalibArea is not None:
207  calib_area = self.uncertToolCalibArea
208 
209  # Expert override for config path:
210  if self.uncertToolConfigPath is not None:
211  config_file = self.uncertToolConfigPath
212  else:
213  if config.geometry() is LHCPeriod.Run2:
214  if config.dataType() is DataType.FastSim:
215  config_file = "rel22/Fall2024_PreRec/" + config_file
216  else:
217  if self.jetInput == "HI":
218  config_file = "HIJetUncertainties/Spring2023/HI" + config_file
219  else:
220  config_file = "rel22/Summer2023_PreRec/" + config_file
221  else:
222  if config.dataType() is DataType.FastSim:
223  config_file = "rel22/Winter2025_AF3_PreRec/" + config_file
224  else:
225  if self.jetInput == "HI":
226  config_file = "HIJetUncertainties/Spring2023/HI" + config_file
227  else:
228  config_file = "rel22/Winter2025_PreRec/" + config_file
229 
230  # MC type:
231  mc_type = None
232  if self.uncertToolMCType is not None:
233  mc_type = self.uncertToolMCType
234  else:
235  if config.geometry() is LHCPeriod.Run2:
236  if config.dataType() is DataType.FastSim:
237  mc_type = "AF3"
238  else:
239  mc_type = "MC20"
240  else:
241  if config.dataType() is DataType.FastSim:
242  mc_type = "MC23AF3"
243  else:
244  if self.jetInput == "HI":
245  mc_type = "MC16"
246  else:
247  mc_type = "MC23"
248 
249  return config_file, calib_area, mc_type
250 
251 
252  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
253 
254  # Create an instance of JetUncertaintiesTool, following JetETmiss recommendations.
255  # To run Jet Energy Resolution (JER) uncertainties in the "Full" or "All" schemes,
256  # we need two sets of tools: one configured as normal (MC), the other with the
257  # exact same settings but pretending to run on data (pseudo-data).
258  # This is achieved by passing "isPseudoData=True" to the arguments.
259 
260  # Retrieve the common configuration settings
261  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
262 
263  # The main tool for all JES+JER combinations
264  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
265  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
266  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
267  if calibArea is not None:
268  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
269  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
270  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
271  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
272 
273  if config.dataType() is DataType.Data and not (doPseudoData and self.runJERsystematicsOnData):
274  # we don't want any systematics on data if we're not using the right JER model!
275  jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
276  if config.dataType() is not DataType.Data and doPseudoData and not self.runJERsystematicsOnData:
277  # The secondary tool for pseudo-data JER smearing
278  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
279  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
280  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
281  if calibArea is not None:
282  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
283  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
284 
285  # This is the part that is different!
286  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
287  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
288 
289 
290  def makeAlgs (self, config) :
291 
292  jetCollectionName=self.jetCollection
293  if(self.jetCollection=="AnalysisJets") :
294  jetCollectionName="AntiKt4EMPFlowJets"
295  if(self.jetCollection=="AnalysisLargeRJets") :
296  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
297 
298  if self.jetInput not in ["EMTopo", "EMPFlow", "HI"]:
299  raise ValueError(
300  "Unsupported input type '{0}' for R=0.4 jets!".format(self.jetInput) )
301 
302  if self.jvtWP not in ["FixedEffPt"]:
303  raise ValueError(
304  "Unsupported NNJvt WP '{0}'".format(self.jvtWP) )
305 
306  if self.fJvtWP not in ["Loose", "Tight", "Tighter"]:
307  raise ValueError(
308  "Unsupported fJvt WP '{0}'".format(self.fJvtWP) )
309 
310  if not config.isPhyslite() or self.recalibratePhyslite:
311  # Prepare the jet calibration algorithm
312  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
313  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
314  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
315  # Get the correct string to use in the config file name
316  if self.jetInput == "EMPFlow":
317  if config.geometry() is LHCPeriod.Run2:
318  configFile = "PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config"
319  alg.calibrationTool.CalibArea = "00-04-82"
320  elif config.geometry() >= LHCPeriod.Run3:
321  configFile = "AntiKt4EMPFlow_MC23a_PreRecR22_Phase2_CalibConfig_ResPU_EtaJES_GSC_241208_InSitu.config"
322  alg.calibrationTool.CalibArea = "00-04-83"
323  elif self.jetInput == "HI":
324  if config.geometry() is LHCPeriod.Run2:
325  configFile = "JES_MC16_HI_Jan2021_5TeV.config"
326  if config.geometry() is LHCPeriod.Run3:
327  configFile = "AntiKt4HI_JES_constants_11-05-2024_13p6TeVFinalConfiguration.config"
328  alg.calibrationTool.CalibArea = "00-04-83"
329  else:
330  if config.dataType() is DataType.FastSim:
331  configFile = "JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config"
332  else:
333  configFile = "JES_MC16Recommendation_Consolidated_{0}_Apr2019_Rel21.config"
334  configFile = configFile.format(self.jetInput)
335  if self.calibToolCalibArea is not None:
336  alg.calibrationTool.CalibArea = self.calibToolCalibArea
337  if self.calibToolConfigFile is not None:
338  configFile = self.calibToolConfigFile
339  alg.calibrationTool.ConfigFile = configFile
340  if config.dataType() is DataType.Data:
341  if self.jetInput == "HI":
342  if config.geometry() is LHCPeriod.Run2:
343  alg.calibrationTool.CalibSequence = 'EtaJES_Insitu'
344  if config.geometry() is LHCPeriod.Run3:
345  alg.calibrationTool.CalibSequence = 'EtaJES'
346  else:
347  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Insitu'
348  else:
349  if self.jetInput == "EMPFlow":
350  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC'
351  elif self.jetInput == "HI":
352  alg.calibrationTool.CalibSequence = 'EtaJES'
353  else:
354  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
355  if self.calibToolCalibSeq is not None:
356  alg.calibrationTool.CalibSequence = self.calibToolCalibSeq
357  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
358  alg.jets = config.readName (self.containerName)
359  alg.jetsOut = config.copyName (self.containerName)
360 
361  # Jet uncertainties
362  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg' )
363  self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
364  alg.jets = config.readName (self.containerName)
365  alg.jetsOut = config.copyName (self.containerName)
366  alg.preselection = config.getPreselection (self.containerName, '')
367 
368  # Set up the JVT update algorithm:
369  if self.runJvtUpdate :
370  alg = config.createAlgorithm( 'CP::JvtUpdateAlg', 'JvtUpdateAlg' )
371  config.addPrivateTool( 'jvtTool', 'JetVertexTaggerTool' )
372  alg.jvtTool.JetContainer = self.jetCollection
373  alg.jvtTool.SuppressInputDependence=True
374  alg.jets = config.readName (self.containerName)
375  alg.jetsOut = config.copyName (self.containerName)
376  alg.preselection = config.getPreselection (self.containerName, '')
377 
378  if self.runNNJvtUpdate:
379  assert self.jetInput=="EMPFlow", "NN JVT only defined for PFlow jets"
380  alg = config.createAlgorithm( 'CP::JetDecoratorAlg', 'NNJvtUpdateAlg' )
381  config.addPrivateTool( 'decorator', 'JetPileupTag::JetVertexNNTagger' )
382  # Set this actually to the *output* collection
383  alg.jets = config.readName (self.containerName)
384  alg.jetsOut = config.copyName (self.containerName)
385  alg.decorator.JetContainer = alg.jetsOut.replace ('%SYS%', 'NOSYS')
386  alg.decorator.SuppressInputDependence=True
387  alg.decorator.SuppressOutputDependence=True
388 
389  # Set up the jet efficiency scale factor calculation algorithm
390  # Change the truthJetCollection property to AntiKt4TruthWZJets if preferred
391  if self.runJvtSelection :
392  assert self.jetInput=="EMPFlow", "NNJvt WPs and SFs only valid for PFlow jets"
393  alg = config.createAlgorithm('CP::AsgSelectionAlg', 'JvtSelectionAlg')
394  config.addPrivateTool('selectionTool', 'CP::NNJvtSelectionTool')
395  alg.selectionTool.JetContainer = config.readName(self.containerName)
396  alg.selectionTool.WorkingPoint = self.jvtWP
397  alg.selectionTool.MaxPtForJvt = 60*GeV
398  alg.selectionDecoration = "jvt_selection,as_char"
399  alg.particles = config.readName(self.containerName)
400 
401  if self.runJvtEfficiency and config.dataType() is not DataType.Data:
402  alg = config.createAlgorithm( 'CP::JvtEfficiencyAlg', 'JvtEfficiencyAlg' )
403  config.addPrivateTool( 'efficiencyTool', 'CP::NNJvtEfficiencyTool' )
404  alg.efficiencyTool.JetContainer = config.readName(self.containerName)
405  alg.efficiencyTool.MaxPtForJvt = 60*GeV
406  alg.efficiencyTool.WorkingPoint = self.jvtWP
407  if config.geometry() is LHCPeriod.Run2:
408  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/NNJvtSFFile_Run2_EMPFlow.root"
409  else:
410  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/NNJvtSFFile_Run3_EMPFlow.root"
411  alg.selection = 'jvt_selection,as_char'
412  alg.scaleFactorDecoration = 'jvt_effSF_%SYS%'
413  alg.outOfValidity = 2
414  alg.outOfValidityDeco = 'no_jvt'
415  alg.skipBadEfficiency = False
416  alg.jets = config.readName (self.containerName)
417  alg.preselection = config.getPreselection (self.containerName, '')
418  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'jvtEfficiency')
419  config.addSelection (self.containerName, 'baselineJvt', 'jvt_selection,as_char', preselection=False)
420 
421  if self.runFJvtSelection :
422  assert self.jetInput=="EMPFlow", "fJvt WPs and SFs only valid for PFlow jets"
423  alg = config.createAlgorithm('CP::AsgSelectionAlg', 'FJvtSelectionAlg')
424  config.addPrivateTool('selectionTool', 'CP::FJvtSelectionTool')
425  alg.selectionTool.JetContainer = config.readName(self.containerName)
426  alg.selectionTool.WorkingPoint = self.fJvtWP
427  alg.selectionDecoration = "fjvt_selection,as_char"
428  alg.particles = config.readName(self.containerName)
429 
430  if self.runFJvtEfficiency and config.dataType() is not DataType.Data:
431  alg = config.createAlgorithm( 'CP::JvtEfficiencyAlg', 'FJvtEfficiencyAlg' )
432  config.addPrivateTool( 'efficiencyTool', 'CP::FJvtEfficiencyTool' )
433  alg.efficiencyTool.JetContainer = config.readName(self.containerName)
434  alg.efficiencyTool.WorkingPoint = self.fJvtWP
435  if config.geometry() is LHCPeriod.Run2:
436  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/fJvtSFFile_Run2_EMPFlow.root"
437  else:
438  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/fJvtSFFile_Run3_EMPFlow.root"
439  alg.selection = 'fjvt_selection,as_char'
440  alg.scaleFactorDecoration = 'fjvt_effSF_%SYS%'
441  alg.outOfValidity = 2
442  alg.outOfValidityDeco = 'no_fjvt'
443  alg.skipBadEfficiency = False
444  alg.jets = config.readName (self.containerName)
445  alg.preselection = config.getPreselection (self.containerName, '')
446  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'fjvtEfficiency')
447  config.addSelection (self.containerName, 'baselineFJvt', 'fjvt_selection,as_char', preselection=False)
448 
449  # Additional decorations
450  alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'AsgEnergyDecoratorAlg' )
451  alg.particles = config.readName (self.containerName)
452 
453  config.addOutputVar (self.containerName, 'e_%SYS%', 'e')
454 
455 
456 class RScanJetAnalysisConfig (ConfigBlock) :
457  """the ConfigBlock for the r-scan jet sequence"""
458 
459  def __init__ (self) :
460  super (RScanJetAnalysisConfig, self).__init__ ()
461  self.addOption ('containerName', '', type=str,
462  noneAction='error',
463  info="the name of the output container after calibration.")
464  self.addOption ('jetCollection', '', type=str,
465  noneAction='error',
466  info="the jet container to run on. It is interpreted to determine "
467  "the correct config blocks to call for small- or large-R jets.")
468  # TODO: add info string
469  self.addOption ('jetInput', '', type=str,
470  noneAction='error',
471  info="")
472  # TODO: add info string
473  self.addOption ('radius', None, type=int,
474  noneAction='error',
475  info="")
476  self.addOption ('recalibratePhyslite', True, type=bool,
477  info="whether to run the CP::JetCalibrationAlg on PHYSLITE "
478  "derivations. The default is True.")
479 
480  def instanceName (self) :
481  """Return the instance name for this block"""
482  return self.containerName
483 
484  def makeAlgs (self, config) :
485 
486  log = logging.getLogger('RScanJetAnalysisConfig')
487 
488  jetCollectionName=self.jetCollection
489  if(self.jetCollection=="AnalysisJets") :
490  jetCollectionName="AntiKt4EMPFlowJets"
491  if(self.jetCollection=="AnalysisLargeRJets") :
492  jetCollectionName="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"
493 
494  if not config.isPhyslite() or self.recalibratePhyslite:
495  if self.jetInput != "LCTopo":
496  raise ValueError(
497  "Unsupported input type '{0}' for R-scan jets!".format(self.jetInput) )
498  # Prepare the jet calibration algorithm
499  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
500  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
501  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
502  alg.calibrationTool.ConfigFile = \
503  "JES_MC16Recommendation_Rscan{0}LC_Feb2022_R21.config".format(self.radius)
504  if config.dataType() is DataType.Data:
505  alg.calibrationTool.CalibSequence = "JetArea_Residual_EtaJES_GSC_Insitu"
506  else:
507  alg.calibrationTool.CalibSequence = "JetArea_Residual_EtaJES_GSC_Smear"
508  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
509  alg.jets = config.readName (self.containerName)
510  # Logging would be good
511  log.warning("Uncertainties for R-Scan jets are not yet released!")
512 
513 
514 def _largeLCTopoConfigFile(config, self):
515  is_sim = config.dataType() in {DataType.FullSim}
516  if self.largeRMass == "Comb":
517  if config.dataType() is DataType.Data:
518  return "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_March2021.config"
519  if is_sim:
520  return "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config"
521  elif self.largeRMass == "Calo":
522  if config.dataType() is DataType.Data:
523  return "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_March2021.config"
524  if is_sim:
525  return "JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config "
526  elif self.largeRMass == "TA":
527  if config.dataType() is DataType.Data:
528  return "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_March2021.config"
529  if is_sim:
530  return "JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config"
531  return None
532 
533 
534 class LargeRJetAnalysisConfig (ConfigBlock) :
535  """the ConfigBlock for the large-r jet sequence"""
536 
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 
612  def instanceName (self) :
613  """Return the instance name for this block"""
614  return self.containerName
615 
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 
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 
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 
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
887 def makeJetAnalysisConfig( seq, containerName, jetCollection,
888  runGhostMuonAssociation = None):
889  """Create a jet analysis algorithm sequence
890  The jet collection is interpreted and selects the correct function to call,
891  makeSmallRJetAnalysisConfig, makeRScanJetAnalysisConfig or
892  makeLargeRJetAnalysisConfig
893 
894  Keyword arguments
895  jetCollection -- The jet container to run on.
896  """
897 
898  # Remove b-tagging calibration from the container name
899  btIndex = jetCollection.find('_BTagging')
900  if btIndex != -1:
901  jetCollection = jetCollection[:btIndex]
902 
903  jetCollectionName=jetCollection
904  # needed for PHYSLITE
905  if(jetCollection=="AnalysisJets") :
906  jetCollectionName="AntiKt4EMPFlowJets"
907  if(jetCollection=="AnalysisLargeRJets") :
908  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
909 
910  # interpret the jet collection
911  collection_pattern = re.compile(
912  r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster|UFO|Track|HI)(TrimmedPtFrac5SmallR20|CSSKSoftDropBeta100Zcut10)?Jets")
913  match = collection_pattern.match(jetCollectionName)
914  if not match:
915  raise ValueError(
916  "Jet collection {0} does not match expected pattern!".format(jetCollectionName) )
917  radius = int(match.group(1) )
918  if radius not in [2, 4, 6, 10]:
919  raise ValueError("Jet collection has an unsupported radius '{0}'!".format(radius) )
920  jetInput = match.group(2)
921 
922  if jetCollectionName == 'AntiKtVR30Rmax4Rmin02PV0TrackJets' :
923  # don't to anything on track jets
924  config = PreJetAnalysisConfig()
925  config.setOptionValue ('containerName', containerName)
926  config.setOptionValue ('jetCollection', jetCollection)
927  config.setOptionValue ('runOriginalObjectLink', False)
928  config.setOptionValue ('runGhostMuonAssociation', False)
929  seq.append (config)
930  return
931 
932  config = PreJetAnalysisConfig()
933  config.setOptionValue ('containerName', containerName)
934  config.setOptionValue ('jetCollection', jetCollection)
935  config.runOriginalObjectLink = (btIndex != -1)
936  config.setOptionValue ('runGhostMuonAssociation', runGhostMuonAssociation)
937  seq.append (config)
938 
939  if radius == 4:
940  makeSmallRJetAnalysisConfig(seq, containerName,
941  jetCollection, jetInput=jetInput)
942  elif radius in [2, 6]:
943  makeRScanJetAnalysisConfig(seq, containerName,
944  jetCollection, jetInput=jetInput, radius=radius)
945  else:
946  trim = match.group(3)
947  if trim == "":
948  raise ValueError("Untrimmed large-R jets are not supported!")
949  makeLargeRJetAnalysisConfig(seq, containerName,
950  jetCollection, jetInput=jetInput)
951 
952 
953 
954 def makeSmallRJetAnalysisConfig( seq, containerName, jetCollection, jetInput,
955  runJvtUpdate = None, runNNJvtUpdate = None,
956  runJvtSelection = None, runFJvtSelection = None,
957  jvtWP = None, fJvtWP = None,
958  runJvtEfficiency = None, runFJvtEfficiency = None,
959  systematicsModelJES = None, systematicsModelJER = None):
960  """Add algorithms for the R=0.4 jets.
961 
962  Keyword arguments
963  seq -- The sequence to add the algorithms to
964  jetCollection -- The jet container to run on.
965  jetInput -- The type of input used, read from the collection name.
966  runJvtUpdate -- Determines whether or not to update JVT on the jets
967  runNNJvtUpdate -- Determines whether or not to update NN JVT on the jets
968  runJvtSelection -- Determines whether or not to run JVT selection on the jets
969  runFJvtSelection -- Determines whether or not to run forward JVT selection on the jets
970  jvtWP -- Defines the NNJvt WP to apply on the jets
971  fJvtWP -- Defines the fJvt WP to apply on the jets
972  runJvtEfficiency -- Determines whether or not to calculate the JVT efficiency
973  runFJvtEfficiency -- Determines whether or not to calculate the forward JVT efficiency
974  systematicsModelJES -- Which NP systematicsModelJES scheme should be used (All, Global, Category, Scenario)
975  systematicsModelJER -- Which variant of the systematicsModelJES should be used (All, Full, Simple). Note that not all combinations of systematicsModelJES and systematicsModelJER are valid!
976  """
977 
978  if jetInput not in ["EMTopo", "EMPFlow", "HI"]:
979  raise ValueError(
980  "Unsupported input type '{0}' for R=0.4 jets!".format(jetInput) )
981 
982  config = SmallRJetAnalysisConfig()
983  config.setOptionValue ('containerName', containerName)
984  config.setOptionValue ('jetCollection', jetCollection)
985  config.setOptionValue ('jetInput', jetInput)
986  config.setOptionValue ('runJvtUpdate', runJvtUpdate)
987  config.setOptionValue ('runNNJvtUpdate', runNNJvtUpdate)
988  config.setOptionValue ('runJvtSelection', runJvtSelection)
989  config.setOptionValue ('runFJvtSelection', runFJvtSelection)
990  config.setOptionValue ('jvtWP', jvtWP)
991  config.setOptionValue ('fJvtWP', fJvtWP)
992  config.setOptionValue ('runJvtEfficiency', runJvtEfficiency)
993  config.setOptionValue ('runFJvtEfficiency', runFJvtEfficiency)
994  config.setOptionValue ('systematicsModelJES', systematicsModelJES)
995  config.setOptionValue ('systematicsModelJER', systematicsModelJER)
996  seq.append (config)
997 
998 
999 def makeRScanJetAnalysisConfig( seq, containerName, jetCollection,
1000  jetInput, radius ):
1001  """Add algorithms for the R-scan jets.
1002 
1003  Keyword arguments
1004  seq -- The sequence to add the algorithms to
1005  jetCollection -- The jet container to run on.
1006  jetInput -- The type of input used, read from the collection name.
1007  radius -- The radius of the r-scan jets.
1008  """
1009 
1010  config = RScanJetAnalysisConfig()
1011  config.setOptionValue ('containerName', containerName)
1012  config.setOptionValue ('jetCollection', jetCollection)
1013  config.setOptionValue ('jetInput', jetInput)
1014  config.setOptionValue ('radius', radius)
1015  seq.append (config)
1016 
1017 
1018 
1019 
1020 def makeLargeRJetAnalysisConfig( seq, containerName, jetCollection,
1021  jetInput, largeRMass = None):
1022  """Add algorithms for the R=1.0 jets.
1023 
1024  Keyword arguments
1025  seq -- The sequence to add the algorithms to
1026  jetCollection -- The jet container to run on.
1027  jetInput -- The type of input used, read from the collection name.
1028  largeRMass -- Which large-R mass definition to use. Ignored if not running on large-R jets ("Comb", "Calo", "TA")
1029  """
1030  config = LargeRJetAnalysisConfig()
1031  config.setOptionValue ('containerName', containerName)
1032  config.setOptionValue ('jetCollection', jetCollection)
1033  config.setOptionValue ('jetInput', jetInput)
1034  config.setOptionValue ('largeRMass', largeRMass)
1035  seq.append (config)
1036 
python.JetAnalysisConfig.LargeRJetAnalysisConfig.instanceName
def instanceName(self)
Definition: JetAnalysisConfig.py:612
python.JetAnalysisConfig._largeLCTopoConfigFile
def _largeLCTopoConfigFile(config, self)
Definition: JetAnalysisConfig.py:514
SystemOfUnits
python.JetAnalysisConfig.makeSmallRJetAnalysisConfig
def makeSmallRJetAnalysisConfig(seq, containerName, jetCollection, jetInput, runJvtUpdate=None, runNNJvtUpdate=None, runJvtSelection=None, runFJvtSelection=None, jvtWP=None, fJvtWP=None, runJvtEfficiency=None, runFJvtEfficiency=None, systematicsModelJES=None, systematicsModelJER=None)
Definition: JetAnalysisConfig.py:954
vtune_athena.format
format
Definition: vtune_athena.py:14
python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES
systematicsModelJES
Definition: JetAnalysisConfig.py:189
python.JetAnalysisConfig.LargeRJetAnalysisConfig.createFFSmearingTool
def createFFSmearingTool(self, jetFFSmearingAlg, config)
Definition: JetAnalysisConfig.py:701
python.JetAnalysisConfig.SmallRJetAnalysisConfig.getUncertaintyToolSettings
def getUncertaintyToolSettings(self, config)
Definition: JetAnalysisConfig.py:181
python.JetAnalysisConfig.PreJetAnalysisConfig.jetCollection
jetCollection
Definition: JetAnalysisConfig.py:47
python.JetAnalysisConfig.PreJetAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: JetAnalysisConfig.py:44
python.JetAnalysisConfig.PreJetAnalysisConfig
Definition: JetAnalysisConfig.py:16
python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput
jetInput
Definition: JetAnalysisConfig.py:217
python.JetAnalysisConfig.LargeRJetAnalysisConfig
Definition: JetAnalysisConfig.py:534
python.JetAnalysisConfig.RScanJetAnalysisConfig
Definition: JetAnalysisConfig.py:456
python.JetAnalysisConfig.RScanJetAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: JetAnalysisConfig.py:484
python.JetAnalysisConfig.RScanJetAnalysisConfig.jetCollection
jetCollection
Definition: JetAnalysisConfig.py:489
python.JetAnalysisConfig.makeLargeRJetAnalysisConfig
def makeLargeRJetAnalysisConfig(seq, containerName, jetCollection, jetInput, largeRMass=None)
Definition: JetAnalysisConfig.py:1020
python.JetAnalysisConfig.PreJetAnalysisConfig.__init__
def __init__(self)
Definition: JetAnalysisConfig.py:19
python.JetAnalysisConfig.SmallRJetAnalysisConfig.__init__
def __init__(self)
Definition: JetAnalysisConfig.py:110
python.JetAnalysisConfig.LargeRJetAnalysisConfig.getUncertaintyToolSettings
def getUncertaintyToolSettings(self, config)
Definition: JetAnalysisConfig.py:616
python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER
systematicsModelJER
Definition: JetAnalysisConfig.py:189
python.JetAnalysisConfig.LargeRJetAnalysisConfig.createUncertaintyTool
def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
Definition: JetAnalysisConfig.py:663
python.JetAnalysisConfig.SmallRJetAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: JetAnalysisConfig.py:290
python.JetAnalysisConfig.PreJetAnalysisConfig.instanceName
def instanceName(self)
Definition: JetAnalysisConfig.py:40
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__
def __init__(self)
Definition: JetAnalysisConfig.py:537
python.JetAnalysisConfig.SmallRJetAnalysisConfig.instanceName
def instanceName(self)
Definition: JetAnalysisConfig.py:177
python.JetAnalysisConfig.makeRScanJetAnalysisConfig
def makeRScanJetAnalysisConfig(seq, containerName, jetCollection, jetInput, radius)
Definition: JetAnalysisConfig.py:999
python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection
jetCollection
Definition: JetAnalysisConfig.py:293
python.JetAnalysisConfig.SmallRJetAnalysisConfig
Definition: JetAnalysisConfig.py:107
python.JetAnalysisConfig.makeJetAnalysisConfig
def makeJetAnalysisConfig(seq, containerName, jetCollection, runGhostMuonAssociation=None)
Definition: JetAnalysisConfig.py:887
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetCollection
jetCollection
Definition: JetAnalysisConfig.py:748
python.JetAnalysisConfig.SmallRJetAnalysisConfig.createUncertaintyTool
def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
Definition: JetAnalysisConfig.py:252
python.JetAnalysisConfig.LargeRJetAnalysisConfig.jetInput
jetInput
Definition: JetAnalysisConfig.py:759
python.JetAnalysisConfig.LargeRJetAnalysisConfig.makeAlgs
def makeAlgs(self, config)
Definition: JetAnalysisConfig.py:741
python.JetAnalysisConfig.RScanJetAnalysisConfig.instanceName
def instanceName(self)
Definition: JetAnalysisConfig.py:480
python.JetAnalysisConfig.RScanJetAnalysisConfig.__init__
def __init__(self)
Definition: JetAnalysisConfig.py:459