11 #include "vdt/vdtMath.h" 22 maxIterations_ = 1000;
36 coolingFactor_ = conf.
getParameter<
double>(
"coolingFactor");
39 uniquetrkweight_ = conf.
getParameter<
double>(
"uniquetrkweight");
40 uniquetrkminp_ = conf.
getParameter<
double>(
"uniquetrkminp");
43 convergence_mode_ = conf.
getParameter<
int>(
"convergence_mode");
48 std::cout <<
"DAClusterizerinZ_vect: mintrkweight = " << mintrkweight_ << std::endl;
49 std::cout <<
"DAClusterizerinZ_vect: uniquetrkweight = " << uniquetrkweight_ << std::endl;
50 std::cout <<
"DAClusterizerInZ_vect: uniquetrkminp = " << uniquetrkminp_ << std::endl;
51 std::cout <<
"DAClusterizerinZ_vect: zmerge = " << zmerge_ << std::endl;
52 std::cout <<
"DAClusterizerinZ_vect: Tmin = " <<
Tmin << std::endl;
54 std::cout <<
"DAClusterizerinZ_vect: Tstop = " <<
Tstop << std::endl;
55 std::cout <<
"DAClusterizerinZ_vect: vertexSize = " << vertexSize_ << std::endl;
56 std::cout <<
"DAClusterizerinZ_vect: coolingFactor = " << coolingFactor_ << std::endl;
57 std::cout <<
"DAClusterizerinZ_vect: d0CutOff = " << d0CutOff_ << std::endl;
58 std::cout <<
"DAClusterizerinZ_vect: dzCutOff = " << dzCutOff_ << std::endl;
59 std::cout <<
"DAClusterizerInZ_vect: zrange = " << sel_zrange_ << std::endl;
60 std::cout <<
"DAClusterizerinZ_vect: convergence mode = " << convergence_mode_ << std::endl;
61 std::cout <<
"DAClusterizerinZ_vect: delta_highT = " << delta_highT_ << std::endl;
62 std::cout <<
"DAClusterizerinZ_vect: delta_lowT = " << delta_lowT_ << std::endl;
63 std::cout <<
"DAClusterizerinZ_vect: DEBUGLEVEL " << DEBUGLEVEL << std::endl;
66 if (convergence_mode_ > 1) {
68 <<
"DAClusterizerInZ_vect: invalid convergence_mode " << convergence_mode_ <<
" reset to default " << 0;
69 convergence_mode_ = 0;
75 <<
"DAClusterizerInZ_vect: invalid Tmin " <<
Tmin <<
" reset to default " << 1. / betamax_;
82 <<
"DAClusterizerInZ_vect: invalid Tpurge " <<
Tpurge <<
" set to " <<
Tmin;
89 <<
"DAClusterizerInZ_vect: invalid Tstop " <<
Tstop <<
" set to " <<
max(1.,
Tpurge);
92 betastop_ = 1. /
Tstop;
96 inline double local_exp(
double const& inp) {
return vdt::fast_exp(inp); }
98 inline void local_exp_list_range(
double const* __restrict__ arg_inp,
99 double* __restrict__ arg_out,
102 for (
auto i = kmin;
i != kmax; ++
i)
103 arg_out[
i] = vdt::fast_exp(arg_inp[
i]);
109 if (!(nv == 999999)) {
115 if (!(
nt == 999999)) {
121 assert(
v.zvtx_vec.size() == nv);
122 assert(
v.rho_vec.size() == nv);
123 assert(
v.swz_vec.size() == nv);
124 assert(
v.exp_arg_vec.size() == nv);
125 assert(
v.exp_vec.size() == nv);
127 assert(
v.swz_vec.size() == nv);
128 assert(
v.swE_vec.size() == nv);
130 assert(
v.zvtx == &
v.zvtx_vec.front());
131 assert(
v.rho == &
v.rho_vec.front());
132 assert(
v.exp_arg == &
v.exp_arg_vec.front());
134 assert(
v.swz == &
v.swz_vec.front());
136 assert(
v.swE == &
v.swE_vec.front());
138 for (
unsigned int k = 0;
k < nv - 1;
k++) {
139 if (
v.zvtx_vec[
k] <=
v.zvtx_vec[
k + 1])
141 cout <<
" Z, cluster z-ordering assertion failure z[" <<
k <<
"] =" <<
v.zvtx_vec[
k] <<
" z[" <<
k + 1
142 <<
"] =" <<
v.zvtx_vec[
k + 1] << endl;
158 for (
unsigned int i = 0;
i <
nt;
i++) {
161 cout <<
"track vertex range assertion failure" <<
i <<
"/" <<
nt <<
" kmin,kmax=" << tks.
kmin[
i] <<
", " 162 << tks.
kmax[
i] <<
" nv=" << nv << endl;
165 for (
unsigned int i = 0;
i <
nt;
i++) {
174 for (
auto it =
tracks.begin(); it !=
tracks.end(); it++) {
175 if (!(*it).isValid())
178 double t_z = ((*it).stateAtBeamLine().trackStateAtPCA()).
position().z();
179 if (std::fabs(
t_z) > 1000.)
181 auto const& t_mom = (*it).stateAtBeamLine().trackStateAtPCA().momentum();
184 double t_dz2 =
std::pow((*it).track().dzError(), 2)
196 edm::LogWarning(
"DAClusterizerinZ_vect") <<
"rejected track t_tkwt " << t_tkwt;
205 tks.
osumtkwt = sumtkwt > 0 ? 1. / sumtkwt : 0.;
208 if (DEBUGLEVEL > 0) {
217 inline double Eik(
double t_z,
double k_z,
double t_dz2) {
return std::pow(
t_z - k_z, 2) * t_dz2; }
221 const unsigned int nv = gvertices.
getSize();
222 const unsigned int nt = gtracks.
getSize();
225 edm::LogWarning(
"DAClusterizerinZ_vect") <<
"empty cluster list in set_vtx_range";
229 for (
auto itrack = 0
U; itrack <
nt; ++itrack) {
233 unsigned int kmin =
min(nv - 1, gtracks.
kmin[itrack]);
236 while ((kmin > 0) && (gvertices.
zvtx[kmin - 1] >
zmin)) {
240 while ((kmin < (nv - 1)) && (gvertices.
zvtx[kmin] <
zmin)) {
246 unsigned int kmax =
min(nv - 1, gtracks.
kmax[itrack] - 1);
250 while ((kmax < (nv - 1)) && (gvertices.
zvtx[kmax + 1] <
zmax)) {
254 while ((kmax > 0) && (gvertices.
zvtx[kmax] >
zmax)) {
260 gtracks.
kmin[itrack] = kmin;
261 gtracks.
kmax[itrack] = kmax + 1;
264 gtracks.
kmax[itrack] =
min(nv,
max(kmin, kmax) + 1);
270 const unsigned int nt = gtracks.
getSize();
271 const unsigned int nv = gvertices.
getSize();
272 for (
auto itrack = 0
U; itrack <
nt; ++itrack) {
273 gtracks.
kmin[itrack] = 0;
274 gtracks.
kmax[itrack] = nv;
279 double beta,
track_t& gtracks,
vertex_t& gvertices,
const double rho0,
const bool updateTc)
const {
284 const unsigned int nt = gtracks.
getSize();
285 const unsigned int nv = gvertices.
getSize();
290 Z_init = rho0 * local_exp(-
beta * dzCutOff_ * dzCutOff_);
294 auto kernel_calc_exp_arg_range = [
beta](
const unsigned int itrack,
297 const unsigned int kmin,
298 const unsigned int kmax) {
299 const double track_z =
tracks.zpca[itrack];
300 const double botrack_dz2 = -
beta *
tracks.dz2[itrack];
303 for (
unsigned int ivertex = kmin; ivertex < kmax; ++ivertex) {
304 auto mult_res = track_z -
vertices.zvtx[ivertex];
305 vertices.exp_arg[ivertex] = botrack_dz2 * (mult_res * mult_res);
309 auto kernel_add_Z_range = [Z_init](
310 vertex_t const&
vertices,
const unsigned int kmin,
const unsigned int kmax) ->
double {
311 double ZTemp = Z_init;
312 for (
unsigned int ivertex = kmin; ivertex < kmax; ++ivertex) {
318 auto kernel_calc_normalization_range = [updateTc](
const unsigned int track_num,
321 const unsigned int kmin,
322 const unsigned int kmax) {
323 auto o_trk_sum_Z =
tracks.tkwt[track_num] /
tracks.sum_Z[track_num];
324 auto o_trk_dz2 =
tracks.dz2[track_num];
325 auto tmp_trk_z =
tracks.zpca[track_num];
330 for (
unsigned int k = kmin;
k < kmax; ++
k) {
340 for (
unsigned int k = kmin;
k < kmax; ++
k) {
350 for (
auto ivertex = 0
U; ivertex < nv; ++ivertex) {
351 gvertices.
se[ivertex] = 0.0;
352 gvertices.
sw[ivertex] = 0.0;
353 gvertices.
swz[ivertex] = 0.0;
354 gvertices.
swE[ivertex] = 0.0;
357 for (
auto ivertex = 0
U; ivertex < nv; ++ivertex) {
358 gvertices.
se[ivertex] = 0.0;
359 gvertices.
sw[ivertex] = 0.0;
360 gvertices.
swz[ivertex] = 0.0;
365 for (
auto itrack = 0
U; itrack <
nt; ++itrack) {
366 const unsigned int kmin = gtracks.
kmin[itrack];
367 const unsigned int kmax = gtracks.
kmax[itrack];
369 kernel_calc_exp_arg_range(itrack, gtracks, gvertices, kmin, kmax);
370 local_exp_list_range(gvertices.
exp_arg, gvertices.
exp, kmin, kmax);
371 gtracks.
sum_Z[itrack] = kernel_add_Z_range(gvertices, kmin, kmax);
374 gtracks.
sum_Z[itrack] = 0.0;
376 if (gtracks.
sum_Z[itrack] > 1.e-100) {
377 kernel_calc_normalization_range(itrack, gtracks, gvertices, kmin, kmax);
383 auto obeta = -1. /
beta;
384 for (
auto ivertex = 0
U; ivertex < nv; ++ivertex) {
385 gvertices.
swE[ivertex] *= obeta;
393 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
402 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex)
408 double delta = kernel_calc_z(gvertices);
416 unsigned int niter = 0;
418 double delta_max = delta_lowT_;
420 if (convergence_mode_ == 0) {
421 delta_max = delta_max0;
422 }
else if (convergence_mode_ == 1) {
426 set_vtx_range(
beta, tks,
v);
427 double delta_sum_range = 0;
428 std::vector<double>
z0 =
v.zvtx_vec;
430 while (niter++ < maxIterations_) {
432 delta_sum_range +=
delta;
434 if (delta_sum_range > zrange_min_) {
435 for (
unsigned int k = 0;
k <
v.getSize();
k++) {
437 set_vtx_range(
beta, tks,
v);
445 if (
delta < delta_max) {
451 if (DEBUGLEVEL > 0) {
452 std::cout <<
"DAClusterizerInZ_vect.thermalize niter = " << niter <<
" at T = " << 1 /
beta 453 <<
" nv = " <<
v.getSize() << std::endl;
466 const unsigned int nv = y.getSize();
472 std::vector<std::pair<double, unsigned int> >
critical;
473 for (
unsigned int k = 0; (
k + 1) < nv;
k++) {
474 if (std::fabs(y.zvtx[
k + 1] - y.zvtx[
k]) < zmerge_) {
475 critical.push_back(make_pair(std::fabs(y.zvtx[
k + 1] - y.zvtx[
k]),
k));
481 std::stable_sort(
critical.begin(),
critical.end(), std::less<std::pair<double, unsigned int> >());
483 for (
unsigned int ik = 0; ik <
critical.size(); ik++) {
485 double rho = y.rho[
k] + y.rho[
k + 1];
489 if (DEBUGLEVEL > 1) {
490 std::cout <<
"merging " <<
fixed << setprecision(4) << y.zvtx[
k + 1] <<
" and " << y.zvtx[
k]
491 <<
" sw = " << y.sw[
k] + y.sw[
k + 1] << std::endl;
496 y.zvtx[
k] = (y.rho[
k] * y.zvtx[
k] + y.rho[
k + 1] * y.zvtx[
k + 1]) / rho;
498 y.zvtx[
k] = 0.5 * (y.zvtx[
k] + y.zvtx[
k + 1]);
501 y.sw[
k] += y.sw[
k + 1];
502 y.removeItem(
k + 1, tks);
503 set_vtx_range(
beta, tks, y);
512 constexpr
double eps = 1.e-100;
514 const unsigned int nv = y.getSize();
520 std::vector<double> sump_v(nv), arg_cache_v(nv), exp_cache_v(nv), pcut_cache_v(nv);
521 std::vector<int> nUnique_v(nv);
522 double* __restrict__ parg_cache;
523 double* __restrict__ pexp_cache;
524 double* __restrict__ ppcut_cache;
525 double* __restrict__ psump;
526 int* __restrict__ pnUnique;
527 int constexpr nunique_min_ = 2;
529 set_vtx_range(
beta, tks, y);
531 parg_cache = arg_cache_v.data();
532 pexp_cache = exp_cache_v.data();
533 ppcut_cache = pcut_cache_v.data();
534 psump = sump_v.data();
535 pnUnique = nUnique_v.data();
537 const auto rhoconst = rho0 * local_exp(-
beta * dzCutOff_ * dzCutOff_);
538 for (
unsigned int k = 0;
k < nv;
k++) {
539 const double pmax = y.rho[
k] / (y.rho[
k] + rhoconst);
540 ppcut_cache[
k] = uniquetrkweight_ * pmax;
543 for (
unsigned int i = 0;
i <
nt;
i++) {
544 const auto invZ = ((tks.
sum_Z[
i] >
eps) && (tks.
tkwt[
i] > uniquetrkminp_)) ? 1. / tks.
sum_Z[
i] : 0.;
545 const auto track_z = tks.
zpca[
i];
546 const auto botrack_dz2 = -
beta * tks.
dz2[
i];
547 const auto kmin = tks.
kmin[
i];
548 const auto kmax = tks.
kmax[
i];
550 for (
unsigned int k = kmin;
k < kmax;
k++) {
551 const auto mult_resz = track_z - y.zvtx[
k];
552 parg_cache[
k] = botrack_dz2 * (mult_resz * mult_resz);
555 local_exp_list_range(parg_cache, pexp_cache, kmin, kmax);
557 for (
unsigned int k = kmin;
k < kmax;
k++) {
558 const double p = y.rho[
k] * pexp_cache[
k] * invZ;
560 pnUnique[
k] += (
p > ppcut_cache[
k]) ? 1 : 0;
565 unsigned int k0 = nv;
566 for (
unsigned k = 0;
k < nv;
k++) {
567 if ((pnUnique[
k] < nunique_min_) && (psump[
k] < sumpmin)) {
576 if (DEBUGLEVEL > 1) {
577 std::cout <<
"eliminating prototype at " << std::setw(10) << std::setprecision(4) << y.zvtx[
k0]
578 <<
" with sump=" << sumpmin <<
" rho*nt =" << y.rho[
k0] *
nt << endl;
582 y.removeItem(
k0, tks);
583 set_vtx_range(
beta, tks, y);
594 const unsigned int nv = y.getSize();
596 for (
unsigned int k = 0;
k < nv;
k++) {
600 for (
unsigned int i = 0;
i <
nt;
i++) {
606 y.zvtx[
k] = sumwz / sumw;
610 for (
unsigned int i = 0;
i <
nt;
i++) {
611 double dx = tks.
zpca[
i] - y.zvtx[
k];
616 double Tc = 2. *
a /
b;
624 if (DEBUGLEVEL > 0) {
625 std::cout <<
"DAClusterizerInZ_vect.beta0: Tc = " << T0 << std::endl;
627 std::cout <<
"DAClusterizerInZ_vect.beta0: nstep = " << coolingsteps << std::endl;
631 if (T0 > 1. / betamax) {
634 return betamax *
std::pow(coolingFactor_, coolingsteps);
637 return betamax * coolingFactor_;
649 unsigned int nv = y.getSize();
653 std::vector<std::pair<double, unsigned int> >
critical;
654 for (
unsigned int k = 0;
k < nv;
k++) {
655 double Tc = 2 * y.swE[
k] / y.sw[
k];
663 std::stable_sort(
critical.begin(),
critical.end(), std::greater<std::pair<double, unsigned int> >());
668 for (
unsigned int ic = 0; ic <
critical.size(); ic++) {
672 double p1 = 0, z1 = 0,
w1 = 0;
673 double p2 = 0,
z2 = 0,
w2 = 0;
674 for (
unsigned int i = 0;
i <
nt;
i++) {
675 if (tks.
sum_Z[
i] > 1.e-100) {
677 double tl = tks.
zpca[
i] < y.zvtx[
k] ? 1. : 0.;
682 if (std::fabs(
arg) < 20) {
683 double t = local_exp(-
arg);
689 double w =
p * tks.
dz2[
i];
691 z1 +=
w * tl * tks.
zpca[
i];
711 if ((
k > 0) && (z1 < (0.6 * y.zvtx[
k] + 0.4 * y.zvtx[
k - 1]))) {
712 z1 = 0.6 * y.zvtx[
k] + 0.4 * y.zvtx[
k - 1];
714 if ((
k + 1 < nv) && (
z2 > (0.6 * y.zvtx[
k] + 0.4 * y.zvtx[
k + 1]))) {
715 z2 = 0.6 * y.zvtx[
k] + 0.4 * y.zvtx[
k + 1];
720 if (DEBUGLEVEL > 1) {
721 if (std::fabs(y.zvtx[
k] - zdumpcenter_) < zdumpwidth_) {
723 <<
std::fixed << std::setprecision(4) << y.zvtx[
k] <<
" --> " << z1 <<
"," <<
z2 <<
" [" <<
p1 737 double pk1 =
p1 * y.rho[
k] / (
p1 +
p2);
738 double pk2 =
p2 * y.rho[
k] / (
p1 +
p2);
741 y.insertItem(
k, z1, pk1, tks);
748 for (
unsigned int jc = ic; jc <
critical.size(); jc++) {
755 std::cout <<
"warning ! split rejected, too small." << endl;
778 clear_vtx_range(tks, y);
781 double beta = beta0(betamax_, tks, y);
787 thermalize(
beta, tks, y, delta_highT_);
791 double betafreeze = betamax_ *
sqrt(coolingFactor_);
793 while (
beta < betafreeze) {
800 thermalize(
beta, tks, y, delta_highT_);
806 if (DEBUGLEVEL > 0) {
807 std::cout <<
"DAClusterizerInZ_vect::vertices :" 808 <<
"last round of splitting" << std::endl;
812 set_vtx_range(
beta, tks, y);
816 set_vtx_range(
beta, tks, y);
820 unsigned int ntry = 0;
823 thermalize(
beta, tks, y, delta_highT_, rho0);
834 if (DEBUGLEVEL > 0) {
835 std::cout <<
"DAClusterizerInZ_vect::vertices :" 836 <<
"turning on outlier rejection at T=" << 1 /
beta << std::endl;
842 rho0 = y.getSize() > 1 ? 1. / y.getSize() : 1.;
843 for (
unsigned int a = 0;
a < 5;
a++) {
848 thermalize(
beta, tks, y, delta_lowT_, rho0);
852 if (DEBUGLEVEL > 0) {
853 std::cout <<
"DAClusterizerInZ_vect::vertices :" 854 <<
"merging with outlier rejection at T=" << 1 /
beta << std::endl;
862 set_vtx_range(
beta, tks, y);
868 if (DEBUGLEVEL > 0) {
869 std::cout <<
"DAClusterizerInZ_vect::vertices :" 870 <<
"after merging with outlier rejection at T=" << 1 /
beta << std::endl;
877 while (
beta < betapurge_) {
879 thermalize(
beta, tks, y, delta_lowT_, rho0);
884 if (DEBUGLEVEL > 0) {
885 std::cout <<
"DAClusterizerInZ_vect::vertices :" 886 <<
"purging at T=" << 1 /
beta << std::endl;
891 while (purge(y, tks, rho0,
beta)) {
892 thermalize(
beta, tks, y, delta_lowT_, rho0);
897 if (DEBUGLEVEL > 0) {
898 std::cout <<
"DAClusterizerInZ_vect::vertices :" 899 <<
"last cooling T=" << 1 /
beta << std::endl;
904 while (
beta < betastop_) {
906 thermalize(
beta, tks, y, delta_lowT_, rho0);
911 if (DEBUGLEVEL > 0) {
912 std::cout <<
"DAClusterizerInZ_vect::vertices :" 913 <<
"stop cooling at T=" << 1 /
beta << std::endl;
921 set_vtx_range(
beta, tks, y);
922 const unsigned int nv = y.getSize();
923 for (
unsigned int k = 0;
k < nv;
k++) {
930 const auto z_sum_init = rho0 * local_exp(-
beta * dzCutOff_ * dzCutOff_);
931 std::vector<std::vector<unsigned int> > vtx_track_indices(nv);
932 for (
unsigned int i = 0;
i <
nt;
i++) {
933 const auto kmin = tks.
kmin[
i];
934 const auto kmax = tks.
kmax[
i];
935 for (
auto k = kmin;
k < kmax;
k++) {
939 local_exp_list_range(y.exp_arg, y.exp, kmin, kmax);
941 tks.
sum_Z[
i] = z_sum_init;
942 for (
auto k = kmin;
k < kmax;
k++) {
943 tks.
sum_Z[
i] += y.rho[
k] * y.exp[
k];
945 const double invZ = tks.
sum_Z[
i] > 1
e-100 ? 1. / tks.
sum_Z[
i] : 0.0;
947 for (
auto k = kmin;
k < kmax;
k++) {
948 double p = y.rho[
k] * y.exp[
k] * invZ;
949 if (
p > mintrkweight_) {
951 vtx_track_indices[
k].push_back(
i);
958 GlobalError dummyError(0.01, 0, 0.01, 0., 0., 0.01);
959 for (
unsigned int k = 0;
k < nv;
k++) {
960 if (!vtx_track_indices[
k].
empty()) {
962 vector<reco::TransientTrack> vertexTracks;
963 for (
auto i : vtx_track_indices[
k]) {
964 vertexTracks.push_back(*(tks.
tt[
i]));
975 const vector<reco::TransientTrack>&
tracks)
const {
976 vector<vector<reco::TransientTrack> >
clusters;
980 if (DEBUGLEVEL > 0) {
981 std::cout <<
"###################################################" << endl;
982 std::cout <<
"# vectorized DAClusterizerInZ_vect::clusterize nt=" <<
tracks.size() << endl;
983 std::cout <<
"# DAClusterizerInZ_vect::clusterize pv.size=" <<
pv.size() << endl;
984 std::cout <<
"###################################################" << endl;
993 vector<reco::TransientTrack> aCluster =
pv.begin()->originalTracks();
995 for (
auto k =
pv.begin() + 1;
k !=
pv.end();
k++) {
998 if (aCluster.size() > 1) {
1003 std::cout <<
" one track cluster at " <<
k->position().z() <<
" suppressed" << std::endl;
1008 for (
unsigned int i = 0;
i <
k->originalTracks().size();
i++) {
1009 aCluster.push_back(
k->originalTracks()[
i]);
1020 const unsigned int nv = y.getSize();
1025 update(
beta, tks_local, y_local, rho0,
true);
1027 std::vector<unsigned int> iz;
1028 for (
unsigned int j = 0;
j <
nt;
j++) {
1031 std::sort(iz.begin(), iz.end(), [tks](
unsigned int a,
unsigned int b) {
return tks.
zpca[
a] < tks.
zpca[
b]; });
1033 std::cout <<
"-----DAClusterizerInZ::dump ----" << nv <<
" clusters " << std::endl;
1035 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1036 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) < zdumpwidth_) {
1037 std::cout <<
" " << setw(3) << ivertex <<
" ";
1043 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1044 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) < zdumpwidth_) {
1049 <<
"T=" << setw(15) << 1. /
beta <<
" Tmin =" << setw(10) << 1. / betamax_
1051 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1052 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) < zdumpwidth_) {
1053 double Tc = 2 * y_local.
swE[ivertex] / y_local.
sw[ivertex];
1061 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1062 sumpk += y.rho[ivertex];
1063 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) > zdumpwidth_)
1065 std::cout << setw(8) << setprecision(4) <<
fixed << y.rho[ivertex];
1070 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1071 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) > zdumpwidth_)
1078 double E = 0,
F = 0;
1080 std::cout <<
"---- z +/- dz ip +/-dip pt phi eta weights ----" << endl;
1082 for (
unsigned int i0 = 0; i0 <
nt; i0++) {
1083 unsigned int i = iz[i0];
1087 double tz = tks.
zpca[
i];
1089 if (std::fabs(tz - zdumpcenter_) > zdumpwidth_)
1091 std::cout << setw(4) <<
i <<
")" << setw(8) <<
fixed << setprecision(4) << tz <<
" +/-" << setw(6)
1093 if ((tks.
tt[
i] ==
nullptr)) {
1110 .pixelBarrelLayersWithMeasurement();
1111 std::cout << setw(1) << tks.
tt[
i]->track().hitPattern().pixelEndcapLayersWithMeasurement();
1113 << tks.
tt[
i]->track().hitPattern().trackerLayersWithMeasurement() -
1114 tks.
tt[
i]->track().hitPattern().pixelLayersWithMeasurement()
1120 std::cout << setw(8) <<
IP.value() <<
"+/-" << setw(6) <<
IP.error();
1121 std::cout <<
" " << setw(6) << setprecision(2) << tks.
tt[
i]->track().pt() * tks.
tt[
i]->track().charge();
1122 std::cout <<
" " << setw(5) << setprecision(2) << tks.
tt[
i]->track().phi() <<
" " << setw(5) << setprecision(2)
1123 << tks.
tt[
i]->track().eta();
1127 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1128 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) > zdumpwidth_)
1133 double p = y.rho[ivertex] * local_exp(-
beta * Eik(tks.
zpca[
i], y.zvtx[ivertex], tks.
dz2[
i])) / tks.
sum_Z[
i];
1135 std::cout << setw(8) << setprecision(3) <<
p;
1139 E +=
p * Eik(tks.
zpca[
i], y.zvtx[ivertex], tks.
dz2[
i]);
1145 std::cout <<
" ( " << std::setw(3) << tks.
kmin[
i] <<
"," << std::setw(3) << tks.
kmax[
i] - 1 <<
" ) ";
1149 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1150 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) < zdumpwidth_) {
1151 std::cout <<
" " << setw(3) << ivertex <<
" ";
1157 for (
unsigned int ivertex = 0; ivertex < nv; ++ivertex) {
1158 if (std::fabs(y.zvtx[ivertex] - zdumpcenter_) < zdumpwidth_) {
1164 <<
"T=" << 1 /
beta <<
" E=" << E <<
" n=" << y.getSize() <<
" F= " <<
F << endl
1165 <<
"----------" << endl;
1171 desc.addUntracked<
double>(
"zdumpcenter", 0.);
1172 desc.addUntracked<
double>(
"zdumpwidth", 20.);
1173 desc.add<
double>(
"d0CutOff", 3.0);
1174 desc.add<
double>(
"Tmin", 2.0);
1175 desc.add<
double>(
"delta_lowT", 0.001);
1176 desc.add<
double>(
"zmerge", 0.01);
1177 desc.add<
double>(
"dzCutOff", 3.0);
1178 desc.add<
double>(
"Tpurge", 2.0);
1179 desc.add<
int>(
"convergence_mode", 0);
1180 desc.add<
double>(
"delta_highT", 0.01);
1181 desc.add<
double>(
"Tstop", 0.5);
1182 desc.add<
double>(
"coolingFactor", 0.6);
1183 desc.add<
double>(
"vertexSize", 0.006);
1184 desc.add<
double>(
"uniquetrkweight", 0.8);
1185 desc.add<
double>(
"uniquetrkminp", 0.0);
1186 desc.add<
double>(
"zrange", 4.0);
double beta0(const double betamax, track_t const &tks, vertex_t const &y) const
void addItemSorted(double new_zpca, double new_dz2, const reco::TransientTrack *new_tt, double new_tkwt)
T getParameter(std::string const &) const
bool merge(vertex_t &y, track_t &tks, double &beta) const
common ppss p3p6s2 common epss epspn46 common const1 w2
void clear_vtx_range(track_t >racks, vertex_t &gvertices) const
constexpr bool isNotFinite(T x)
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
bool purge(vertex_t &, track_t &, double &, const double) const
double *__restrict__ sum_Z
static void fillPSetDescription(edm::ParameterSetDescription &desc)
double *__restrict__ tkwt
std::vector< const reco::TransientTrack * > tt
std::vector< double > dz2_vec
std::vector< std::vector< reco::TransientTrack > > clusterize(const std::vector< reco::TransientTrack > &tracks) const override
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const
std::vector< double > tkwt_vec
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
std::vector< unsigned int > kmin
double *__restrict__ zpca
double update(double beta, track_t >racks, vertex_t &gvertices, const double rho0=0, const bool updateTc=false) const
std::vector< unsigned int > kmax
double *__restrict__ exp_arg
void dump(const double beta, const vertex_t &y, const track_t &tks, const int verbosity=0, const double rho0=0.) const
track_t fill(const std::vector< reco::TransientTrack > &tracks) const
double *__restrict__ zvtx
Abs< T >::type abs(const T &t)
unsigned int getSize() const
unsigned int getSize() const
def split(sequence, size)
std::vector< double > sum_Z_vec
DAClusterizerInZ_vect(const edm::ParameterSet &conf)
auto const & tracks
cannot be loose
weight_default_t w1[2000]
unsigned int thermalize(double beta, track_t >racks, vertex_t &gvertices, const double delta_max, const double rho0=0.) const
void set_vtx_range(double beta, track_t >racks, vertex_t &gvertices) const
static int position[264][3]
std::vector< double > zpca_vec
Log< level::Warning, false > LogWarning
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void verify(const vertex_t &v, const track_t &tks, unsigned int nv=999999, unsigned int nt=999999) const
bool split(const double beta, track_t &t, vertex_t &y, double threshold=1.) const
Power< A, B >::type pow(const A &a, const B &b)
def merge(dictlist, TELL=False)