ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigMuonHypo
src
TrigMuonEFTrackIsolationHypoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AthenaMonitoringKernel/Monitored.h
"
6
#include "
TrigMuonEFTrackIsolationHypoTool.h
"
7
8
9
using namespace
TrigCompositeUtils
;
10
// --------------------------------------------------------------------------------
11
// --------------------------------------------------------------------------------
12
13
TrigMuonEFTrackIsolationHypoTool::TrigMuonEFTrackIsolationHypoTool
(
const
std::string&
type
,
14
const
std::string & name,
15
const
IInterface* parent )
16
:
AthAlgTool
(
type
, name, parent ),
17
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) )
18
{
19
}
20
21
TrigMuonEFTrackIsolationHypoTool::~TrigMuonEFTrackIsolationHypoTool
(){
22
}
23
24
// --------------------------------------------------------------------------------
25
// --------------------------------------------------------------------------------
26
27
StatusCode
TrigMuonEFTrackIsolationHypoTool::initialize
()
28
{
29
ATH_MSG_DEBUG
(
"Initializing "
<< name());
30
31
if
(
m_acceptAll
) {
32
ATH_MSG_DEBUG
(
"AcceptAll = True"
);
33
ATH_MSG_DEBUG
(
"Accepting all the events!"
);
34
}
35
else
{
36
ATH_MSG_DEBUG
(
"AcceptAll = False"
);
37
if
(
m_ptcone02_cut
< 0.0 &&
m_ptcone03_cut
< 0.0 ) {
38
ATH_MSG_ERROR
(
"Configured to apply cuts, but not cut was specified"
);
39
return
StatusCode::SUCCESS;
40
}
41
if
(
m_ptcone02_cut
> 0.0 ) {
42
if
(
m_abscut
) {
43
ATH_MSG_DEBUG
(
"Requiring sum pT in 0.2 cone < "
<<
m_ptcone02_cut
.value() <<
" MeV"
);
44
}
else
{
45
ATH_MSG_DEBUG
(
"Requiring sum pT in 0.2 cone / muon pT < "
<<
m_ptcone02_cut
.value());
46
}
47
}
48
if
(
m_ptcone03_cut
> 0.0 ) {
49
if
(
m_abscut
) {
50
ATH_MSG_DEBUG
(
"Requiring sum pT in 0.3 cone < "
<<
m_ptcone03_cut
.value() <<
" MeV"
);
51
}
else
{
52
ATH_MSG_DEBUG
(
"Requiring sum pT in 0.3 cone / muon pT < "
<<
m_ptcone03_cut
.value());
53
}
54
}
55
}
56
57
if
( not
m_monTool
.name().empty() ) {
58
ATH_CHECK
(
m_monTool
.retrieve() );
59
ATH_MSG_DEBUG
(
"MonTool name: "
<<
m_monTool
);
60
}
61
62
return
StatusCode::SUCCESS;
63
}
64
65
// --------------------------------------------------------------------------------
66
// --------------------------------------------------------------------------------
67
68
bool
TrigMuonEFTrackIsolationHypoTool::decideOnSingleObject
(
TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo
& input,
size_t
cutIndex)
const
69
{
70
ATH_MSG_DEBUG
(
"Decision ..."
);
71
72
float
ptcone20(-1), ptcone30(-1);
73
auto
fex_ptcone03 =
Monitored::Scalar
(
"PtCone03"
, 0.0);
74
auto
fex_ptconeRel03 =
Monitored::Scalar
(
"PtConeRel03"
, 0.0);
75
76
auto
monitorIt =
Monitored::Group
(
m_monTool
, fex_ptcone03, fex_ptconeRel03 );
77
78
ATH_MSG_VERBOSE
(
"Cut index "
<< cutIndex );
79
80
bool
result =
false
;
81
82
if
(
m_acceptAll
) {
83
result =
true
;
84
ATH_MSG_DEBUG
(
"Accept property is set: taking all the events"
);
85
return
result;
86
}
87
88
auto
pMuon = input.muEFIso;
89
if
( !pMuon ) {
90
result =
false
;
91
ATH_MSG_ERROR
(
"Retrieval of L2StandAloneMuon from vector failed"
);
92
return
result;
93
}
94
95
const
xAOD::Muon::MuonType muontype = pMuon->muonType();
96
97
if
(
m_requireCombined
&& muontype != xAOD::Muon::MuonType::Combined ) {
98
result =
false
;
99
ATH_MSG_DEBUG
(
"Require combined muon, but this muon is not combined. -> false"
);
100
return
result;
101
}
else
if
( muontype != xAOD::Muon::MuonType::MuonStandAlone && muontype != xAOD::Muon::MuonType::Combined ) {
102
result =
false
;
103
ATH_MSG_DEBUG
(
"This muon type is neither standalone nor combined. -> false"
);
104
return
result;
105
}
106
107
108
bool
goodmu=
true
;
109
ptcone20 = input.ptcone20;
110
ptcone30 = input.ptcone30;
111
112
fex_ptcone03=ptcone30/1000;
113
if
(
m_abscut
) {
//absolute cut
114
if
(
m_ptcone02_cut
> 0.0 ) {
115
if
( ptcone20 >=
m_ptcone02_cut
) goodmu=
false
;
116
}
117
if
(
m_ptcone03_cut
> 0.0 ) {
118
if
( ptcone30 >=
m_ptcone03_cut
) goodmu=
false
;
119
}
120
121
ATH_MSG_DEBUG
(
"Muon with pT cone 0.2 = "
<< ptcone20 <<
", pT cone 0.3 = "
<< ptcone30
122
<<
" so result for this muon is "
<< (goodmu?
"true"
:
"false"
) );
123
}
else
{
//relative cut
124
125
const
double
mupt = pMuon->pt();
126
fex_ptconeRel03 = ptcone30/mupt;
127
ATH_MSG_DEBUG
(
"Muon with pT "
<< mupt);
128
129
// now we can make the cut(s)
130
if
(
m_ptcone02_cut
> 0.0 ) {
131
if
( ptcone20/mupt >=
m_ptcone02_cut
) goodmu=
false
;
132
}
133
if
(
m_ptcone03_cut
> 0.0 ) {
134
if
( ptcone30/mupt >=
m_ptcone03_cut
) goodmu=
false
;
135
}
136
137
ATH_MSG_DEBUG
(
"Muon with pT cone 0.2 / pt = "
<< ptcone20/mupt <<
", pT cone 0.3 / pt = "
<< ptcone30/mupt
138
<<
" so result for this muon is "
<< (goodmu?
"true"
:
"false"
) );
139
}
140
141
if
( goodmu ) {
142
result =
true
;
143
}
144
145
ATH_MSG_DEBUG
(
"Algo result = "
<< (result?
"true"
:
"false"
) );
146
147
return
result;
148
}
149
150
// --------------------------------------------------------------------------------
151
// --------------------------------------------------------------------------------
152
153
StatusCode
TrigMuonEFTrackIsolationHypoTool::decide
(std::vector<EFIsolationMuonInfo>& toolInput)
const
154
{
155
ATH_MSG_DEBUG
(
"Deciding ..."
);
156
157
size_t
numMuon = toolInput.size();
158
ATH_MSG_DEBUG
(
"Number of muon event = "
<< numMuon);
159
160
if
( numMuon==0 ) {
161
ATH_MSG_DEBUG
(
"The event has no muon, so No applying selection "
<<
m_decisionId
);
162
return
StatusCode::SUCCESS;
163
}
else
{
164
ATH_MSG_DEBUG
(
"Applying selection of single"
<<
m_decisionId
);
165
return
inclusiveSelection
(toolInput);
166
}
167
168
return
StatusCode::SUCCESS;
169
}
170
171
172
StatusCode
TrigMuonEFTrackIsolationHypoTool::inclusiveSelection
(std::vector<TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo>& toolInput)
const
173
{
174
ATH_MSG_DEBUG
(
"Inclusive ..."
);
175
176
for
(
auto
&i : toolInput ) {
177
// If muon event has defference DecisionID, it shouldn't apply.
178
if
(
TrigCompositeUtils::passed
(
m_decisionId
.numeric(), i.previousDecisionIDs ) ) {
179
if
(
decideOnSingleObject
( i, 0 )==
true
) {
180
ATH_MSG_DEBUG
(
"Pass through selection "
<<
m_decisionId
);
181
TrigCompositeUtils::addDecisionID
(
m_decisionId
, i.decision);
182
}
else
{
183
ATH_MSG_DEBUG
(
"Not pass through selection "
<<
m_decisionId
);
184
}
185
}
else
{
186
ATH_MSG_DEBUG
(
"Not match DecisionID:"
<<
m_decisionId
);
187
}
188
}
189
return
StatusCode::SUCCESS;
190
}
191
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
TrigMuonEFTrackIsolationHypoTool.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
TrigMuonEFTrackIsolationHypoTool::m_ptcone03_cut
Gaudi::Property< float > m_ptcone03_cut
Definition
TrigMuonEFTrackIsolationHypoTool.h:69
TrigMuonEFTrackIsolationHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
TrigMuonEFTrackIsolationHypoTool.h:77
TrigMuonEFTrackIsolationHypoTool::m_abscut
Gaudi::Property< bool > m_abscut
Definition
TrigMuonEFTrackIsolationHypoTool.h:71
TrigMuonEFTrackIsolationHypoTool::decide
virtual StatusCode decide(std::vector< TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo > &toolInput) const
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:153
TrigMuonEFTrackIsolationHypoTool::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition
TrigMuonEFTrackIsolationHypoTool.h:65
TrigMuonEFTrackIsolationHypoTool::inclusiveSelection
StatusCode inclusiveSelection(std::vector< TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo > &toolInput) const
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:172
TrigMuonEFTrackIsolationHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
TrigMuonEFTrackIsolationHypoTool.h:63
TrigMuonEFTrackIsolationHypoTool::m_ptcone02_cut
Gaudi::Property< float > m_ptcone02_cut
Definition
TrigMuonEFTrackIsolationHypoTool.h:67
TrigMuonEFTrackIsolationHypoTool::~TrigMuonEFTrackIsolationHypoTool
virtual ~TrigMuonEFTrackIsolationHypoTool()
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:21
TrigMuonEFTrackIsolationHypoTool::decideOnSingleObject
bool decideOnSingleObject(TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo &input, size_t cutIndex) const
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:68
TrigMuonEFTrackIsolationHypoTool::m_requireCombined
Gaudi::Property< bool > m_requireCombined
Definition
TrigMuonEFTrackIsolationHypoTool.h:75
TrigMuonEFTrackIsolationHypoTool::initialize
virtual StatusCode initialize() override
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:27
TrigMuonEFTrackIsolationHypoTool::TrigMuonEFTrackIsolationHypoTool
TrigMuonEFTrackIsolationHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TrigMuonEFTrackIsolationHypoTool.cxx:13
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
Identifier
Definition
IdentifierFieldParser.cxx:14
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
type
TrigMuonEFTrackIsolationHypoTool::EFIsolationMuonInfo
Definition
TrigMuonEFTrackIsolationHypoTool.h:30
Generated on
for ATLAS Offline Software by
1.17.0