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

Public Attributes

 systematicsModelJES
 
 systematicsModelJER
 
 jetCollection
 
 jetInput
 

Detailed Description

the ConfigBlock for the small-r jet sequence

Definition at line 97 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 100 of file JetAnalysisConfig.py.

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

Member Function Documentation

◆ createUncertaintyTool()

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

Definition at line 222 of file JetAnalysisConfig.py.

222  def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
223 
224  # Create an instance of JetUncertaintiesTool, following JetETmiss recommendations.
225  # To run Jet Energy Resolution (JER) uncertainties in the "Full" or "All" schemes,
226  # we need two sets of tools: one configured as normal (MC), the other with the
227  # exact same settings but pretending to run on data (pseudo-data).
228  # This is achieved by passing "isPseudoData=True" to the arguments.
229 
230  # Retrieve the common configuration settings
231  configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
232 
233  # The main tool for all JES+JER combinations
234  config.addPrivateTool( 'uncertaintiesTool', 'JetUncertaintiesTool' )
235  jetUncertaintiesAlg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
236  jetUncertaintiesAlg.uncertaintiesTool.ConfigFile = configFile
237  if calibArea is not None:
238  jetUncertaintiesAlg.uncertaintiesTool.CalibArea = calibArea
239  jetUncertaintiesAlg.uncertaintiesTool.MCType = mcType
240  jetUncertaintiesAlg.uncertaintiesTool.IsData = (config.dataType() is DataType.Data)
241  jetUncertaintiesAlg.uncertaintiesTool.PseudoDataJERsmearingMode = False
242 
243  if doPseudoData:
244  # The secondary tool for pseudo-data JER smearing
245  config.addPrivateTool( 'uncertaintiesToolPD', 'JetUncertaintiesTool' )
246  jetUncertaintiesAlg.uncertaintiesToolPD.JetDefinition = jetCollectionName[:-4]
247  jetUncertaintiesAlg.uncertaintiesToolPD.ConfigFile = configFile
248  if calibArea is not None:
249  jetUncertaintiesAlg.uncertaintiesToolPD.CalibArea = calibArea
250  jetUncertaintiesAlg.uncertaintiesToolPD.MCType = mcType
251 
252  # This is the part that is different!
253  jetUncertaintiesAlg.uncertaintiesToolPD.IsData = True
254  jetUncertaintiesAlg.uncertaintiesToolPD.PseudoDataJERsmearingMode = True
255 
256 

◆ getUncertaintyToolSettings()

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

Definition at line 168 of file JetAnalysisConfig.py.

168  def getUncertaintyToolSettings(self, config):
169 
170  # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
171  # We do this separately from the tool declaration, as we may need to set uo
172  # two such tools, but they have to be private.
173 
174  # Config file:
175  config_file = None
176  if self.systematicsModelJES == "All" and self.systematicsModelJER == "All":
177  config_file = "R4_AllNuisanceParameters_AllJERNP.config"
178  elif "Scenario" in self.systematicsModelJES:
179  if self.systematicsModelJER != "Simple":
180  raise ValueError(
181  "Invalid uncertainty configuration - Scenario* systematicsModelJESs can "
182  "only be used together with the Simple systematicsModelJER")
183  config_file = "R4_{0}_SimpleJER.config".format(self.systematicsModelJES)
184  elif self.systematicsModelJES in ["Global", "Category"] and self.systematicsModelJER in ["Simple", "Full"]:
185  config_file = "R4_{0}Reduction_{1}JER.config".format(self.systematicsModelJES, self.systematicsModelJER)
186  else:
187  raise ValueError(
188  "Invalid combination of systematicsModelJES and systematicsModelJER settings: "
189  "systematicsModelJES: {0}, systematicsModelJER: {1}".format(self.systematicsModelJES, self.systematicsModelJER) )
190 
191  # Calibration area:
192  calib_area = None
193  if self.uncertToolCalibArea is not None:
194  calib_area = self.uncertToolCalibArea
195 
196  # Expert override for config path:
197  if self.uncertToolConfigPath is not None:
198  config_file = self.uncertToolConfigPath
199  else:
200  if config.geometry() is LHCPeriod.Run2:
201  config_file = "rel22/Summer2023_PreRec/" + config_file
202  else:
203  config_file = "rel22/Summer2024_PreRec/" + config_file
204 
205  # MC type:
206  mc_type = None
207  if self.uncertToolMCType is not None:
208  mc_type = self.uncertToolMCType
209  else:
210  if config.dataType() is DataType.FastSim and config.geometry() is LHCPeriod.Run2:
211  # not supported for Run 3 yet!
212  mc_type = "AF3"
213  else:
214  if config.geometry() is LHCPeriod.Run2:
215  mc_type = "MC20"
216  else:
217  mc_type = "MC23"
218 
219  return config_file, calib_area, mc_type
220 
221 

◆ makeAlgs()

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

Definition at line 257 of file JetAnalysisConfig.py.

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

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection

Definition at line 260 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput

Definition at line 283 of file JetAnalysisConfig.py.

◆ systematicsModelJER

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER

Definition at line 176 of file JetAnalysisConfig.py.

◆ systematicsModelJES

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES

Definition at line 176 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:569