Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add non-empty checks in DAClusterizer to avoid reading null refs #44281

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZT_vect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ DAClusterizerInZT_vect::track_t DAClusterizerInZT_vect::fill(const vector<reco::
sumtkwt += t_tkwt;
}

tks.extractRaw();
tks.osumtkwt = sumtkwt > 0 ? 1. / sumtkwt : 0.;
if (sumtkwt > 0) {
tks.extractRaw();
tks.osumtkwt = 1. / sumtkwt;
} else {
tks.osumtkwt = 0.;
}

#ifdef DEBUG
if (DEBUGLEVEL > 0) {
Expand Down Expand Up @@ -1109,15 +1113,14 @@ bool DAClusterizerInZT_vect::split(const double beta, track_t& tks, vertex_t& y,

vector<TransientVertex> DAClusterizerInZT_vect::vertices(const vector<reco::TransientTrack>& tracks) const {
track_t&& tks = fill(tracks);
vector<TransientVertex> clusters;
if (tks.getSize() == 0)
return clusters;
tks.extractRaw();

unsigned int nt = tks.getSize();
double rho0 = 0.0; // start with no outlier rejection

vector<TransientVertex> clusters;
if (tks.getSize() == 0)
return clusters;

vertex_t y; // the vertex prototypes

// initialize:single vertex at infinite temperature
Expand Down
15 changes: 9 additions & 6 deletions RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ DAClusterizerInZ_vect::track_t DAClusterizerInZ_vect::fill(const vector<reco::Tr
sumtkwt += t_tkwt;
}

tks.extractRaw();
tks.osumtkwt = sumtkwt > 0 ? 1. / sumtkwt : 0.;
if (sumtkwt > 0) {
tks.extractRaw();
tks.osumtkwt = 1. / sumtkwt;
} else {
tks.osumtkwt = 0.;
}

#ifdef DEBUG
if (DEBUGLEVEL > 0) {
Expand Down Expand Up @@ -768,13 +772,12 @@ bool DAClusterizerInZ_vect::split(const double beta, track_t& tks, vertex_t& y,

vector<TransientVertex> DAClusterizerInZ_vect::vertices_no_blocks(const vector<reco::TransientTrack>& tracks) const {
track_t&& tks = fill(tracks);
tks.extractRaw();

double rho0 = 0.0; // start with no outlier rejection

vector<TransientVertex> clusters;
if (tks.getSize() == 0)
return clusters;
tks.extractRaw();

double rho0 = 0.0; // start with no outlier rejection

vertex_t y; // the vertex prototypes

Expand Down