2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 ///////////////////////////////////////////////////////////////////
6 // KinematicParticleCuts.icc, (c) ATLAS Detector software
7 ///////////////////////////////////////////////////////////////////
9 // @TODO: probably replace this by an enum some day
10 #define ISF_UNDEF_CHARGE -99999.
13 ISF::KinematicParticleCuts::KinematicParticleCuts() :
14 m_cut_minPosEta(-99.f),
15 m_cut_maxPosEta( 99.f),
16 m_cut_minMomEta(-99.f),
17 m_cut_maxMomEta( 99.f),
21 m_cut_charge(ISF_UNDEF_CHARGE),
26 /** emtpy destructor */
27 ISF::KinematicParticleCuts::~KinematicParticleCuts() {
30 bool ISF::KinematicParticleCuts::pass(const ISFParticle& particle) const {
31 const Amg::Vector3D& hepMom = particle.momentum();
32 const Amg::Vector3D& hepPos = particle.position();
33 double posEta = hepPos.eta();
34 double mom2 = hepMom.mag2();
35 double momEta = hepMom.eta();
37 // tolerance on the charge
38 const float chargeTolerance = 1e-4f;
41 pass &= m_cut_pdg ? (abs(particle.pdgCode()) == m_cut_pdg) : true;
42 pass &= (m_cut_charge < (ISF_UNDEF_CHARGE+1.)) || fabs(particle.charge()-m_cut_charge)<chargeTolerance;
43 pass &= (m_cut_minMom2 < 0.) || (mom2 >= m_cut_minMom2);
44 pass &= (m_cut_maxMom2 < 0.) || (mom2 <= m_cut_maxMom2);
45 pass &= (momEta >= m_cut_minMomEta);
46 pass &= (momEta <= m_cut_maxMomEta);
47 pass &= (posEta >= m_cut_minPosEta);
48 pass &= (posEta <= m_cut_maxPosEta);