Skip to content

Commit

Permalink
restore old behaviour wrt Tc updates before merging
Browse files Browse the repository at this point in the history
  • Loading branch information
werdmann committed Feb 12, 2021
1 parent 6131507 commit fec4cbd
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions RecoVertex/PrimaryVertexProducer/src/DAClusterizerInZ_vect.cc
Expand Up @@ -322,16 +322,15 @@ double DAClusterizerInZ_vect::update(
return ZTemp;
};

auto kernel_calc_normalization_range = [beta, updateTc](const unsigned int track_num,
track_t& tracks,
vertex_t& vertices,
const unsigned int kmin,
const unsigned int kmax) {
auto kernel_calc_normalization_range = [updateTc](const unsigned int track_num,
track_t& tracks,
vertex_t& vertices,
const unsigned int kmin,
const unsigned int kmax) {
auto tmp_trk_tkwt = tracks.tkwt[track_num];
auto o_trk_sum_Z = 1. / tracks.sum_Z[track_num];
auto o_trk_dz2 = tracks.dz2[track_num];
auto tmp_trk_z = tracks.zpca[track_num];
auto obeta = -1. / beta;

// auto-vectorized
if (updateTc) {
Expand All @@ -341,7 +340,7 @@ double DAClusterizerInZ_vect::update(
auto w = vertices.rho[k] * vertices.exp[k] * (tmp_trk_tkwt * o_trk_sum_Z * o_trk_dz2);
vertices.sw[k] += w;
vertices.swz[k] += w * tmp_trk_z;
vertices.swE[k] += w * vertices.exp_arg[k] * obeta;
vertices.swE[k] += w * vertices.exp_arg[k];
}
} else {
// same loop but without updating sWE
Expand All @@ -355,11 +354,19 @@ double DAClusterizerInZ_vect::update(
}
};

for (auto ivertex = 0U; ivertex < nv; ++ivertex) {
gvertices.se[ivertex] = 0.0;
gvertices.sw[ivertex] = 0.0;
gvertices.swz[ivertex] = 0.0;
gvertices.swE[ivertex] = 0.0;
if (updateTc) {
for (auto ivertex = 0U; ivertex < nv; ++ivertex) {
gvertices.se[ivertex] = 0.0;
gvertices.sw[ivertex] = 0.0;
gvertices.swz[ivertex] = 0.0;
gvertices.swE[ivertex] = 0.0;
}
} else {
for (auto ivertex = 0U; ivertex < nv; ++ivertex) {
gvertices.se[ivertex] = 0.0;
gvertices.sw[ivertex] = 0.0;
gvertices.swz[ivertex] = 0.0;
}
}

// loop over tracks
Expand All @@ -381,6 +388,14 @@ double DAClusterizerInZ_vect::update(
}
}

// (un-)apply the factor -beta which is needed in exp_arg, but not in swE
if (updateTc) {
auto obeta = -1. / beta;
for (auto ivertex = 0U; ivertex < nv; ++ivertex) {
gvertices.swE[ivertex] *= obeta;
}
}

// now update z and rho
auto kernel_calc_z = [sumtkwt, nv](vertex_t& vertices) -> double {
double delta = 0;
Expand Down Expand Up @@ -840,7 +855,7 @@ vector<TransientVertex> DAClusterizerInZ_vect::vertices(const vector<reco::Trans
}

thermalize(beta, tks, y, delta_lowT_, rho0);
update(beta, tks, y, rho0, true);
//update(beta, tks, y, rho0, true);//to be introduced in a forthcoming PR

#ifdef DEBUG
verify(y, tks);
Expand All @@ -855,7 +870,7 @@ vector<TransientVertex> DAClusterizerInZ_vect::vertices(const vector<reco::Trans
// merge again (some cluster split by outliers collapse here)
while (merge(y, tks, beta)) {
set_vtx_range(beta, tks, y);
update(beta, tks, y, rho0, true);
update(beta, tks, y, rho0, false); //change to "true" in a forthcoming PR
}

#ifdef DEBUG
Expand Down

0 comments on commit fec4cbd

Please sign in to comment.