ATLAS Offline Software
NMuonTightSelector.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 <algorithm>
8 
9 namespace top {
11  SignValueSelector("MU_N_TIGHT", params, true) {
13  }
14 
16  auto func = [&](const xAOD::Muon* muPtr) {
17  return muPtr->pt() > value() && muPtr->auxdataConst<char>("passPreORSelection");
18  };
19  auto count = std::count_if(event.m_muons.begin(), event.m_muons.end(), func);
20 
21  return checkInt(count, multiplicity());
22  }
23 
25  // If any of the required collections is a nullptr (i.e. has not been
26  // loaded) return false.
27  if (not event.m_muons) {
28  return false;
29  }
30 
31  auto func = [&](const xAOD::TruthParticle* truMuPtr) {
32  return truMuPtr->pt() > value();
33  };
34  auto count = std::count_if(event.m_muons->begin(), event.m_muons->end(), func);
35  return checkInt(count, multiplicity());
36  }
37 }
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
NMuonTightSelector.h
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
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
top::NMuonTightSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
This does stuff based on the information in a particle level event.
Definition: NMuonTightSelector.cxx:24
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
top::NMuonTightSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: NMuonTightSelector.cxx:15
top::SignValueSelector::checkMultiplicityIsInteger
void checkMultiplicityIsInteger()
Integers are annoying in C++.
Definition: SignValueSelector.cxx:82
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
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
top::NMuonTightSelector::NMuonTightSelector
NMuonTightSelector(const std::string &params)
Definition: NMuonTightSelector.cxx:10