ATLAS Offline Software
HTSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 
7 #include "TopEvent/EventTools.h"
8 
9 namespace top {
10  HTSelector::HTSelector(const std::string& params) :
11  SignValueSelector("HT", params) {
12  }
13 
14  bool HTSelector::apply(const top::Event& event) const {
15  const double ht = top::ht(event);
16 
17  return checkFloat(ht, value());
18  }
19 
21  // If any of the required collections is a nullptr (i.e. has not been
22  // loaded) return false.
23  if (not event.m_electrons
24  or not event.m_muons
25  or not event.m_jets) {
26  return false;
27  }
28 
29  double sumHt = 0.0;
30 
31  for (const auto el : *event.m_electrons)
32  sumHt += el->pt();
33 
34  for (const auto mu : *event.m_muons)
35  sumHt += mu->pt();
36 
37  for (const auto jet : *event.m_jets)
38  sumHt += jet->pt();
39 
40  return checkFloat(sumHt, value());
41  }
42 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::SignValueSelector::checkFloat
bool checkFloat(double value, double cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:133
HTSelector.h
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
top::HTSelector::applyParticleLevel
virtual bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
This does stuff based on the information in a particle level event.
Definition: HTSelector.cxx:20
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::HTSelector::apply
virtual bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: HTSelector.cxx:14
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
top::ht
double ht(const top::Event &event)
HT calculation.
Definition: EventTools.cxx:33
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
top::HTSelector::HTSelector
HTSelector(const std::string &params)
Definition: HTSelector.cxx:10