ATLAS Offline Software
Trigger
TrigAlgorithms
TrigMuonEF
src
MuonFilterAlg.cxx
Go to the documentation of this file.
1
/*
2
Filter algorithms for muon trigger
3
4
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#include "
MuonFilterAlg.h
"
8
9
MuonFilterAlg::MuonFilterAlg
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
10
:
AthReentrantAlgorithm
(
name
, pSvcLocator)
11
{
12
}
13
14
StatusCode
MuonFilterAlg::initialize
(){
15
16
ATH_CHECK
(
m_muonContainerKey
.initialize());
17
return
StatusCode::SUCCESS;
18
}
19
20
StatusCode
MuonFilterAlg::execute
(
const
EventContext& ctx)
const
21
{
22
23
bool
pass =
false
;
24
//Get muon container
25
SG::ReadHandle<xAOD::MuonContainer>
rh_muons(
m_muonContainerKey
, ctx);
26
if
(!rh_muons.
isValid
()){
27
ATH_MSG_ERROR
(
"Could not find muons with name: "
<<
m_muonContainerKey
.key());
28
return
StatusCode::FAILURE;
29
}
30
31
//if we find no muons, pass
32
const
xAOD::MuonContainer
*muons = rh_muons.
ptr
();
33
int
nCBmuons=0;
34
for
(
auto
mu
: *muons){
35
if
(
mu
->author()==1) nCBmuons++;
//count only combined muons
36
}
37
if
(nCBmuons==0) pass =
true
;
38
39
ATH_MSG_DEBUG
(
"Found: "
<<nCBmuons<<
" muons; pass="
<<pass);
40
setFilterPassed
(pass, ctx);
41
42
return
StatusCode::SUCCESS;
43
}
MuonFilterAlg::MuonFilterAlg
MuonFilterAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition:
MuonFilterAlg.cxx:9
MuonFilterAlg.h
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition:
AthReentrantAlgorithm.h:83
MuonFilterAlg::m_muonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainerKey
Definition:
MuonFilterAlg.h:30
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:581
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
MuonFilterAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
execute the filter alg
Definition:
MuonFilterAlg.cxx:20
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:195
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
MuonFilterAlg::initialize
virtual StatusCode initialize() override
initialize
Definition:
MuonFilterAlg.cxx:14
CaloNoise_fillDB.mu
mu
Definition:
CaloNoise_fillDB.py:53
AthReentrantAlgorithm::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition:
AthReentrantAlgorithm.h:139
Generated on Thu Jul 4 2024 21:22:43 for ATLAS Offline Software by
1.8.18