Skip to content
Snippets Groups Projects
Commit f817f061 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Avoid nan momentum in low energy neutrals with energy < mass

parent 84118b25
No related branches found
No related tags found
1 merge request!346Avoid nan momentum in low energy neutrals with energy < mass
...@@ -203,7 +203,7 @@ private: ...@@ -203,7 +203,7 @@ private:
const eic::ConstCluster* optional_hclus, const double mass, const eic::ConstCluster* optional_hclus, const double mass,
const int32_t pid, const eic::Index& newID) const { const int32_t pid, const eic::Index& newID) const {
const float energy = (optional_hclus) ? eclus.energy() + optional_hclus->energy() : eclus.energy(); const float energy = (optional_hclus) ? eclus.energy() + optional_hclus->energy() : eclus.energy();
const float momentum = sqrt(energy * energy - mass * mass); const float momentum = energy < mass ? 0 : std::hypot(energy, mass);
const eic::VectorPolar p{momentum, eclus.position().theta(), eclus.position().phi()}; const eic::VectorPolar p{momentum, eclus.position().theta(), eclus.position().phi()};
// setup our particle // setup our particle
eic::ReconstructedParticle part; eic::ReconstructedParticle part;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment