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

Constructor & Destructor Documentation

◆ __init__()

def python.JetAnalysisConfig.SmallRJetAnalysisConfig.__init__ (   self)

Definition at line 109 of file JetAnalysisConfig.py.

109  def __init__ (self) :
110  super (SmallRJetAnalysisConfig, self).__init__ ()
111  self.addOption ('containerName', '', type=str,
112  noneAction='error',
113  info="the name of the output container after calibration.")
114  self.addOption ('jetCollection', '', type=str,
115  noneAction='error',
116  info="the jet container to run on. It is interpreted to determine "
117  "the correct config blocks to call for small- or large-R jets.")
118  # TODO: add info string
119  self.addOption ('jetInput', '', type=str,
120  noneAction='error',
121  info="")
122  self.addOption ('runJvtUpdate', False, type=bool,
123  info="whether to update the JVT. The default is False.")
124  self.addOption ('runNNJvtUpdate', False, type=bool,
125  info="whether to update the NN-JVT. The default is False.")
126  self.addOption ('runJvtSelection', True, type=bool,
127  info="whether to run JVT selection. The default is True.")
128  self.addOption ('runFJvtSelection', False, type=bool,
129  info="whether to run forward JVT selection. The default is False.")
130  self.addOption ('jvtWP', "FixedEffPt", type=str,
131  info="which Jvt WP to apply. The default is FixedEffPt.")
132  self.addOption ('fJvtWP', "Loose", type=str,
133  info="which fJvt WP to apply. The default is Loose.")
134  self.addOption ('runJvtEfficiency', True, type=bool,
135  info="whether to calculate the JVT efficiency. The default is True.")
136  self.addOption ('runFJvtEfficiency', False, type=bool,
137  info="whether to calculate the forward JVT efficiency. The default is False.")
138  self.addOption ('systematicsModelJES', "Category", type=str,
139  info="the NP reduction scheme to use for JES: All, Global, Category, "
140  "Scenario. The default is Category.")
141  self.addOption ('systematicsModelJER', "Full", type=str,
142  info="the NP reduction scheme to use for JER: All, Full, Simple. The "
143  "default is Full.")
144  self.addOption ('runJERsystematicsOnData', False, type=bool,
145  info="whether to run the All/Full JER model variations also on data samples. Expert option!")
146  self.addOption ('recalibratePhyslite', True, type=bool,
147  info="whether to run the CP::JetCalibrationAlg on PHYSLITE derivations. "
148  "The default is True.")
149  # Calibration tool options
150  self.addOption ('calibToolConfigFile', None, type=str,
151  info="name (str) of the config file to use for the jet calibration "
152  "tool. Expert option to override JetETmiss recommendations. The "
153  "default is None.")
154  self.addOption ('calibToolCalibArea', None, type=str,
155  info="name (str) of the CVMFS area to use for the jet calibration "
156  "tool. Expert option to override JetETmiss recommendations. The "
157  "default is None.")
158  self.addOption ('calibToolCalibSeq', None, type=str,
159  info="name (str) of the sequence to use for the jet calibration "
160  "tool (e.g. 'JetArea_Residual_EtaJES_GSC'). Expert option to override "
161  "JetETmiss recommendations. The default is None.")
162  # Uncertainties tool options
163  self.addOption ('uncertToolConfigPath', None, type=str,
164  info="name (str) of the config file to use for the jet uncertainty "
165  "tool. Expert option to override JetETmiss recommendations. The "
166  "default is None.")
167  self.addOption ('uncertToolCalibArea', None, type=str,
168  info="name (str) of the CVMFS area to use for the jet uncertainty "
169  "tool. Expert option to override JetETmiss recommendations. The "
170  "default is None.")
171  self.addOption ('uncertToolMCType', None, type=str,
172  info="data type (str) to use for the jet uncertainty tool (e.g. "
173  "'AF3' or 'MC16'). Expert option to override JetETmiss "
174  "recommendations. The default is None.")
175 

Member Function Documentation

◆ createUncertaintyTool()

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

Definition at line 251 of file JetAnalysisConfig.py.

251  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
252 
253  # Create an instance of JetUncertaintiesTool, following JetETmiss recommendations.
254  # To run Jet Energy Resolution (JER) uncertainties in the "Full" or "All" schemes,
255  # we need two sets of tools: one configured as normal (MC), the other with the
256  # exact same settings but pretending to run on data (pseudo-data).
257  # This is achieved by passing "isPseudoData=True" to the arguments.
258 
259  # Retrieve the common configuration settings
260  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
261 
262  # The main tool for all JES+JER combinations
263  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
264  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
265  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
266  if calibArea is not None:
267  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
268  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
269  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
270  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
271 
272  if config.dataType() is DataType.Data and not (doPseudoData and self.runJERsystematicsOnData):
273  # we don't want any systematics on data if we're not using the right JER model!
274  jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
275  if config.dataType() is not DataType.Data and doPseudoData and not self.runJERsystematicsOnData:
276  # The secondary tool for pseudo-data JER smearing
277  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
278  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
279  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
280  if calibArea is not None:
281  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
282  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
283 
284  # This is the part that is different!
285  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
286  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
287 
288 

◆ getUncertaintyToolSettings()

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

Definition at line 180 of file JetAnalysisConfig.py.

180  def getUncertaintyToolSettings(self, config):
181 
182  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
183  # We do this separately from the tool declaration, as we may need to set uo
184  # two such tools, but they have to be private.
185 
186  # Config file:
187  config_file = None
188  if self.systematicsModelJES == "All" and self.systematicsModelJER == "All":
189  config_file = "R4_AllNuisanceParameters_AllJERNP.config"
190  elif "Scenario" in self.systematicsModelJES:
191  if self.systematicsModelJER != "Simple":
192  raise ValueError(
193  "Invalid uncertainty configuration - Scenario* systematicsModelJESs can "
194  "only be used together with the Simple systematicsModelJER")
195  config_file = "R4_{0}_SimpleJER.config".format(self.systematicsModelJES)
196  elif self.systematicsModelJES in ["Global", "Category"] and self.systematicsModelJER in ["Simple", "Full"]:
197  config_file = "R4_{0}Reduction_{1}JER.config".format(self.systematicsModelJES, self.systematicsModelJER)
198  else:
199  raise ValueError(
200  "Invalid combination of systematicsModelJES and systematicsModelJER settings: "
201  "systematicsModelJES: {0}, systematicsModelJER: {1}".format(self.systematicsModelJES, self.systematicsModelJER) )
202 
203  # Calibration area:
204  calib_area = None
205  if self.uncertToolCalibArea is not None:
206  calib_area = self.uncertToolCalibArea
207 
208  # Expert override for config path:
209  if self.uncertToolConfigPath is not None:
210  config_file = self.uncertToolConfigPath
211  else:
212  if config.geometry() is LHCPeriod.Run2:
213  if config.dataType() is DataType.FastSim:
214  config_file = "rel22/Fall2024_PreRec/" + config_file
215  else:
216  if self.jetInput == "HI":
217  config_file = "HIJetUncertainties/Spring2023/HI" + config_file
218  else:
219  config_file = "rel22/Summer2023_PreRec/" + config_file
220  else:
221  if config.dataType() is DataType.FastSim:
222  config_file = "rel22/Winter2025_AF3_PreRec/" + config_file
223  else:
224  if self.jetInput == "HI":
225  config_file = "HIJetUncertainties/Spring2023/HI" + config_file
226  else:
227  config_file = "rel22/Winter2025_PreRec/" + config_file
228 
229  # MC type:
230  mc_type = None
231  if self.uncertToolMCType is not None:
232  mc_type = self.uncertToolMCType
233  else:
234  if config.geometry() is LHCPeriod.Run2:
235  if config.dataType() is DataType.FastSim:
236  mc_type = "AF3"
237  else:
238  mc_type = "MC20"
239  else:
240  if config.dataType() is DataType.FastSim:
241  mc_type = "MC23AF3"
242  else:
243  if self.jetInput == "HI":
244  mc_type = "MC16"
245  else:
246  mc_type = "MC23"
247 
248  return config_file, calib_area, mc_type
249 
250 

◆ instanceName()

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

Definition at line 176 of file JetAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 289 of file JetAnalysisConfig.py.

289  def makeAlgs (self, config) :
290 
291  jetCollectionName=self.jetCollection
292  if(self.jetCollection=="AnalysisJets") :
293  jetCollectionName="AntiKt4EMPFlowJets"
294  if(self.jetCollection=="AnalysisLargeRJets") :
295  jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
296 
297  if self.jetInput not in ["EMTopo", "EMPFlow", "HI"]:
298  raise ValueError(
299  "Unsupported input type '{0}' for R=0.4 jets!".format(self.jetInput) )
300 
301  if self.jvtWP not in ["FixedEffPt"]:
302  raise ValueError(
303  "Unsupported NNJvt WP '{0}'".format(self.jvtWP) )
304 
305  if self.fJvtWP not in ["Loose", "Tight", "Tighter"]:
306  raise ValueError(
307  "Unsupported fJvt WP '{0}'".format(self.fJvtWP) )
308 
309  if not config.isPhyslite() or self.recalibratePhyslite:
310  # Prepare the jet calibration algorithm
311  alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
312  config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
313  alg.calibrationTool.JetCollection = jetCollectionName[:-4]
314  # Get the correct string to use in the config file name
315  if self.jetInput == "EMPFlow":
316  if config.geometry() is LHCPeriod.Run2:
317  configFile = "PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config"
318  alg.calibrationTool.CalibArea = "00-04-82"
319  elif config.geometry() >= LHCPeriod.Run3:
320  configFile = "AntiKt4EMPFlow_MC23a_PreRecR22_Phase2_CalibConfig_ResPU_EtaJES_GSC_241208_InSitu.config"
321  alg.calibrationTool.CalibArea = "00-04-83"
322  elif self.jetInput == "HI":
323  if config.geometry() is LHCPeriod.Run2:
324  configFile = "JES_MC16_HI_Jan2021_5TeV.config"
325  if config.geometry() is LHCPeriod.Run3:
326  configFile = "AntiKt4HI_JES_constants_11-05-2024_13p6TeVFinalConfiguration.config"
327  alg.calibrationTool.CalibArea = "00-04-83"
328  else:
329  if config.dataType() is DataType.FastSim:
330  configFile = "JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config"
331  else:
332  configFile = "JES_MC16Recommendation_Consolidated_{0}_Apr2019_Rel21.config"
333  configFile = configFile.format(self.jetInput)
334  if self.calibToolCalibArea is not None:
335  alg.calibrationTool.CalibArea = self.calibToolCalibArea
336  if self.calibToolConfigFile is not None:
337  configFile = self.calibToolConfigFile
338  alg.calibrationTool.ConfigFile = configFile
339  if config.dataType() is DataType.Data:
340  if self.jetInput == "HI":
341  if config.geometry() is LHCPeriod.Run2:
342  alg.calibrationTool.CalibSequence = 'EtaJES_Insitu'
343  if config.geometry() is LHCPeriod.Run3:
344  alg.calibrationTool.CalibSequence = 'EtaJES'
345  else:
346  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Insitu'
347  else:
348  if self.jetInput == "EMPFlow":
349  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC'
350  elif self.jetInput == "HI":
351  alg.calibrationTool.CalibSequence = 'EtaJES'
352  else:
353  alg.calibrationTool.CalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
354  if self.calibToolCalibSeq is not None:
355  alg.calibrationTool.CalibSequence = self.calibToolCalibSeq
356  alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
357  alg.jets = config.readName (self.containerName)
358  alg.jetsOut = config.copyName (self.containerName)
359 
360  # Jet uncertainties
361  alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg' )
362  self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
363  alg.jets = config.readName (self.containerName)
364  alg.jetsOut = config.copyName (self.containerName)
365  alg.preselection = config.getPreselection (self.containerName, '')
366 
367  # Set up the JVT update algorithm:
368  if self.runJvtUpdate :
369  alg = config.createAlgorithm( 'CP::JvtUpdateAlg', 'JvtUpdateAlg' )
370  config.addPrivateTool( 'jvtTool', 'JetVertexTaggerTool' )
371  alg.jvtTool.JetContainer = self.jetCollection
372  alg.jvtTool.SuppressInputDependence=True
373  alg.jets = config.readName (self.containerName)
374  alg.jetsOut = config.copyName (self.containerName)
375  alg.preselection = config.getPreselection (self.containerName, '')
376 
377  if self.runNNJvtUpdate:
378  assert self.jetInput=="EMPFlow", "NN JVT only defined for PFlow jets"
379  alg = config.createAlgorithm( 'CP::JetDecoratorAlg', 'NNJvtUpdateAlg' )
380  config.addPrivateTool( 'decorator', 'JetPileupTag::JetVertexNNTagger' )
381  # Set this actually to the *output* collection
382  alg.jets = config.readName (self.containerName)
383  alg.jetsOut = config.copyName (self.containerName)
384  alg.decorator.JetContainer = alg.jetsOut.replace ('%SYS%', 'NOSYS')
385  alg.decorator.SuppressInputDependence=True
386  alg.decorator.SuppressOutputDependence=True
387 
388  # Set up the jet efficiency scale factor calculation algorithm
389  # Change the truthJetCollection property to AntiKt4TruthWZJets if preferred
390  if self.runJvtSelection :
391  assert self.jetInput=="EMPFlow", "NNJvt WPs and SFs only valid for PFlow jets"
392  alg = config.createAlgorithm('CP::AsgSelectionAlg', 'JvtSelectionAlg')
393  config.addPrivateTool('selectionTool', 'CP::NNJvtSelectionTool')
394  alg.selectionTool.JetContainer = config.readName(self.containerName)
395  alg.selectionTool.WorkingPoint = self.jvtWP
396  alg.selectionTool.MaxPtForJvt = 60*GeV
397  alg.selectionDecoration = "jvt_selection,as_char"
398  alg.particles = config.readName(self.containerName)
399 
400  if self.runJvtEfficiency and config.dataType() is not DataType.Data:
401  alg = config.createAlgorithm( 'CP::JvtEfficiencyAlg', 'JvtEfficiencyAlg' )
402  config.addPrivateTool( 'efficiencyTool', 'CP::NNJvtEfficiencyTool' )
403  alg.efficiencyTool.JetContainer = config.readName(self.containerName)
404  alg.efficiencyTool.MaxPtForJvt = 60*GeV
405  alg.efficiencyTool.WorkingPoint = self.jvtWP
406  if config.geometry() is LHCPeriod.Run2:
407  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/NNJvtSFFile_Run2_EMPFlow.root"
408  else:
409  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/NNJvtSFFile_Run3_EMPFlow.root"
410  alg.selection = 'jvt_selection,as_char'
411  alg.scaleFactorDecoration = 'jvt_effSF_%SYS%'
412  alg.outOfValidity = 2
413  alg.outOfValidityDeco = 'no_jvt'
414  alg.skipBadEfficiency = False
415  alg.jets = config.readName (self.containerName)
416  alg.preselection = config.getPreselection (self.containerName, '')
417  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'jvtEfficiency')
418  config.addSelection (self.containerName, 'baselineJvt', 'jvt_selection,as_char', preselection=False)
419 
420  if self.runFJvtSelection :
421  assert self.jetInput=="EMPFlow", "fJvt WPs and SFs only valid for PFlow jets"
422  alg = config.createAlgorithm('CP::AsgSelectionAlg', 'FJvtSelectionAlg')
423  config.addPrivateTool('selectionTool', 'CP::FJvtSelectionTool')
424  alg.selectionTool.JetContainer = config.readName(self.containerName)
425  alg.selectionTool.WorkingPoint = self.fJvtWP
426  alg.selectionDecoration = "fjvt_selection,as_char"
427  alg.particles = config.readName(self.containerName)
428 
429  if self.runFJvtEfficiency and config.dataType() is not DataType.Data:
430  alg = config.createAlgorithm( 'CP::JvtEfficiencyAlg', 'FJvtEfficiencyAlg' )
431  config.addPrivateTool( 'efficiencyTool', 'CP::FJvtEfficiencyTool' )
432  alg.efficiencyTool.JetContainer = config.readName(self.containerName)
433  alg.efficiencyTool.WorkingPoint = self.fJvtWP
434  if config.geometry() is LHCPeriod.Run2:
435  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/fJvtSFFile_Run2_EMPFlow.root"
436  else:
437  alg.efficiencyTool.SFFile = "JetJvtEfficiency/May2024/fJvtSFFile_Run3_EMPFlow.root"
438  alg.selection = 'fjvt_selection,as_char'
439  alg.scaleFactorDecoration = 'fjvt_effSF_%SYS%'
440  alg.outOfValidity = 2
441  alg.outOfValidityDeco = 'no_fjvt'
442  alg.skipBadEfficiency = False
443  alg.jets = config.readName (self.containerName)
444  alg.preselection = config.getPreselection (self.containerName, '')
445  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'fjvtEfficiency')
446  config.addSelection (self.containerName, 'baselineFJvt', 'fjvt_selection,as_char', preselection=False)
447 
448  # Additional decorations
449  alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'AsgEnergyDecoratorAlg' )
450  alg.particles = config.readName (self.containerName)
451 
452  config.addOutputVar (self.containerName, 'e_%SYS%', 'e')
453 
454 

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection

Definition at line 292 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput

Definition at line 216 of file JetAnalysisConfig.py.

◆ systematicsModelJER

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER

Definition at line 188 of file JetAnalysisConfig.py.

◆ systematicsModelJES

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES

Definition at line 188 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.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