ATLAS Offline Software
OSLeptonSelector.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 #include "TopEvent/EventTools.h"
7 
8 namespace top {
10  unsigned int negative_counter = 0;
11  unsigned int positive_counter = 0;
12 
13  for (const auto* const elPtr : event.m_electrons)
14  if (elPtr->charge() > 0) ++positive_counter;
15  else ++negative_counter;
16 
17  for (const auto* const muPtr : event.m_muons)
18  if (muPtr->charge() > 0) ++positive_counter;
19  else ++negative_counter;
20 
21  return positive_counter > 0 && negative_counter > 0;
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_electrons
28  or not event.m_muons) {
29  return false;
30  }
31 
32  unsigned int negative_counter = 0;
33  unsigned int positive_counter = 0;
34 
35  for (const auto elPtr : *event.m_electrons)
36  if (elPtr->charge() > 0) ++positive_counter;
37  else ++negative_counter;
38 
39  for (const auto muPtr : *event.m_muons)
40  if (muPtr->charge() > 0) ++positive_counter;
41  else ++negative_counter;
42 
43  return positive_counter > 0 && negative_counter > 0;
44  }
45 
46  std::string OSLeptonSelector::name() const {
47  return "OS";
48  }
49 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::OSLeptonSelector::name
std::string name() const override
A human readable name.
Definition: OSLeptonSelector.cxx:46
top::OSLeptonSelector::applyParticleLevel
bool applyParticleLevel(const top::ParticleLevelEvent &event) const override
This does stuff based on the information in a particle level event.
Definition: OSLeptonSelector.cxx:24
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::ParticleLevelEvent
Definition: ParticleLevelEvent.h:24
OSLeptonSelector.h
top::OSLeptonSelector::apply
bool apply(const top::Event &event) const override
This does stuff based on the information in an event.
Definition: OSLeptonSelector.cxx:9
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49