ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
8 #include <xAODBase/IParticle.h>
9 
10 namespace CP
11 {
12 
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 
41  getAcceptInfo () const
42  {
43  return m_accept;
44  }
45 
46 
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);
62  } else
63  {
65  }
66  }
67  if (m_maxMassCutIndex >= 0) {
69  }
70  }
71 
72  return accept;
73  }
74 }
75 
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
IParticle.h
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
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
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:49
CP::AsgMassSelectionTool::m_accept
asg::AcceptInfo m_accept
the asg::AcceptInfo we are using
Definition: AsgMassSelectionTool.h:63
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
asg::AcceptInfo
Definition: AcceptInfo.h:28
CP::AsgMassSelectionTool::m_maxM
Gaudi::Property< float > m_maxM
Definition: AsgMassSelectionTool.h:54
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
ANA_MSG_WARNING
#define ANA_MSG_WARNING(xmsg)
Macro printing warning messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:292
AsgMassSelectionTool.h
CP::AsgMassSelectionTool::m_minM
Gaudi::Property< float > m_minM
Definition: AsgMassSelectionTool.h:53
asg::AcceptData::setCutResult
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition: AcceptData.h:134
CP::AsgMassSelectionTool::m_minMassCutIndex
int m_minMassCutIndex
Index for the minimum pT selection.
Definition: AsgMassSelectionTool.h:57
asg::AcceptData
Definition: AcceptData.h:30
CP::AsgMassSelectionTool::m_maxMassCutIndex
int m_maxMassCutIndex
Index for the maximum pT selection.
Definition: AsgMassSelectionTool.h:59
CP::AsgMassSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Declare the interface ID for this pure-virtual interface class to the Athena framework.
Definition: AsgMassSelectionTool.cxx:41
CP::AsgMassSelectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: AsgMassSelectionTool.cxx:14
asg::AcceptInfo::addCut
int addCut(const std::string &cutName, const std::string &cutDescription)
Add a cut; returning the cut position.
Definition: AcceptInfo.h:53