ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigMuonMatching
src
src/TrigMuonMatching_example.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xAODMuon/MuonContainer.h
"
6
#include "
xAODMuon/MuonAuxContainer.h
"
7
#include "
TrigMuonMatching_example.h
"
8
9
10
#include <cmath>
11
12
namespace
Trig
{
13
14
TrigMuonMatching_example::TrigMuonMatching_example
(
const
std::string& name, ISvcLocator* svcLoc )
15
:
AthAlgorithm
( name, svcLoc ),
16
m_matchTool
(
"CP::TrigMuonMatching/TrigMuonMatching"
,this)
17
{
18
declareProperty
(
"MuonMatchTool"
,
m_matchTool
);
19
}
20
21
StatusCode
TrigMuonMatching_example::initialize
()
22
{
23
24
ATH_CHECK
(
m_matchTool
.retrieve());
25
26
return
StatusCode::SUCCESS;
27
}
28
29
30
StatusCode
TrigMuonMatching_example::execute
(
const
EventContext&
/*ctx*/
)
31
{
32
33
const
xAOD::MuonContainer
* muons = 0;
34
ATH_CHECK
(
evtStore
()->retrieve( muons,
"Muons"
) );
35
ATH_MSG_INFO
(
"Number of muons: "
<< muons->
size
() );
36
37
xAOD::MuonContainer
*goodMuon =
new
xAOD::MuonContainer
;
38
xAOD::MuonAuxContainer
*goodMuonAux =
new
xAOD::MuonAuxContainer
;
39
goodMuon -> setStore(goodMuonAux);
40
CHECK
(
evtStore
()->record(goodMuon,
"GoodMuon"
));
41
CHECK
(
evtStore
()->record(goodMuonAux,
"GoodMuonAux."
));
42
43
for
(
const
auto
* mu: *muons){
44
Bool_t ismu26_imedium =
false
;
45
Bool_t ismu50 =
false
;
46
Bool_t isL2SA =
false
;
47
Bool_t isL2CB =
false
;
48
Bool_t isL1 =
false
;
49
ismu26_imedium =
m_matchTool
->match(mu,
"HLT_mu26_imedium"
);
50
ismu50 =
m_matchTool
->match(mu,
"HLT_mu50"
);
51
isL2SA =
m_matchTool
->matchL2SA(mu,
"L1_MU20"
,
"HLT_mu26_imedium"
);
52
isL2CB =
m_matchTool
->matchL2CB(mu,
"HLT_mu26_imedium"
);
53
isL1 =
m_matchTool
->matchL1(mu,
"L1_MU20"
);
54
if
(ismu26_imedium)std::cout <<
"HLT_mu26_imedium matched."
<< std::endl;
55
if
(ismu50)std::cout <<
"HLT_mu50 matched."
<< std::endl;
56
if
(isL2SA) std::cout <<
"L2 SA matched"
<< std::endl;
57
if
(isL2CB) std::cout <<
"L2 CB matched"
<< std::endl;
58
if
(isL1) std::cout <<
"L1_MU20 matched"
<< std::endl;
59
60
Double_t dR =
m_matchTool
->minDelR(mu,
"HLT_mu26_imedium"
);
61
std::cout <<
"DeltaR(mu26_imedium) "
<< dR << std::endl;
62
Double_t dRL1 =
m_matchTool
->minDelRL1(mu,
"L1_MU20"
);
63
std::cout <<
"DeltaR(L1_MU20) "
<< dRL1 << std::endl;
64
65
xAOD::Muon
* newMuon =
new
xAOD::Muon
;
66
goodMuon->
push_back
(newMuon);
67
*newMuon = *mu;
68
}
69
70
const
xAOD::MuonContainer
* SelectedMuons = 0;
71
ATH_CHECK
(
evtStore
()->retrieve(SelectedMuons,
"GoodMuon"
));
72
ATH_MSG_INFO
(
"Number of selected muons: "
<< SelectedMuons->
size
() );
73
if
(SelectedMuons->
size
()==2){
74
const
xAOD::Muon
*mu1 = (*SelectedMuons)[0];
75
const
xAOD::Muon
*mu2 = (*SelectedMuons)[1];
76
if
(mu1 && mu2) {
77
std::pair<Bool_t,Bool_t> result1, result2;
78
m_matchTool
->matchDimuon(mu1, mu2,
"HLT_2mu14"
, result1, result2);
79
if
(result1.first && result2.first)std::cout <<
"HLT_2mu14 matched"
<< std::endl;
80
}
81
}
82
83
return
StatusCode::SUCCESS;
84
}
85
86
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
MuonContainer.h
MuonAuxContainer.h
TrigMuonMatching_example.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trig::TrigMuonMatching_example::TrigMuonMatching_example
TrigMuonMatching_example(const std::string &name, ISvcLocator *svcLoc)
Definition
src/TrigMuonMatching_example.cxx:14
Trig::TrigMuonMatching_example::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
src/TrigMuonMatching_example.cxx:30
Trig::TrigMuonMatching_example::m_matchTool
ToolHandle< ITrigMuonMatching > m_matchTool
Definition
TrigMuonMatching_example.h:27
Trig::TrigMuonMatching_example::initialize
virtual StatusCode initialize()
Definition
src/TrigMuonMatching_example.cxx:21
Trig
The common trigger namespace for trigger analysis tools.
Definition
LArCellMonAlg.h:33
xAOD::MuonAuxContainer
MuonAuxContainer_v5 MuonAuxContainer
Definition of the current Muon auxiliary container.
Definition
MuonAuxContainer.h:19
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
Generated on
for ATLAS Offline Software by
1.17.0