ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
9
10namespace 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 {
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
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
virtual asg::AcceptData accept(const xAOD::IParticle *particle) const override
The main accept method: the actual cuts are applied here.
int m_maxMassCutIndex
Index for the maximum pT selection.
Gaudi::Property< float > m_maxM
int m_minMassCutIndex
Index for the minimum pT selection.
asg::AcceptInfo m_accept
the asg::AcceptInfo we are using
Gaudi::Property< float > m_minM
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.