ATLAS Offline Software
PhysicsAnalysis
TopPhys
xAOD
TopEventSelectionTools
Root
NElectronNMuonSelector.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TopEventSelectionTools/NElectronNMuonSelector.h
"
6
7
namespace
top
{
8
NElectronNMuonSelector::NElectronNMuonSelector
(
const
std::string&
params
) :
9
SignValueSelector
(
"EL_N_OR_MU_N"
,
params
, true) {
10
checkMultiplicityIsInteger
();
11
}
12
13
bool
NElectronNMuonSelector::apply
(
const
top::Event
&
event
)
const
{
14
auto
elFunc = [&](
const
xAOD::Electron
* elPtr) {
15
return
elPtr->pt() >
value
();
16
};
17
auto
elCount = std::count_if(
event
.m_electrons.begin(),
event
.m_electrons.end(), elFunc);
18
19
auto
muFunc = [&](
const
xAOD::Muon
* muPtr) {
20
return
muPtr->pt() >
value
();
21
};
22
auto
muCount = std::count_if(
event
.m_muons.begin(),
event
.m_muons.end(), muFunc);
23
24
return
checkInt
(elCount,
multiplicity
()) ||
checkInt
(muCount,
multiplicity
());
25
}
26
27
bool
NElectronNMuonSelector::applyParticleLevel
(
const
top::ParticleLevelEvent
&
event
)
const
{
28
// If any of the required collections is a nullptr (i.e. has not been
29
// loaded) return false.
30
if
(not
event
.m_electrons
31
or not
event
.m_muons) {
32
return
false
;
33
}
34
35
auto
elFunc = [&](
const
xAOD::TruthParticle
* truElPtr) {
36
return
truElPtr->pt() >
value
();
37
};
38
auto
elCount = std::count_if(
event
.m_electrons->begin(),
event
.m_electrons->end(), elFunc);
39
40
auto
muFunc = [&](
const
xAOD::TruthParticle
* truMuPtr) {
41
return
truMuPtr->pt() >
value
();
42
};
43
auto
muCount = std::count_if(
event
.m_muons->begin(),
event
.m_muons->end(), muFunc);
44
45
return
checkInt
(elCount,
multiplicity
()) ||
checkInt
(muCount,
multiplicity
());
46
}
47
}
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::NElectronNMuonSelector::NElectronNMuonSelector
NElectronNMuonSelector(const std::string ¶ms)
Select events based on multiplicity, which should be an integer.
Definition:
NElectronNMuonSelector.cxx:8
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
top::NElectronNMuonSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
The 'OR' of a check against electrons and muons.
Definition:
NElectronNMuonSelector.cxx:27
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
NElectronNMuonSelector.h
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:41
top::ParticleLevelEvent
Definition:
ParticleLevelEvent.h:24
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
xAOD::Electron_v1
Definition:
Electron_v1.h:34
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::NElectronNMuonSelector::apply
bool apply(const top::Event &event) const override
The 'OR' of a check against electrons and muons.
Definition:
NElectronNMuonSelector.cxx:13
Generated on Fri Jul 5 2024 21:23:42 for ATLAS Offline Software by
1.8.18