Commit 8172f68a authored by Enrico Bothmann's avatar Enrico Bothmann Committed by Enrico Bothmann

Recover if soft cluster kinematics is slightly off

... probably due to numerical inaccuracies. Also, return false, if it's
off significantly.
parent 3cb4d0b3
......@@ -169,16 +169,26 @@ bool Soft_Cluster_Handler::FixKinematics() {
double M2(m_mass*m_mass);
double m12(sqr(m_hads[0].Mass())),m22(sqr(m_hads[1].Mass()));
double E1((M2+m12-m22)/(2.*m_mass)), p1(sqrt(sqr(E1)-m12)), pt;
double E1((M2+m12-m22)/(2.*m_mass));
double p1(sqrt(sqr(E1)-m12));
if (std::isnan(p1)) {
if (IsZero(sqr(E1) - m12, 1e-3)) {
msg_Debugging() << METHOD << "(): Cluster energy is a bit too small."
<< " Assume it's a numerical inaccuracy and set it to"
<< " threshold.";
p1 = 0.0;
} else {
msg_Error() << METHOD << "(): There is not enough energy in the cluster."
<< " Return false and hope for the best.\n";
return false;
}
}
bool lead = (*p_cluster)[0]->IsLeading() || (*p_cluster)[0]->IsLeading();
//if (lead)
pt = m_ktselector(p1,lead?1.:m_ktfac);
//else pt = p1 * sqrt(1.-sqr(1.-2.*ran->Get()));
double pt = m_ktselector(p1,lead?1.:m_ktfac);
double pl = sqrt(p1*p1-pt*pt);
double phi = 2.*M_PI*ran->Get();
m_moms[0] = Vec4D( E1, pt*cos(phi), pt*sin(phi), pl);
m_moms[1] = Vec4D(m_mass-E1,-pt*cos(phi),-pt*sin(phi),-pl);
bool print(false);
for (size_t i=0;i<2;i++) {
rotat.RotateBack(m_moms[i]);
boost.BoostBack(m_moms[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment