ATLAS Offline Software
JetObjectCollectionMaker.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: JetObjectCollectionMaker.cxx 809674 2017-08-23 14:10:24Z iconnell $
9 #include "TopEvent/EventTools.h"
10 
11 #include "xAODJet/JetContainer.h"
14 #include "xAODCore/ShallowCopy.h"
18 
20 
24 
25 namespace top {
27  asg::AsgTool(name),
28  m_config(nullptr),
29  m_doFull_JER(false),
30  m_doFull_JER_Pseudodata(false),
31  m_doFull_JER_largeR(false),
32  m_doFull_JER_largeR_Pseudodata(false),
33  m_isMC(false),
34  m_doMultipleJES(false),
35 
36  m_specifiedSystematics(),
37  m_specifiedSystematicsLargeR(),
38  m_specifiedSystematicsTrackJets(),
39  m_recommendedSystematics(),
40  m_nominalSystematicSet(),
41 
42  m_jetCalibrationTool("JetCalibrationTool"),
43  m_jetCalibrationToolLargeR("JetCalibrationToolLargeR"),
44 
45  m_jetUncertaintiesTool("JetUncertaintiesTool"),
46  m_jetUncertaintiesToolPseudoData("JetUncertaintiesToolPseudoData"),
47  m_jetUncertaintiesToolReducedNPScenario1("JetUncertaintiesToolReducedNPScenario1"),
48  m_jetUncertaintiesToolReducedNPScenario2("JetUncertaintiesToolReducedNPScenario2"),
49  m_jetUncertaintiesToolReducedNPScenario3("JetUncertaintiesToolReducedNPScenario3"),
50  m_jetUncertaintiesToolReducedNPScenario4("JetUncertaintiesToolReducedNPScenario4"),
51  m_jetUncertaintiesToolLargeR("JetUncertaintiesToolLargeR"),
52  m_jetUncertaintiesToolLargeRPseudoData("JetUncertaintiesToolLargeRPseudoData"),
53  m_FFJetSmearingTool("FFJetSmearingTool"),
54 
55  m_jetJvtEfficiencyTool("JetJvtEfficiencyTool"),
56  m_jetSelectfJvtTool("JetSelectfJvtTool"),
57 
58  m_jetSubstructure(nullptr),
59 
60  m_systMap_AllNP(),
61  m_systMap_JERPseudo(),
62  m_systMap_ReducedNPScenario1(),
63  m_systMap_ReducedNPScenario2(),
64  m_systMap_ReducedNPScenario3(),
65  m_systMap_ReducedNPScenario4(),
66  m_systMap_LargeR(),
67  m_systMap_LargeR_JERPseudo() {
68  declareProperty("config", m_config);
69 
70  declareProperty("JetCalibrationTool", m_jetCalibrationTool);
71  declareProperty("JetCalibrationToolLargeR", m_jetCalibrationToolLargeR);
72 
73  declareProperty("JetUncertaintiesTool", m_jetUncertaintiesTool);
74  declareProperty("JetUncertaintiesToolPseudoData", m_jetUncertaintiesToolPseudoData);
75  declareProperty("JetUncertaintiesToolReducedNPScenario1", m_jetUncertaintiesToolReducedNPScenario1);
76  declareProperty("JetUncertaintiesToolReducedNPScenario2", m_jetUncertaintiesToolReducedNPScenario2);
77  declareProperty("JetUncertaintiesToolReducedNPScenario3", m_jetUncertaintiesToolReducedNPScenario3);
78  declareProperty("JetUncertaintiesToolReducedNPScenario4", m_jetUncertaintiesToolReducedNPScenario4);
79  declareProperty("JetUncertaintiesToolLargeR", m_jetUncertaintiesToolLargeR);
80  declareProperty("JetUncertaintiesToolLargeRPseudoData", m_jetUncertaintiesToolLargeRPseudoData);
81  declareProperty("FFJetSmearingTool", m_FFJetSmearingTool);
82 
83  declareProperty("JetJvtEfficiencyTool", m_jetJvtEfficiencyTool);
84 
85  declareProperty("TruthJetCollectionForHSTagging", m_truthJetCollForHS = "AntiKt4TruthDressedWZJets");
86  }
87 
89  ATH_MSG_INFO(" top::JetObjectCollectionMaker initialize");
90 
97 
98 
99  top::check(m_jetCalibrationTool.retrieve(), "Failed to retrieve JetCalibrationTool");
100  if (m_config->useLargeRJets()) {
102  "Failed to retrieve JetCalibrationToolLargeR");
103 
104  // Retrieve large-R jet uncertainties tools
105  // (Commented out until large-R jet uncertainty prescriptions become available)
106  // top::check(m_jetUncertaintiesToolLargeR.retrieve(),
107  // "Failed to retrieve JetUncertaintiesToolLargeR");
108  // if (m_config->isMC() && m_config->doLargeRPseudodataJER())
109  // top::check(m_jetUncertaintiesToolLargeRPseudoData.retrieve(),
110  // "Failed to retrieve JetUncertaintiesToolLargeRPseudoData");
111  // if (!m_config->isSystNominal(m_config->systematics()))
112  // top::check(m_FFJetSmearingTool.retrieve(),
113  // "Failed to retrieve FFJetSmearingTool");
114  }
115 
117  if (m_config->jetJERSmearingModel() == "Full" || m_config->jetJERSmearingModel() == "All") m_doFull_JER = true;
118  if (m_config->jetJERSmearingModel() == "Simple") m_doFull_JER = false;
119  if (m_config->jetJERSmearingModel() == "Full_PseudoData" ||
120  m_config->jetJERSmearingModel() == "All_PseudoData") m_doFull_JER_Pseudodata = true;
121  else m_doFull_JER_Pseudodata = false;
122 
124  if (!m_config->isMC() && (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") == std::string::npos)
125  m_doFull_JER_largeR = true;
126  else m_doFull_JER_largeR = false;
127  if (m_config->isMC() && m_config->doLargeRPseudodataJER() && (m_config->largeRJetUncertainties_NPModel()).find("_SimpleJER_") == std::string::npos)
129  else m_doFull_JER_largeR_Pseudodata = false;
130 
131  m_isMC = m_config->isMC();
132  m_doMultipleJES = m_config->doMultipleJES();
133 
134 
135  if (m_isMC || m_doFull_JER) {
136  if (!m_doMultipleJES) {
137  top::check(m_jetUncertaintiesTool.retrieve(), "Failed to retrieve JetUncertaintiesTool");
139  top::check(m_jetUncertaintiesToolPseudoData.retrieve(), "Failed to retrieve JetUncertaintiesTool for pseudo data");
140  }
141  } else {
142  top::check(
144  "Failed to retrieve JetUncertaintiesToolReducedNPScenario1");
145  top::check(
147  "Failed to retrieve JetUncertaintiesToolReducedNPScenario2");
148  top::check(
150  "Failed to retrieve JetUncertaintiesToolReducedNPScenario3");
151  top::check(
153  "Failed to retrieve JetUncertaintiesToolReducedNPScenario4");
154  }
155  }
156 
157  // Use JetJvtEfficiencyTool to recalculate scores for NNJvt algorithm
158  top::check(m_jetJvtEfficiencyTool.retrieve(), "Failed to retrieve JetJvtEfficiencyTool");
159 
160  //fJVT tool isn't setup unless requested
161  if (m_config->doForwardJVTinMET() || m_config->getfJVTWP() != "None") {
162  top::check(m_jetSelectfJvtTool.retrieve(), "Failed to retrieve JetSelectfJvtTool");
163  }
164  // Take this from the TopConfiguration
165  // A blank vector will setup all systematics
166 
167  const std:: string& syststr = m_config->systematics();
168  std::set<std::string> syst, systLargeR;
169 
170 
171  if (!m_config->isSystNominal(syststr) && !m_config->isSystAll(syststr)) {
172  bool ok = m_config->getSystematicsList(syststr, syst);
173  bool okLargeR = m_config->getSystematicsList(syststr, systLargeR);
174 
175 
176  if (!ok || !okLargeR) {
177  ATH_MSG_ERROR(" top::JetObjectCollectionMaker could not determine systematic list");
178  return StatusCode::FAILURE;
179  }
180  //here the idea is that if the user specifies AllXXX, we leave syst as an empty string, so that all recommended CP
181  // systematics are then used
182  if (m_config->contains(syst, "AllJets")) {
183  syst.clear();
184  systLargeR.clear();
185  }
186  if (m_config->contains(syst, "AllSmallRJets")) {
187  syst.clear();
188  }
189  if (m_config->contains(systLargeR, "AllLargeRJets")) {
190  systLargeR.clear();
191  }
192  }
193 
195  if (m_isMC || m_doFull_JER) {
196  std::string allNP(""),
197  np1("SR_Scenario1_"), np2("SR_Scenario2_"), np3("SR_Scenario3_"), np4("SR_Scenario4_");
198 
199  bool onlyJER = ((!m_isMC) && m_doFull_JER) || (m_isMC && m_doFull_JER_Pseudodata);
200 
201  if (!m_doMultipleJES) {
202  if (!m_isMC && m_doFull_JER) { // full JER on data = only JER systematics
203  addSystematics(syst, m_jetUncertaintiesTool->recommendedSystematics(), m_systMap_AllNP, allNP, false, true, false);
204  } else { // if it is MC run all JES/JER
205  addSystematics(syst, m_jetUncertaintiesTool->recommendedSystematics(), m_systMap_AllNP, allNP, false, false, false);
206  }
207  if (m_doFull_JER_Pseudodata) { // if it is PseudoData JER run extra PD smearing
208  addSystematics(syst, m_jetUncertaintiesToolPseudoData->recommendedSystematics(), m_systMap_JERPseudo, allNP, false, true, true);
209  }
210  } else {
211  addSystematics(syst,
212  m_jetUncertaintiesToolReducedNPScenario1->recommendedSystematics(), m_systMap_ReducedNPScenario1, np1, false,
213  onlyJER, false);
214  addSystematics(syst,
215  m_jetUncertaintiesToolReducedNPScenario2->recommendedSystematics(), m_systMap_ReducedNPScenario2, np2, false,
216  onlyJER, false);
217  addSystematics(syst,
218  m_jetUncertaintiesToolReducedNPScenario3->recommendedSystematics(), m_systMap_ReducedNPScenario3, np3, false,
219  onlyJER, false);
220  addSystematics(syst,
221  m_jetUncertaintiesToolReducedNPScenario4->recommendedSystematics(), m_systMap_ReducedNPScenario4, np4, false,
222  onlyJER, false);
223  }
224  }
225 
226 
228  CP::SystematicSet largeRsysts;
229  if ((m_isMC || m_doFull_JER_largeR) && m_config->useLargeRJets()) {
230  ATH_MSG_WARNING("No Large-R jet systematic recommendations are available yet! Large-R jet systematics skipped!");
231  // largeRsysts.insert(m_jetUncertaintiesToolLargeR->recommendedSystematics());
232  // if (!m_config->isSystNominal(m_config->systematics()))
233  // largeRsysts.insert(m_FFJetSmearingTool->recommendedSystematics());
234  }
235 
236 
238  if (m_config->isMC() && m_config->useLargeRJets()) {
239  for (const auto& name : m_config->boostedTaggerSFnames()) {
240  ToolHandle<ICPJetUncertaintiesTool> tmp_SF_uncert_tool("JetSFuncert_" + name.first);
241  if (tmp_SF_uncert_tool.retrieve()) {
242 
243  m_tagSFUncorrelatedSystematics[name.first].clear();
244  CP::SystematicSet correlatedSys, uncorrelatedSys;
245  const CP::SystematicSet& recommendedSys = tmp_SF_uncert_tool->recommendedSystematics();
246 
247  for (const CP::SystematicVariation& sys : recommendedSys) {
248  // Splitting uncertainties into two categories
249  // correlated will get a special tree
250  // uncorrelated SFs will be stored in the nominal tree
251  bool res = ((sys.name().find("TopTag") == std::string::npos) &&
252  (sys.name().find("WTag") == std::string::npos) &&
253  (sys.name().find("ZTag") == std::string::npos) &&
254  (sys.name().find("JetTag") == std::string::npos) &&
255  (sys.name().find("bTag") == std::string::npos));
256  res ? correlatedSys.insert(sys) : uncorrelatedSys.insert(sys);
257  }
258 
261  if(sys.name()!="") m_tagSFSysNames[name.first].push_back(name.first + "_" + sys.name());
262  }
263  largeRsysts.insert(correlatedSys);
264  m_tagSFuncertTool[name.first] = tmp_SF_uncert_tool;
265  }
266  }
267  m_config->setBoostedTaggersSFSysNames(m_tagSFSysNames);
268 
269  }
270 
271 
272  // add the merged set of systematics for large-R jets including the tagging SF systs
273  if ((m_config->isMC() || m_doFull_JER_largeR) && m_config->useLargeRJets()) {
274  std::string allNPlargeR("");
275  addSystematics(systLargeR, largeRsysts, m_systMap_LargeR, allNPlargeR, true, m_doFull_JER_largeR, false);
277  addSystematics(systLargeR, largeRsysts, m_systMap_LargeR_JERPseudo, allNPlargeR, true, true, true);
278  }
279 
281  if (m_config->jetSubstructureName() == "Trimmer") m_jetSubstructure.reset(new top::LargeJetTrimmer);
282 
283  if (m_config->jetSubstructureName() == "SubjetMaker") m_jetSubstructure.reset(new top::SubjetMaker);
284 
286  m_jetTruthLabelingTool = nullptr;
287  if (m_config->isMC() && m_config->useLargeRJets()) {
288  m_jetTruthLabelingTool = std::unique_ptr<JetTruthLabelingTool>(new JetTruthLabelingTool("JetTruthLabeling"));
289  // For DAOD_PHYS we need to pass few more arguments as it uses TRUTH3
290  top::check(m_jetTruthLabelingTool->setProperty("RecoJetContainer", m_config->sgKeyLargeRJets()), "Failed to set RecoJetContainer for m_jetTruthLabelingTool");
291  top::check(m_jetTruthLabelingTool->setProperty("UseTRUTH3", true), "Failed to set UseTRUTH3 for m_jetTruthLabelingTool");
292  top::check(m_jetTruthLabelingTool->setProperty("TruthBosonContainerName", "TruthBoson"), "Failed to set truth container name for m_jetTruthLabelingTool");
293  top::check(m_jetTruthLabelingTool->setProperty("TruthTopQuarkContainerName", "TruthTop"), "Failed to set truth container name for m_jetTruthLabelingTool");
294  top::check(m_jetTruthLabelingTool->initialize(), "Failed to initialize m_jetTruthLabelingTool");
295  }
296 
297 
298  // set the systematics list
299  m_config->systematicsJets(specifiedSystematics());
300  m_config->systematicsLargeRJets(specifiedSystematicsLargeR());
301  m_config->systematicsTrackJets(m_specifiedSystematicsTrackJets);
302 
304  for (const auto& algo : m_config->bTagAlgos()) {
305  m_btagSelToolsDL1Decor[algo.first] = algo.second;
306  top::check(m_btagSelToolsDL1Decor[algo.first].retrieve(), "Failed to retrieve " + algo.first + " btagging selector for " + m_config->sgKeyJets() + ". This is required for b-tagging score decorations in EventSaver!");
307  DLx.emplace(algo.first, SG::AuxElement::Decorator<float>("AnalysisTop_" + algo.first));
308  }
309 
310  if (m_config->useTrackJets()) {
311  for (const auto& algo : m_config->bTagAlgos_trkJet()) {
312  m_btagSelToolsDL1Decor_trkJet[algo.first] = algo.second;
313  top::check(m_btagSelToolsDL1Decor_trkJet[algo.first].retrieve(), "Failed to retrieve " + algo.first + " btagging selector for " + m_config->sgKeyTrackJets() + ". This is required for b-tagging score decorations in EventSaver!");
314  DLx.emplace(algo.first, SG::AuxElement::Decorator<float>("AnalysisTop_" + algo.first));
315  }
316  }
317 
318  // initialize boosted jet taggers -- we have to do it here instead pf TopObjectSelectionTools
319  // because we have to apply tagger inbetween JES uncertainty tool and the tagging SF tool
320  if (m_config->useLargeRJets()) {
321  for (const std::pair<std::string, std::string>& name : m_config->boostedJetTaggers()) {
322  m_boostedJetTaggers[name.second] = ToolHandle<IJetDecorator>(name.second);
323  top::check(m_boostedJetTaggers[name.second].retrieve(), "Failed to retrieve " + name.second);
324  }
325  }
326 
327  return StatusCode::SUCCESS;
328  }
329 
331  bool isLargeR(false);
332 
333  return execute(isLargeR, executeNominal);
334  }
335 
337  bool isLargeR(true);
338 
339  return execute(isLargeR, executeNominal);
340  }
341 
342  StatusCode JetObjectCollectionMaker::execute(const bool isLargeR, bool executeNominal) {
344  if (executeNominal) {
345  // decorating the HS jets with truth info on which are HS jets
346  if (!isLargeR & m_isMC) {
347  top::check(
348  decorateHSJets(),
349  "Failed to decorate jets with truth info of which are HS - this is needed for JVT scale-factors!");
350  if (m_isMC && m_config->jetResponseMatchingDeltaR() > 0) {
351  top::check(decorateMatchedTruth(), "Failed to decorate matched jet");
352  }
353  }
354 
355  // Decorate the DL1 variable
356  top::check(decorateDL1(), "Failed to decorate jets with DL1 b-tagging discriminant");
357 
359  // --///
360  top::check(calibrate(isLargeR), "Failed to calibrate jets");
361  if (isLargeR)
362  top::check(tagNominalLargeRJets(), "Failed to tag large-R jets");
363 
365  return StatusCode::SUCCESS;
366  }
367 
369 
371  if (!isLargeR) {
373  if (m_isMC || m_doFull_JER) {
374  if (!m_doMultipleJES) {
375  top::check(applySystematic(m_jetUncertaintiesTool, m_systMap_AllNP, false), "Failed to apply JES");
377  top::check(applySystematic(m_jetUncertaintiesToolPseudoData, m_systMap_JERPseudo, false), "Failed to apply JES for pseudodata");
378  }
379  }
380  if (m_doMultipleJES) {
382  m_systMap_ReducedNPScenario1), "Failed to apply JES");
384  m_systMap_ReducedNPScenario2), "Failed to apply JES");
386  m_systMap_ReducedNPScenario3), "Failed to apply JES");
388  m_systMap_ReducedNPScenario4), "Failed to apply JES");
389  }
390  }
391  } else {
392  // tag calibrated (nominal) jets -- the tagging information will be available
393  // for systematically-shifted shallow copies as well
394  top::check(tagNominalLargeRJets(), "Failed to tag large-R jets");
395  if (m_isMC || m_doFull_JER_largeR) {
396  top::check(applyTaggingSFSystematic(), "Failed to apply large-R tagging SFs syst.");
398  true), "Failed to apply large-R syst.");
401  true), "Failed to apply large-R pseudodata JER.");
402  }
403  }
404 
405  return StatusCode::SUCCESS;
406  }
407 
410  std::string sgKey = isLargeR ? m_config->sgKeyLargeRJets() : m_config->sgKeyJets();
411 
412  const xAOD::JetContainer* xaod(nullptr);
413  top::check(evtStore()->retrieve(xaod, sgKey), "Failed to retrieve Jets");
414 
416  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer(*xaod);
417 
420  if (isLargeR) {
421  top::check(m_jetCalibrationToolLargeR->applyCalibration(*(shallow_xaod_copy.first)),
422  "Failed to do applyCalibration on large-R jets");
423  if (m_config->isMC()) {
425  top::check(m_jetTruthLabelingTool->decorate(*(shallow_xaod_copy.first)), "Failed to do truth labeling for large-R jet");
426  }
427  } else {
428  top::check(m_jetCalibrationTool->applyCalibration(*(shallow_xaod_copy.first)),
429  "Failed to do applyCalibration on small-R jets");
430  }
431 
433  for (const auto jet : *(shallow_xaod_copy.first)) {
434  if (!isLargeR) {
435  // only multiply by JSF and bJSF if one of them != 1.0 (used by top mass analysis)
436  float JSF = m_config->JSF();
437  float bJSF = m_config->bJSF();
438 
439  if (JSF != 1.0 || bJSF != 1.0) {
440  int truthflav = -1;
441  if (jet->isAvailable<int>("PartonTruthLabelID")) {
442  jet->getAttribute("PartonTruthLabelID", truthflav);
443  }
444 
445  xAOD::JetFourMom_t jet_p4 = jet->jetP4() * JSF;
446  if (truthflav == 5) jet_p4 = jet_p4 * bJSF;
447 
448  jet->setJetP4(jet_p4);
449  }
450  // end application JSF/bJSF
451 
452 
453  top::check(decorateBJets(*jet), "Failed to decorate if b-jet");
454  }
455 
456  if (isLargeR && m_jetSubstructure.get() != nullptr) {
457  m_jetSubstructure->correctJet(*jet);
458  }
459 
460  if (isLargeR) {
462 
463  float tau3 = jet->getAttribute<float>("Tau3_wta");
464  float tau2 = jet->getAttribute<float>("Tau2_wta");
465  float tau1 = jet->getAttribute<float>("Tau1_wta");
466  float ECF1 = jet->getAttribute<float>("ECF1");
467  float ECF2 = jet->getAttribute<float>("ECF2");
468  float ECF3 = jet->getAttribute<float>("ECF3");
469 
470  jet->auxdecor<float>("Tau32_wta") = fabs(tau2) > 1.e-6 ? (tau3 / tau2) : -999; // 999 to match
471  // JetSubStructureMomentTools/NSubjettinessRatiosTool
472  jet->auxdecor<float>("Tau21_wta") = fabs(tau1) > 1.e-6 ? (tau2 / tau1) : -999; // 999 to match
473  // JetSubStructureMomentTools/NSubjettinessRatiosTool
474  // Same definition as in JetSubStructureMomentTools/Root/EnergyCorrelatorRatiosTool.cxx
475  jet->auxdecor<float>("D2") = (ECF2 > 1e-8) ? (ECF3*ECF1*ECF1*ECF1) / (ECF2*ECF2*ECF2) : -999;
476  jet->auxdecor<float>("C2") = (ECF2 > 1e-8) ? (ECF3*ECF1) / (ECF2*ECF2) : -999;
477  jet->auxdecor<float>("E3") = (ECF1 > 1e-8) ? ECF3 / (ECF1*ECF1*ECF1) : -999;
478 
479 
481  const std::string calibChoice = m_config->largeRJESJMSConfig();
482  if (m_config->isMC()) {
483  if (calibChoice == "TAMass") {
484  xAOD::JetFourMom_t jet_calib_p4;
485  jet->getAttribute<xAOD::JetFourMom_t>("JetJMSScaleMomentumTA", jet_calib_p4);
486  jet->setJetP4(jet_calib_p4);
487  }
488  } else { //For data, there's only one config file so special method is required for TA mass and Calos mass
489  if (calibChoice == "CaloMass") {
490  xAOD::JetFourMom_t jetInsituP4_calo;
491  jet->getAttribute<xAOD::JetFourMom_t>("JetInsituScaleMomentumCalo", jetInsituP4_calo);
492  jet->setJetP4(jetInsituP4_calo);
493  } else if (calibChoice == "TAMass") {
494  xAOD::JetFourMom_t jetInsituP4_ta;
495  jet->getAttribute<xAOD::JetFourMom_t>("JetInsituScaleMomentumTA", jetInsituP4_ta);
496  jet->setJetP4(jetInsituP4_ta);
497  }
498  }
499  }
500  }
501 
503  // Recalculate Jvt directly in JetJvtEfficiency tool for NNJvt
504  if (!isLargeR) {
505  top::check(m_jetJvtEfficiencyTool->recalculateScores(*shallow_xaod_copy.first),
506  "Failed to recalculate JVT scores");
507  }
508 
509  // Check if the derivation we are running on contains
510  // MET_Track (once), if so apply the fJVT decoration
511  // if not then don't
512  if (!isLargeR && (m_config->doForwardJVTinMET() || m_config->getfJVTWP() != "None")) {
513  static bool checked_track_MET = false;
514  if (!checked_track_MET) {
515  if (evtStore()->contains<xAOD::MissingETContainer>("MET_Track")) {
516  m_do_fjvt = true;
517  } else {
518  ATH_MSG_ERROR(" Cannot retrieve MET_Track, fJVT values can't be calculated correctly!!");
519  return StatusCode::FAILURE;
520  }
521  checked_track_MET = true;
522  }
523  }
524 
526  if (m_do_fjvt) {
527  top::check(!m_jetSelectfJvtTool->modify(*shallow_xaod_copy.first),
528  "Failed to apply fJVT decoration");
529  }
530 
531  if (!isLargeR) {
534  // NOTE, if we use one of the b-tagging re-trained collections, we need to load
535  // the original uncalibrated jet container to which the b-tagging shallow-copy is pointing to
536  const xAOD::JetContainer* xaod_original(nullptr);
537  top::check(evtStore()->retrieve(xaod_original,
538  m_config->sgKeyJets()),
539  "Failed to retrieve uncalibrated Jets for METMaker!");
540  if (!xaod_original || !shallow_xaod_copy.first) {
541  ATH_MSG_ERROR("Cannot retrieve the original jet collection!");
542  return StatusCode::FAILURE;
543  }
544  bool setLinks = xAOD::setOriginalObjectLink(*xaod_original, *shallow_xaod_copy.first);
545  if (!setLinks) ATH_MSG_ERROR(" Cannot set original object links for jets, MET recalculation may struggle");
546  }
547 
549  std::string outputSGKey;
550  if (!isLargeR) {
551  outputSGKey = m_config->sgKeyJetsStandAlone(m_nominalSystematicSet.hash());
552  }
553  if (isLargeR) {
554  outputSGKey = m_config->sgKeyLargeRJets(m_nominalSystematicSet.hash());
555  }
556 
557  std::string outputSGKeyAux = outputSGKey + "Aux.";
558 
559  StatusCode save = evtStore()->tds()->record(shallow_xaod_copy.first, outputSGKey);
560  StatusCode saveAux = evtStore()->tds()->record(shallow_xaod_copy.second, outputSGKeyAux);
561  if (!save || !saveAux) {
562  return StatusCode::FAILURE;
563  }
564 
565  return StatusCode::SUCCESS;
566  }
567 
568 
570 
572  const xAOD::JetContainer* ljets(nullptr);
573  top::check(evtStore()->retrieve(ljets, m_config->sgKeyLargeRJets(
574  m_nominalSystematicSet.hash())), "Failed to retrieve Jets");
575  const size_t njets = ljets->size();
576 
577  const std::unordered_map<std::string,std::string>& sfNames = m_config->boostedTaggerSFnames();
578 
579  for(auto& it : m_tagSFuncertTool) {
580  ToolHandle<ICPJetUncertaintiesTool>& tool = it.second;
581  const std::string& fullName=it.first;
582 
583  const std::string sfNameNominal = sfNames.at(fullName);
584  const SG::AuxElement::Accessor<float> accSF(sfNameNominal);
585  // accessor to retrieve nominal efficiency decoration from BoostedJetTaggers
586  std::string taggerName = sfNameNominal;
587  taggerName.erase(taggerName.length()-3);
588  const SG::AuxElement::Accessor<float> accEff(taggerName + "_efficiency");
589 
591 
592  // shallow copy with nominal tagging SFs and efficiencies
593  // JetUncertainties may apply relative variations, so we need to make sure we always apply on
594  // shallow copy from nominal tagged jets
595  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* >
596  shallow_xaod_copy = xAOD::shallowCopyContainer(*ljets);
597  auto shallowJets = std::make_pair(std::unique_ptr<xAOD::JetContainer>{shallow_xaod_copy.first},
598  std::unique_ptr<xAOD::ShallowAuxContainer>{shallow_xaod_copy.second});
599 
600  top::check(tool->applySystematicVariation(sys), "Failed to applySystematicVariation");
601 
602  const std::string sfNameShifted = fullName + "_" + sys.name();
603 
604  top::check(tool->applyContainerCorrection(*shallow_xaod_copy.first),
605  "Failed to apply large-R jet SF uncertainties in nominal TTree");
606 
607  for(size_t i = 0; i < njets; i++) {
608  xAOD::Jet* shallowJet = shallowJets.first->at(i);
609  const xAOD::Jet* jet = ljets->at(i);
610 
611  float sf = accSF.isAvailable(*shallowJet) ? accSF(*shallowJet) : -999.;
612  jet->auxdecor<float>(sfNameShifted.c_str()) = sf;
613 
614  // decorate efficiencies for inefficiency SF variations
615  if (sys.name().find("TagEffUnc") != std::string::npos) {
616  if (accEff.isAvailable(*shallowJet)) {
617  jet->auxdecor<float>(fullName + "_" + sys.name() + "_efficiency") = accEff(*shallowJet);
618  }
619  }
620  } // end loop over jets
621  } // end loop over SF systs
622  } // end loop over tagging WP
623 
624  return StatusCode::SUCCESS;
625  }
626 
627  StatusCode JetObjectCollectionMaker::applySystematic(ToolHandle<ICPJetUncertaintiesTool>& tool,
628  const std::unordered_map<CP::SystematicSet,
629  CP::SystematicSet>& map,
630  bool isLargeR) {
632  const xAOD::JetContainer* xaod(nullptr);
633 
634  // helper string for error messages, so we know if we are running over
635  // small-R or large-R jets
636  const std::string msg_jet_collection = isLargeR ? "large-R jets" : "small-R jets";
637 
638  if (!isLargeR) {
639  top::check(evtStore()->retrieve(xaod, m_config->sgKeyJetsStandAlone(
640  m_nominalSystematicSet.hash())), "Failed to retrieve " + msg_jet_collection);
641  } else {
642  top::check(evtStore()->retrieve(xaod, m_config->sgKeyLargeRJets(
643  m_nominalSystematicSet.hash())), "Failed to retrieve " + msg_jet_collection);
644  }
645 
647  for (Itr syst = map.begin(); syst != map.end(); ++syst) {
649  if ((*syst).second.hash() == m_nominalSystematicSet.hash())
650  continue;
651 
653  bool isJMR = false;
654  CP::SystematicSet::iterator itr = (*syst).second.begin();
655  std::string systname = itr->name();
656  if (systname.find("JMR") != std::string::npos) isJMR = true;
657 
660  if (!isJMR) {
661  top::check(tool->applySystematicVariation((*syst).second),
662  "Failed to applySystematicVariation for " + msg_jet_collection);
663  } else {
664  top::check(m_FFJetSmearingTool->applySystematicVariation((*syst).second),
665  "Failed to applySystematicVariation (JMR) for " + msg_jet_collection);
666  }
667 
668  if (isLargeR && m_config->isMC()) {
669  // for boosted tagging SFs, apply syst variation for all initialized WPs
670  for (std::pair<const std::string, ToolHandle<ICPJetUncertaintiesTool> >& tagSF : m_tagSFuncertTool) {
671  top::check(tagSF.second->applySystematicVariation((*syst).second),
672  "Failed to applySystematicVariation for " + msg_jet_collection);
673  }
674  }
675 
677  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* >
678  shallow_xaod_copy = xAOD::shallowCopyContainer(*xaod);
679 
680  // apply large-R jet tagging SF uncertainties
681  if (isLargeR && m_config->isMC()) {
682  for (std::pair<const std::string, ToolHandle<ICPJetUncertaintiesTool> >& tagSF : m_tagSFuncertTool) {
683  top::check(tagSF.second->applyContainerCorrection(*shallow_xaod_copy.first),
684  "Failed to apply large-R jet tagging SF uncertainties");
685  }
686  }
687 
688  // apply JES/JER uncertainties -- for large-R jets only on MC
689  // also apply large-R jet JMR on MC only
690  if (!isJMR) {
691  top::check(tool->applyContainerCorrection(*shallow_xaod_copy.first),
692  "Failed to apply JES/JER uncertainties for " + msg_jet_collection);
693  } else {
694  top::check(m_FFJetSmearingTool->applyContainerCorrection(*shallow_xaod_copy.first),
695  "Failed to JMR uncertainties for " + msg_jet_collection);
696  }
697 
699  if (!isLargeR) {
700  top::check(m_jetJvtEfficiencyTool->recalculateScores(*shallow_xaod_copy.first),
701  "Failed to recalculate JVT scores");
702  }
703 
705  // Check if the derivation we are running on contains
706  // MET_Track (once) before applying the fJVT decoration
707  if (!isLargeR && (m_config->doForwardJVTinMET() || m_config->getfJVTWP() != "None")) {
708  static bool checked_track_MET = false;
709  if (!checked_track_MET) {
710  if (evtStore()->contains<xAOD::MissingETContainer>("MET_Track")) {
711  m_do_fjvt = true;
712  } else {
713  ATH_MSG_ERROR(" Cannot retrieve MET_Track, fJVT values can't be calculated correctly!!");
714  return StatusCode::FAILURE;
715  }
716  checked_track_MET = true;
717  }
718  }
719 
721  if (m_do_fjvt) {
722  top::check(!m_jetSelectfJvtTool->modify(*shallow_xaod_copy.first),
723  "Failed to apply fJVT decoration");
724  }
725 
727  bool setLinks = xAOD::setOriginalObjectLink(*xaod,
728  *shallow_xaod_copy.first);
729  if (!setLinks) ATH_MSG_ERROR(" Cannot set original object links"
730  " for jets, MET recalculation may struggle");
731 
735  std::string outputSGKey;
736  if (isLargeR) {
737  outputSGKey = m_config->sgKeyLargeRJets((*syst).first.hash());
738  } else {
739  outputSGKey = m_config->sgKeyJetsStandAlone((*syst).first.hash());
740  }
741  std::string outputSGKeyAux = outputSGKey + "Aux.";
742 
743  StatusCode save = evtStore()->tds()->record(shallow_xaod_copy.first, outputSGKey);
744  StatusCode saveAux = evtStore()->tds()->record(shallow_xaod_copy.second, outputSGKeyAux);
745  if (!save || !saveAux) {
746  return StatusCode::FAILURE;
747  }
748  }
749 
750  return StatusCode::SUCCESS;
751  }
752 
756  if (!executeNominal) return StatusCode::SUCCESS;
757 
758  top::check(decorateDL1(true), "Failed to decorate track jets with DL1 b-tagging discriminant");
759 
760 
762 
763  const xAOD::JetContainer* xaod(nullptr);
764  top::check(evtStore()->retrieve(xaod, m_config->sgKeyTrackJets()), "Failed to retrieve Jets");
765 
767  std::pair< xAOD::JetContainer*, xAOD::ShallowAuxContainer* > shallow_xaod_copy = xAOD::shallowCopyContainer(*xaod);
768 
770  bool setLinks = xAOD::setOriginalObjectLink(*xaod, *shallow_xaod_copy.first);
771  if (!setLinks) ATH_MSG_ERROR(" Cannot set original object links for track jets");
772 
774  std::string outputSGKey = m_config->sgKeyTrackJets(m_config->nominalHashValue());
775  std::string outputSGKeyAux = outputSGKey + "Aux.";
776 
777  StatusCode save = evtStore()->tds()->record(shallow_xaod_copy.first, outputSGKey);
778  StatusCode saveAux = evtStore()->tds()->record(shallow_xaod_copy.second, outputSGKeyAux);
779  if (!save || !saveAux) {
780  return StatusCode::FAILURE;
781  }
782  return StatusCode::SUCCESS;
783  }
784 
786  bool isLargeR(false);
787 
788  return this->printout(isLargeR);
789  }
790 
792  bool isLargeR(true);
793 
794  return this->printout(isLargeR);
795  }
796 
799  for (auto s : m_specifiedSystematics) {
800  std::string sgKey = isLargeR ? m_config->sgKeyLargeRJets() : m_config->sgKeyJets();
801 
802  const xAOD::JetContainer* xaod(nullptr);
803  top::check(evtStore()->retrieve(xaod, sgKey), "Failed to retrieve Jets");
804 
805  ATH_MSG_INFO(" Jets with sgKey = " << sgKey);
806  for (auto x : *xaod) {
807  ATH_MSG_INFO(" Jet pT , eta = " << x->pt() << " , " << x->eta());
808  }
809  }
810 
811  return StatusCode::SUCCESS;
812  }
813 
814  std::string JetObjectCollectionMaker::getLargeRModName(const std::string& NPModel) const {
815  if (NPModel.find("CategoryReduction")!=std::string::npos) return "CategoryReduction_";
816  return NPModel+"_";
817  }
818 
819  void JetObjectCollectionMaker::addSystematics(const std::set<std::string>& specifiedSystematics,
820  const CP::SystematicSet& recommendedSysts,
821  std::unordered_map<CP::SystematicSet, CP::SystematicSet>& map,
822  const std::string& modName,
823  bool isLargeR,
824  bool onlyJER,
825  bool isPseudoData) {
826 
827  if (isPseudoData && m_config->isSystNominal(m_config->systematics())) return;
828 
830  const std::vector<CP::SystematicSet> systList = CP::make_systematics_vector(recommendedSysts);
831 
832  for (const CP::SystematicSet& s : systList) {
833  if (s.size() != 1) continue;
835 
836  if(!m_config->getTreeFilter()->filterTree(modName + ss->name())) continue; // Applying tree filter
837 
838  if (onlyJER && ss->name().find("JER") == std::string::npos) continue;
839 
840  const std::string name = isPseudoData ? modName + ss->name() + "_PseudoData" : modName + ss->name();
841 
842  CP::SystematicSet modSet(name);
843 
844  m_recommendedSystematics.push_back(modSet);
845  if (!m_config->isSystNominal(m_config->systematics())) {
846  if (specifiedSystematics.size() == 0) {
847  if (!isLargeR) m_specifiedSystematics.push_back(modSet);
848  else m_specifiedSystematicsLargeR.push_back(modSet);
849  map.insert(std::make_pair(modSet, s));
850  } else {
851  for (const std::string& i : specifiedSystematics) {
853  if (!filter.filterTree(modSet.name())) {
854  if (!isLargeR) m_specifiedSystematics.push_back(modSet);
855  else m_specifiedSystematicsLargeR.push_back(modSet);
856  map.insert(std::make_pair(modSet, s));
857  }
858  }
859  } // User has specified a systematic
860  } // Don't do anything if the user requests nominal only
861  } // Loop over systList
862 
864  m_recommendedSystematics.unique();
865 
866  m_specifiedSystematics.sort();
867  m_specifiedSystematics.unique();
868 
871  }
872 
874  const xAOD::JetContainer* xaod_calibrated_jets(nullptr);
875 
876  top::check(evtStore()->retrieve(xaod_calibrated_jets, m_config->sgKeyLargeRJets(
878  "Failed to retrieve nominal calibrated large-R jets");
879 
880  top::check(tagLargeRJets(*xaod_calibrated_jets), "Failed to tag large-R jet");
881  return StatusCode::SUCCESS;
882  }
883 
885  //decorate with boosted-tagging flags
886  for (const std::pair<std::string, std::string>& name : m_config->boostedJetTaggers()) {
887  top::check(m_boostedJetTaggers[name.second]->decorate(container), "Failed to decorate jets with booster tagger");
888  SG::AuxElement::Decorator<char> passedRangeCheckDec(name.second + "_passedRangeCheck");
889  SG::AuxElement::Accessor<bool> validPtRangeLowDec(name.second + "_ValidPtRangeLow");
890  SG::AuxElement::Accessor<bool> validPtRangeHighDec(name.second + "_ValidPtRangeHigh");
891  SG::AuxElement::Accessor<bool> validEtaRangeDec(name.second + "_ValidEtaRange");
892  for (const xAOD::Jet *jet : container) {
893  if (validPtRangeLowDec(*jet) && validPtRangeHighDec(*jet) && validEtaRangeDec(*jet)) {
894  passedRangeCheckDec(*jet) = 1;
895  } else {
896  passedRangeCheckDec(*jet) = 0;
897  }
898  }
899  }
900  return StatusCode::SUCCESS;
901  }
902 
904  // initialise decorator and accessor
905  static SG::AuxElement::Decorator<char> isbjet("IsBjet");
906  static const std::string labelB = "PartonTruthLabelID";
907  static SG::AuxElement::Accessor<int> truth_label(labelB);
908 
909  // Is b-jet if truth label == 5 and pT > 15 GeV
910  isbjet(jet) = (jet.pt() > 15000. && truth_label(jet) == 5);
911 
912  return StatusCode::SUCCESS;
913  }
914 
916  // initialise decorator
917  static SG::AuxElement::Decorator<char> isHS("AnalysisTop_isHS");
918 
919  // retrieve small-R jets collection
920  const xAOD::JetContainer* jets(nullptr);
921 
923  m_config->sgKeyJets()),
924  "Failed to retrieve small-R jet collection" + m_config->sgKeyJets());
925 
926  // retrieve truth jet collection
927  const xAOD::JetContainer* truthJets = nullptr;
928  top::check(evtStore()->retrieve(truthJets,
930  "Unable to retrieve truth jet container " + m_truthJetCollForHS +
931  " - this is needed to define HS jets for application of JVT");
932 
933  for (const auto *jet : *jets) {
934  bool ishs = false;
935  for (const auto *tjet : *truthJets) {
936  if (tjet->p4().DeltaR(jet->p4()) < 0.3 && tjet->pt() > 10e3) ishs = true;
937  }
938  isHS(*jet) = ishs;
939  }
940 
941  return StatusCode::SUCCESS;
942  }
943 
945  static const SG::AuxElement::Decorator<float> matchedPt("AnalysisTop_MatchedTruthJetPt");
946  // retrieve small-R jets collection
947  const xAOD::JetContainer* jets(nullptr);
948 
950  m_config->sgKeyJets()),
951  "Failed to retrieve small-R jet collection" + m_config->sgKeyJets());
952 
953  const xAOD::JetContainer* truthJets = nullptr;
954  top::check(asg::AsgTool::evtStore()->retrieve(truthJets, m_config->sgKeyTruthJets()), "Failed to retrieve the truth jets");
955 
956  const xAOD::Jet* matchedTruthJet = nullptr;
957  double deltaR(9999);
958 
959  for (const auto *jet : *jets) {
960  // loop over truth jets
961  for (const auto *iTruthJet : *truthJets) {
962  TLorentzVector truthJetTLV;
963  truthJetTLV.SetPtEtaPhiE(iTruthJet->pt(),iTruthJet->eta(),iTruthJet->phi(),iTruthJet->e());
964 
965  // do the matching
966  if(!matchedTruthJet) {
967  matchedTruthJet = iTruthJet;
968  } else {
969  const double newdR = jet->p4().DeltaR(iTruthJet->p4());
970  if(newdR < deltaR) {
971  deltaR = newdR;
972  matchedTruthJet = iTruthJet;
973  }
974  }
975  }
976  if (deltaR > m_config->jetResponseMatchingDeltaR()) {
977  matchedPt(*jet) = -9999;
978  continue;
979  }
980  if (!matchedTruthJet) {
981  matchedPt(*jet) = -9999;
982  continue;
983  }
984  matchedPt(*jet) = matchedTruthJet->pt();
985  }
986 
987  return StatusCode::SUCCESS;
988  }
989 
991  // retrieve small-R jets collection -- either calo or track jets
992  const xAOD::JetContainer* jets(nullptr);
993 
994  if (trackJets) {
996  m_config->sgKeyTrackJets()),
997  "Failed to retrieve track jet collection" + m_config->sgKeyTrackJets());
998  } else {
1000  m_config->sgKeyJets()),
1001  "Failed to retrieve small-R jet collection" + m_config->sgKeyJets());
1002  }
1003 
1004  for (const auto *jet : *jets) {
1005  // loop over either calo or track jet btag selection tools to calculate the DL1x scores
1006  const std::unordered_map<std::string, ToolHandle<IBTaggingSelectionTool>>& btagDecorTools \
1008  for (std::pair<std::string, ToolHandle<IBTaggingSelectionTool>> algo : btagDecorTools) {
1009  double DL1_weight = -999.;
1010  double dl1_pb = -10.;
1011  double dl1_pc = -10.;
1012  double dl1_pu = -10.;
1013  double dl1_ptau = 0.;
1014 
1015  // exception for GN2v00 tagger
1016  std::string taggerName = algo.first;
1017  if(taggerName == "GN2v00LegacyWP" || taggerName == "GN2v00NewAliasWP"){
1018  taggerName = "GN2v00";
1019  }
1020 
1021  if (xAOD::BTaggingUtilities::getBTagging(*jet)->pb(taggerName, dl1_pb)
1022  && xAOD::BTaggingUtilities::getBTagging(*jet)->pc(taggerName, dl1_pc)
1023  && xAOD::BTaggingUtilities::getBTagging(*jet)->pu(taggerName, dl1_pu)
1024  && (taggerName == "GN2v01" ? xAOD::BTaggingUtilities::getBTagging(*jet)->ptau(taggerName, dl1_ptau) : true)) {
1025  if (!algo.second->getTaggerWeight(dl1_pb, dl1_pc, dl1_pu, DL1_weight, dl1_ptau)) {
1026  DL1_weight = -999.; // value for errors from retrieving DL1x weight
1027  }
1028  } else {
1029  DL1_weight = -100.; // value for errors from nonexistence of probabilities
1030  }
1031  DLx.at(algo.first)(*jet) = DL1_weight;
1032  }
1033  }
1034 
1035  return StatusCode::SUCCESS;
1036  }
1037 } // namespace top
top::JetObjectCollectionMaker::m_recommendedSystematics
std::list< CP::SystematicSet > m_recommendedSystematics
Definition: JetObjectCollectionMaker.h:126
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ShallowCopy.h
xAOD::BTagging_v1::ptau
bool ptau(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:374
BTaggingUtilities.h
top::JetObjectCollectionMaker::execute
StatusCode execute(const bool isLargeR, bool executeNominal)
Definition: JetObjectCollectionMaker.cxx:342
top::JetObjectCollectionMaker::calibrate
StatusCode calibrate(const bool isLargeR)
Definition: JetObjectCollectionMaker.cxx:408
top::JetObjectCollectionMaker::executeTrackJets
StatusCode executeTrackJets(bool)
Definition: JetObjectCollectionMaker.cxx:753
top::JetObjectCollectionMaker::m_doFull_JER_largeR
bool m_doFull_JER_largeR
Definition: JetObjectCollectionMaker.h:117
top::JetObjectCollectionMaker::m_jetUncertaintiesToolLargeRPseudoData
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolLargeRPseudoData
Definition: JetObjectCollectionMaker.h:140
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
top::JetObjectCollectionMaker::addSystematics
virtual void addSystematics(const std::set< std::string > &specifiedSystematics, const CP::SystematicSet &recommendedSysts, std::unordered_map< CP::SystematicSet, CP::SystematicSet > &map, const std::string &modName, bool isLargeR=false, bool onlyJER=false, bool isPseudoData=false)
Definition: JetObjectCollectionMaker.cxx:819
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::JetObjectCollectionMaker::m_jetUncertaintiesTool
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesTool
Definition: JetObjectCollectionMaker.h:132
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
top::JetObjectCollectionMaker::executeLargeRJets
StatusCode executeLargeRJets(bool)
Definition: JetObjectCollectionMaker.cxx:336
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::make_systematics_vector
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
Definition: SystematicsUtil.cxx:25
top::JetObjectCollectionMaker::applyTaggingSFSystematic
virtual StatusCode applyTaggingSFSystematic()
Definition: JetObjectCollectionMaker.cxx:569
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
top::JetObjectCollectionMaker::JetObjectCollectionMaker
JetObjectCollectionMaker(const std::string &name)
Definition: JetObjectCollectionMaker.cxx:26
SubjetMaker.h
top::JetObjectCollectionMaker::tagLargeRJets
StatusCode tagLargeRJets(const xAOD::JetContainer &jet)
Definition: JetObjectCollectionMaker.cxx:884
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
top::JetObjectCollectionMaker::m_btagSelToolsDL1Decor_trkJet
std::unordered_map< std::string, ToolHandle< IBTaggingSelectionTool > > m_btagSelToolsDL1Decor_trkJet
Definition: JetObjectCollectionMaker.h:181
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
TreeFilter.h
CP::SystematicSet::const_iterator
std::set< SystematicVariation >::const_iterator const_iterator
Definition: SystematicSet.h:52
skel.it
it
Definition: skel.GENtoEVGEN.py:423
top::JetObjectCollectionMaker::m_tagSFUncorrelatedSystematics
std::unordered_map< std::string, std::vector< CP::SystematicSet > > m_tagSFUncorrelatedSystematics
Definition: JetObjectCollectionMaker.h:142
asg
Definition: DataHandleTestTool.h:28
top::JetObjectCollectionMaker::m_jetJvtEfficiencyTool
ToolHandle< CP::IJetJvtEfficiency > m_jetJvtEfficiencyTool
Definition: JetObjectCollectionMaker.h:152
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
top::JetObjectCollectionMaker::printoutJets
StatusCode printoutJets()
Definition: JetObjectCollectionMaker.cxx:785
CP::SystematicSet::name
std::string name() const
returns: the systematics joined into a single string.
Definition: SystematicSet.cxx:278
top::deltaR
double deltaR(const xAOD::IParticle &p1, const xAOD::IParticle &p2)
Calculate the delta-r distance between two particles (e.g.
Definition: EventTools.cxx:21
JetObjectCollectionMaker.h
CP::SystematicVariation
Definition: SystematicVariation.h:47
top::JetObjectCollectionMaker::m_do_fjvt
bool m_do_fjvt
Definition: JetObjectCollectionMaker.h:121
top::JetObjectCollectionMaker::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetObjectCollectionMaker.cxx:88
x
#define x
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
top::JetObjectCollectionMaker::m_systMap_JERPseudo
systMap m_systMap_JERPseudo
Definition: JetObjectCollectionMaker.h:160
top::JetObjectCollectionMaker::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: JetObjectCollectionMaker.h:114
top::JetObjectCollectionMaker::m_FFJetSmearingTool
ToolHandle< ICPJetCorrectionTool > m_FFJetSmearingTool
Definition: JetObjectCollectionMaker.h:144
top::JetObjectCollectionMaker::getLargeRModName
virtual std::string getLargeRModName(const std::string &NPModel) const
Definition: JetObjectCollectionMaker.cxx:814
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::JetObjectCollectionMaker::m_jetUncertaintiesToolReducedNPScenario3
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolReducedNPScenario3
Definition: JetObjectCollectionMaker.h:136
top::JetObjectCollectionMaker::decorateMatchedTruth
StatusCode decorateMatchedTruth()
Definition: JetObjectCollectionMaker.cxx:944
covarianceTool.filter
filter
Definition: covarianceTool.py:514
top::TreeFilter
Definition: TreeFilter.h:13
top::JetObjectCollectionMaker::m_specifiedSystematicsLargeR
std::list< CP::SystematicSet > m_specifiedSystematicsLargeR
Definition: JetObjectCollectionMaker.h:124
top::JetObjectCollectionMaker::specifiedSystematicsLargeR
virtual const std::list< CP::SystematicSet > & specifiedSystematicsLargeR() const
Definition: JetObjectCollectionMaker.h:83
top::JetObjectCollectionMaker::m_jetSubstructure
std::unique_ptr< top::TopJetSubstructure > m_jetSubstructure
Definition: JetObjectCollectionMaker.h:157
top::LargeJetTrimmer
JetCorrection-derived class that trims large-R jets while derivations are not ready.
Definition: LargeJetTrimmer.h:16
top::JetObjectCollectionMaker::applySystematic
virtual StatusCode applySystematic(ToolHandle< ICPJetUncertaintiesTool > &tool, const std::unordered_map< CP::SystematicSet, CP::SystematicSet > &map, bool isLargeR=false)
Definition: JetObjectCollectionMaker.cxx:627
top::JetObjectCollectionMaker::m_jetUncertaintiesToolPseudoData
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolPseudoData
Definition: JetObjectCollectionMaker.h:133
top::JetObjectCollectionMaker::m_jetCalibrationTool
ToolHandle< IJetCalibrationTool > m_jetCalibrationTool
Definition: JetObjectCollectionMaker.h:129
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::SystematicSet::hash
std::size_t hash() const
returns: hash value for the joined string.
Definition: SystematicSet.cxx:289
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
top::JetObjectCollectionMaker::m_systMap_LargeR
systMap m_systMap_LargeR
Definition: JetObjectCollectionMaker.h:165
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
xAOD::BTagging_v1::pc
bool pc(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:367
top::JetObjectCollectionMaker::printout
StatusCode printout(const bool isLargeR)
Definition: JetObjectCollectionMaker.cxx:797
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
top::JetObjectCollectionMaker::m_nominalSystematicSet
CP::SystematicSet m_nominalSystematicSet
Definition: JetObjectCollectionMaker.h:127
JetTruthLabelingTool
Definition: JetTruthLabelingTool.h:26
top::JetObjectCollectionMaker::m_systMap_ReducedNPScenario3
systMap m_systMap_ReducedNPScenario3
Definition: JetObjectCollectionMaker.h:163
lumiFormat.i
int i
Definition: lumiFormat.py:92
top::JetObjectCollectionMaker::m_jetUncertaintiesToolReducedNPScenario4
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolReducedNPScenario4
Definition: JetObjectCollectionMaker.h:137
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
top::JetObjectCollectionMaker::m_truthJetCollForHS
std::string m_truthJetCollForHS
Definition: JetObjectCollectionMaker.h:155
top::JetObjectCollectionMaker::decorateBJets
StatusCode decorateBJets(xAOD::Jet &jet)
Definition: JetObjectCollectionMaker.cxx:903
top::JetObjectCollectionMaker::m_systMap_ReducedNPScenario2
systMap m_systMap_ReducedNPScenario2
Definition: JetObjectCollectionMaker.h:162
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
CP::SystematicSet::iterator
std::set< SystematicVariation >::iterator iterator
Definition: SystematicSet.h:51
top::JetObjectCollectionMaker::m_tagSFSysNames
std::unordered_map< std::string, std::vector< std::string > > m_tagSFSysNames
Definition: JetObjectCollectionMaker.h:143
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
top::JetObjectCollectionMaker::m_jetUncertaintiesToolReducedNPScenario2
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolReducedNPScenario2
Definition: JetObjectCollectionMaker.h:135
top::JetObjectCollectionMaker::decorateHSJets
StatusCode decorateHSJets()
Definition: JetObjectCollectionMaker.cxx:915
top::JetObjectCollectionMaker::m_jetTruthLabelingTool
std::unique_ptr< JetTruthLabelingTool > m_jetTruthLabelingTool
– Large R jet truth labeling –///
Definition: JetObjectCollectionMaker.h:177
top::JetObjectCollectionMaker::m_systMap_AllNP
systMap m_systMap_AllNP
Definition: JetObjectCollectionMaker.h:159
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
top::JetObjectCollectionMaker::m_doFull_JER_largeR_Pseudodata
bool m_doFull_JER_largeR_Pseudodata
Definition: JetObjectCollectionMaker.h:118
xAOD::BTagging_v1::pu
bool pu(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:353
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
top::JetObjectCollectionMaker::m_systMap_ReducedNPScenario4
systMap m_systMap_ReducedNPScenario4
Definition: JetObjectCollectionMaker.h:164
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
top::JetObjectCollectionMaker::m_boostedJetTaggers
std::unordered_map< std::string, ToolHandle< IJetDecorator > > m_boostedJetTaggers
Definition: JetObjectCollectionMaker.h:149
top::JetObjectCollectionMaker::m_jetSelectfJvtTool
ToolHandle< IJetModifier > m_jetSelectfJvtTool
Definition: JetObjectCollectionMaker.h:153
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
top::JetObjectCollectionMaker::m_doMultipleJES
bool m_doMultipleJES
Definition: JetObjectCollectionMaker.h:120
TopConfig.h
top::JetObjectCollectionMaker::m_jetCalibrationToolLargeR
ToolHandle< IJetCalibrationTool > m_jetCalibrationToolLargeR
Definition: JetObjectCollectionMaker.h:130
top::JetObjectCollectionMaker::m_doFull_JER
bool m_doFull_JER
Definition: JetObjectCollectionMaker.h:115
LargeJetTrimmer.h
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
EventInfo.h
xAOD::BTaggingUtilities::getBTagging
const BTagging * getBTagging(const SG::AuxElement &part)
Access the default xAOD::BTagging object associated to an object.
Definition: BTaggingUtilities.cxx:37
top::JetObjectCollectionMaker::tagNominalLargeRJets
StatusCode tagNominalLargeRJets()
Definition: JetObjectCollectionMaker.cxx:873
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
top::JetObjectCollectionMaker::m_specifiedSystematicsTrackJets
std::list< CP::SystematicSet > m_specifiedSystematicsTrackJets
Definition: JetObjectCollectionMaker.h:125
top::JetObjectCollectionMaker::specifiedSystematics
virtual const std::list< CP::SystematicSet > & specifiedSystematics() const
Definition: JetObjectCollectionMaker.h:82
top::JetObjectCollectionMaker::m_tagSFuncertTool
std::unordered_map< std::string, ToolHandle< ICPJetUncertaintiesTool > > m_tagSFuncertTool
Definition: JetObjectCollectionMaker.h:141
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
JetContainer.h
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::setOriginalObjectLink
bool setOriginalObjectLink(const IParticle &original, IParticle &copy)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
Definition: IParticleHelpers.cxx:30
BchCleanup.modName
modName
Definition: BchCleanup.py:201
JetAuxContainer.h
top::JetObjectCollectionMaker::m_jetUncertaintiesToolReducedNPScenario1
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolReducedNPScenario1
Definition: JetObjectCollectionMaker.h:134
top::JetObjectCollectionMaker::m_btagSelToolsDL1Decor
std::unordered_map< std::string, ToolHandle< IBTaggingSelectionTool > > m_btagSelToolsDL1Decor
Definition: JetObjectCollectionMaker.h:180
top::JetObjectCollectionMaker::m_systMap_ReducedNPScenario1
systMap m_systMap_ReducedNPScenario1
Definition: JetObjectCollectionMaker.h:161
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
IParticleHelpers.h
top::JetObjectCollectionMaker::DLx
std::unordered_map< std::string, SG::AuxElement::Decorator< float > > DLx
Definition: JetObjectCollectionMaker.h:184
top::JetObjectCollectionMaker::m_doFull_JER_Pseudodata
bool m_doFull_JER_Pseudodata
Definition: JetObjectCollectionMaker.h:116
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
TopJetSubstructure.h
top::JetObjectCollectionMaker::executeJets
StatusCode executeJets(bool)
Definition: JetObjectCollectionMaker.cxx:330
top::JetObjectCollectionMaker::m_isMC
bool m_isMC
Definition: JetObjectCollectionMaker.h:119
top::JetObjectCollectionMaker::Itr
std::unordered_map< CP::SystematicSet, CP::SystematicSet >::const_iterator Itr
Definition: JetObjectCollectionMaker.h:168
top::JetObjectCollectionMaker::m_specifiedSystematics
std::list< CP::SystematicSet > m_specifiedSystematics
Definition: JetObjectCollectionMaker.h:123
top::JetObjectCollectionMaker::decorateDL1
StatusCode decorateDL1(bool trackJets=false)
Definition: JetObjectCollectionMaker.cxx:990
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MissingETContainer.h
top::JetObjectCollectionMaker::printoutLargeRJets
StatusCode printoutLargeRJets()
Definition: JetObjectCollectionMaker.cxx:791
top::SubjetMaker
Derived class that constructs subjets while derivations are not ready.
Definition: SubjetMaker.h:16
top::JetObjectCollectionMaker::m_systMap_LargeR_JERPseudo
systMap m_systMap_LargeR_JERPseudo
Definition: JetObjectCollectionMaker.h:166
xAOD::BTagging_v1::pb
bool pb(const std::string &taggername, double &value) const
Definition: BTagging_v1.cxx:360
SystematicsUtil.h
top::JetObjectCollectionMaker::m_jetUncertaintiesToolLargeR
ToolHandle< ICPJetUncertaintiesTool > m_jetUncertaintiesToolLargeR
Definition: JetObjectCollectionMaker.h:139