ATLAS Offline Software
Public Member Functions | List of all members
top::SSLeptonSelector Class Reference

Keep only events that have at least one same sign lepton pair. More...

#include <SSLeptonSelector.h>

Inheritance diagram for top::SSLeptonSelector:
Collaboration diagram for top::SSLeptonSelector:

Public Member Functions

bool apply (const top::Event &event) const override
 This does stuff based on the information in an event. More...
 
bool applyParticleLevel (const top::ParticleLevelEvent &event) const override
 This does stuff based on the information in a particle level event. More...
 
std::string name () const override
 A human readable name. More...
 

Detailed Description

Keep only events that have at least one same sign lepton pair.

Definition at line 15 of file SSLeptonSelector.h.

Member Function Documentation

◆ apply()

bool top::SSLeptonSelector::apply ( const top::Event ) const
overridevirtual

This does stuff based on the information in an event.

The idea is that you implement this to return either true or false based on the information held within top::Event. If this returns true then the event is kept. If it returns false then the event is removed.

Parameters
top::EventThe current event.
Returns
true if the event should be kept, false otherwise.

Implements top::EventSelectorBase.

Definition at line 15 of file SSLeptonSelector.cxx.

15  {
16  unsigned int negative_counter = 0;
17  unsigned int positive_counter = 0;
18 
19  for (const auto* const elPtr : event.m_electrons)
20  if (elPtr->charge() > 0) ++positive_counter;
21  else ++negative_counter;
22 
23  for (const auto* const muPtr : event.m_muons)
24  if (muPtr->charge() > 0) ++positive_counter;
25  else ++negative_counter;
26 
27  return positive_counter > 1 || negative_counter > 1;
28  }

◆ applyParticleLevel()

bool top::SSLeptonSelector::applyParticleLevel ( const top::ParticleLevelEvent ) const
overridevirtual

This does stuff based on the information in a particle level event.

The idea is that you implement this to return either true or false, based on the information held within the top::ParticleLevelEvent. If this function returns true, then the event is kept, otherwise it is removed. The function has a default implementation (which returns true) because it is expected that many EventSelector objects do not operate on ParticleLevelEvent objects.

Parameters
top::ParticleLevelEventthe current particle level event.
trueif the event should be kept (i.e. it passed the selector criteria), false otherwise.

Reimplemented from top::EventSelectorBase.

Definition at line 30 of file SSLeptonSelector.cxx.

30  {
31  // If any of the required collections is a nullptr (i.e. has not been
32  // loaded) return false.
33  if (not event.m_electrons
34  or not event.m_muons) {
35  return false;
36  }
37 
38  unsigned int negative_counter = 0;
39  unsigned int positive_counter = 0;
40 
41  for (const auto elPtr : *event.m_electrons)
42  if (elPtr->charge() > 0) ++positive_counter;
43  else ++negative_counter;
44 
45  for (const auto muPtr : *event.m_muons)
46  if (muPtr->charge() > 0) ++positive_counter;
47  else ++negative_counter;
48 
49  return positive_counter > 1 || negative_counter > 1;
50  }

◆ name()

std::string top::SSLeptonSelector::name ( ) const
overridevirtual

A human readable name.

Mostly used for printing the cut and value to the screen. Must be implemented for each tool.

Implements top::EventSelectorBase.

Definition at line 52 of file SSLeptonSelector.cxx.

52  {
53  return "SS";
54  }

The documentation for this class was generated from the following files:
event
POOL::TEvent event(POOL::TEvent::kClassAccess)