CMS 3D CMS Logo

VertexFinder.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 
5 namespace l1tVertexFinder {
6 
7  void VertexFinder::computeAndSetVertexParameters(RecoVertex<>& vertex,
8  const std::vector<float>& bin_centers,
9  const std::vector<unsigned int>& counts) {
10  double pt = 0.;
11  double z0 = -999.;
12  double z0width = 0.;
13  bool highPt = false;
14  double highestPt = 0.;
15  unsigned int numHighPtTracks = 0;
16 
17  float SumZ = 0.;
18  float z0square = 0.;
19  float trackPt = 0.;
20 
21  std::vector<double> bin_pt(bin_centers.size(), 0.0);
22  unsigned int ibin = 0;
23  unsigned int itrack = 0;
24 
25  for (const L1Track* track : vertex.tracks()) {
26  itrack++;
27  trackPt = track->pt();
28 
29  // Skip the bins with no tracks
30  while (ibin < counts.size() && counts[ibin] == 0)
31  ibin++;
32 
33  if (trackPt > settings_->vx_TrackMaxPt()) {
34  highPt = true;
35  numHighPtTracks++;
36  highestPt = (trackPt > highestPt) ? trackPt : highestPt;
37  if (settings_->vx_TrackMaxPtBehavior() == 0)
38  continue; // ignore this track
39  else if (settings_->vx_TrackMaxPtBehavior() == 1)
40  trackPt = settings_->vx_TrackMaxPt(); // saturate
41  }
42 
43  pt += std::pow(trackPt, settings_->vx_weightedmean());
44  if (bin_centers.empty() && counts.empty()) {
45  SumZ += track->z0() * std::pow(trackPt, settings_->vx_weightedmean());
46  z0square += track->z0() * track->z0();
47  } else {
48  bin_pt[ibin] += std::pow(trackPt, settings_->vx_weightedmean());
49  if (itrack == counts[ibin]) {
50  SumZ += bin_centers[ibin] * bin_pt[ibin];
51  z0square += bin_centers[ibin] * bin_centers[ibin];
52  itrack = 0;
53  ibin++;
54  }
55  }
56  }
57 
58  z0 = SumZ / ((settings_->vx_weightedmean() > 0) ? pt : vertex.numTracks());
59  z0square /= vertex.numTracks();
60  z0width = sqrt(std::abs(z0 * z0 - z0square));
61 
62  vertex.setParameters(pt, z0, z0width, highPt, numHighPtTracks, highestPt);
63  }
64 
65  void VertexFinder::GapClustering() {
66  sort(fitTracks_.begin(), fitTracks_.end(), SortTracksByZ0());
67  iterations_ = 0;
69  for (unsigned int i = 0; i < fitTracks_.size(); ++i) {
70  Vertex.insert(&fitTracks_[i]);
71  iterations_++;
72  if ((i + 1 < fitTracks_.size() and fitTracks_[i + 1].z0() - fitTracks_[i].z0() > settings_->vx_distance()) or
73  i == fitTracks_.size() - 1) {
74  if (Vertex.numTracks() >= settings_->vx_minTracks()) {
75  computeAndSetVertexParameters(Vertex, {}, {});
76  vertices_.push_back(Vertex);
77  }
78  Vertex.clear();
79  }
80  }
81  }
82 
84  float distance = 0;
85  for (const L1Track* track0 : cluster0.tracks()) {
86  for (const L1Track* track1 : cluster1.tracks()) {
87  if (std::abs(track0->z0() - track1->z0()) > distance) {
88  distance = std::abs(track0->z0() - track1->z0());
89  }
90  }
91  }
92 
93  return distance;
94  }
95 
96  float VertexFinder::minDistance(RecoVertex<> cluster0, RecoVertex<> cluster1) {
97  float distance = 9999;
98  for (const L1Track* track0 : cluster0.tracks()) {
99  for (const L1Track* track1 : cluster1.tracks()) {
100  if (std::abs(track0->z0() - track1->z0()) < distance) {
101  distance = std::abs(track0->z0() - track1->z0());
102  }
103  }
104  }
105 
106  return distance;
107  }
108 
109  float VertexFinder::meanDistance(RecoVertex<> cluster0, RecoVertex<> cluster1) {
110  float distanceSum = 0;
111 
112  for (const L1Track* track0 : cluster0.tracks()) {
113  for (const L1Track* track1 : cluster1.tracks()) {
114  distanceSum += std::abs(track0->z0() - track1->z0());
115  }
116  }
117 
118  float distance = distanceSum / (cluster0.numTracks() * cluster1.numTracks());
119  return distance;
120  }
121 
122  float VertexFinder::centralDistance(RecoVertex<> cluster0, RecoVertex<> cluster1) {
123  computeAndSetVertexParameters(cluster0, {}, {});
124  computeAndSetVertexParameters(cluster1, {}, {});
125  float distance = std::abs(cluster0.z0() - cluster1.z0());
126  return distance;
127  }
128 
129  void VertexFinder::agglomerativeHierarchicalClustering() {
130  iterations_ = 0;
131 
132  sort(fitTracks_.begin(), fitTracks_.end(), SortTracksByZ0());
133 
134  RecoVertexCollection vClusters;
135  vClusters.resize(fitTracks_.size());
136 
137  for (unsigned int i = 0; i < fitTracks_.size(); ++i) {
138  vClusters[i].insert(&fitTracks_[i]);
139  // iterations_++;
140  }
141 
142  while (true) {
143  float MinimumScore = 9999;
144 
145  unsigned int clusterId0 = 0;
146  unsigned int clusterId1 = 0;
147  for (unsigned int iClust = 0; iClust < vClusters.size() - 1; iClust++) {
148  iterations_++;
149 
150  float M = 0;
151  if (settings_->vx_distanceType() == 0)
152  M = maxDistance(vClusters[iClust], vClusters[iClust + 1]);
153  else if (settings_->vx_distanceType() == 1)
154  M = minDistance(vClusters[iClust], vClusters[iClust + 1]);
155  else if (settings_->vx_distanceType() == 2)
156  M = meanDistance(vClusters[iClust], vClusters[iClust + 1]);
157  else
158  M = centralDistance(vClusters[iClust], vClusters[iClust + 1]);
159 
160  if (M < MinimumScore) {
161  MinimumScore = M;
162  clusterId0 = iClust;
163  clusterId1 = iClust + 1;
164  }
165  }
166  if (MinimumScore > settings_->vx_distance() or vClusters[clusterId1].tracks().empty())
167  break;
168  for (const L1Track* track : vClusters[clusterId0].tracks()) {
169  vClusters[clusterId1].insert(track);
170  }
171  vClusters.erase(vClusters.begin() + clusterId0);
172  }
173 
174  for (RecoVertex clust : vClusters) {
175  if (clust.numTracks() >= settings_->vx_minTracks()) {
176  computeAndSetVertexParameters(clust, {}, {});
177  vertices_.push_back(clust);
178  }
179  }
180  }
181 
182  void VertexFinder::DBSCAN() {
183  // std::vector<RecoVertex> vClusters;
184  std::vector<unsigned int> visited;
185  std::vector<unsigned int> saved;
186 
187  sort(fitTracks_.begin(), fitTracks_.end(), SortTracksByPt());
188  iterations_ = 0;
189 
190  for (unsigned int i = 0; i < fitTracks_.size(); ++i) {
191  if (find(visited.begin(), visited.end(), i) != visited.end())
192  continue;
193 
194  // if(fitTracks_[i]->pt()>10.){
195  visited.push_back(i);
196  std::set<unsigned int> neighbourTrackIds;
197  unsigned int numDensityTracks = 0;
198  if (fitTracks_[i].pt() > settings_->vx_dbscan_pt())
199  numDensityTracks++;
200  else
201  continue;
202  for (unsigned int k = 0; k < fitTracks_.size(); ++k) {
203  iterations_++;
204  if (k != i and std::abs(fitTracks_[k].z0() - fitTracks_[i].z0()) < settings_->vx_distance()) {
205  neighbourTrackIds.insert(k);
206  if (fitTracks_[k].pt() > settings_->vx_dbscan_pt()) {
207  numDensityTracks++;
208  }
209  }
210  }
211 
212  if (numDensityTracks < settings_->vx_dbscan_mintracks()) {
213  // mark track as noise
214  } else {
216  vertex.insert(&fitTracks_[i]);
217  saved.push_back(i);
218  for (unsigned int id : neighbourTrackIds) {
219  if (find(visited.begin(), visited.end(), id) == visited.end()) {
220  visited.push_back(id);
221  std::vector<unsigned int> neighbourTrackIds2;
222  for (unsigned int k = 0; k < fitTracks_.size(); ++k) {
223  iterations_++;
224  if (std::abs(fitTracks_[k].z0() - fitTracks_[id].z0()) < settings_->vx_distance()) {
225  neighbourTrackIds2.push_back(k);
226  }
227  }
228 
229  // if (neighbourTrackIds2.size() >= settings_->vx_minTracks()) {
230  for (unsigned int id2 : neighbourTrackIds2) {
231  neighbourTrackIds.insert(id2);
232  }
233  // }
234  }
235  if (find(saved.begin(), saved.end(), id) == saved.end())
236  vertex.insert(&fitTracks_[id]);
237  }
238  computeAndSetVertexParameters(vertex, {}, {});
239  if (vertex.numTracks() >= settings_->vx_minTracks())
240  vertices_.push_back(vertex);
241  }
242  // }
243  }
244  }
245 
246  void VertexFinder::PVR() {
247  bool start = true;
248  FitTrackCollection discardedTracks, acceptedTracks;
249  iterations_ = 0;
250  for (const L1Track& track : fitTracks_) {
251  acceptedTracks.push_back(track);
252  }
253 
254  while (discardedTracks.size() >= settings_->vx_minTracks() or start == true) {
255  start = false;
256  bool removing = true;
257  discardedTracks.clear();
258  while (removing) {
259  float oldDistance = 0.;
260 
261  if (settings_->debug() > 2)
262  edm::LogInfo("VertexFinder") << "PVR::AcceptedTracks " << acceptedTracks.size();
263 
264  float z0start = 0;
265  for (const L1Track& track : acceptedTracks) {
266  z0start += track.z0();
267  iterations_++;
268  }
269 
270  z0start /= acceptedTracks.size();
271  if (settings_->debug() > 2)
272  edm::LogInfo("VertexFinder") << "PVR::z0 vertex " << z0start;
273  FitTrackCollection::iterator badTrackIt = acceptedTracks.end();
274  removing = false;
275 
276  for (FitTrackCollection::iterator it = acceptedTracks.begin(); it < acceptedTracks.end(); ++it) {
277  const L1Track* track = &*it;
278  iterations_++;
279  if (std::abs(track->z0() - z0start) > settings_->vx_distance() and
280  std::abs(track->z0() - z0start) > oldDistance) {
281  badTrackIt = it;
282  oldDistance = std::abs(track->z0() - z0start);
283  removing = true;
284  }
285  }
286 
287  if (removing) {
288  const L1Track badTrack = *badTrackIt;
289  if (settings_->debug() > 2)
290  edm::LogInfo("VertexFinder") << "PVR::Removing track " << badTrack.z0() << " at distance " << oldDistance;
291  discardedTracks.push_back(badTrack);
292  acceptedTracks.erase(badTrackIt);
293  }
294  }
295 
296  if (acceptedTracks.size() >= settings_->vx_minTracks()) {
298  for (const L1Track& track : acceptedTracks) {
299  vertex.insert(&track);
300  }
301  computeAndSetVertexParameters(vertex, {}, {});
302  vertices_.push_back(vertex);
303  }
304  if (settings_->debug() > 2)
305  edm::LogInfo("VertexFinder") << "PVR::DiscardedTracks size " << discardedTracks.size();
306  acceptedTracks.clear();
307  acceptedTracks = discardedTracks;
308  }
309  }
310 
311  void VertexFinder::adaptiveVertexReconstruction() {
312  bool start = true;
313  iterations_ = 0;
314  FitTrackCollection discardedTracks, acceptedTracks, discardedTracks2;
315 
316  for (const L1Track& track : fitTracks_) {
317  discardedTracks.push_back(track);
318  }
319 
320  while (discardedTracks.size() >= settings_->vx_minTracks() or start == true) {
321  start = false;
322  discardedTracks2.clear();
323  FitTrackCollection::iterator it = discardedTracks.begin();
324  const L1Track track = *it;
325  acceptedTracks.push_back(track);
326  float z0sum = track.z0();
327 
328  for (FitTrackCollection::iterator it2 = discardedTracks.begin(); it2 < discardedTracks.end(); ++it2) {
329  if (it2 != it) {
330  const L1Track secondTrack = *it2;
331  // Calculate new vertex z0 adding this track
332  z0sum += secondTrack.z0();
333  float z0vertex = z0sum / (acceptedTracks.size() + 1);
334  // Calculate chi2 of new vertex
335  float chi2 = 0.;
336  float dof = 0.;
337  for (const L1Track& accTrack : acceptedTracks) {
338  iterations_++;
339  float Residual = accTrack.z0() - z0vertex;
340  if (std::abs(accTrack.eta()) < 1.2)
341  Residual /= 0.1812; // Assumed z0 resolution
342  else if (std::abs(accTrack.eta()) >= 1.2 && std::abs(accTrack.eta()) < 1.6)
343  Residual /= 0.2912;
344  else if (std::abs(accTrack.eta()) >= 1.6 && std::abs(accTrack.eta()) < 2.)
345  Residual /= 0.4628;
346  else
347  Residual /= 0.65;
348 
349  chi2 += Residual * Residual;
350  dof = (acceptedTracks.size() + 1) * 2 - 1;
351  }
352  if (chi2 / dof < settings_->vx_chi2cut()) {
353  acceptedTracks.push_back(secondTrack);
354  } else {
355  discardedTracks2.push_back(secondTrack);
356  z0sum -= secondTrack.z0();
357  }
358  }
359  }
360 
361  if (acceptedTracks.size() >= settings_->vx_minTracks()) {
363  for (const L1Track& track : acceptedTracks) {
364  vertex.insert(&track);
365  }
366  computeAndSetVertexParameters(vertex, {}, {});
367  vertices_.push_back(vertex);
368  }
369 
370  acceptedTracks.clear();
371  discardedTracks.clear();
372  discardedTracks = discardedTracks2;
373  }
374  }
375 
376  void VertexFinder::HPV() {
377  iterations_ = 0;
378  sort(fitTracks_.begin(), fitTracks_.end(), SortTracksByPt());
379 
381  bool first = true;
382  float z = 99.;
383  for (const L1Track& track : fitTracks_) {
384  if (track.pt() < 50.) {
385  if (first) {
386  first = false;
387  z = track.z0();
388  vertex.insert(&track);
389  } else {
390  if (std::abs(track.z0() - z) < settings_->vx_distance())
391  vertex.insert(&track);
392  }
393  }
394  }
395 
396  computeAndSetVertexParameters(vertex, {}, {});
397  vertex.setZ0(z);
398  vertices_.push_back(vertex);
399  }
400 
401  void VertexFinder::Kmeans() {
402  unsigned int NumberOfClusters = settings_->vx_kmeans_nclusters();
403 
404  vertices_.resize(NumberOfClusters);
405  float ClusterSeparation = 30. / NumberOfClusters;
406 
407  for (unsigned int i = 0; i < NumberOfClusters; ++i) {
408  float ClusterCentre = -15. + ClusterSeparation * (i + 0.5);
409  vertices_[i].setZ0(ClusterCentre);
410  }
411  unsigned int iterations = 0;
412  // Initialise Clusters
413  while (iterations < settings_->vx_kmeans_iterations()) {
414  for (unsigned int i = 0; i < NumberOfClusters; ++i) {
415  vertices_[i].clear();
416  }
417 
418  for (const L1Track& track : fitTracks_) {
419  float distance = 9999;
420  if (iterations == settings_->vx_kmeans_iterations() - 3)
421  distance = settings_->vx_distance() * 2;
422  if (iterations > settings_->vx_kmeans_iterations() - 3)
423  distance = settings_->vx_distance();
424  unsigned int ClusterId;
425  bool NA = true;
426  for (unsigned int id = 0; id < NumberOfClusters; ++id) {
427  if (std::abs(track.z0() - vertices_[id].z0()) < distance) {
428  distance = std::abs(track.z0() - vertices_[id].z0());
429  ClusterId = id;
430  NA = false;
431  }
432  }
433  if (!NA) {
434  vertices_[ClusterId].insert(&track);
435  }
436  }
437  for (unsigned int i = 0; i < NumberOfClusters; ++i) {
438  if (vertices_[i].numTracks() >= settings_->vx_minTracks())
439  computeAndSetVertexParameters(vertices_[i], {}, {});
440  }
441  iterations++;
442  }
443  }
444 
445  void VertexFinder::findPrimaryVertex() {
446  if (settings_->vx_precision() == Precision::Emulation) {
447  pv_index_ = std::distance(verticesEmulation_.begin(),
448  std::max_element(verticesEmulation_.begin(),
449  verticesEmulation_.end(),
450  [](const l1t::VertexWord& vertex0, const l1t::VertexWord& vertex1) {
451  return (vertex0.pt() < vertex1.pt());
452  }));
453  } else {
454  pv_index_ = std::distance(
455  vertices_.begin(),
456  std::max_element(
457  vertices_.begin(), vertices_.end(), [](const RecoVertex<>& vertex0, const RecoVertex<>& vertex1) {
458  return (vertex0.pt() < vertex1.pt());
459  }));
460  }
461  }
462 
463  // Possible Formatting Codes: https://misc.flogisoft.com/bash/tip_colors_and_formatting
464  template <class data_type, typename stream_type>
465  void VertexFinder::printHistogram(stream_type& stream,
466  std::vector<data_type> data,
467  int width,
468  int minimum,
469  int maximum,
471  std::string color) {
472  int tableSize = data.size();
473 
474  if (maximum == -1) {
475  maximum = float(*std::max_element(std::begin(data), std::end(data))) * 1.05;
476  } else if (maximum <= minimum) {
477  maximum = float(*std::max_element(std::begin(data), std::end(data))) * 1.05;
478  minimum = float(*std::min_element(std::begin(data), std::end(data)));
479  }
480 
481  if (minimum < 0) {
482  minimum *= 1.05;
483  } else {
484  minimum = 0;
485  }
486 
487  std::vector<std::string> intervals(tableSize, "");
488  std::vector<std::string> values(tableSize, "");
489  char buffer[128];
490  int intervalswidth = 0, valueswidth = 0, tmpwidth = 0;
491  for (int i = 0; i < tableSize; i++) {
492  //Format the bin labels
493  tmpwidth = sprintf(buffer, "[%-.5g, %-.5g)", float(i), float(i + 1));
494  intervals[i] = buffer;
495  if (i == (tableSize - 1)) {
496  intervals[i][intervals[i].size() - 1] = ']';
497  }
498  if (tmpwidth > intervalswidth)
499  intervalswidth = tmpwidth;
500 
501  //Format the values
502  tmpwidth = sprintf(buffer, "%-.5g", float(data[i]));
503  values[i] = buffer;
504  if (tmpwidth > valueswidth)
505  valueswidth = tmpwidth;
506  }
507 
508  sprintf(buffer, "%-.5g", float(minimum));
509  std::string minimumtext = buffer;
510  sprintf(buffer, "%-.5g", float(maximum));
511  std::string maximumtext = buffer;
512 
513  int plotwidth =
514  std::max(int(minimumtext.size() + maximumtext.size()), width - (intervalswidth + 1 + valueswidth + 1 + 2));
516  minimumtext + std::string(plotwidth + 2 - minimumtext.size() - maximumtext.size(), ' ') + maximumtext;
517 
518  float norm = float(plotwidth) / float(maximum - minimum);
519  int zero = std::round((0.0 - minimum) * norm);
520  std::vector<char> line(plotwidth, '-');
521 
522  if ((minimum != 0) && (0 <= zero) && (zero < plotwidth)) {
523  line[zero] = '+';
524  }
525  std::string capstone =
526  std::string(intervalswidth + 1 + valueswidth + 1, ' ') + "+" + std::string(line.begin(), line.end()) + "+";
527 
528  std::vector<std::string> out;
529  if (!title.empty()) {
530  out.push_back(title);
531  out.push_back(std::string(title.size(), '='));
532  }
533  out.push_back(std::string(intervalswidth + valueswidth + 2, ' ') + scale);
534  out.push_back(capstone);
535  for (int i = 0; i < tableSize; i++) {
536  std::string interval = intervals[i];
538  data_type x = data[i];
539  std::fill_n(line.begin(), plotwidth, ' ');
540 
541  int pos = std::round((float(x) - minimum) * norm);
542  if (x < 0) {
543  std::fill_n(line.begin() + pos, zero - pos, '*');
544  } else {
545  std::fill_n(line.begin() + zero, pos - zero, '*');
546  }
547 
548  if ((minimum != 0) && (0 <= zero) && (zero < plotwidth)) {
549  line[zero] = '|';
550  }
551 
552  sprintf(buffer,
553  "%-*s %-*s |%s|",
554  intervalswidth,
555  interval.c_str(),
556  valueswidth,
557  value.c_str(),
558  std::string(line.begin(), line.end()).c_str());
559  out.push_back(buffer);
560  }
561  out.push_back(capstone);
562  if (!color.empty())
563  stream << color;
564  for (const auto& o : out) {
565  stream << o << "\n";
566  }
567  if (!color.empty())
568  stream << "\e[0m";
569  stream << "\n";
570  }
571 
572  void VertexFinder::sortVerticesInPt() {
573  if (settings_->vx_precision() == Precision::Emulation) {
574  std::sort(
575  verticesEmulation_.begin(),
576  verticesEmulation_.end(),
577  [](const l1t::VertexWord& vertex0, const l1t::VertexWord& vertex1) { return (vertex0.pt() > vertex1.pt()); });
578  } else {
579  std::sort(vertices_.begin(), vertices_.end(), [](const RecoVertex<>& vertex0, const RecoVertex<>& vertex1) {
580  return (vertex0.pt() > vertex1.pt());
581  });
582  }
583  }
584 
585  void VertexFinder::sortVerticesInZ0() {
586  if (settings_->vx_precision() == Precision::Emulation) {
587  std::sort(
588  verticesEmulation_.begin(),
589  verticesEmulation_.end(),
590  [](const l1t::VertexWord& vertex0, const l1t::VertexWord& vertex1) { return (vertex0.z0() < vertex1.z0()); });
591  } else {
592  std::sort(vertices_.begin(), vertices_.end(), [](const RecoVertex<>& vertex0, const RecoVertex<>& vertex1) {
593  return (vertex0.z0() < vertex1.z0());
594  });
595  }
596  }
597 
598  void VertexFinder::associatePrimaryVertex(double trueZ0) {
599  double distance = 999.;
600  for (unsigned int id = 0; id < vertices_.size(); ++id) {
601  if (std::abs(trueZ0 - vertices_[id].z0()) < distance) {
602  distance = std::abs(trueZ0 - vertices_[id].z0());
603  pv_index_ = id;
604  }
605  }
606  }
607 
608  void VertexFinder::fastHistoLooseAssociation() {
609  float vxPt = 0.;
610  RecoVertex leading_vertex;
611 
612  for (float z = settings_->vx_histogram_min(); z < settings_->vx_histogram_max();
613  z += settings_->vx_histogram_binwidth()) {
615  for (const L1Track& track : fitTracks_) {
616  if (std::abs(z - track.z0()) < settings_->vx_width()) {
617  vertex.insert(&track);
618  }
619  }
620  computeAndSetVertexParameters(vertex, {}, {});
621  vertex.setZ0(z);
622  if (vertex.pt() > vxPt) {
623  leading_vertex = vertex;
624  vxPt = vertex.pt();
625  }
626  }
627 
628  vertices_.emplace_back(leading_vertex);
629  pv_index_ = 0; // by default fastHistoLooseAssociation algorithm finds only hard PV
630  } // end of fastHistoLooseAssociation
631 
632  void VertexFinder::fastHisto(const TrackerTopology* tTopo) {
633  // Create the histogram
634  int nbins =
635  std::ceil((settings_->vx_histogram_max() - settings_->vx_histogram_min()) / settings_->vx_histogram_binwidth());
636  std::vector<RecoVertex<>> hist(nbins);
637  std::vector<RecoVertex<>> sums(nbins - settings_->vx_windowSize());
638  std::vector<float> bounds(nbins + 1);
639  strided_iota(std::begin(bounds),
640  std::next(std::begin(bounds), nbins + 1),
641  settings_->vx_histogram_min(),
642  settings_->vx_histogram_binwidth());
643 
644  // Loop over the tracks and fill the histogram
645  for (const L1Track& track : fitTracks_) {
646  if ((track.z0() < settings_->vx_histogram_min()) || (track.z0() > settings_->vx_histogram_max()))
647  continue;
648  if (track.getTTTrackPtr()->chi2() > settings_->vx_TrackMaxChi2())
649  continue;
650  if (track.pt() < settings_->vx_TrackMinPt())
651  continue;
652 
653  // Get the number of stubs and the number of stubs in PS layers
654  float nPS = 0., nstubs = 0;
655 
656  // Get pointers to stubs associated to the L1 track
657  const auto& theStubs = track.getTTTrackPtr()->getStubRefs();
658  if (theStubs.empty()) {
659  edm::LogWarning("VertexFinder") << "fastHisto::Could not retrieve the vector of stubs.";
660  continue;
661  }
662 
663  // Loop over the stubs
664  for (const auto& stub : theStubs) {
665  nstubs++;
666  bool isPS = false;
667  DetId detId(stub->getDetId());
668  if (detId.det() == DetId::Detector::Tracker) {
669  if (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3)
670  isPS = true;
671  else if (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9)
672  isPS = true;
673  }
674  if (isPS)
675  nPS++;
676  } // End loop over stubs
677  if (nstubs < settings_->vx_NStubMin())
678  continue;
679  if (nPS < settings_->vx_NStubPSMin())
680  continue;
681 
682  // Quality cuts, may need to be re-optimized
683  int trk_nstub = (int)track.getTTTrackPtr()->getStubRefs().size();
684  float chi2dof = track.getTTTrackPtr()->chi2() / (2 * trk_nstub - 4);
685 
686  if (settings_->vx_DoPtComp()) {
687  float trk_consistency = track.getTTTrackPtr()->stubPtConsistency();
688  if (trk_nstub == 4) {
689  if (std::abs(track.eta()) < 2.2 && trk_consistency > 10)
690  continue;
691  else if (std::abs(track.eta()) > 2.2 && chi2dof > 5.0)
692  continue;
693  }
694  }
695  if (settings_->vx_DoTightChi2()) {
696  if (track.pt() > 10.0 && chi2dof > 5.0)
697  continue;
698  }
699 
700  // Assign the track to the correct vertex
701  // The values are ordered with bounds [lower, upper)
702  // Values below bounds.begin() return 0 as the index (underflow)
703  // Values above bounds.end() will return the index of the last bin (overflow)
704  auto upper_bound = std::upper_bound(bounds.begin(), bounds.end(), track.z0());
705  int index = std::distance(bounds.begin(), upper_bound) - 1;
706  if (index == -1)
707  index = 0;
708  hist.at(index).insert(&track);
709  } // end loop over tracks
710 
711  // Compute the sums
712  // sliding windows ... sum_i_i+(w-1) where i in (0,nbins-w) and w is the window size
713  std::vector<float> bin_centers(settings_->vx_windowSize(), 0.0);
714  std::vector<unsigned int> counts(settings_->vx_windowSize(), 0);
715  for (unsigned int i = 0; i < sums.size(); i++) {
716  for (unsigned int j = 0; j < settings_->vx_windowSize(); j++) {
717  bin_centers[j] = settings_->vx_histogram_min() + ((i + j) * settings_->vx_histogram_binwidth()) +
718  (0.5 * settings_->vx_histogram_binwidth());
719  counts[j] = hist.at(i + j).numTracks();
720  sums.at(i) += hist.at(i + j);
721  }
722  computeAndSetVertexParameters(sums.at(i), bin_centers, counts);
723  }
724 
725  // Find the maxima of the sums
726  float sigma_max = -999;
727  int imax = -999;
728  std::vector<int> found;
729  found.reserve(settings_->vx_nvtx());
730  for (unsigned int ivtx = 0; ivtx < settings_->vx_nvtx(); ivtx++) {
731  sigma_max = -999;
732  imax = -999;
733  for (unsigned int i = 0; i < sums.size(); i++) {
734  // Skip this window if it will already be returned
735  if (find(found.begin(), found.end(), i) != found.end())
736  continue;
737  if (sums.at(i).pt() > sigma_max) {
738  sigma_max = sums.at(i).pt();
739  imax = i;
740  }
741  }
742  found.push_back(imax);
743  vertices_.emplace_back(sums.at(imax));
744  }
745  pv_index_ = 0;
746 
747  if (settings_->debug() >= 1) {
748  edm::LogInfo log("VertexProducer");
749  log << "fastHisto::Checking the output parameters ... \n";
750  std::vector<double> tmp;
751  std::transform(std::begin(sums), std::end(sums), std::back_inserter(tmp), [](const RecoVertex<>& v) -> double {
752  return v.pt();
753  });
754  printHistogram<double, edm::LogInfo>(log, tmp, 80, 0, -1, "fastHisto::sums", "\e[92m");
755  for (unsigned int i = 0; i < found.size(); i++) {
756  log << "RecoVertex " << i << ": bin index = " << found[i] << "\tsumPt = " << sums.at(imax).pt()
757  << "\tz0 = " << sums.at(imax).z0();
758  }
759  }
760  } // end of fastHisto
761 
762  void VertexFinder::fastHistoEmulation() {
763  // Relevant constants for the track word
764  enum TrackBitWidths {
765  kZ0Size = 12, // Width of z-position (40cm / 0.1)
766  kZ0MagSize = 5, // Width of z-position magnitude (signed)
767  kPtSize = 14, // Width of pt
768  kPtMagSize = 9, // Width of pt magnitude (unsigned)
769  kReducedPrecisionPt = 7, // Width of the reduced precision, integer only, pt
770  };
771 
772  enum HistogramBitWidths {
773  kBinSize = 10, // Width of a single bin in z
774  kBinFixedSize = 7, // Width of a single z0 bin in fixed point representation
775  kBinFixedMagSize = 4, // Width (magnitude) of a single z0 bin in fixed point representation
776  kSlidingSumSize = 11, // Width of the sum of a window of bins
777  kInverseSize = 14, // Width of the inverse sum
778  kInverseMagSize = 1, // Width of the inverse sum magnitude (unsigned)
779  kWeightedSlidingSumSize = 20, // Width of the pT weighted sliding sum
780  kWeightedSlidingSumMagSize = 10, // Width of the pT weighted sliding sum magnitude (signed)
781  kWindowSize = 3, // Number of bins in the window used to sum histogram bins
782  kSumPtLinkSize = 9, // Number of bits used to represent the sum of track pts in a single bin from a single link
783  kSumPtWindowBits = BitsToRepresent(HistogramBitWidths::kWindowSize * (1 << HistogramBitWidths::kSumPtLinkSize)),
784  };
785 
786  static constexpr unsigned int kTableSize =
787  ((1 << HistogramBitWidths::kSumPtLinkSize) - 1) * HistogramBitWidths::kWindowSize;
788 
789  typedef ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize, AP_RND_CONV, AP_SAT> pt_t;
790  // Same size as TTTrack_TrackWord::z0_t, but now taking into account the sign bit (i.e. 2's complement)
791  typedef ap_int<TrackBitWidths::kZ0Size> z0_t;
792  // 7 bits chosen to represent values between [0,127]
793  // This is the next highest power of 2 value to our chosen track pt saturation value (100)
794  typedef ap_ufixed<TrackBitWidths::kReducedPrecisionPt, TrackBitWidths::kReducedPrecisionPt, AP_RND_INF, AP_SAT>
795  track_pt_fixed_t;
796  // Histogram bin index
797  typedef ap_uint<HistogramBitWidths::kBinSize> histbin_t;
798  // Histogram bin in fixed point representation, before truncation
799  typedef ap_ufixed<HistogramBitWidths::kBinFixedSize, HistogramBitWidths::kBinFixedMagSize, AP_RND_INF, AP_SAT>
800  histbin_fixed_t;
801  // This value is slightly arbitrary, but small enough that the windows sums aren't too big.
802  typedef ap_ufixed<HistogramBitWidths::kSumPtLinkSize, HistogramBitWidths::kSumPtLinkSize, AP_RND_INF, AP_SAT>
803  link_pt_sum_fixed_t;
804  // Enough bits to store HistogramBitWidths::kWindowSize * (2**HistogramBitWidths::kSumPtLinkSize)
805  typedef ap_ufixed<HistogramBitWidths::kSumPtWindowBits, HistogramBitWidths::kSumPtWindowBits, AP_RND_INF, AP_SAT>
806  window_pt_sum_fixed_t;
807  // pt weighted sum of bins in window
808  typedef ap_fixed<HistogramBitWidths::kWeightedSlidingSumSize,
809  HistogramBitWidths::kWeightedSlidingSumMagSize,
810  AP_RND_INF,
811  AP_SAT>
812  zsliding_t;
813  // Sum of histogram bins in window
814  typedef ap_uint<HistogramBitWidths::kSlidingSumSize> slidingsum_t;
815  // Inverse of sum of bins in a given window
816  typedef ap_ufixed<HistogramBitWidths::kInverseSize, HistogramBitWidths::kInverseMagSize, AP_RND_INF, AP_SAT>
817  inverse_t;
818 
819  auto track_quality_check = [&](const track_pt_fixed_t& pt) -> bool {
820  // Track quality cuts
821  if (pt.to_double() < settings_->vx_TrackMinPt())
822  return false;
823  return true;
824  };
825 
826  auto fetch_bin = [&](const z0_t& z0, int nbins) -> std::pair<histbin_t, bool> {
827  // Increase the the number of bits in the word to allow for additional dynamic range
828  ap_int<TrackBitWidths::kZ0Size + 1> z0_13 = z0;
829  // Add a number equal to half of the range in z0, meaning that the range is now [0, 2*z0_max]
830  ap_int<TrackBitWidths::kZ0Size + 1> absz0_13 = z0_13 + (1 << (TrackBitWidths::kZ0Size - 1));
831  // Shift the bits down to truncate the dynamic range to the most significant HistogramBitWidths::kBinFixedSize bits
832  ap_int<TrackBitWidths::kZ0Size + 1> absz0_13_reduced =
833  absz0_13 >> (TrackBitWidths::kZ0Size - HistogramBitWidths::kBinFixedSize);
834  // Put the relevant bits into the histbin_t container
835  histbin_t bin = absz0_13_reduced.range(HistogramBitWidths::kBinFixedSize - 1, 0);
836 
837  if (settings_->debug() > 2) {
838  edm::LogInfo("VertexProducer")
839  << "fastHistoEmulation::fetchBin() Checking the mapping from z0 to bin index ... \n"
840  << "histbin_fixed_t(1.0 / settings_->vx_histogram_binwidth()) = "
841  << histbin_fixed_t(1.0 / settings_->vx_histogram_binwidth()) << "\n"
842  << "histbin_t(std::floor(nbins / 2) = " << histbin_t(std::floor(nbins / 2.)) << "\n"
843  << "z0 = " << z0 << "\n"
844  << "bin = " << bin;
845  }
846  bool valid = true;
847  if (bin < 0) {
848  return std::make_pair(0, false);
849  } else if (bin > (nbins - 1)) {
850  return std::make_pair(0, false);
851  }
852  return std::make_pair(bin, valid);
853  };
854 
855  // Replace with https://stackoverflow.com/questions/13313980/populate-an-array-using-constexpr-at-compile-time ?
856  auto init_inversion_table = [&]() -> std::vector<inverse_t> {
857  std::vector<inverse_t> table_out(kTableSize, 0.);
858  for (unsigned int ii = 0; ii < kTableSize; ii++) {
859  // First, convert from table index to X-value (unsigned 8-bit, range 0 to +1533)
860  float in_val = 1533.0 * (ii / float(kTableSize));
861  // Next, compute lookup table function
862  table_out.at(ii) = (in_val > 0) ? (1.0 / in_val) : 0.0;
863  }
864  return table_out;
865  };
866 
867  auto inversion = [&](slidingsum_t& data_den) -> inverse_t {
868  std::vector<inverse_t> inversion_table = init_inversion_table();
869 
870  // Index into the lookup table based on data
871  int index;
872  if (data_den < 0)
873  data_den = 0;
874  if (data_den > (kTableSize - 1))
875  data_den = kTableSize - 1;
876  index = data_den;
877  return inversion_table.at(index);
878  };
879 
880  auto bin_center = [&](zsliding_t iz, int nbins) -> l1t::VertexWord::vtxz0_t {
881  zsliding_t z = iz - histbin_t(std::floor(nbins / 2.));
882  std::unique_ptr<edm::LogInfo> log;
883  if (settings_->debug() >= 1) {
884  log = std::make_unique<edm::LogInfo>("VertexProducer");
885  *log << "bin_center information ...\n"
886  << "iz = " << iz << "\n"
887  << "histbin_t(std::floor(nbins / 2.)) = " << histbin_t(std::floor(nbins / 2.)) << "\n"
888  << "binwidth = " << zsliding_t(settings_->vx_histogram_binwidth()) << "\n"
889  << "z = " << z << "\n"
890  << "zsliding_t(z * zsliding_t(binwidth)) = " << std::setprecision(7)
891  << l1t::VertexWord::vtxz0_t(z * zsliding_t(settings_->vx_histogram_binwidth()));
892  }
893  return l1t::VertexWord::vtxz0_t(z * zsliding_t(settings_->vx_histogram_binwidth()));
894  };
895 
896  auto weighted_position = [&](histbin_t b_max,
897  const std::vector<link_pt_sum_fixed_t>& binpt,
898  slidingsum_t maximums,
899  int nbins) -> zsliding_t {
900  zsliding_t zvtx_sliding = 0;
901  slidingsum_t zvtx_sliding_sum = 0;
902  inverse_t inv = 0;
903 
904  std::unique_ptr<edm::LogInfo> log;
905  if (settings_->debug() >= 1) {
906  log = std::make_unique<edm::LogInfo>("VertexProducer");
907  *log << "Progression of weighted_position() ...\n"
908  << "zvtx_sliding_sum = ";
909  }
910 
911  // Find the weighted position within the window in index space (width = 1)
912  for (ap_uint<BitsToRepresent(HistogramBitWidths::kWindowSize)> w = 0; w < HistogramBitWidths::kWindowSize; ++w) {
913  zvtx_sliding_sum += (binpt.at(w) * w);
914  if (settings_->debug() >= 1) {
915  *log << "(" << w << " * " << binpt.at(w) << ")";
916  if (w < HistogramBitWidths::kWindowSize - 1) {
917  *log << " + ";
918  }
919  }
920  }
921 
922  if (settings_->debug() >= 1) {
923  *log << " = " << zvtx_sliding_sum << "\n";
924  }
925 
926  if (maximums != 0) {
927  inv = inversion(maximums);
928  zvtx_sliding = zvtx_sliding_sum * inv;
929  } else {
930  zvtx_sliding = (settings_->vx_windowSize() / 2.0) + (((int(settings_->vx_windowSize()) % 2) != 0) ? 0.5 : 0.0);
931  }
932  if (settings_->debug() >= 1) {
933  *log << "inversion(" << maximums << ") = " << inv << "\nzvtx_sliding = " << zvtx_sliding << "\n";
934  }
935 
936  // Add the starting index plus half an index to shift the z position to its weighted position (still in inxex space) within all of the bins
937  zvtx_sliding += b_max;
938  zvtx_sliding += ap_ufixed<1, 0>(0.5);
939  if (settings_->debug() >= 1) {
940  *log << "b_max = " << b_max << "\n";
941  *log << "zvtx_sliding + b_max + 0.5 = " << zvtx_sliding << "\n";
942  }
943 
944  // Shift the z position from index space into z [cm] space
945  zvtx_sliding = bin_center(zvtx_sliding, nbins);
946  if (settings_->debug() >= 1) {
947  *log << "bin_center(zvtx_sliding + b_max + 0.5, nbins) = " << std::setprecision(7) << zvtx_sliding;
948  log.reset();
949  }
950  return zvtx_sliding;
951  };
952 
953  // Create the histogram
954  unsigned int nbins = std::round((settings_->vx_histogram_max() - settings_->vx_histogram_min()) /
955  settings_->vx_histogram_binwidth());
956  unsigned int nsums = nbins - settings_->vx_windowSize();
957  std::vector<link_pt_sum_fixed_t> hist(nbins, 0);
958 
959  // Loop over the tracks and fill the histogram
960  if (settings_->debug() > 2) {
961  edm::LogInfo("VertexProducer") << "fastHistoEmulation::Processing " << fitTracks_.size() << " tracks";
962  }
963  for (const L1Track& track : fitTracks_) {
964  // Get the track pt and z0
965  // Convert them to an appropriate data format
966  // Truncation and saturdation taken care of by the data type specification
967  pt_t tkpt = 0;
968  tkpt.V = track.getTTTrackPtr()->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1,
969  TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
970  track_pt_fixed_t pt_tmp = tkpt;
971  z0_t tkZ0 = track.getTTTrackPtr()->getZ0Word();
972 
973  if ((settings_->vx_DoQualityCuts() && track_quality_check(tkpt)) || (!settings_->vx_DoQualityCuts())) {
974  //
975  // Check bin validity of bin found for the current track
976  //
977  std::pair<histbin_t, bool> bin = fetch_bin(tkZ0, nbins);
978  assert(bin.first >= 0 && bin.first < nbins);
979 
980  //
981  // If the bin is valid then sum the tracks
982  //
983  if (settings_->debug() > 2) {
984  edm::LogInfo("VertexProducer") << "fastHistoEmulation::Checking the track word ... \n"
985  << "track word = " << track.getTTTrackPtr()->getTrackWord().to_string(2)
986  << "\n"
987  << "tkZ0 = " << tkZ0.to_double() << "(" << tkZ0.to_string(2)
988  << ")\ttkpt = " << tkpt.to_double() << "(" << tkpt.to_string(2)
989  << ")\tpt_tmp = " << pt_tmp << "\tbin = " << bin.first.to_int() << "\n"
990  << "pt sum in bin " << bin.first.to_int()
991  << " BEFORE adding track = " << hist.at(bin.first).to_double();
992  }
993  if (bin.second) {
994  hist.at(bin.first) = hist.at(bin.first) + pt_tmp;
995  }
996  if (settings_->debug() > 2) {
997  edm::LogInfo("VertexProducer") << "fastHistoEmulation::\npt sum in bin " << bin.first.to_int()
998  << " AFTER adding track = " << hist.at(bin.first).to_double();
999  }
1000  } else {
1001  if (settings_->debug() > 2) {
1002  edm::LogInfo("VertexProducer") << "fastHistoEmulation::Did not add the following track ... \n"
1003  << "track word = " << track.getTTTrackPtr()->getTrackWord().to_string(2)
1004  << "\n"
1005  << "tkZ0 = " << tkZ0.to_double() << "(" << tkZ0.to_string(2)
1006  << ")\ttkpt = " << tkpt.to_double() << "(" << tkpt.to_string(2)
1007  << ")\tpt_tmp = " << pt_tmp;
1008  }
1009  }
1010  } // end loop over tracks
1011 
1012  // Loop through all bins, taking into account the fact that the last bin is nbins-window_width+1,
1013  // and compute the sums using sliding windows ... sum_i_i+(w-1) where i in (0,nbins-w) and w is the window size
1014  std::vector<window_pt_sum_fixed_t> hist_window_sums(nsums, 0);
1015  for (unsigned int b = 0; b < nsums; ++b) {
1016  for (unsigned int w = 0; w < HistogramBitWidths::kWindowSize; ++w) {
1017  unsigned int index = b + w;
1018  hist_window_sums.at(b) += hist.at(index);
1019  }
1020  }
1021 
1022  // Find the top N vertices
1023  std::vector<int> found;
1024  found.reserve(settings_->vx_nvtx());
1025  for (unsigned int ivtx = 0; ivtx < settings_->vx_nvtx(); ivtx++) {
1026  histbin_t b_max = 0;
1027  window_pt_sum_fixed_t max_pt = 0;
1028  zsliding_t zvtx_sliding = -999;
1029  std::vector<link_pt_sum_fixed_t> binpt_max(HistogramBitWidths::kWindowSize, 0);
1030 
1031  // Find the maxima of the sums
1032  for (unsigned int i = 0; i < hist_window_sums.size(); i++) {
1033  // Skip this window if it will already be returned
1034  if (find(found.begin(), found.end(), i) != found.end())
1035  continue;
1036  if (hist_window_sums.at(i) > max_pt) {
1037  b_max = i;
1038  max_pt = hist_window_sums.at(b_max);
1039  std::copy(std::begin(hist) + b_max,
1040  std::begin(hist) + b_max + HistogramBitWidths::kWindowSize,
1041  std::begin(binpt_max));
1042 
1043  // Find the weighted position only for the highest sum pt window
1044  zvtx_sliding = weighted_position(b_max, binpt_max, max_pt, nbins);
1045  }
1046  }
1047  if (settings_->debug() >= 1) {
1048  edm::LogInfo log("VertexProducer");
1049  log << "fastHistoEmulation::Checking the output parameters ... \n";
1050  if (found.empty()) {
1051  printHistogram<link_pt_sum_fixed_t, edm::LogInfo>(log, hist, 80, 0, -1, "fastHistoEmulation::hist", "\e[92m");
1052  printHistogram<window_pt_sum_fixed_t, edm::LogInfo>(
1053  log, hist_window_sums, 80, 0, -1, "fastHistoEmulation::hist_window_sums", "\e[92m");
1054  }
1055  printHistogram<link_pt_sum_fixed_t, edm::LogInfo>(
1056  log, binpt_max, 80, 0, -1, "fastHistoEmulation::binpt_max", "\e[92m");
1057  log << "bin index (not a VertexWord parameter) = " << b_max << "\n"
1058  << "sumPt = " << max_pt.to_double() << "\n"
1059  << "z0 = " << zvtx_sliding.to_double();
1060  }
1061  found.push_back(b_max);
1062  verticesEmulation_.emplace_back(l1t::VertexWord::vtxvalid_t(1),
1063  l1t::VertexWord::vtxz0_t(zvtx_sliding),
1069  }
1070  pv_index_ = 0;
1071  } // end of fastHistoEmulation
1072 
1073 } // namespace l1tVertexFinder
Definition: start.py:1
static double constexpr NA
Avogadro&#39;s number.
Definition: Constants.h:16
constexpr int32_t ceil(float num)
double pt() const
Sum of fitted tracks transverse momentum [GeV].
Definition: RecoVertex.h:55
unsigned int tobLayer(const DetId &id) const
::ecal::reco::ComputationScalarType data_type
ap_uint< VertexBitWidths::kUnassignedSize > vtxunassigned_t
Definition: VertexWord.h:73
T w() const
ap_ufixed< VertexBitWidths::kNTrackInPVSize, VertexBitWidths::kNTrackInPVSize, AP_RND_CONV, AP_SAT > vtxmultiplicity_t
Definition: VertexWord.h:67
std::vector< L1Track > FitTrackCollection
Definition: VertexFinder.h:23
double z0() const
Vertex z0 position [cm].
Definition: RecoVertex.h:75
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
const std::vector< const T * > & tracks() const
Tracks in the vertex.
Definition: RecoVertex.h:57
void insert(TP &tp)
Assign TP to this vertex.
Definition: Vertex.h:28
ap_ufixed< VertexBitWidths::kNTrackOutPVSize, VertexBitWidths::kNTrackOutPVSize, AP_RND_CONV, AP_SAT > vtxinversemult_t
Definition: VertexWord.h:72
unsigned int numTracks() const
Number of tracks originating from this vertex.
Definition: Vertex.h:26
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
Definition: VertexWord.h:65
static constexpr unsigned BitsToRepresent(unsigned x)
Definition: VertexFinder.h:21
T sqrt(T t)
Definition: SSEVec.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Simple wrapper class for TTTrack.
Definition: L1Track.h:17
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ap_ufixed< VertexBitWidths::kSumPtSize, VertexBitWidths::kSumPtMagSize, AP_RND_CONV, AP_SAT > vtxsumpt_t
Definition: VertexWord.h:69
Definition: value.py:1
static constexpr auto TOB
ap_uint< VertexBitWidths::kQualitySize > vtxquality_t
Definition: VertexWord.h:70
double pt() const
Definition: VertexWord.h:160
ap_int< 10 > z0_t
Definition: datatypes.h:32
ii
Definition: cuy.py:589
Log< level::Info, false > LogInfo
Definition: DetId.h:17
float z0() const
Definition: L1Track.h:25
std::vector< RecoVertex<> > RecoVertexCollection
Definition: VertexFinder.h:24
double b
Definition: hdecay.h:118
const unsigned int kPtMagSize
double z0() const
Definition: VertexWord.h:158
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
float x
unsigned int tidRing(const DetId &id) const
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
ap_ufixed< 16, 14 > pt_t
Definition: TauNNIdHW.h:27
static constexpr auto TID
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
unsigned int numTracks() const
Number of tracks originating from this vertex.
Definition: RecoVertex.h:49
ap_uint< VertexBitWidths::kValidSize > vtxvalid_t
Definition: VertexWord.h:64
unsigned transform(const HcalDetId &id, unsigned transformCode)