ATLAS Offline Software
JetFtagEffPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 
7 #include <cmath>
8 #include <array>
9 #include <string>
10 
11 #include "TopEvent/EventTools.h"
14 
15 #include "TH1.h"
16 #include "TH2D.h"
17 #include "TFile.h"
18 
19 // Systematic include(s):
21 
23 using namespace TopEventSelectionTools;
24 
25 namespace top {
26  const double JetFtagEffPlots::toGeV = 0.001;
27 
28 
29  JetFtagEffPlots::JetFtagEffPlots(const std::string& name,
30  TFile* outputFile, const std::string& params, std::shared_ptr<top::TopConfig> config,
31  EL::Worker* wk) :
32  m_nominalHashValue(0),
33  m_CDIfile("xAODBTaggingEfficiency/13TeV/2020-21-13TeV-MC16-CDI-2020-03-11_v3.root"),
34  m_fill_total_hists(false),
35  m_histogram_suffix(""),
36  m_dont_use_event_weight(false),
37  m_use_track_jets(false),
38  m_doNominal(false),
39  m_doMuRup(false),
40  m_doMuRdown(false),
41  m_doMuFup(false),
42  m_doMuFdown(false),
43  m_doVar3cup(false),
44  m_doVar3cdown(false),
45  m_doFSRup(false),
46  m_doFSRdown(false),
47  // default pT and eta binning
48  m_ptBins("15:20:30:45:60:80:110:160:210:260:310:400:500:600:800:1000:1200:1500:1800:2500"),
49  m_etaBins("0.:0.3:0.8:1.2:2.1:2.8:3.6:4.5"),
50  m_max_pT(-1),
51  m_min_pT(-1),
52  m_N_pT_bins(-1),
53  m_max_Eta(-1),
54  m_min_Eta(-1),
55  m_N_Eta_bins(-1),
56  m_jetCollection(""),
57  m_WP("FixedCutBEff_70"),
58  m_tagger("DL1"),
59  m_config(config),
60  m_selection_tool("BTaggingSelectionTool/selTool"),
61  m_PMGTruthWeights(nullptr),
62  m_sfRetriever(nullptr) {
64  m_nominalHashValue = nominal.hash();
65 
66 
67  const std::string truthWeightToolName = "PMGTruthWeightTool";
68  if (asg::ToolStore::contains<PMGTools::PMGTruthWeightTool>(truthWeightToolName)) m_PMGTruthWeights =
69  asg::ToolStore::get<PMGTools::PMGTruthWeightTool>(truthWeightToolName);
70  else {
71  m_PMGTruthWeights = new PMGTools::PMGTruthWeightTool(truthWeightToolName);
72  top::check(m_PMGTruthWeights->initialize(), "Failed to initialize " + truthWeightToolName);
73  }
74  //decoding arguments
75  std::istringstream stream(params);
76  std::string s;
77  while (stream >> s) {
78  if (s.substr(0, 3) == "WP:") m_WP = s.substr(3, s.size() - 3);
79  else if (s.substr(0, 7) == "tagger:") m_tagger = s.substr(7, s.size() - 7);
80  else if (s.substr(0, 8) == "CDIfile:") m_CDIfile = s.substr(8, s.size() - 8);
81  else if (s.substr(0, 3) == "pt:" || s.substr(0, 3) == "pT:") m_ptBins = s.substr(3, s.size() - 3);
82  else if (s.substr(0, 7) == "abseta:") m_etaBins = s.substr(7, s.size() - 7);
83  else if (s.substr(0, 7) == "max_pT:") m_max_pT = std::stof(s.substr(7, s.size() - 7));
84  else if (s.substr(0, 7) == "min_pT:") m_min_pT = std::stof(s.substr(7, s.size() - 7));
85  else if (s.substr(0, 5) == "N_pT:") m_N_pT_bins = std::stoi(s.substr(5, s.size() - 5));
86  else if (s.substr(0, 8) == "max_eta:") m_max_Eta = std::stof(s.substr(8, s.size() - 8));
87  else if (s.substr(0, 8) == "min_eta:") m_min_Eta = std::stof(s.substr(8, s.size() - 8));
88  else if (s.substr(0, 6) == "N_eta:") m_N_Eta_bins = std::stoi(s.substr(6, s.size() - 6));
89  else if (s.substr(0, 7) == "suffix:") m_histogram_suffix = s.substr(7, s.size() - 7);
90  else if (s == "fill_total_hist") m_fill_total_hists = true;
91  else if (s == "dont_use_event_weight") m_dont_use_event_weight = true;
92  else if (s == "use_track_jets") m_use_track_jets = true;
93  else if (s == "NOMINAL") m_doNominal = true;
94  else if (s == "MURUP") m_doMuRup = true;
95  else if (s == "MURDOWN") m_doMuRdown = true;
96  else if (s == "MUFUP") m_doMuFup = true;
97  else if (s == "MUFDOWN") m_doMuFdown = true;
98  else if (s == "VAR3CUP") m_doVar3cup = true;
99  else if (s == "VAR3CDOWN") m_doVar3cdown = true;
100  else if (s == "FSRUP") m_doFSRup = true;
101  else if (s == "FSRDOWN") m_doFSRdown = true;
102  else {
103  throw std::runtime_error {
104  "ERROR: Can't understand argument " + s + " for JETFTAGEFFPLOTS."
105  };
106  }
107  }
108 
109  // retrieve jet collection
110  if (!m_use_track_jets) {
111  m_jetCollection = m_config->sgKeyJets();
112  } else {
113  m_jetCollection = m_config->sgKeyTrackJets();
114  }
115 
116  m_sfRetriever = asg::ToolStore::get<ScaleFactorRetriever>("top::ScaleFactorRetriever");
117 
118  // No option were set, run only nominal
119  if (!m_doNominal && !m_doMuRup && !m_doMuRdown && !m_doMuFup
121  ATH_MSG_INFO("No variation has been set. Assuming nominal.");
122  m_doNominal = true;
123  }
124 
125  if (m_doNominal) m_hists = std::make_shared<PlotManager>(name + "/JetFtagEffPlots", outputFile, wk);
126  if (m_doMuRup) m_hists_muRup = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_MuRup", outputFile, wk);
127  if (m_doMuRdown) m_hists_muRdown = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_MuRdown", outputFile, wk);
128 
129  if (m_doMuFup) m_hists_muFup = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_MuFup", outputFile, wk);
130  if (m_doMuFdown) m_hists_muFdown = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_MuFdown", outputFile, wk);
131 
132  if (m_doVar3cup) m_hists_Var3cup = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_Var3cup", outputFile, wk);
133 
134  if (m_doVar3cdown) m_hists_Var3cdown = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_Var3cdown", outputFile, wk);
135  if (m_doFSRup) m_hists_FSRup = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_FSRup", outputFile, wk);
136  if (m_doFSRup) m_hists_FSRdown = std::make_shared<PlotManager>(name + "/JetFtagEffPlots_FSRdown", outputFile, wk);
137 
138  //handle binning and book histograms
139  std::vector<double> ptBins;
140  std::vector<double> etaBins;
141 
142  if (m_N_pT_bins < 1) {
143  formatBinning(m_ptBins, ptBins);
145  }
146 
147  for (std::string flavour:{"B", "C", "L", "T"}) {
148  if (m_fill_total_hists) {
149  std::string total_hist_name = flavour + "_total_" + m_jetCollection + m_histogram_suffix;
150  if (m_N_pT_bins < 1) {
151  if (m_hists) m_hists->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
152  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
153  if (m_hists_muRup) m_hists_muRup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
154  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
155  if (m_hists_muRdown) m_hists_muRdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
156  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
157  if (m_hists_muFup) m_hists_muFup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
158  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
159  if (m_hists_muFdown) m_hists_muFdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
160  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
161  if (m_hists_Var3cup) m_hists_Var3cup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
162  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
163  if (m_hists_Var3cdown) m_hists_Var3cdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
164  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
165  if (m_hists_FSRup) m_hists_FSRup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
166  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
167  if (m_hists_FSRdown) m_hists_FSRdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
168  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
169  } else {
170  if (m_hists) m_hists->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
172  if (m_hists_muRup) m_hists_muRup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
174  if (m_hists_muRdown) m_hists_muRdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
176  if (m_hists_muFup) m_hists_muFup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
178  if (m_hists_muFdown) m_hists_muFdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
180  if (m_hists_Var3cup) m_hists_Var3cup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
182  if (m_hists_Var3cdown) m_hists_Var3cdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
184  if (m_hists_FSRup) m_hists_FSRup->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
186  if (m_hists_FSRdown) m_hists_FSRdown->addHist(total_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
188  }
189  }
190 
191  const std::string pass_hist_name = m_tagger + "_" + m_WP + "_" + m_jetCollection + "_" + flavour + "_pass" + m_histogram_suffix;
192  if (m_N_pT_bins < 1) {
193  if (m_hists) m_hists->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
194  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
195  if (m_hists_muRup) m_hists_muRup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
196  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
197  if (m_hists_muRdown) m_hists_muRdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
198  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
199  if (m_hists_muFup) m_hists_muFup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
200  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
201  if (m_hists_muFdown) m_hists_muFdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
202  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
203  if (m_hists_Var3cup) m_hists_Var3cup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
204  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
205  if (m_hists_Var3cdown) m_hists_Var3cdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
206  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
207  if (m_hists_FSRup) m_hists_FSRup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
208  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
209  if (m_hists_FSRdown) m_hists_FSRdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
210  ptBins.size() - 1, ptBins.data(), etaBins.size() - 1, etaBins.data());
211  } else {
212  if (m_hists) m_hists->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
214  if (m_hists_muRup) m_hists_muRup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
216  if (m_hists_muRdown) m_hists_muRdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
218  if (m_hists_muFup) m_hists_muFup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
220  if (m_hists_muFdown) m_hists_muFdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
222  if (m_hists_Var3cup) m_hists_Var3cup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
224  if (m_hists_Var3cdown) m_hists_Var3cdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
226  if (m_hists_FSRup) m_hists_FSRup->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
228  if (m_hists_FSRdown) m_hists_FSRdown->addHist(pass_hist_name, ";pT [GeV];|#eta^{jet}|;Events",
230  }
231  }
232 
233  m_selection_tool = asg::AnaToolHandle<IBTaggingSelectionTool>("BTaggingSelectionTool/BTagSelec_" + m_tagger + "_" + m_WP + "_" + m_jetCollection);
234  top::check(m_selection_tool.setProperty("FlvTagCutDefinitionsFileName", m_CDIfile), "failed to initialize BtagSelectionTool " + m_tagger + "_" + m_WP + "_" + m_jetCollection);
235  top::check(m_selection_tool.setProperty("TaggerName", m_tagger), "failed to initialize BtagSelectionTool " + m_tagger + "_" + m_WP + "_" + m_jetCollection);
236  top::check(m_selection_tool.setProperty("OperatingPoint", m_WP), "failed to initialize BtagSelectionTool " + m_tagger + "_" + m_WP + "_" + m_jetCollection);
237  top::check(m_selection_tool.setProperty("JetAuthor", m_jetCollection), "failed to initialize BtagSelectionTool " + m_tagger + "_" + m_WP + "_" + m_jetCollection);
238  top::check(m_selection_tool.setProperty("MinPt", m_min_pT*1e3), "failed to initialize BtagSelectionTool, failed in min jet pT");
239  top::check(m_selection_tool.setProperty("MaxEta", m_max_Eta), "failed to initialize BtagSelectionTool, failed in max jet eta");
240 
241  top::check(m_selection_tool.initialize(), "failed to initialize BtagSelectionTool " + m_tagger + "_" + m_WP + "_" + m_jetCollection);
242  }
243 
245  //only MC
246  if (!top::isSimulation(event)) return true;
247 
248  // only nominal
249  if (event.m_hashValue != m_nominalHashValue) return true;
250 
251  // do loose or tight events only if requested
252  if (event.m_isLoose && !m_config->doLooseEvents()) return true;
253 
254  if (!event.m_isLoose && !m_config->doTightEvents()) return true;
255 
256  float eventWeightNominal = 1.0;
257  float eventWeightMuRup = 1.0;
258  float eventWeightMuRdown = 1.0;
259  float eventWeightMuFup = 1.0;
260  float eventWeightMuFdown = 1.0;
261  float eventWeightVar3cUp = 1.0;
262  float eventWeightVar3cDown = 1.0;
263  float eventWeightFSRUp = 1.0;
264  float eventWeightFSRDown = 1.0;
265  float muRup = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::MURUP);
266  float muRdown = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::MURDOWN);
267  float muFup = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::MUFUP);
268  float muFdown = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::MUFDOWN);
269  float Var3cUp = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::VAR3CUP);
270  float Var3cDown = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::VAR3CDOWN);
271  float FSRUp = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::FSRUP);
272  float FSRDown = GetPMGTruthWeight(event.m_info,WEIGHTTYPE::FSRDOWN);
273 
274  float jvt_sf = event.m_jvtSF;
275  float pu_weight = 1.0;
278  }
279  float lepton_sf = m_sfRetriever->leptonSF(event, nominal);
280 
281  if (m_doNominal) {
282  eventWeightNominal = event.m_info->auxdataConst<float>("AnalysisTop_eventWeight") * jvt_sf * pu_weight * lepton_sf;
283  }
284  if (m_doMuRup) eventWeightMuRup = muRup * jvt_sf * pu_weight * lepton_sf;
285  if (m_doMuRdown) eventWeightMuRdown = muRdown * jvt_sf * pu_weight * lepton_sf;
286  if (m_doMuFup) eventWeightMuFup = muFup * jvt_sf * pu_weight * lepton_sf;
287  if (m_doMuFdown) eventWeightMuFdown = muFdown * jvt_sf * pu_weight * lepton_sf;
288  if (m_doVar3cup) eventWeightVar3cUp = Var3cUp * jvt_sf * pu_weight * lepton_sf;
289  if (m_doVar3cdown) eventWeightVar3cDown = Var3cDown * jvt_sf * pu_weight * lepton_sf;
290  if (m_doFSRup) eventWeightFSRUp = FSRUp * jvt_sf * pu_weight * lepton_sf;
291  if (m_doFSRdown) eventWeightFSRDown = FSRDown * jvt_sf * pu_weight * lepton_sf;
292 
294  eventWeightNominal = 1.0;
295  }
296 
297  if (m_hists) FillHistograms(m_hists, eventWeightNominal, event);
298  if (m_hists_muRup) FillHistograms(m_hists_muRup, eventWeightMuRup, event);
299  if (m_hists_muRdown) FillHistograms(m_hists_muRdown, eventWeightMuRdown, event);
300  if (m_hists_muFup) FillHistograms(m_hists_muFup, eventWeightMuFup, event);
301  if (m_hists_muFdown) FillHistograms(m_hists_muFdown, eventWeightMuFdown, event);
302  if (m_hists_Var3cup) FillHistograms(m_hists_Var3cup, eventWeightVar3cUp, event);
303  if (m_hists_Var3cdown) FillHistograms(m_hists_Var3cdown, eventWeightVar3cDown, event);
304  if (m_hists_FSRup) FillHistograms(m_hists_FSRup, eventWeightFSRUp, event);
305  if (m_hists_FSRdown) FillHistograms(m_hists_FSRdown, eventWeightFSRDown, event);
306 
307  return true;
308  }
309 
310  void JetFtagEffPlots::FillHistograms(std::shared_ptr<PlotManager> h_ptr, double w_event, const top::Event& event) const {
311  const xAOD::JetContainer* jets;
312 
313  if (!m_use_track_jets) {
314  jets = &event.m_jets;
315  } else {
316  jets = &event.m_trackJets;
317  }
318 
319  for (unsigned long jet_i = 0; jet_i < jets->size(); jet_i++) {
320  const xAOD::Jet* jetPtr = jets->at(jet_i);
321 
322  int jet_flavor = -99;
323  bool status = jetPtr->getAttribute<int>("HadronConeExclTruthLabelID", jet_flavor);
324 
325  if (!status) continue;
326 
327  std::string flav_name;
328 
329  if (jet_flavor == 5) flav_name = "B";
330 
331  else if (jet_flavor == 4) flav_name = "C";
332 
333  else if (jet_flavor == 0) flav_name = "L";
334 
335  else if (jet_flavor == 15) flav_name = "T";
336 
337  if (m_fill_total_hists) {
338  static_cast<TH2D*>(h_ptr->hist(flav_name + "_total_" + m_jetCollection + m_histogram_suffix))->Fill(jetPtr->pt() * toGeV, fabs(jetPtr->eta()), w_event);
339  }
340 
341  bool pass_cut = static_cast<bool>(m_selection_tool->accept(jetPtr));
342 
343  if (pass_cut) {
344  std::string hist_name = m_tagger + "_" + m_WP + "_" + m_jetCollection + "_" + flav_name + "_pass" + m_histogram_suffix;
345  static_cast<TH2D*>(h_ptr->hist(hist_name))->Fill(jetPtr->pt() * toGeV, fabs(jetPtr->eta()), w_event);
346  }
347  }
348  }
349 
350 // function to translate the binnings into vector of bin edges
351  void JetFtagEffPlots::formatBinning(const std::string& str, std::vector<double>& binEdges) {
352  std::stringstream ss(str);
353  std::string tok;
354  char separator = ':';
355  while (std::getline(ss, tok, separator)) {
356  binEdges.push_back(std::atof(tok.c_str()));
357  }
358  }
359 
360  float JetFtagEffPlots::GetPMGTruthWeight(const xAOD::EventInfo* evtInfo, WEIGHTTYPE type) const {
361  float result = 1;
362 
363  if (type == WEIGHTTYPE::MURUP) {
364  if (m_PMGTruthWeights->hasWeight(" muR = 2.0, muF = 1.0 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 2.0, muF = 1.0 ");
365  else if (m_PMGTruthWeights->hasWeight(" muR = 2.00, muF = 1.00 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 2.00, muF = 1.00 ");
366  } else if (type == WEIGHTTYPE::MURDOWN) {
367  if (m_PMGTruthWeights->hasWeight(" muR = 0.5, muF = 1.0 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 0.5, muF = 1.0 ");
368  else if (m_PMGTruthWeights->hasWeight(" muR = 0.50, muF = 1.00 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 0.50, muF = 1.00 ");
369  } else if (type == WEIGHTTYPE::MUFUP) {
370  if (m_PMGTruthWeights->hasWeight(" muR = 1.0, muF = 2.0 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 1.0, muF = 2.0 ");
371  else if (m_PMGTruthWeights->hasWeight(" muR = 1.00, muF = 2.00 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 1.00, muF = 2.00 ");
372  } else if (type == WEIGHTTYPE::MUFDOWN) {
373  if (m_PMGTruthWeights->hasWeight(" muR = 1.0, muF = 0.5 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 1.0, muF = 0.5 ");
374  else if (m_PMGTruthWeights->hasWeight(" muR = 1.00, muF = 0.50 ")) result = m_PMGTruthWeights->getWeight(evtInfo," muR = 1.00, muF = 0.50 ");
375  } else if (type == WEIGHTTYPE::VAR3CUP) {
376  if (m_PMGTruthWeights->hasWeight("Var3cUp")) result = m_PMGTruthWeights->getWeight(evtInfo,"Var3cUp");
377  } else if (type == WEIGHTTYPE::VAR3CDOWN) {
378  if (m_PMGTruthWeights->hasWeight("Var3cDown")) result = m_PMGTruthWeights->getWeight(evtInfo,"Var3cDown");
379  } else if (type == WEIGHTTYPE::FSRUP) {
380  if (m_PMGTruthWeights->hasWeight("isr:muRfac=1.0_fsr:muRfac=2.0")) result = m_PMGTruthWeights->getWeight(evtInfo,"isr:muRfac=1.0_fsr:muRfac=2.0");
381  else if (m_PMGTruthWeights->hasWeight("isr:muRfac=1.00_fsr:muRfac=2.00")) result = m_PMGTruthWeights->getWeight(evtInfo,"isr:muRfac=1.00_fsr:muRfac=2.00");
382  } else if (type == WEIGHTTYPE::FSRDOWN) {
383  if (m_PMGTruthWeights->hasWeight("isr:muRfac=1.0_fsr:muRfac=0.5")) result = m_PMGTruthWeights->getWeight(evtInfo,"isr:muRfac=1.0_fsr:muRfac=0.5");
384  else if (m_PMGTruthWeights->hasWeight("isr:muRfac=1.00_fsr:muRfac=0.50")) result = m_PMGTruthWeights->getWeight(evtInfo,"isr:muRfac=1.00_fsr:muRfac=0.50");
385  }
386 
387  return result;
388  }
389 
390  std::string JetFtagEffPlots::name() const {
391  return "JETFTAGEFFPLOTS";
392  }
393 } // namespace top
asg::AnaToolHandle::initialize
StatusCode initialize()
initialize the tool
top::JetFtagEffPlots::m_hists_Var3cup
std::shared_ptr< PlotManager > m_hists_Var3cup
Definition: JetFtagEffPlots.h:59
top::JetFtagEffPlots::m_hists
std::shared_ptr< PlotManager > m_hists
Definition: JetFtagEffPlots.h:54
asg::AnaToolHandle< IBTaggingSelectionTool >
top::JetFtagEffPlots::m_use_track_jets
bool m_use_track_jets
Definition: JetFtagEffPlots.h:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
top::ScaleFactorRetriever::hasPileupSF
static bool hasPileupSF(const top::Event &event)
Definition: ScaleFactorRetriever.cxx:63
top::JetFtagEffPlots::m_N_pT_bins
int m_N_pT_bins
Definition: JetFtagEffPlots.h:92
top::JetFtagEffPlots::m_dont_use_event_weight
bool m_dont_use_event_weight
Definition: JetFtagEffPlots.h:74
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
top::JetFtagEffPlots::formatBinning
void formatBinning(const std::string &str, std::vector< double > &binEdges)
Definition: JetFtagEffPlots.cxx:351
top::JetFtagEffPlots::m_CDIfile
std::string m_CDIfile
Definition: JetFtagEffPlots.h:68
PMGTools::PMGTruthWeightTool::hasWeight
virtual bool hasWeight(const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:135
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
top::JetFtagEffPlots::GetPMGTruthWeight
float GetPMGTruthWeight(const xAOD::EventInfo *evtInfo, WEIGHTTYPE type) const
A helper function to get the correct truth weight.
Definition: JetFtagEffPlots.cxx:360
top::JetFtagEffPlots::name
std::string name() const override
A human readable name.
Definition: JetFtagEffPlots.cxx:390
top::JetFtagEffPlots::m_hists_FSRdown
std::shared_ptr< PlotManager > m_hists_FSRdown
Definition: JetFtagEffPlots.h:62
top::JetFtagEffPlots::m_hists_FSRup
std::shared_ptr< PlotManager > m_hists_FSRup
Definition: JetFtagEffPlots.h:61
PMGTools::PMGTruthWeightTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: PMGTruthWeightTool.cxx:31
MsgCategory.h
top::JetFtagEffPlots::m_min_Eta
float m_min_Eta
Definition: JetFtagEffPlots.h:95
top::JetFtagEffPlots::m_doMuFup
bool m_doMuFup
Definition: JetFtagEffPlots.h:79
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
top::JetFtagEffPlots::m_hists_muFdown
std::shared_ptr< PlotManager > m_hists_muFdown
Definition: JetFtagEffPlots.h:58
xAOD::Jet_v1::getAttribute
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
top::JetFtagEffPlots::m_doFSRup
bool m_doFSRup
Definition: JetFtagEffPlots.h:83
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
top::JetFtagEffPlots::m_max_pT
float m_max_pT
Definition: JetFtagEffPlots.h:90
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::JetFtagEffPlots::m_jetCollection
std::string m_jetCollection
Definition: JetFtagEffPlots.h:99
top::ScaleFactorRetriever::leptonSF
float leptonSF(const top::Event &event, const top::topSFSyst SFSyst) const
Definition: ScaleFactorRetriever.cxx:85
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
top::JetFtagEffPlots::m_doNominal
bool m_doNominal
Definition: JetFtagEffPlots.h:76
top::JetFtagEffPlots::m_max_Eta
float m_max_Eta
Definition: JetFtagEffPlots.h:94
JetFtagEffPlots.h
top::JetFtagEffPlots::m_fill_total_hists
bool m_fill_total_hists
Definition: JetFtagEffPlots.h:70
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
top::JetFtagEffPlots::m_ptBins
std::string m_ptBins
Definition: JetFtagEffPlots.h:87
EL::Worker
Definition: Worker.h:25
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::JetFtagEffPlots::m_WP
std::string m_WP
Definition: JetFtagEffPlots.h:100
top::JetFtagEffPlots::m_doMuRdown
bool m_doMuRdown
Definition: JetFtagEffPlots.h:78
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
top::JetFtagEffPlots::m_PMGTruthWeights
PMGTools::PMGTruthWeightTool * m_PMGTruthWeights
Definition: JetFtagEffPlots.h:108
top::JetFtagEffPlots::m_hists_muRup
std::shared_ptr< PlotManager > m_hists_muRup
Definition: JetFtagEffPlots.h:55
top::JetFtagEffPlots::m_histogram_suffix
std::string m_histogram_suffix
Definition: JetFtagEffPlots.h:73
toGeV
#define toGeV
Definition: HIEfficiencyResponseHistos.cxx:16
top::JetFtagEffPlots::m_hists_Var3cdown
std::shared_ptr< PlotManager > m_hists_Var3cdown
Definition: JetFtagEffPlots.h:60
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::JetFtagEffPlots::m_tagger
std::string m_tagger
Definition: JetFtagEffPlots.h:101
top::JetFtagEffPlots::m_hists_muFup
std::shared_ptr< PlotManager > m_hists_muFup
Definition: JetFtagEffPlots.h:57
top::isSimulation
bool isSimulation(const top::Event &event)
Is this event MC simulation (True) or data (False)?
Definition: EventTools.cxx:52
top::JetFtagEffPlots::m_doVar3cdown
bool m_doVar3cdown
Definition: JetFtagEffPlots.h:82
top::JetFtagEffPlots::m_selection_tool
asg::AnaToolHandle< IBTaggingSelectionTool > m_selection_tool
Definition: JetFtagEffPlots.h:106
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Jet_v1.cxx:49
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
top::JetFtagEffPlots::toGeV
static const double toGeV
Definition: JetFtagEffPlots.h:51
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
top::JetFtagEffPlots::m_min_pT
float m_min_pT
Definition: JetFtagEffPlots.h:91
top::JetFtagEffPlots::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: JetFtagEffPlots.cxx:244
TopConfig.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
PMGTools::PMGTruthWeightTool
Implementation for the xAOD truth meta data weight tool.
Definition: PMGTruthWeightTool.h:26
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
top::ScaleFactorRetriever::pileupSF
static float pileupSF(const top::Event &event, int var=0)
Definition: ScaleFactorRetriever.cxx:68
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
top::JetFtagEffPlots::m_doMuFdown
bool m_doMuFdown
Definition: JetFtagEffPlots.h:80
top::JetFtagEffPlots::m_doFSRdown
bool m_doFSRdown
Definition: JetFtagEffPlots.h:84
IBTaggingSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *p) const =0
Declare the interface that the class provides.
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
str
Definition: BTagTrackIpAccessor.cxx:11
merge.status
status
Definition: merge.py:17
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
top::JetFtagEffPlots::m_etaBins
std::string m_etaBins
Definition: JetFtagEffPlots.h:88
top::JetFtagEffPlots::m_N_Eta_bins
int m_N_Eta_bins
Definition: JetFtagEffPlots.h:96
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
top::JetFtagEffPlots::FillHistograms
void FillHistograms(std::shared_ptr< PlotManager > h_ptr, double w_event, const top::Event &event) const
Definition: JetFtagEffPlots.cxx:310
top::JetFtagEffPlots::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: JetFtagEffPlots.h:103
top::JetFtagEffPlots::m_sfRetriever
top::ScaleFactorRetriever * m_sfRetriever
Definition: JetFtagEffPlots.h:110
ScaleFactorRetriever.h
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
top::JetFtagEffPlots::m_nominalHashValue
std::size_t m_nominalHashValue
Definition: JetFtagEffPlots.h:66
top::JetFtagEffPlots::m_hists_muRdown
std::shared_ptr< PlotManager > m_hists_muRdown
Definition: JetFtagEffPlots.h:56
top::JetFtagEffPlots::m_doVar3cup
bool m_doVar3cup
Definition: JetFtagEffPlots.h:81
PMGTools::PMGTruthWeightTool::getWeight
virtual float getWeight(const xAOD::EventInfo *evtInfo, const std::string &weightName) const override
Implements interface from IPMGTruthWeightTool.
Definition: PMGTruthWeightTool.cxx:111
top::JetFtagEffPlots::m_doMuRup
bool m_doMuRup
Definition: JetFtagEffPlots.h:77