Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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, containerName='', jetCollection='', jetInput='')
 
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 104 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 107 of file JetAnalysisConfig.py.

107  def __init__ (self, containerName='', jetCollection='', jetInput='') :
108  super (SmallRJetAnalysisConfig, self).__init__ ()
109  self.addOption ('containerName', containerName, type=str,
110  noneAction='error',
111  info="the name of the output container after calibration.")
112  self.addOption ('jetCollection', jetCollection, type=str,
113  noneAction='error',
114  info="the jet container to run on. It is interpreted to determine "
115  "the correct config blocks to call for small- or large-R jets.")
116  # TODO: add info string
117  self.addOption ('jetInput', jetInput, type=str,
118  noneAction='error',
119  info="")
120  self.addOption ('runJvtUpdate', False, type=bool,
121  info="whether to update the JVT. The default is False.")
122  self.addOption ('runNNJvtUpdate', False, type=bool,
123  info="whether to update the NN-JVT. The default is False.")
124  self.addOption ('runFJvtUpdate', False, type=bool,
125  info="whether to update the forward 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 
176 

Member Function Documentation

◆ createUncertaintyTool()

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

Definition at line 248 of file JetAnalysisConfig.py.

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

◆ getUncertaintyToolSettings()

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

Definition at line 177 of file JetAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 286 of file JetAnalysisConfig.py.

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

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection

Definition at line 289 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput

Definition at line 213 of file JetAnalysisConfig.py.

◆ systematicsModelJER

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER

Definition at line 185 of file JetAnalysisConfig.py.

◆ systematicsModelJES

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES

Definition at line 185 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