ATLAS Offline Software
NTauSelector.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 namespace top {
8  NTauSelector::NTauSelector(const std::string& params) :
9  SignValueSelector("TAU_N", params, true) {
11  }
12 
13  bool NTauSelector::apply(const top::Event& event) const {
14  auto func = [&](const xAOD::TauJet* tauPtr) {
15  return tauPtr->pt() > value();
16  };
17  auto count = std::count_if(event.m_tauJets.begin(), event.m_tauJets.end(), func);
18 
19  return checkInt(count, multiplicity());
20  }
21 
23  // If any of the required collections is a nullptr (i.e. has not been
24  // loaded) return false.
25  if (!event.m_taus) {
26  return false;
27  }
28 
29  auto func = [&](const xAOD::TruthParticle* truTauPtr) {
30  return truTauPtr->pt() > value();
31  };
32  auto count = std::count_if(event.m_taus->begin(), event.m_taus->end(), func);
33  return checkInt(count, multiplicity());
34  }
35 }
top::NTauSelector::NTauSelector
NTauSelector(const std::string &params)
Definition: NTauSelector.cxx:8
top::SignValueSelector::checkInt
bool checkInt(int value, int cut) const
Compare a cut supplied by the user with the value calculated in the event.
Definition: SignValueSelector.cxx:159
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::SignValueSelector::multiplicity
double multiplicity() const
Get the cut multiplicity assigned in the constructor.
Definition: SignValueSelector.cxx:106
top::SignValueSelector
Many of the tools need a sign (>=) and a value (2).
Definition: SignValueSelector.h:16
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
top::NTauSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
This does stuff based on the information in a particle level event.
Definition: NTauSelector.cxx:22
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::SignValueSelector::checkMultiplicityIsInteger
void checkMultiplicityIsInteger()
Integers are annoying in C++.
Definition: SignValueSelector.cxx:82
NTauSelector.h
top::SignValueSelector::value
double value() const
Get the cut value assigned in the constructor.
Definition: SignValueSelector.cxx:94
top::NTauSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: NTauSelector.cxx:13
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226