ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
AsgMassSelectionTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include <
AsgAnalysisAlgorithms/AsgMassSelectionTool.h
>
7
8
#include <
xAODBase/IParticle.h
>
9
10
namespace
CP
11
{
12
13
StatusCode AsgMassSelectionTool ::
14
initialize ()
15
{
16
if
(
m_minM
< 0 || !std::isfinite (
m_minM
))
17
{
18
ATH_MSG_ERROR
(
"invalid value of minM: "
<<
m_minM
);
19
return
StatusCode::FAILURE;
20
}
21
if
(
m_maxM
< 0 || !std::isfinite (
m_maxM
))
22
{
23
ATH_MSG_ERROR
(
"invalid value of maxM: "
<<
m_maxM
);
24
return
StatusCode::FAILURE;
25
}
26
27
if
(
m_minM
> 0) {
28
ATH_MSG_DEBUG
(
"Performing m >= "
<<
m_minM
<<
" MeV selection"
);
29
m_minMassCutIndex
=
m_accept
.addCut (
"minM"
,
"minimum mass cut"
);
30
}
31
if
(
m_maxM
> 0) {
32
ATH_MSG_DEBUG
(
"Performing m < "
<<
m_maxM
<<
" MeV selection"
);
33
m_maxMassCutIndex
=
m_accept
.addCut (
"maxM"
,
"maximum mass cut"
);
34
}
35
36
return
StatusCode::SUCCESS;
37
}
38
39
40
const
asg::AcceptInfo
& AsgMassSelectionTool ::
41
getAcceptInfo ()
const
42
{
43
return
m_accept
;
44
}
45
46
47
asg::AcceptData
AsgMassSelectionTool ::
48
accept (
const
xAOD::IParticle
*particle)
const
49
{
50
asg::AcceptData
accept
(&
m_accept
);
51
52
// Perform the mass cuts.
53
if
(
m_minMassCutIndex
>= 0 ||
m_maxMassCutIndex
>= 0)
54
{
55
float
m = particle->m();
56
57
if
(
m_minMassCutIndex
>= 0) {
58
if
(!std::isfinite(m))
59
{
60
ANA_MSG_WARNING
(
"invalid mass value, setting object to fail mass-cut: "
<< m);
61
accept
.setCutResult (
m_minMassCutIndex
,
false
);
62
}
else
63
{
64
accept
.setCutResult (
m_minMassCutIndex
, m >=
m_minM
);
65
}
66
}
67
if
(
m_maxMassCutIndex
>= 0) {
68
accept
.setCutResult (
m_maxMassCutIndex
, m <
m_maxM
);
69
}
70
}
71
72
return
accept
;
73
}
74
}
75
AsgMassSelectionTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
IParticle.h
CP::AsgMassSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *particle) const override
The main accept method: the actual cuts are applied here.
Definition
AsgMassSelectionTool.cxx:48
CP::AsgMassSelectionTool::m_maxMassCutIndex
int m_maxMassCutIndex
Index for the maximum pT selection.
Definition
AsgMassSelectionTool.h:59
CP::AsgMassSelectionTool::m_maxM
Gaudi::Property< float > m_maxM
Definition
AsgMassSelectionTool.h:54
CP::AsgMassSelectionTool::m_minMassCutIndex
int m_minMassCutIndex
Index for the minimum pT selection.
Definition
AsgMassSelectionTool.h:57
CP::AsgMassSelectionTool::m_accept
asg::AcceptInfo m_accept
the asg::AcceptInfo we are using
Definition
AsgMassSelectionTool.h:63
CP::AsgMassSelectionTool::m_minM
Gaudi::Property< float > m_minM
Definition
AsgMassSelectionTool.h:53
asg::AcceptData
Definition
AcceptData.h:30
asg::AcceptInfo
Definition
AcceptInfo.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
Generated on
for ATLAS Offline Software by
1.14.0