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 ('runJERsystematicsOnData', False, type=bool,
138  info="whether to run the All/Full JER model variations also on data samples. Expert option!")
139  self.addOption ('recalibratePhyslite', True, type=bool,
140  info="whether to run the CP::JetCalibrationAlg on PHYSLITE derivations. "
141  "The default is True.")
142  # Calibration tool options
143  self.addOption ('calibToolConfigFile', None, type=str,
144  info="name (str) of the config file to use for the jet calibration "
145  "tool. Expert option to override JetETmiss recommendations. The "
146  "default is None.")
147  self.addOption ('calibToolCalibArea', None, type=str,
148  info="name (str) of the CVMFS area to use for the jet calibration "
149  "tool. Expert option to override JetETmiss recommendations. The "
150  "default is None.")
151  self.addOption ('calibToolCalibSeq', None, type=str,
152  info="name (str) of the sequence to use for the jet calibration "
153  "tool (e.g. 'JetArea_Residual_EtaJES_GSC'). Expert option to override "
154  "JetETmiss recommendations. The default is None.")
155  # Uncertainties tool options
156  self.addOption ('uncertToolConfigPath', None, type=str,
157  info="name (str) of the config file to use for the jet uncertainty "
158  "tool. Expert option to override JetETmiss recommendations. The "
159  "default is None.")
160  self.addOption ('uncertToolCalibArea', None, type=str,
161  info="name (str) of the CVMFS area to use for the jet uncertainty "
162  "tool. Expert option to override JetETmiss recommendations. The "
163  "default is None.")
164  self.addOption ('uncertToolMCType', None, type=str,
165  info="data type (str) to use for the jet uncertainty tool (e.g. "
166  "'AF3' or 'MC16'). Expert option to override JetETmiss "
167  "recommendations. The default is None.")
168 
169 

Member Function Documentation

◆ createUncertaintyTool()

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

Definition at line 224 of file JetAnalysisConfig.py.

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

◆ getUncertaintyToolSettings()

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

Definition at line 170 of file JetAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 262 of file JetAnalysisConfig.py.

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

Member Data Documentation

◆ jetCollection

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetCollection

Definition at line 265 of file JetAnalysisConfig.py.

◆ jetInput

python.JetAnalysisConfig.SmallRJetAnalysisConfig.jetInput

Definition at line 288 of file JetAnalysisConfig.py.

◆ systematicsModelJER

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJER

Definition at line 178 of file JetAnalysisConfig.py.

◆ systematicsModelJES

python.JetAnalysisConfig.SmallRJetAnalysisConfig.systematicsModelJES

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