ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.JetAnalysisConfig.SmallRJetAnalysisConfig Class Reference
Inheritance diagram for python.JetAnalysisConfig.SmallRJetAnalysisConfig:
Collaboration diagram for python.JetAnalysisConfig.SmallRJetAnalysisConfig:

Public Member Functions

def __init__ (self)
 
def instanceName (self)
 
def getUncertaintyToolSettings (self, config)
 
def createUncertaintyTool (self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
 
def makeAlgs (self, config)
 

Public Attributes

 systematicsModelJES
 
 systematicsModelJER
 
 jetInput
 
 jetCollection
 

Detailed Description

the ConfigBlock for the small-r jet sequence

Definition at line 107 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisConfig.SmallRJetAnalysisConfig.__init__ (   self)

Definition at line 110 of file JetAnalysisConfig.py.

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 

Member Function Documentation

◆ createUncertaintyTool()

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

Definition at line 252 of file JetAnalysisConfig.py.

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 

◆ getUncertaintyToolSettings()

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

Definition at line 181 of file JetAnalysisConfig.py.

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 

◆ instanceName()

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

Definition at line 177 of file JetAnalysisConfig.py.

177  def instanceName (self) :
178  """Return the instance name for this block"""
179  return self.containerName
180 

◆ makeAlgs()

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

Definition at line 290 of file JetAnalysisConfig.py.

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 

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection

Definition at line 293 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput

Definition at line 217 of file JetAnalysisConfig.py.

◆ systematicsModelJER

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER

Definition at line 189 of file JetAnalysisConfig.py.

◆ systematicsModelJES

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES

Definition at line 189 of file JetAnalysisConfig.py.


The documentation for this class was generated from the following file:
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