ATLAS Offline Software
EventSelection.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "TopAnalysis/Tools.h"
7 
8 #include "TopEvent/EventTools.h"
10 
12 
14 
15 #include <iomanip>
16 #include <sstream>
17 #include <cassert>
18 #include <utility>
19 
20 #include "TH1D.h"
21 #include "TFile.h"
22 #include "TClass.h"
23 #include "TROOT.h"
24 
26 
29 
31 using namespace TopAnalysis;
32 
33 namespace top {
34  EventSelection::EventSelection(const std::string& name, const std::vector<std::string>& cutNames, TFile* outputFile,
35  const std::vector<std::unique_ptr<top::ToolLoaderBase> >& toolLoaders,
36  const std::shared_ptr<top::TopConfig>& config, EL::Worker* wk) :
37  m_cutflow(nullptr),
38  m_cutflow_Loose(nullptr),
39  m_cutflowMCWeights(nullptr),
40  m_cutflowMCWeights_Loose(nullptr),
41  m_cutflowPUWeights(nullptr),
42  m_cutflowPUWeights_Loose(nullptr),
43  m_cutflowMCPUWeights(nullptr),
44  m_cutflowMCPUWeights_Loose(nullptr),
45  m_cutflowScaleFactors(nullptr),
46  m_cutflowScaleFactors_Loose(nullptr),
47  m_cutflowParticleLevel(nullptr),
48  m_cutflowParticleLevelMCWeights(nullptr),
49  m_name(name),
50  m_isMC(false),
51  m_sfRetriever(nullptr),
52  m_nominalHashValue(0),
53  m_containsInitial(false),
54  m_containsGRL(false),
55  m_containsGoodCalo(false),
56  m_containsPrimaryVertex(false),
57  m_positionInitial(0),
58  m_positionGRL(0),
59  m_positionGoodCalo(0),
60  m_positionPrimaryVertex(0),
61  m_toBeSaved(false) {
62  // We use the nominal hash value so we don't do
63  // string comparisions during the event loop
65  m_nominalHashValue = nominal.hash();
66 
67  // need that later for the sf in the cutflow, not especially elegant but works for now
68  m_config = config;
69  m_isMC = config->isMC();
70 
71  if (m_isMC) {
73  }
74 
75  TDirectory* plotDir = outputFile->mkdir(m_name.c_str());
76  plotDir->cd();
77  if (config->doTightEvents()) {
78  m_cutflow = new TH1D("cutflow", (name + " cutflow").c_str(), cutNames.size(), -0.5, cutNames.size() - 0.5);
79  m_cutflowMCWeights = new TH1D("cutflow_mc", (name + " cutflow MC weights").c_str(),
80  cutNames.size(), -0.5, cutNames.size() - 0.5);
81  m_cutflowPUWeights = new TH1D("cutflow_pu", (name + " cutflow PU weights").c_str(),
82  cutNames.size(), -0.5, cutNames.size() - 0.5);
83  m_cutflowMCPUWeights = new TH1D("cutflow_mc_pu", (name + " cutflow MC*PU weights").c_str(),
84  cutNames.size(), -0.5, cutNames.size() - 0.5);
85  m_cutflowScaleFactors = new TH1D("cutflow_scale_factors", (name + " cutflow ScaleFactors").c_str(),
86  cutNames.size(), -0.5, cutNames.size() - 0.5);
87  }
88  if (config->doLooseEvents()) {
89  m_cutflow_Loose = new TH1D("cutflow_Loose", (name + " cutflow_Loose").c_str(),
90  cutNames.size(), -0.5, cutNames.size() - 0.5);
91  m_cutflowMCWeights_Loose = new TH1D("cutflow_mc_Loose",
92  (name + " cutflow_Loose MC weights").c_str(),
93  cutNames.size(), -0.5, cutNames.size() - 0.5);
94  m_cutflowPUWeights_Loose = new TH1D("cutflow_pu_Loose",
95  (name + " cutflow_Loose PU weights").c_str(),
96  cutNames.size(), -0.5, cutNames.size() - 0.5);
97  m_cutflowMCPUWeights_Loose = new TH1D("cutflow_mc_pu_Loose",
98  (name + " cutflow_Loose MC*PU weights").c_str(),
99  cutNames.size(), -0.5, cutNames.size() - 0.5);
100  m_cutflowScaleFactors_Loose = new TH1D("cutflow_scale_factors_Loose",
101  (name + " cutflow_Loose ScaleFactors").c_str(),
102  cutNames.size(), -0.5, cutNames.size() - 0.5);
103  }
104 
105  if (config->doTopParticleLevel()) {
106  m_cutflowParticleLevel = new TH1D("cutflow_particle_level",
107  (name + " cutflow_particle_level").c_str(),
108  cutNames.size(), -0.5, cutNames.size() - 0.5);
109  m_cutflowParticleLevelMCWeights = new TH1D("cutflow_particle_level_mc",
110  (name + " cutflow_particle_level_mc").c_str(),
111  cutNames.size(), -0.5, cutNames.size() - 0.5);
112  }
113 
114  unsigned int i(0);
115  for (const auto& currentCutName : cutNames) {
116  //look through all the libraries and load any tools
117  top::EventSelectorBase* tool = nullptr;
118  for (const auto& libraryPtr : toolLoaders) {
119  tool = libraryPtr->initTool(m_name, currentCutName, outputFile, config, wk);
120  if (tool) break;
121  }
122 
123  if (tool != nullptr) {
124  m_allCuts.emplace_back(std::move(tool));
125  } else {
126  throw std::runtime_error("Could not find " + currentCutName);
127  }
128 
129  // Initlal and GRL
130  if (currentCutName == "INITIAL") {
131  m_containsInitial = true;
133  }
134 
135  if (currentCutName == "GRL") {
136  m_containsGRL = true;
137  m_positionGRL = i;
138  }
139 
140  if (currentCutName == "GOODCALO") {
141  m_containsGoodCalo = true;
143  }
144 
145  if (currentCutName == "PRIVTX") {
148  }
149 
150  //some cutflow histograms
151  if (config->doTightEvents()) {
152  m_cutflow->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
153  m_cutflowMCWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
154  m_cutflowPUWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
155  m_cutflowMCPUWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
156  m_cutflowScaleFactors->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
157  }
158  if (config->doLooseEvents()) {
159  m_cutflow_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
160  m_cutflowMCWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
161  m_cutflowPUWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
162  m_cutflowMCPUWeights_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
163  m_cutflowScaleFactors_Loose->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
164  }
165 
167  m_cutflowParticleLevel->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
168  }
169 
171  m_cutflowParticleLevelMCWeights->GetXaxis()->SetBinLabel(i + 1, m_allCuts[i]->name().c_str());
172  }
173 
174  if (currentCutName == "SAVE") {
175  m_toBeSaved = true;
176  }
177 
178  ++i;
179  }
180 
181  //be nice to the user and tell them what they enabled
182  //at the very start of the run. It allows them to quit the program
183  //if they notice a problem.
184  printCuts();
185  }
186 
188  m_allCuts(std::move(other.m_allCuts)),
189  m_cutflow(std::move(other.m_cutflow)),
190  m_cutflow_Loose(std::move(other.m_cutflow_Loose)),
191  m_cutflowMCWeights(std::move(other.m_cutflowMCWeights)),
192  m_cutflowMCWeights_Loose(std::move(other.m_cutflowMCWeights_Loose)),
193  m_cutflowPUWeights(std::move(other.m_cutflowPUWeights)),
194  m_cutflowPUWeights_Loose(std::move(other.m_cutflowPUWeights_Loose)),
195  m_cutflowMCPUWeights(std::move(other.m_cutflowMCPUWeights)),
196  m_cutflowMCPUWeights_Loose(std::move(other.m_cutflowMCPUWeights_Loose)),
197  m_cutflowScaleFactors(std::move(other.m_cutflowScaleFactors)),
198  m_cutflowScaleFactors_Loose(std::move(other.m_cutflowScaleFactors_Loose)),
199  m_cutflowParticleLevel(std::move(other.m_cutflowParticleLevel)),
200  m_cutflowParticleLevelMCWeights(std::move(other.m_cutflowParticleLevelMCWeights)),
201  m_name(std::move(other.m_name)),
202  m_isMC(std::move(other.m_isMC)),
203  m_config(std::move(other.m_config)),
204  m_sfRetriever(nullptr),
205  m_nominalHashValue(std::move(other.m_nominalHashValue)),
206  m_containsInitial(std::move(other.m_containsInitial)),
207  m_containsGRL(std::move(other.m_containsGRL)),
208  m_containsGoodCalo(std::move(other.m_containsGoodCalo)),
209  m_containsPrimaryVertex(std::move(other.m_containsPrimaryVertex)),
210  m_positionInitial(std::move(other.m_positionInitial)),
211  m_positionGRL(std::move(other.m_positionGRL)),
212  m_positionGoodCalo(std::move(other.m_positionGoodCalo)),
213  m_positionPrimaryVertex(std::move(other.m_positionPrimaryVertex)),
214  m_toBeSaved(std::move(other.m_toBeSaved)) {
215  // need this to calculate the lepton SF for the cutflow
216  if (m_isMC) {
218  }
219  }
220 
221  void EventSelection::initialiseTopScaleFactorRetriever(const std::shared_ptr<TopConfig>& config) {
222  // Define this once, and then use it when needed
223  if (asg::ToolStore::contains<ScaleFactorRetriever>("top::ScaleFactorRetriever")) {
224  m_sfRetriever = asg::ToolStore::get<ScaleFactorRetriever>("top::ScaleFactorRetriever");
225  } else {
226  top::ScaleFactorRetriever* topSFR = new top::ScaleFactorRetriever("top::ScaleFactorRetriever");
227  top::check(asg::setProperty(topSFR, "config", config), "Failed to set config");
228  top::check(topSFR->initialize(), "Failed to initalialise");
229  m_sfRetriever = topSFR;
230  }
231  }
232 
233  void EventSelection::countInitial(const float mcEventWeight, const float pileupWeight) const {
234  if (m_containsInitial) {
235  if (m_config->doTightEvents()) {
237  m_cutflowMCWeights->Fill(m_positionInitial, mcEventWeight);
238  m_cutflowPUWeights->Fill(m_positionInitial, pileupWeight);
239  m_cutflowMCPUWeights->Fill(m_positionInitial, mcEventWeight * pileupWeight);
240  }
241  if (m_config->doLooseEvents()) {
243  m_cutflowMCWeights_Loose->Fill(m_positionInitial, mcEventWeight);
244  m_cutflowPUWeights_Loose->Fill(m_positionInitial, pileupWeight);
245  m_cutflowMCPUWeights_Loose->Fill(m_positionInitial, mcEventWeight * pileupWeight);
246  }
247  }
248  }
249 
250  void EventSelection::countGRL(const float mcEventWeight, const float pileupWeight) const {
251  if (m_containsGRL) {
252  if (m_config->doTightEvents()) {
253  m_cutflow->Fill(m_positionGRL);
254  m_cutflowMCWeights->Fill(m_positionGRL, mcEventWeight);
255  m_cutflowPUWeights->Fill(m_positionGRL, pileupWeight);
256  m_cutflowMCPUWeights->Fill(m_positionGRL, mcEventWeight * pileupWeight);
257  }
258  if (m_config->doLooseEvents()) {
260  m_cutflowMCWeights_Loose->Fill(m_positionGRL, mcEventWeight);
261  m_cutflowPUWeights_Loose->Fill(m_positionGRL, pileupWeight);
262  m_cutflowMCPUWeights_Loose->Fill(m_positionGRL, mcEventWeight * pileupWeight);
263  }
264  }
265  }
266 
267  void EventSelection::countGoodCalo(const float mcEventWeight, const float pileupWeight) const {
268  if (m_containsGoodCalo) {
269  if (m_config->doTightEvents()) {
271  m_cutflowMCWeights->Fill(m_positionGoodCalo, mcEventWeight);
272  m_cutflowPUWeights->Fill(m_positionGoodCalo, pileupWeight);
273  m_cutflowMCPUWeights->Fill(m_positionGoodCalo, mcEventWeight * pileupWeight);
274  }
275  if (m_config->doLooseEvents()) {
277  m_cutflowMCWeights_Loose->Fill(m_positionGoodCalo, mcEventWeight);
278  m_cutflowPUWeights_Loose->Fill(m_positionGoodCalo, pileupWeight);
279  m_cutflowMCPUWeights_Loose->Fill(m_positionGoodCalo, mcEventWeight * pileupWeight);
280  }
281  }
282  }
283 
284  void EventSelection::countPrimaryVertex(const float mcEventWeight, const float pileupWeight) const {
286  if (m_config->doTightEvents()) {
288  m_cutflowMCWeights->Fill(m_positionPrimaryVertex, mcEventWeight);
289  m_cutflowPUWeights->Fill(m_positionPrimaryVertex, pileupWeight);
290  m_cutflowMCPUWeights->Fill(m_positionPrimaryVertex, mcEventWeight * pileupWeight);
291  }
292  if (m_config->doLooseEvents()) {
296  m_cutflowMCPUWeights_Loose->Fill(m_positionPrimaryVertex, mcEventWeight * pileupWeight);
297  }
298  }
299  }
300 
302  unsigned int i(0);
303  bool passEvent(false);
304 
305  for (const auto& currentCut : m_allCuts) {
306  const bool passed = currentCut->apply(event);
307 
308  if (!passed) break;
309 
310  double mcweight = 1.;
311  double puweight = 1.;
312  double leptonSF = 1.;
313 
314  if (m_isMC) {
315  mcweight = event.m_info->auxdataConst<float>("AnalysisTop_eventWeight");
316 
318 
320  }
321 
322  //add cutflow information for the nominal (not systematic) selection
323  //For data we have (sometimes) the same event with loose and tight
324  //The cutflow is just the "analysis" -> tight to avoid double counting
325  if (event.m_hashValue == m_nominalHashValue) {
326  bool countThisCut(true);
328  countThisCut = false;
329  }
330  if (m_containsGRL && i == m_positionGRL) {
331  countThisCut = false;
332  }
334  countThisCut = false;
335  }
337  countThisCut = false;
338  }
339  if (countThisCut) {
340  if (m_config->doTightEvents() && !event.m_isLoose) {
341  m_cutflow->Fill(i);
342  m_cutflowMCWeights->Fill(i, mcweight);
343  m_cutflowPUWeights->Fill(i, puweight);
344  m_cutflowMCPUWeights->Fill(i, mcweight * puweight);
345  m_cutflowScaleFactors->Fill(i, leptonSF);
346  }
347  if (m_config->doLooseEvents() && event.m_isLoose) {
348  m_cutflow_Loose->Fill(i);
349  m_cutflowMCWeights_Loose->Fill(i, mcweight);
350  m_cutflowPUWeights_Loose->Fill(i, puweight);
351  m_cutflowMCPUWeights_Loose->Fill(i, mcweight * puweight);
352  m_cutflowScaleFactors_Loose->Fill(i, leptonSF);
353  }
354  }
355  }
356 
357  passEvent |= (currentCut->name() == "SAVE");
358  ++i;
359  }
360 
361  // If "SAVE" wasn't found but event passes all cuts, event passes the selection
362  passEvent |= (i == m_allCuts.size());
363 
364  return passEvent;
365  }
366 
368  // In principle, this function should never be called for non-active
369  // particle level. However, for code safetly, include a null pointer
370  // check. Return false here because "do-not-do-particle-level" is equivalent
371  // to "do-no-save-particle-level".
372  if (not m_cutflowParticleLevel) {
373  return false;
374  }
376  return false;
377  }
378 
379  unsigned int i(0);
380  bool passEvent(false);
381 
382  for (const auto& currentCut : m_allCuts) {
383  const bool passed = currentCut->applyParticleLevel(plEvent);
384 
385  if (!passed) break;
386 
387  m_cutflowParticleLevel->Fill(i);
388 
389  double mcweight = plEvent.m_info->mcEventWeight(0);
390  m_cutflowParticleLevelMCWeights->Fill(i, mcweight);
391 
392  passEvent |= (currentCut->name() == "SAVE");
393  ++i;
394  }
395 
396  // If "SAVE" wasn't found but event passes all cuts, event passes the selection
397  passEvent |= (i == m_allCuts.size());
398 
399  return passEvent;
400  }
401 
403  //2dp, neater output for numbers
404  MsgStream& msgInfo = msg(MSG::Level::INFO);
405  msgInfo << std::right;
406  if (m_isMC) msgInfo << std::fixed << std::setprecision(2);
407 
408  if (m_config->doTightEvents()) {
409  //channel name
410  msgInfo << " - " << m_name << " cutflow:\n";
411 
412  //some headings
413  msgInfo << std::setw(7) << "" <<
414  std::setw(30) << "cut" <<
415  std::setw(15) << "events";
416 
417  if (m_isMC)
418  msgInfo << std::setw(15) << "mc weights" <<
419  std::setw(15) << "mc*pu weights" <<
420  std::setw(15) << "lepton SF" <<
421  std::setw(15) << "b-tag SF";
422 
424  msgInfo << std::setw(15) << "particle level";
425  }
426 
428  msgInfo << std::setw(15) << "particle level mc";
429  }
430 
431  msgInfo << "\n";
432 
433  //cutflow table content
434  for (int i = 1; i <= m_cutflow->GetNbinsX(); ++i) {
435  msgInfo << " " << std::setw(3) << i
436  << std::setw(30) << m_cutflow->GetXaxis()->GetBinLabel(i)
437  << std::setw(15) << m_cutflow->GetBinContent(i);
438 
439  if (m_isMC)
440  msgInfo << std::setw(15) << m_cutflowMCWeights->GetBinContent(i)
441  << std::setw(15) << m_cutflowMCPUWeights->GetBinContent(i)
442  << std::setw(15) << m_cutflowScaleFactors->GetBinContent(i);
443 
445  msgInfo << std::setw(15) << m_cutflowParticleLevel->GetBinContent(i);
446  }
447 
449  msgInfo << std::setw(15) << m_cutflowParticleLevelMCWeights->GetBinContent(i);
450  }
451 
452  msgInfo << "\n";
453  }
454  }
455  if (m_config->doLooseEvents()) {
456  //channel name
457  msgInfo << " - " << m_name << " cutflow (Loose):\n";
458 
459  //some headings
460  msgInfo << std::setw(7) << "" <<
461  std::setw(30) << "cut" <<
462  std::setw(15) << "events";
463 
464  if (m_isMC)
465  msgInfo << std::setw(15) << "mc weights" <<
466  std::setw(15) << "mc*pu weights" <<
467  std::setw(15) << "lepton SF" <<
468  std::setw(15) << "b-tag SF";
469 
471  msgInfo << std::setw(15) << "particle level";
472  }
473 
475  msgInfo << std::setw(15) << "particle level mc";
476  }
477 
478  msgInfo << "\n";
479 
480  //cutflow table content
481  for (int i = 1; i <= m_cutflow_Loose->GetNbinsX(); ++i) {
482  msgInfo << " " << std::setw(3) << i
483  << std::setw(30) << m_cutflow_Loose->GetXaxis()->GetBinLabel(i)
484  << std::setw(15) << m_cutflow_Loose->GetBinContent(i);
485 
486  if (m_isMC)
487  msgInfo << std::setw(15) << m_cutflowMCWeights_Loose->GetBinContent(i)
488  << std::setw(15) << m_cutflowMCPUWeights_Loose->GetBinContent(i)
489  << std::setw(15) << m_cutflowScaleFactors_Loose->GetBinContent(i);
490 
492  msgInfo << std::setw(15) << m_cutflowParticleLevel->GetBinContent(i);
493  }
494 
496  msgInfo << std::setw(15) << m_cutflowParticleLevelMCWeights->GetBinContent(i);
497  }
498 
499  msgInfo << "\n";
500  }
501  }
502  msgInfo << "\n";
503  msgInfo.doOutput();
504  }
505 
506  const std::string EventSelection::name() const {
507  return m_name;
508  }
509 
510  std::vector<std::string> EventSelection::GetFakesMMConfigs() const {
511  std::vector<std::string> configs;
512  for (const auto& currentCutName : m_allCuts) {
513  if (currentCutName->name() != "FAKESMMCONFIGS") continue;
514  else {
515  FakesMMConfigs* conf = dynamic_cast<FakesMMConfigs*>(currentCutName.get());
516  for (const std::string& s : conf->configurations())
517  configs.push_back(s);
518  }
519  }
520  return configs;
521  }
522 
524  MsgStream& msgInfo = msg(MSG::Level::INFO);
525  msgInfo << "\n - " << m_name << ":\n";
526  if (m_config->doTightEvents()) {
527  for (int i = 1; i <= m_cutflow->GetNbinsX(); ++i) {
528  msgInfo << " " << std::setw(3) << i
529  << std::setw(30) << m_cutflow->GetXaxis()->GetBinLabel(i)
530  << "\n";
531  }
532  } else if (m_config->doLooseEvents()) {
533  for (int i = 1; i <= m_cutflow_Loose->GetNbinsX(); ++i) {
534  msgInfo << " " << std::setw(3) << i
535  << std::setw(30) << m_cutflow_Loose->GetXaxis()->GetBinLabel(i)
536  << "\n";
537  }
538  }
539  msgInfo << std::endl;
540  msgInfo.doOutput();
541  }
542 }
top::EventSelection::m_toBeSaved
bool m_toBeSaved
Definition: EventSelection.h:225
top::EventSelection::m_config
std::shared_ptr< TopConfig > m_config
Definition: EventSelection.h:201
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
top::ParticleLevelEvent::m_info
const xAOD::EventInfo * m_info
Pointer to the event info object.
Definition: ParticleLevelEvent.h:39
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::EventSelection::m_cutflowParticleLevel
TH1D * m_cutflowParticleLevel
The particle level cutflow histogram filled by the tool.
Definition: EventSelection.h:188
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
top::EventSelection::m_containsGRL
bool m_containsGRL
Definition: EventSelection.h:214
top::EventSelection::m_cutflowMCWeights
TH1D * m_cutflowMCWeights
Cutflow counting MC weights instead of events.
Definition: EventSelection.h:172
Tools.h
top::EventSelection::m_cutflowMCWeights_Loose
TH1D * m_cutflowMCWeights_Loose
Definition: EventSelection.h:173
top::EventSelection::printCuts
virtual void printCuts()
Print a cutflow showing the number of events passing each cut.
Definition: EventSelection.cxx:523
top::EventSelection::applyParticleLevel
virtual bool applyParticleLevel(const top::ParticleLevelEvent &plEvent) const
Apply the selection for each particle level event.
Definition: EventSelection.cxx:367
top::ScaleFactorRetriever::hasPileupSF
static bool hasPileupSF(const top::Event &event)
Definition: ScaleFactorRetriever.cxx:63
top::EventSelection::m_cutflowMCPUWeights
TH1D * m_cutflowMCPUWeights
Cutflow counting MC*Pileup weights instead of events.
Definition: EventSelection.h:180
top::EventSelection::m_cutflowParticleLevelMCWeights
TH1D * m_cutflowParticleLevelMCWeights
Definition: EventSelection.h:189
SystematicSet.h
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
top::EventSelection::m_cutflowScaleFactors
TH1D * m_cutflowScaleFactors
Cutflow counting ScaleFactors instead of events.
Definition: EventSelection.h:184
top::EventSelection::m_containsInitial
bool m_containsInitial
Definition: EventSelection.h:213
top::EventSelection::m_positionGRL
unsigned int m_positionGRL
Definition: EventSelection.h:218
top::EventSelection::finalise
virtual void finalise() const
Print some yield information.
Definition: EventSelection.cxx:402
top::EventSelection::m_positionPrimaryVertex
unsigned int m_positionPrimaryVertex
Definition: EventSelection.h:220
top::EventSelection
Perform the event selection on a top::Event object.
Definition: EventSelection.h:37
top::EventSelection::m_cutflowPUWeights_Loose
TH1D * m_cutflowPUWeights_Loose
Definition: EventSelection.h:177
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::EventSelection::m_nominalHashValue
std::size_t m_nominalHashValue
Definition: EventSelection.h:209
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::EventSelection::countGoodCalo
virtual void countGoodCalo(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing Good Calo.
Definition: EventSelection.cxx:267
MsgCategory.h
python.ConfigurableDb.conf
def conf
Definition: ConfigurableDb.py:282
top::EventSelection::apply
virtual bool apply(const top::Event &event) const
Apply the selection for each event.
Definition: EventSelection.cxx:301
EL::Worker
Definition: Worker.h:25
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:92
top::EventSelection::countPrimaryVertex
virtual void countPrimaryVertex(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing Primary Vertex.
Definition: EventSelection.cxx:284
NJetBtagSelector.h
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
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::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::EventSelection::m_cutflow_Loose
TH1D * m_cutflow_Loose
Definition: EventSelection.h:169
top::ScaleFactorRetriever::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: ScaleFactorRetriever.cxx:30
top::EventSelection::m_cutflow
TH1D * m_cutflow
The cutflow histogram filled by the tool.
Definition: EventSelection.h:168
FakesMMConfigs.h
top::ScaleFactorRetriever
Definition: ScaleFactorRetriever.h:216
top::EventSelection::countGRL
virtual void countGRL(const float mcEventWeight, const float pileupWeight) const
Count the number of events passing GRL.
Definition: EventSelection.cxx:250
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
top::EventSelectorBase
This should apply event-level cuts and perform simple plotting on top::Event objects.
Definition: EventSelectorBase.h:20
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
top::EventSelection::countInitial
virtual void countInitial(const float mcEventWeight, const float pileupWeight) const
Count the number of initial events.
Definition: EventSelection.cxx:233
top::EventSelection::m_positionInitial
unsigned int m_positionInitial
Definition: EventSelection.h:217
top::EventSelection::name
const std::string name() const
Tells you the name of this event selection.
Definition: EventSelection.cxx:506
TopConfig.h
EventSelection.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
top::EventSelection::m_containsGoodCalo
bool m_containsGoodCalo
Definition: EventSelection.h:215
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:16
top::EventSelection::m_positionGoodCalo
unsigned int m_positionGoodCalo
Definition: EventSelection.h:219
top::ScaleFactorRetriever::pileupSF
static float pileupSF(const top::Event &event, int var=0)
Definition: ScaleFactorRetriever.cxx:68
config
std::vector< std::string > config
Definition: fbtTestBasics.cxx:72
top::EventSelection::m_containsPrimaryVertex
bool m_containsPrimaryVertex
Definition: EventSelection.h:216
top::EventSelection::initialiseTopScaleFactorRetriever
void initialiseTopScaleFactorRetriever(const std::shared_ptr< TopConfig > &config)
Function to setup the tool in one place.
Definition: EventSelection.cxx:221
top::EventSelection::EventSelection
EventSelection()=delete
Default constructor is not allowed.
top::EventSelection::m_isMC
bool m_isMC
To turn on/off confusing messages about mc weights when running on data.
Definition: EventSelection.h:198
xAOD::EventInfo_v1::mcEventWeight
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
Definition: EventInfo_v1.cxx:203
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
top::EventSelection::m_allCuts
std::vector< std::unique_ptr< EventSelectorBase > > m_allCuts
Vector of all the tools that will be used in the analysis.
Definition: EventSelection.h:165
top::EventSelection::m_sfRetriever
ScaleFactorRetriever * m_sfRetriever
Scale factors.
Definition: EventSelection.h:204
top::EventSelection::GetFakesMMConfigs
std::vector< std::string > GetFakesMMConfigs() const
Gives you the lists of the Fakes MM configurations associated to this selection.
Definition: EventSelection.cxx:510
top::EventSelection::m_cutflowMCPUWeights_Loose
TH1D * m_cutflowMCPUWeights_Loose
Definition: EventSelection.h:181
ParticleLevelEvent.h
ScaleFactorRetriever.h
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
top::FakesMMConfigs
An example of how to quickly make some plots at a certain point in the cutflow.
Definition: FakesMMConfigs.h:17
top::EventSelection::m_cutflowPUWeights
TH1D * m_cutflowPUWeights
Cutflow counting PileUp weights instead of events.
Definition: EventSelection.h:176
top::EventSelection::m_name
std::string m_name
Name of this selection (you can have multiple selections run in the same job.
Definition: EventSelection.h:195
top::EventSelection::m_cutflowScaleFactors_Loose
TH1D * m_cutflowScaleFactors_Loose
Definition: EventSelection.h:185