ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
top::NoBadMuonSelector Class Reference

A tool that selects events containing no bad muons https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool#is_BadMuon_Flag_Event_Veto. More...

#include <NoBadMuonSelector.h>

Inheritance diagram for top::NoBadMuonSelector:
Collaboration diagram for top::NoBadMuonSelector:

Public Member Functions

 NoBadMuonSelector (std::shared_ptr< top::TopConfig > m_config)
 Event selection if bad muon detected using the official muon selector tool. More...
 
bool apply (const top::Event &event) const override
 Events with a muon flagged bad are rejected. More...
 
std::string name () const override
 The name of the tool. More...
 
virtual bool applyParticleLevel (const top::ParticleLevelEvent &) const
 This does stuff based on the information in a particle level event. More...
 

Private Attributes

ToolHandle< CP::IMuonSelectionToolm_muonSelectionTool
 
std::shared_ptr< top::TopConfigm_config
 

Detailed Description

A tool that selects events containing no bad muons https://twiki.cern.ch/twiki/bin/view/Atlas/MuonSelectionTool#is_BadMuon_Flag_Event_Veto.

Definition at line 21 of file NoBadMuonSelector.h.

Constructor & Destructor Documentation

◆ NoBadMuonSelector()

top::NoBadMuonSelector::NoBadMuonSelector ( std::shared_ptr< top::TopConfig m_config)
explicit

Event selection if bad muon detected using the official muon selector tool.

Call the muon selector tool and reject the event if any of the muons that passed the event selection are marked as bad.

Definition at line 10 of file NoBadMuonSelector.cxx.

10  :
11  m_config(config) {
12  if (!m_config->isTruthDxAOD()) {
13  m_muonSelectionTool = ToolHandle<CP::IMuonSelectionTool>("MuonSelectionTool");
14  top::check(m_muonSelectionTool.retrieve(), "Failed to retrieve muonSelectionTool");
15  }
16  }

Member Function Documentation

◆ apply()

bool top::NoBadMuonSelector::apply ( const top::Event event) const
overridevirtual

Events with a muon flagged bad are rejected.

Parameters
eventThe event in question
Returns
False if a bad muon is found

Implements top::EventSelectorBase.

Definition at line 18 of file NoBadMuonSelector.cxx.

18  {
19  if (m_config->isTruthDxAOD()) return true;
20 
21  for (const auto* const muPtr : event.m_muons) {
22  if (m_muonSelectionTool->isBadMuon(*muPtr)) {
23  event.m_info->auxdecor<char>("AnalysisTop_HASBADMUON") = 1;
24  return false;
25  }
26  }
27  return true;
28  }

◆ applyParticleLevel()

virtual bool top::EventSelectorBase::applyParticleLevel ( const top::ParticleLevelEvent ) const
inlinevirtualinherited

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 in top::JetNGhostSelector, top::PrintEventSelector, top::PseudoTopRecoRun, top::NElectronNMuonTightSelector, top::NElectronNMuonSelector, top::NFwdElectronSelector, top::HTSelector, top::OSLeptonTightSelector, top::MLLSelector, top::MWTSelector, top::NElectronTightSelector, top::NFwdElectronTightSelector, top::NMuonTightSelector, top::OSLeptonSelector, top::METMWTSelector, top::METSelector, top::MLLWindow, top::NElectronSelector, top::NJetSelector, top::NMuonSelector, top::NPhotonSelector, top::NSoftMuonSelector, top::NTauSelector, top::SSLeptonTightSelector, top::SSLeptonSelector, top::ParticleLevelSelector, top::RecoLevelSelector, top::NVarRCJetSelector, top::NLargeJetSelector, and top::NRCJetSelector.

Definition at line 73 of file EventSelectorBase.h.

73 {return true;}

◆ name()

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

The name of the tool.

Returns
The name of the tool for humans to see.

Implements top::EventSelectorBase.

Definition at line 30 of file NoBadMuonSelector.cxx.

30  {
31  return "NOBADMUON";
32  }

Member Data Documentation

◆ m_config

std::shared_ptr<top::TopConfig> top::NoBadMuonSelector::m_config
private

Definition at line 48 of file NoBadMuonSelector.h.

◆ m_muonSelectionTool

ToolHandle<CP::IMuonSelectionTool> top::NoBadMuonSelector::m_muonSelectionTool
private

Definition at line 46 of file NoBadMuonSelector.h.


The documentation for this class was generated from the following files:
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
top::NoBadMuonSelector::m_muonSelectionTool
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
Definition: NoBadMuonSelector.h:46
top::NoBadMuonSelector::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: NoBadMuonSelector.h:48