ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ISF::GenParticleLifetimeFilter Class Reference

#include <GenParticleLifetimeFilter.h>

Inheritance diagram for ISF::GenParticleLifetimeFilter:
Collaboration diagram for ISF::GenParticleLifetimeFilter:

Public Member Functions

 GenParticleLifetimeFilter (const std::string &t, const std::string &n, const IInterface *p)
 Constructor. More...
 
 ~GenParticleLifetimeFilter ()
 Destructor. More...
 
bool pass (const HepMC::GenParticle &particle) const
 does the given particle pass the filter? More...
 

Private Attributes

double m_minLifetime {0.000001}
 

Detailed Description

Filter out particles with lifetimes shorter than a minimum value

Definition at line 27 of file GenParticleLifetimeFilter.h.

Constructor & Destructor Documentation

◆ GenParticleLifetimeFilter()

ISF::GenParticleLifetimeFilter::GenParticleLifetimeFilter ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor.

Definition at line 20 of file GenParticleLifetimeFilter.cxx.

23  : base_class(t,n,p)
24 {
25  declareProperty("MinimumLifetime", m_minLifetime, "");
26 }

◆ ~GenParticleLifetimeFilter()

ISF::GenParticleLifetimeFilter::~GenParticleLifetimeFilter ( )
inline

Destructor.

Definition at line 34 of file GenParticleLifetimeFilter.h.

34 {}

Member Function Documentation

◆ pass()

bool ISF::GenParticleLifetimeFilter::pass ( const HepMC::GenParticle particle) const

does the given particle pass the filter?

Definition at line 35 of file GenParticleLifetimeFilter.cxx.

35  {
36  // the GenParticle end vertex
37  auto endVtx = particle.end_vertex();
38 #endif
39  // no end vertex?
40  if (!endVtx) {
41  ATH_MSG_DEBUG("GenParticle does not have an end vertex, this is fine");
42  return true;
43  }
44  // (x,y,z) end position
45  const auto& end4Vec = endVtx->position();
46 
47  // the GenParticle production vertex
48 #ifdef HEPMC3
49  auto prodVtx = particle->production_vertex();
50 #else
51  auto prodVtx = particle.production_vertex();
52 #endif
53  // no production vertex?
54  if (!prodVtx) {
55  ATH_MSG_DEBUG("GenParticle does not have a production vertex, filtering it out");
56  return false;
57  }
58  // (x,y,z) production position
59  const auto& prod4Vec = prodVtx->position();
60  const CLHEP::HepLorentzVector lv0 ( prod4Vec.x(), prod4Vec.y(), prod4Vec.z(), prod4Vec.t() );
61  const CLHEP::HepLorentzVector lv1 ( end4Vec.x(), end4Vec.y(), end4Vec.z(), end4Vec.t() );
62  return ((lv1-lv0).mag()>m_minLifetime);
63 }

Member Data Documentation

◆ m_minLifetime

double ISF::GenParticleLifetimeFilter::m_minLifetime {0.000001}
private

Definition at line 44 of file GenParticleLifetimeFilter.h.


The documentation for this class was generated from the following files:
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ISF::GenParticleLifetimeFilter::m_minLifetime
double m_minLifetime
Definition: GenParticleLifetimeFilter.h:44
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25