257 def makeAlgs (self, config) :
259 jetCollectionName=self.jetCollection
260 if(self.jetCollection==
"AnalysisJets") :
261 jetCollectionName=
"AntiKt4EMPFlowJets"
262 if(self.jetCollection==
"AnalysisLargeRJets") :
263 jetCollectionName=
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
265 if self.jetInput
not in [
"EMTopo",
"EMPFlow"]:
267 "Unsupported input type '{0}' for R=0.4 jets!".
format(self.jetInput) )
269 if self.jvtWP
not in [
"FixedEffPt"]:
271 "Unsupported NNJvt WP '{0}'".
format(self.jvtWP) )
273 if self.fJvtWP
not in [
"Loose",
"Tight",
"Tighter"]:
275 "Unsupported fJvt WP '{0}'".
format(self.fJvtWP) )
277 if not config.isPhyslite()
or self.recalibratePhyslite:
279 alg = config.createAlgorithm(
'CP::JetCalibrationAlg',
'JetCalibrationAlg'+self.containerName )
280 config.addPrivateTool(
'calibrationTool',
'JetCalibrationTool' )
281 alg.calibrationTool.JetCollection = jetCollectionName[:-4]
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"
291 if config.dataType()
is DataType.FastSim:
292 configFile =
"JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config"
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'
304 if self.jetInput ==
"EMPFlow":
305 alg.calibrationTool.CalibSequence =
'JetArea_Residual_EtaJES_GSC'
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)
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,
'')
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,
'')
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' )
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
342 if self.runFJvtUpdate :
343 alg = config.createAlgorithm(
'CP::JetModifierAlg',
'JetModifierAlg'+self.containerName )
344 config.addPrivateTool(
'modifierTool',
'JetForwardJvtTool')
345 alg.modifierTool.OutputDec =
"passFJVT_internal"
346 alg.modifierTool.FJVTName =
"fJVT"
349 alg.modifierTool.EtaThresh = 2.5
350 alg.modifierTool.ForwardMaxPt = 120*GeV
351 alg.modifierTool.RenounceOutputs =
True
352 alg.jets = config.readName (self.containerName)
353 alg.jetsOut = config.copyName (self.containerName)
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)
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"
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)
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)
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"
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)
416 alg = config.createAlgorithm(
'CP::AsgEnergyDecoratorAlg',
'EnergyDecorator' + self.containerName )
417 alg.particles = config.readName (self.containerName)
419 config.addOutputVar (self.containerName,
'e_%SYS%',
'e')