155 jetInput, postfix = '',
156 runJvtUpdate = False, runNNJvtUpdate = False, runFJvtUpdate = False,
157 runJvtSelection = True, runFJvtSelection = False,
158 runJvtEfficiency = True, runFJvtEfficiency = False,
159 reduction = "Category", JEROption = "Full"):
160 """Add algorithms for the R=0.4 jets.
163 seq -- The sequence to add the algorithms to
164 dataType -- The data type to run on ("data", "mc" or "afii")
165 jetCollection -- The jet container to run on.
166 jetInput -- The type of input used, read from the collection name.
167 postfix -- String to be added to the end of all public names.
168 runJvtUpdate -- Determines whether or not to update JVT on the jets
169 runNNJvtUpdate -- Determines whether or not to update NN JVT on the jets
170 runFJvtUpdate -- Determines whether or not to update forward JVT on the jets
171 runJvtSelection -- Determines whether or not to run JVT selection on the jets
172 runFJvtSelection -- Determines whether or not to run forward JVT selection on the jets
173 runJvtEfficiency -- Determines whether or not to calculate the JVT efficiency
174 runFJvtEfficiency -- Determines whether or not to calculate the forward JVT efficiency
175 reduction -- Which NP reduction scheme should be used (All, Global, Category, Scenario)
176 JEROption -- Which variant of the reduction should be used (All, Full, Simple). Note that not all combinations of reduction and JEROption are valid!
179 jetCollectionName=jetCollection
180 if(jetCollection==
"AnalysisJets") :
181 jetCollectionName=
"AntiKt4EMPFlowJets"
182 if(jetCollection==
"AnalysisLargeRJets") :
183 jetCollectionName=
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
185 if jetInput
not in [
"EMTopo",
"EMPFlow"]:
187 "Unsupported input type '{0}' for R=0.4 jets!".
format(jetInput) )
190 assert jetInput==
"EMPFlow",
"NN JVT only defined for PFlow jets"
192 if (runJvtEfficiency
or runFJvtEfficiency)
and dataType !=
"data":
194 alg =
createAlgorithm(
'CP::JetDecoratorAlg',
'JetPileupLabelAlg'+postfix )
196 alg.decorator.RecoJetContainer = jetCollection
197 alg.decorator.SuppressOutputDependence=
True
199 seq.append(alg, inputPropName =
'jets', outputPropName =
'jetsOut', stageName =
'selection')
200 seq.addDecorAwareTool(tool=alg.decorator,parent=alg,outputPropName=
'RecoJetContainer')
203 alg =
createAlgorithm(
'CP::JetCalibrationAlg',
'JetCalibrationAlg'+postfix )
205 alg.calibrationTool.JetCollection = jetCollectionName[:-4]
207 if jetInput ==
"EMPFlow":
208 configFile =
"PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config"
210 if dataType ==
'afii':
211 configFile =
"JES_MC16Recommendation_AFII_{0}_Apr2019_Rel21.config"
213 configFile =
"JES_MC16Recommendation_Consolidated_{0}_Apr2019_Rel21.config"
214 configFile = configFile.format(jetInput)
215 alg.calibrationTool.ConfigFile = configFile
216 if dataType ==
'data':
217 alg.calibrationTool.CalibSequence =
'JetArea_Residual_EtaJES_GSC_Insitu'
219 if jetInput ==
"EMPFlow":
220 alg.calibrationTool.CalibSequence =
'JetArea_Residual_EtaJES_GSC'
222 alg.calibrationTool.CalibSequence =
'JetArea_Residual_EtaJES_GSC_Smear'
223 alg.calibrationTool.IsData = (dataType ==
'data')
224 seq.append( alg, inputPropName =
'jets', outputPropName =
'jetsOut', stageName =
'calibration')
228 if reduction ==
"All" and JEROption ==
"All":
229 alg.uncertaintiesTool.ConfigFile =
"R4_AllNuisanceParameters_AllJERNP.config"
230 elif "Scenario" in reduction:
231 if JEROption !=
"Simple":
233 "Invalid uncertainty configuration - Scenario* reductions can "
234 "only be used together with the Simple JEROption")
235 configFile =
"R4_{0}_SimpleJER.config".
format(reduction)
236 elif reduction
in [
"Global",
"Category"]
and JEROption
in [
"Simple",
"Full"]:
237 configFile =
"R4_{0}Reduction_{1}JER.config".
format(reduction, JEROption)
240 "Invalid combination of reduction and JEROption settings: "
241 "reduction: {0}, JEROption: {1}".
format(reduction, JEROption) )
243 alg =
createAlgorithm(
'CP::JetUncertaintiesAlg',
'JetUncertaintiesAlg'+postfix )
244 addPrivateTool( alg,
'uncertaintiesTool',
'JetUncertaintiesTool' )
245 alg.uncertaintiesTool.JetDefinition = jetCollectionName[:-4]
247 alg.uncertaintiesTool.ConfigFile =
"rel22/Summer2023_PreRec/"+configFile
248 alg.uncertaintiesTool.MCType =
"MC20"
249 alg.uncertaintiesTool.IsData = (dataType ==
'data')
250 seq.append( alg, inputPropName =
'jets', outputPropName =
'jetsOut',
251 stageName =
'calibration' )
257 alg.jvtTool.JetContainer = jetCollection
258 alg.jvtTool.SuppressInputDependence=
True
260 seq.append( alg, inputPropName =
'jets', outputPropName =
'jetsOut', stageName =
'selection' )
263 alg =
createAlgorithm(
'CP::JetDecoratorAlg',
'NNJvtUpdateAlg'+postfix )
264 addPrivateTool( alg,
'decorator',
'JetPileupTag::JetVertexNNTagger' )
266 alg.decorator.JetContainer = jetCollection
267 alg.decorator.SuppressInputDependence=
True
268 alg.decorator.SuppressOutputDependence=
True
270 seq.append(alg, inputPropName =
'jets', outputPropName =
'jetsOut', stageName =
'selection')
271 seq.addDecorAwareTool(tool=alg.decorator,parent=alg,outputPropName=
'JetContainer')
274 alg =
createAlgorithm(
'CP::JetModifierAlg',
'JetModifierAlg'+postfix )
276 alg.modifierTool.OutputDec =
"passFJVT_internal"
277 alg.modifierTool.FJVTName =
"fJVT"
280 alg.modifierTool.EtaThresh = 2.5
281 alg.modifierTool.ForwardMaxPt = 120.0e3
282 alg.modifierTool.RenounceOutputs =
True
283 seq.append( alg, inputPropName =
'jets', outputPropName =
'jetsOut', stageName =
'selection' )
287 alg =
createAlgorithm(
"CP::AsgSelectionAlg",
"JvtSelectionAlg"+postfix)
289 alg.selectionTool.MaxPtForJvt = 60e3
if jetInput ==
"EMPFlow" else 120e3
290 alg.selectionTool.WorkingPoint =
"FixedEffPt"
291 alg.selectionDecoration =
'jvt_selection'
292 seq.append( alg, inputPropName =
'particles', stageName =
'selection' )
295 if runJvtEfficiency
and dataType !=
"data":
296 alg =
createAlgorithm(
'CP::JvtEfficiencyAlg',
'JvtEfficiencyAlg'+postfix )
297 addPrivateTool( alg,
'efficiencyTool',
'CP::NNJvtEfficiencyTool' )
298 alg.efficiencyTool.MaxPtForJvt = 60e3
if jetInput ==
"EMPFlow" else 120e3
299 alg.efficiencyTool.WorkingPoint =
"FixedEffPt"
300 alg.selection =
'jvt_selection'
301 alg.scaleFactorDecoration =
'jvt_effSF_%SYS%'
302 alg.outOfValidity = 2
303 alg.outOfValidityDeco =
'no_jvt'
304 alg.skipBadEfficiency = 0
305 seq.append( alg, inputPropName =
'jets', stageName =
'efficiency' )
308 alg =
createAlgorithm(
"CP::AsgSelectionAlg",
"FJvtSelectionAlg"+postfix)
310 alg.selectionTool.JvtMomentName =
"fJVT" if runFJvtUpdate
else "DFCommonJets_fJvt"
311 alg.selectionTool.WorkingPoint =
"Loose"
312 alg.selectionDecoration =
'fjvt_selection'
313 seq.append( alg, inputPropName =
'particles', stageName =
'selection' )
316 if runFJvtEfficiency
and dataType !=
"data":
317 alg =
createAlgorithm(
'CP::JvtEfficiencyAlg',
'JvtEfficiencyAlg'+postfix )
319 alg.efficiencyTool.WorkingPoint =
"Loose"
320 alg.efficiencyTool.SFFile = f
"JetJvtEfficiency/May2020/fJvtSFFile.{jetInput}.root"
321 alg.selection =
'fjvt_selection'
322 alg.scaleFactorDecoration =
'fjvt_effSF_%SYS%'
323 alg.outOfValidity = 2
324 alg.outOfValidityDeco =
'no_fjvt'
325 alg.skipBadEfficiency = 0
326 seq.append( alg, inputPropName =
'jets', stageName =
'efficiency' )