262 def makeAlgs (self, config) :
264 jetCollectionName=self.jetCollection
265 if(self.jetCollection==
"AnalysisJets") :
266 jetCollectionName=
"AntiKt4EMPFlowJets"
267 if(self.jetCollection==
"AnalysisLargeRJets") :
268 jetCollectionName=
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
270 if self.jetInput
not in [
"EMTopo",
"EMPFlow"]:
272 "Unsupported input type '{0}' for R=0.4 jets!".
format(self.jetInput) )
274 if self.jvtWP
not in [
"FixedEffPt"]:
276 "Unsupported NNJvt WP '{0}'".
format(self.jvtWP) )
278 if self.fJvtWP
not in [
"Loose",
"Tight",
"Tighter"]:
280 "Unsupported fJvt WP '{0}'".
format(self.fJvtWP) )
282 if not config.isPhyslite()
or self.recalibratePhyslite:
284 alg = config.createAlgorithm(
'CP::JetCalibrationAlg',
'JetCalibrationAlg'+self.containerName )
285 config.addPrivateTool(
'calibrationTool',
'JetCalibrationTool' )
286 alg.calibrationTool.JetCollection = jetCollectionName[:-4]
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"
296 if config.dataType()
is DataType.FastSim:
297 configFile =
"JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config"
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'
309 if self.jetInput ==
"EMPFlow":
310 alg.calibrationTool.CalibSequence =
'JetArea_Residual_EtaJES_GSC'
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)
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,
'')
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,
'')
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' )
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
347 if self.runFJvtUpdate :
348 alg = config.createAlgorithm(
'CP::JetModifierAlg',
'JetModifierAlg'+self.containerName )
349 config.addPrivateTool(
'modifierTool',
'JetForwardJvtTool')
350 alg.modifierTool.OutputDec =
"passFJVT_internal"
351 alg.modifierTool.FJVTName =
"fJVT"
354 alg.modifierTool.EtaThresh = 2.5
355 alg.modifierTool.ForwardMaxPt = 120*GeV
356 alg.modifierTool.RenounceOutputs =
True
357 alg.jets = config.readName (self.containerName)
358 alg.jetsOut = config.copyName (self.containerName)
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)
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"
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)
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)
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"
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)
421 alg = config.createAlgorithm(
'CP::AsgEnergyDecoratorAlg',
'EnergyDecorator' + self.containerName )
422 alg.particles = config.readName (self.containerName)
424 config.addOutputVar (self.containerName,
'e_%SYS%',
'e')