ATLAS Offline Software
NoBadMuonSelector.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"
8 
9 namespace top {
10  NoBadMuonSelector::NoBadMuonSelector(std::shared_ptr<top::TopConfig> config) :
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  }
17 
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  }
29 
30  std::string NoBadMuonSelector::name() const {
31  return "NOBADMUON";
32  }
33 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::NoBadMuonSelector::name
std::string name() const override
The name of the tool.
Definition: NoBadMuonSelector.cxx:30
NoBadMuonSelector.h
top::NoBadMuonSelector::apply
bool apply(const top::Event &event) const override
Events with a muon flagged bad are rejected.
Definition: NoBadMuonSelector.cxx:18
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
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::NoBadMuonSelector
NoBadMuonSelector(std::shared_ptr< top::TopConfig > m_config)
Event selection if bad muon detected using the official muon selector tool.
Definition: NoBadMuonSelector.cxx:10
top::NoBadMuonSelector::m_muonSelectionTool
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
Definition: NoBadMuonSelector.h:46
TopConfig.h
top::NoBadMuonSelector::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: NoBadMuonSelector.h:48
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49