Skip to content

Commit

Permalink
fix dz nan-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
swagata87 committed May 21, 2024
1 parent 43944b8 commit 81b1b2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions DataFormats/PatCandidates/src/PackedCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ void pat::PackedCandidate::packVtx(bool unpackAfterwards) {
// if we want to go back to the full x,y,z we need to store also
// float dl = dxPV * c + dyPV * s;
// float xRec = - dxy_ * s + dl * c, yRec = dxy_ * c + dl * s;
float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
dz_ = vertex_.load()->Z() - pv.Z() - (dxPV * c + dyPV * s) * pzpt;
dz_ = 0;
if (p4_.load()->Pt() != 0.f) {
float pzpt = p4_.load()->Pz() / p4_.load()->Pt();
dz_ = vertex_.load()->Z() - pv.Z() - (dxPV * c + dyPV * s) * pzpt;
}
packedDxy_ = MiniFloatConverter::float32to16(dxy_ * 100);
packedDz_ = pvRef.isNonnull() ? MiniFloatConverter::float32to16(dz_ * 100)
: int16_t(std::round(dz_ / 40.f * std::numeric_limits<int16_t>::max()));
Expand Down

0 comments on commit 81b1b2f

Please sign in to comment.