CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
l1tVertexFinder::VertexFinder Class Reference

#include <VertexFinder.h>

Classes

struct  SortTracksByPt
 
struct  SortTracksByZ0
 Helper structs/classes. More...
 

Public Member Functions

void adaptiveVertexReconstruction ()
 Adaptive Vertex Reconstruction algorithm. More...
 
void agglomerativeHierarchicalClustering ()
 Simple Merge Algorithm. More...
 
void associatePrimaryVertex (double trueZ0)
 Associate the primary vertex with the real one. More...
 
float centralDistance (RecoVertex<> cluster0, RecoVertex<> cluster1)
 Find distance between centres of two clusters. More...
 
void computeAndSetVertexParameters (RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
 Vertexing algorithms. More...
 
void DBSCAN ()
 DBSCAN algorithm. More...
 
void fastHisto (const TrackerTopology *tTopo)
 Histogramming algorithm. More...
 
void fastHistoEmulation ()
 Histogramming algorithm (emulation) More...
 
void fastHistoLooseAssociation ()
 High pT Vertex Algorithm. More...
 
void findPrimaryVertex ()
 Find the primary vertex. More...
 
const FitTrackCollectionfitTracks () const
 Accessors. More...
 
void GapClustering ()
 Gap Clustering Algorithm. More...
 
void HPV ()
 High pT Vertex Algorithm. More...
 
unsigned int iterationsPerTrack () const
 Number of iterations. More...
 
void Kmeans ()
 Kmeans Algorithm. More...
 
float maxDistance (RecoVertex<> cluster0, RecoVertex<> cluster1)
 Find maximum distance in two clusters of tracks. More...
 
float meanDistance (RecoVertex<> cluster0, RecoVertex<> cluster1)
 Find average distance in two clusters of tracks. More...
 
float minDistance (RecoVertex<> cluster0, RecoVertex<> cluster1)
 Find minimum distance in two clusters of tracks. More...
 
unsigned int numInputTracks () const
 Storage for tracks out of the L1 Track finder. More...
 
unsigned int numIterations () const
 Number of iterations. More...
 
unsigned int numVertices () const
 Number of reconstructed vertices. More...
 
unsigned int numVerticesEmulation () const
 Number of emulation vertices. More...
 
template<typename T >
T PrimaryVertex () const
 Reconstructed primary vertex. More...
 
unsigned int primaryVertexId () const
 Reconstructed Primary Vertex Id. More...
 
template<class data_type , typename stream_type = std::ostream>
void printHistogram (stream_type &stream, std::vector< data_type > data, int width=80, int minimum=0, int maximum=-1, std::string title="", std::string color="")
 Print an ASCII histogram. More...
 
void PVR ()
 Find maximum distance in two clusters of tracks. More...
 
void sortVerticesInPt ()
 Sort vertices in pT. More...
 
void sortVerticesInZ0 ()
 Sort vertices in z. More...
 
template<typename ForwardIterator , typename T >
void strided_iota (ForwardIterator first, ForwardIterator last, T value, T stride)
 
 VertexFinder (FitTrackCollection &fitTracks, const AlgoSettings &settings)
 Constructor and destructor. More...
 
const std::vector< RecoVertex<> > & vertices () const
 Returns the z positions of the reconstructed primary vertices. More...
 
const l1t::VertexWordCollectionverticesEmulation () const
 Returns the emulation primary vertices. More...
 
 ~VertexFinder ()
 

Private Attributes

FitTrackCollection fitTracks_
 
unsigned int iterations_
 
unsigned int numMatchedVertices_
 
unsigned int pv_index_
 
const AlgoSettingssettings_
 
RecoVertexCollection vertices_
 
l1t::VertexWordCollection verticesEmulation_
 

Detailed Description

Definition at line 24 of file VertexFinder.h.

Constructor & Destructor Documentation

◆ VertexFinder()

l1tVertexFinder::VertexFinder::VertexFinder ( FitTrackCollection fitTracks,
const AlgoSettings settings 
)
inline

Constructor and destructor.

Definition at line 27 of file VertexFinder.h.

References fitTracks(), fitTracks_, and settings_.

27  {
29  settings_ = &settings;
30  }
const FitTrackCollection & fitTracks() const
Accessors.
Definition: VertexFinder.h:47
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
const AlgoSettings * settings_
Definition: VertexFinder.h:141

◆ ~VertexFinder()

l1tVertexFinder::VertexFinder::~VertexFinder ( )
inline

Definition at line 31 of file VertexFinder.h.

31 {}

Member Function Documentation

◆ adaptiveVertexReconstruction()

void l1tVertexFinder::VertexFinder::adaptiveVertexReconstruction ( )

Adaptive Vertex Reconstruction algorithm.

Definition at line 311 of file VertexFinder.cc.

References funct::abs(), hltPixelTracks_cff::chi2, or, HLT_2022v12_cff::track, bphysicsOniaDQM_cfi::vertex, and l1tVertexFinder::L1Track::z0().

Referenced by VertexProducer::produce().

311  {
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  }
367  vertices_.push_back(vertex);
368  }
369 
370  acceptedTracks.clear();
371  discardedTracks.clear();
372  discardedTracks = discardedTracks2;
373  }
374  }
Definition: start.py:1
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
std::vector< L1Track > FitTrackCollection
Definition: VertexFinder.h:21
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ agglomerativeHierarchicalClustering()

void l1tVertexFinder::VertexFinder::agglomerativeHierarchicalClustering ( )

Simple Merge Algorithm.

Definition at line 129 of file VertexFinder.cc.

References mps_fire::i, particleFlowClusterHGC_cfi::maxDistance, or, jetUpdater_cfi::sort, HLT_2022v12_cff::track, and tracks.

Referenced by VertexProducer::produce().

129  {
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  }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
float maxDistance(RecoVertex<> cluster0, RecoVertex<> cluster1)
Find maximum distance in two clusters of tracks.
Definition: VertexFinder.cc:83
float meanDistance(RecoVertex<> cluster0, RecoVertex<> cluster1)
Find average distance in two clusters of tracks.
float centralDistance(RecoVertex<> cluster0, RecoVertex<> cluster1)
Find distance between centres of two clusters.
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
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
float minDistance(RecoVertex<> cluster0, RecoVertex<> cluster1)
Find minimum distance in two clusters of tracks.
Definition: VertexFinder.cc:96
const AlgoSettings * settings_
Definition: VertexFinder.h:141
auto const & tracks
cannot be loose
std::vector< RecoVertex<> > RecoVertexCollection
Definition: VertexFinder.h:22
unsigned int vx_distanceType() const
Definition: AlgoSettings.h:37
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ associatePrimaryVertex()

void l1tVertexFinder::VertexFinder::associatePrimaryVertex ( double  trueZ0)

Associate the primary vertex with the real one.

Definition at line 598 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, triggerObjects_cff::id, and HLTMuonOfflineAnalyzer_cfi::z0.

598  {
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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142

◆ centralDistance()

float l1tVertexFinder::VertexFinder::centralDistance ( RecoVertex<>  cluster0,
RecoVertex<>  cluster1 
)

Find distance between centres of two clusters.

Definition at line 122 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, and l1tVertexFinder::RecoVertex< T >::z0().

122  {
123  computeAndSetVertexParameters(cluster0, {}, {});
124  computeAndSetVertexParameters(cluster1, {}, {});
125  float distance = std::abs(cluster0.z0() - cluster1.z0());
126  return distance;
127  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ computeAndSetVertexParameters()

void l1tVertexFinder::VertexFinder::computeAndSetVertexParameters ( RecoVertex<> &  vertex,
const std::vector< float > &  bin_centers,
const std::vector< unsigned int > &  counts 
)

Vertexing algorithms.

Compute the vertex parameters

Definition at line 7 of file VertexFinder.cc.

References funct::abs(), dqmiodumpmetadata::counts, funct::pow(), DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), HLT_2022v12_cff::track, listHistos::trackPt, bphysicsOniaDQM_cfi::vertex, and HLTMuonOfflineAnalyzer_cfi::z0.

9  {
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 
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  }
float vx_TrackMaxPtBehavior() const
Definition: AlgoSettings.h:71
unsigned int vx_weightedmean() const
Definition: AlgoSettings.h:45
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const AlgoSettings * settings_
Definition: VertexFinder.h:141
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ DBSCAN()

void l1tVertexFinder::VertexFinder::DBSCAN ( )

DBSCAN algorithm.

Definition at line 182 of file VertexFinder.cc.

References funct::abs(), spr::find(), mps_fire::i, triggerObjects_cff::id, globals_cff::id2, dqmdumpme::k, DiDispStaMuonMonitor_cfi::pt, jetUpdater_cfi::sort, bphysicsOniaDQM_cfi::vertex, class-composition::visited, and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by VertexProducer::produce().

182  {
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  }
239  if (vertex.numTracks() >= settings_->vx_minTracks())
240  vertices_.push_back(vertex);
241  }
242  // }
243  }
244  }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ fastHisto()

void l1tVertexFinder::VertexFinder::fastHisto ( const TrackerTopology tTopo)

Histogramming algorithm.

Definition at line 632 of file VertexFinder.cc.

References funct::abs(), reco::ceil(), dqmiodumpmetadata::counts, HLT_2022v12_cff::distance, mps_fire::end, spr::find(), newFWLiteAna::found, gpuVertexFinder::hist, mps_fire::i, createfilelist::int, dqmiolumiharvest::j, dqm-mbProfile::log, LaserClient_cfi::nbins, GetRecoTauVFromDQM_MC_cff::next, StripSubdetector::TID, TrackerTopology::tidRing(), createJobs::tmp, StripSubdetector::TOB, TrackerTopology::tobLayer(), HLT_2022v12_cff::track, align::Tracker, HcalDetIdTransform::transform(), pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and findQualityFiles::v.

Referenced by VertexProducer::produce().

632  {
633  // Create the histogram
634  int nbins =
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),
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
constexpr int32_t ceil(float num)
unsigned int tobLayer(const DetId &id) const
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned int debug() const
Definition: AlgoSettings.h:77
double vx_histogram_binwidth() const
Definition: AlgoSettings.h:56
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr auto TOB
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
__shared__ Hist hist
void strided_iota(ForwardIterator first, ForwardIterator last, T value, T stride)
Definition: VertexFinder.h:118
Definition: DetId.h:17
const AlgoSettings * settings_
Definition: VertexFinder.h:141
double vx_histogram_min() const
Definition: AlgoSettings.h:54
double vx_histogram_max() const
Definition: AlgoSettings.h:55
unsigned int tidRing(const DetId &id) const
Log< level::Warning, false > LogWarning
unsigned int vx_windowSize() const
Definition: AlgoSettings.h:51
tmp
align.sh
Definition: createJobs.py:716
static constexpr auto TID
unsigned int vx_nvtx() const
Definition: AlgoSettings.h:63
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ fastHistoEmulation()

void l1tVertexFinder::VertexFinder::fastHistoEmulation ( )

Histogramming algorithm (emulation)

Definition at line 762 of file VertexFinder.cc.

References cms::cuda::assert(), b, newFWLiteAna::bin, l1tVertexFinder::BitsToRepresent(), reco::ceil(), filterCSVwithJSON::copy, spr::find(), dqmMemoryStats::float, newFWLiteAna::found, gpuVertexFinder::hist, mps_fire::i, cuy::ii, createfilelist::int, dqm-mbProfile::log, LaserClient_cfi::nbins, DiDispStaMuonMonitor_cfi::pt, TTTrack_TrackWord::stepZ0, HLT_2022v12_cff::track, validateGeometry_cfg::valid, w(), and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by VertexProducer::produce().

762  {
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  static constexpr double kZ0Scale =
790  (1 << (TrackBitWidths::kZ0Size - TrackBitWidths::kZ0MagSize))); // scale = 1.27932032
791 
792  typedef ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize, AP_RND_CONV, AP_SAT> pt_t;
793  typedef ap_fixed<TrackBitWidths::kZ0Size, TrackBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT> z0_t;
794  // 7 bits chosen to represent values between [0,127]
795  // This is the next highest power of 2 value to our chosen track pt saturation value (100)
796  typedef ap_ufixed<TrackBitWidths::kReducedPrecisionPt, TrackBitWidths::kReducedPrecisionPt, AP_RND_INF, AP_SAT>
797  track_pt_fixed_t;
798  // Histogram bin index
799  typedef ap_uint<HistogramBitWidths::kBinSize> histbin_t;
800  // Histogram bin in fixed point representation, before truncation
801  typedef ap_ufixed<HistogramBitWidths::kBinFixedSize, HistogramBitWidths::kBinFixedMagSize, AP_RND_INF, AP_SAT>
802  histbin_fixed_t;
803  // This value is slightly arbitrary, but small enough that the windows sums aren't too big.
804  typedef ap_ufixed<HistogramBitWidths::kSumPtLinkSize, HistogramBitWidths::kSumPtLinkSize, AP_RND_INF, AP_SAT>
805  link_pt_sum_fixed_t;
806  // Enough bits to store HistogramBitWidths::kWindowSize * (2**HistogramBitWidths::kSumPtLinkSize)
807  typedef ap_ufixed<HistogramBitWidths::kSumPtWindowBits, HistogramBitWidths::kSumPtWindowBits, AP_RND_INF, AP_SAT>
808  window_pt_sum_fixed_t;
809  // pt weighted sum of bins in window
810  typedef ap_fixed<HistogramBitWidths::kWeightedSlidingSumSize,
811  HistogramBitWidths::kWeightedSlidingSumMagSize,
812  AP_RND_INF,
813  AP_SAT>
814  zsliding_t;
815  // Sum of histogram bins in window
816  typedef ap_uint<HistogramBitWidths::kSlidingSumSize> slidingsum_t;
817  // Inverse of sum of bins in a given window
818  typedef ap_ufixed<HistogramBitWidths::kInverseSize, HistogramBitWidths::kInverseMagSize, AP_RND_INF, AP_SAT>
819  inverse_t;
820 
821  auto track_quality_check = [&](const track_pt_fixed_t& pt) -> bool {
822  // track quality cuts
823  if (pt.to_double() < settings_->vx_TrackMinPt())
824  return false;
825  return true;
826  };
827 
828  auto fetch_bin = [&](const z0_t& z0, int nbins) -> std::pair<histbin_t, bool> {
829  histbin_t bin = (z0 * histbin_fixed_t(1.0 / settings_->vx_histogram_binwidth())) +
830  histbin_t(std::floor(
831  nbins / 2.)); // Rounding down (std::floor) taken care of by implicitly casting to ap_uint
832  if (settings_->debug() > 2) {
833  edm::LogInfo("VertexProducer")
834  << "fastHistoEmulation::fetchBin() Checking the mapping from z0 to bin index ... \n"
835  << "histbin_fixed_t(1.0 / settings_->vx_histogram_binwidth()) = "
836  << histbin_fixed_t(1.0 / settings_->vx_histogram_binwidth()) << "\n"
837  << "histbin_t(std::floor(nbins / 2) = " << histbin_t(std::floor(nbins / 2.)) << "\n"
838  << "z0 = " << z0 << "\n"
839  << "bin = " << bin;
840  }
841  bool valid = true;
842  if (bin < 0) {
843  return std::make_pair(0, false);
844  } else if (bin > (nbins - 1)) {
845  return std::make_pair(0, false);
846  }
847  return std::make_pair(bin, valid);
848  };
849 
850  // Replace with https://stackoverflow.com/questions/13313980/populate-an-array-using-constexpr-at-compile-time ?
851  auto init_inversion_table = [&]() -> std::vector<inverse_t> {
852  std::vector<inverse_t> table_out(kTableSize, 0.);
853  for (unsigned int ii = 0; ii < kTableSize; ii++) {
854  // First, convert from table index to X-value (unsigned 8-bit, range 0 to +1533)
855  float in_val = 1533.0 * (ii / float(kTableSize));
856  // Next, compute lookup table function
857  table_out.at(ii) = (in_val > 0) ? (1.0 / in_val) : 0.0;
858  }
859  return table_out;
860  };
861 
862  auto inversion = [&](slidingsum_t& data_den) -> inverse_t {
863  std::vector<inverse_t> inversion_table = init_inversion_table();
864 
865  // Index into the lookup table based on data
866  int index;
867  if (data_den < 0)
868  data_den = 0;
869  if (data_den > (kTableSize - 1))
870  data_den = kTableSize - 1;
871  index = data_den;
872  return inversion_table.at(index);
873  };
874 
875  auto bin_center = [&](zsliding_t iz, int nbins) -> z0_t {
876  zsliding_t z = iz - histbin_t(std::floor(nbins / 2.));
877  std::unique_ptr<edm::LogInfo> log;
878  if (settings_->debug() >= 1) {
879  log = std::make_unique<edm::LogInfo>("VertexProducer");
880  *log << "bin_center information ...\n"
881  << "iz = " << iz << "\n"
882  << "histbin_t(std::floor(nbins / 2.)) = " << histbin_t(std::floor(nbins / 2.)) << "\n"
883  << "binwidth = " << zsliding_t(settings_->vx_histogram_binwidth()) << "\n"
884  << "z = " << z << "\n"
885  << "zsliding_t(z * zsliding_t(binwidth)) = " << std::setprecision(7)
886  << z0_t(z * zsliding_t(settings_->vx_histogram_binwidth()));
887  }
888  return z0_t(z * zsliding_t(settings_->vx_histogram_binwidth()));
889  };
890 
891  auto weighted_position = [&](histbin_t b_max,
892  const std::vector<link_pt_sum_fixed_t>& binpt,
893  slidingsum_t maximums,
894  int nbins) -> zsliding_t {
895  zsliding_t zvtx_sliding = 0;
896  slidingsum_t zvtx_sliding_sum = 0;
897  inverse_t inv = 0;
898 
899  std::unique_ptr<edm::LogInfo> log;
900  if (settings_->debug() >= 1) {
901  log = std::make_unique<edm::LogInfo>("VertexProducer");
902  *log << "Progression of weighted_position() ...\n"
903  << "zvtx_sliding_sum = ";
904  }
905 
906  // Find the weighted position within the window in index space (width = 1)
907  for (ap_uint<BitsToRepresent(HistogramBitWidths::kWindowSize)> w = 0; w < HistogramBitWidths::kWindowSize; ++w) {
908  zvtx_sliding_sum += (binpt.at(w) * w);
909  if (settings_->debug() >= 1) {
910  *log << "(" << w << " * " << binpt.at(w) << ")";
911  if (w < HistogramBitWidths::kWindowSize - 1) {
912  *log << " + ";
913  }
914  }
915  }
916 
917  if (settings_->debug() >= 1) {
918  *log << " = " << zvtx_sliding_sum << "\n";
919  }
920 
921  if (maximums != 0) {
922  inv = inversion(maximums);
923  zvtx_sliding = zvtx_sliding_sum * inv;
924  } else {
925  zvtx_sliding = (settings_->vx_windowSize() / 2.0) + (((int(settings_->vx_windowSize()) % 2) != 0) ? 0.5 : 0.0);
926  }
927  if (settings_->debug() >= 1) {
928  *log << "inversion(" << maximums << ") = " << inv << "\nzvtx_sliding = " << zvtx_sliding << "\n";
929  }
930 
931  // 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
932  zvtx_sliding += b_max;
933  zvtx_sliding += ap_ufixed<1, 0>(0.5);
934  if (settings_->debug() >= 1) {
935  *log << "b_max = " << b_max << "\n";
936  *log << "zvtx_sliding + b_max + 0.5 = " << zvtx_sliding << "\n";
937  }
938 
939  // Shift the z position from index space into z [cm] space
940  zvtx_sliding = bin_center(zvtx_sliding, nbins);
941  if (settings_->debug() >= 1) {
942  *log << "bin_center(zvtx_sliding + b_max + 0.5, nbins) = " << std::setprecision(7) << zvtx_sliding;
943  log.reset();
944  }
945  return zvtx_sliding;
946  };
947 
948  // Create the histogram
949  unsigned int nbins =
951  unsigned int nsums = nbins - settings_->vx_windowSize();
952  std::vector<link_pt_sum_fixed_t> hist(nbins, 0);
953 
954  // Loop over the tracks and fill the histogram
955  if (settings_->debug() > 2) {
956  edm::LogInfo("VertexProducer") << "fastHistoEmulation::Processing " << fitTracks_.size() << " tracks";
957  }
958  for (const L1Track& track : fitTracks_) {
959  // Get the track pt and z0
960  // Convert them to an appropriate data format
961  // Truncation and saturdation taken care of by the data type specification
962  pt_t tkpt = 0;
963  tkpt.V = track.getTTTrackPtr()->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1,
964  TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
965  track_pt_fixed_t pt_tmp = tkpt;
966  //z0_t tkZ0 = track.getTTTrackPtr()->getZ0();
967  z0_t tkZ0 = 0;
968  tkZ0.V = track.getTTTrackPtr()->getTrackWord()(TTTrack_TrackWord::TrackBitLocations::kZ0MSB,
969  TTTrack_TrackWord::TrackBitLocations::kZ0LSB);
970  ap_ufixed<32, 1> kZ0Scale_fixed = kZ0Scale;
971  tkZ0 *= kZ0Scale_fixed;
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);
1063  l1t::VertexWord::vtxz0_t(zvtx_sliding),
1069  }
1070  pv_index_ = 0;
1071  } // end of fastHistoEmulation
constexpr int32_t ceil(float num)
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
ap_uint< VertexBitWidths::kUnassignedSize > vtxunassigned_t
Definition: VertexWord.h:71
T w() const
ap_ufixed< VertexBitWidths::kNTrackInPVSize, VertexBitWidths::kNTrackInPVSize, AP_RND_CONV, AP_SAT > vtxmultiplicity_t
Definition: VertexWord.h:65
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
unsigned int debug() const
Definition: AlgoSettings.h:77
ap_ufixed< VertexBitWidths::kNTrackOutPVSize, VertexBitWidths::kNTrackOutPVSize, AP_RND_CONV, AP_SAT > vtxinversemult_t
Definition: VertexWord.h:70
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
Definition: VertexWord.h:63
static constexpr unsigned BitsToRepresent(unsigned x)
Definition: VertexFinder.h:19
double vx_histogram_binwidth() const
Definition: AlgoSettings.h:56
ap_ufixed< VertexBitWidths::kSumPtSize, VertexBitWidths::kSumPtMagSize, AP_RND_CONV, AP_SAT > vtxsumpt_t
Definition: VertexWord.h:67
ap_uint< VertexBitWidths::kQualitySize > vtxquality_t
Definition: VertexWord.h:68
ap_int< 10 > z0_t
Definition: data.h:10
ii
Definition: cuy.py:589
__shared__ Hist hist
Log< level::Info, false > LogInfo
const AlgoSettings * settings_
Definition: VertexFinder.h:141
double vx_histogram_min() const
Definition: AlgoSettings.h:54
double vx_histogram_max() const
Definition: AlgoSettings.h:55
double b
Definition: hdecay.h:118
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143
ap_int< 16 > pt_t
Definition: data.h:6
unsigned int vx_windowSize() const
Definition: AlgoSettings.h:51
static constexpr double stepZ0
unsigned int vx_nvtx() const
Definition: AlgoSettings.h:63
ap_uint< VertexBitWidths::kValidSize > vtxvalid_t
Definition: VertexWord.h:62

◆ fastHistoLooseAssociation()

void l1tVertexFinder::VertexFinder::fastHistoLooseAssociation ( )

High pT Vertex Algorithm.

Definition at line 608 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::track, and bphysicsOniaDQM_cfi::vertex.

Referenced by VertexProducer::produce().

608  {
609  float vxPt = 0.;
610  RecoVertex leading_vertex;
611 
612  for (float z = settings_->vx_histogram_min(); z < settings_->vx_histogram_max();
615  for (const L1Track& track : fitTracks_) {
616  if (std::abs(z - track.z0()) < settings_->vx_width()) {
617  vertex.insert(&track);
618  }
619  }
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
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
double vx_histogram_binwidth() const
Definition: AlgoSettings.h:56
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
double vx_histogram_min() const
Definition: AlgoSettings.h:54
double vx_histogram_max() const
Definition: AlgoSettings.h:55
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ findPrimaryVertex()

void l1tVertexFinder::VertexFinder::findPrimaryVertex ( )

Find the primary vertex.

Definition at line 445 of file VertexFinder.cc.

References HLT_2022v12_cff::distance, l1tVertexFinder::RecoVertex< T >::pt(), and l1t::VertexWord::pt().

Referenced by VertexProducer::produce().

445  {
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 {
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  }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
double pt() const
Definition: VertexWord.h:158
const AlgoSettings * settings_
Definition: VertexFinder.h:141
Precision vx_precision() const
Definition: AlgoSettings.h:35
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143

◆ fitTracks()

const FitTrackCollection& l1tVertexFinder::VertexFinder::fitTracks ( ) const
inline

Accessors.

Storage for tracks out of the L1 Track finder

Definition at line 47 of file VertexFinder.h.

References fitTracks_.

Referenced by VertexFinder().

47 { return fitTracks_; }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145

◆ GapClustering()

void l1tVertexFinder::VertexFinder::GapClustering ( )

Gap Clustering Algorithm.

Definition at line 65 of file VertexFinder.cc.

References mps_fire::i, l1tVertexFinder::Vertex::insert(), l1tVertexFinder::Vertex::numTracks(), or, jetUpdater_cfi::sort, and HltBtagValidation_cff::Vertex.

Referenced by VertexProducer::produce().

65  {
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()) {
76  vertices_.push_back(Vertex);
77  }
78  Vertex.clear();
79  }
80  }
81  }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
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
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ HPV()

void l1tVertexFinder::VertexFinder::HPV ( )

High pT Vertex Algorithm.

Definition at line 376 of file VertexFinder.cc.

References funct::abs(), first, jetUpdater_cfi::sort, HLT_2022v12_cff::track, and bphysicsOniaDQM_cfi::vertex.

Referenced by VertexProducer::produce().

376  {
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 
397  vertex.setZ0(z);
398  vertices_.push_back(vertex);
399  }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ iterationsPerTrack()

unsigned int l1tVertexFinder::VertexFinder::iterationsPerTrack ( ) const
inline

Number of iterations.

Definition at line 49 of file VertexFinder.h.

References fitTracks_, and iterations_.

49 { return double(iterations_) / double(fitTracks_.size()); }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145

◆ Kmeans()

void l1tVertexFinder::VertexFinder::Kmeans ( )

Kmeans Algorithm.

Definition at line 401 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, mps_fire::i, triggerObjects_cff::id, fastsim::Constants::NA, and HLT_2022v12_cff::track.

Referenced by VertexProducer::produce().

401  {
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)
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())
440  }
441  iterations++;
442  }
443  }
static double constexpr NA
Avogadro&#39;s number.
Definition: Constants.h:16
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
unsigned int vx_kmeans_nclusters() const
Definition: AlgoSettings.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
unsigned int vx_kmeans_iterations() const
Definition: AlgoSettings.h:67
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ maxDistance()

float l1tVertexFinder::VertexFinder::maxDistance ( RecoVertex<>  cluster0,
RecoVertex<>  cluster1 
)

Find maximum distance in two clusters of tracks.

Definition at line 83 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, and l1tVertexFinder::RecoVertex< T >::tracks().

83  {
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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ meanDistance()

float l1tVertexFinder::VertexFinder::meanDistance ( RecoVertex<>  cluster0,
RecoVertex<>  cluster1 
)

Find average distance in two clusters of tracks.

Definition at line 109 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, l1tVertexFinder::RecoVertex< T >::numTracks(), and l1tVertexFinder::RecoVertex< T >::tracks().

109  {
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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ minDistance()

float l1tVertexFinder::VertexFinder::minDistance ( RecoVertex<>  cluster0,
RecoVertex<>  cluster1 
)

Find minimum distance in two clusters of tracks.

Definition at line 96 of file VertexFinder.cc.

References funct::abs(), HLT_2022v12_cff::distance, and l1tVertexFinder::RecoVertex< T >::tracks().

96  {
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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ numInputTracks()

unsigned int l1tVertexFinder::VertexFinder::numInputTracks ( ) const
inline

Storage for tracks out of the L1 Track finder.

Definition at line 51 of file VertexFinder.h.

References fitTracks_.

51 { return fitTracks_.size(); }
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145

◆ numIterations()

unsigned int l1tVertexFinder::VertexFinder::numIterations ( ) const
inline

Number of iterations.

Definition at line 53 of file VertexFinder.h.

References iterations_.

53 { return iterations_; }

◆ numVertices()

unsigned int l1tVertexFinder::VertexFinder::numVertices ( ) const
inline

Number of reconstructed vertices.

Definition at line 55 of file VertexFinder.h.

References vertices_.

55 { return vertices_.size(); }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142

◆ numVerticesEmulation()

unsigned int l1tVertexFinder::VertexFinder::numVerticesEmulation ( ) const
inline

Number of emulation vertices.

Definition at line 57 of file VertexFinder.h.

References verticesEmulation_.

57 { return verticesEmulation_.size(); }
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143

◆ PrimaryVertex()

template<typename T >
T l1tVertexFinder::VertexFinder::PrimaryVertex ( ) const
inline

Reconstructed primary vertex.

Definition at line 60 of file VertexFinder.h.

References l1tVertexFinder::Emulation, pv_index_, settings_, l1tVertexFinder::Simulation, vertices_, verticesEmulation_, and l1tVertexFinder::AlgoSettings::vx_precision().

60  {
62  return vertices_[pv_index_];
63  else if ((settings_->vx_precision() == Precision::Emulation) && (pv_index_ < vertices_.size()))
65  else {
66  edm::LogWarning("VertexFinder") << "PrimaryVertex::No primary vertex has been found.";
67  return RecoVertex<>();
68  }
69  }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
Precision vx_precision() const
Definition: AlgoSettings.h:35
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143
Log< level::Warning, false > LogWarning

◆ primaryVertexId()

unsigned int l1tVertexFinder::VertexFinder::primaryVertexId ( ) const
inline

Reconstructed Primary Vertex Id.

Definition at line 71 of file VertexFinder.h.

References pv_index_.

71 { return pv_index_; }

◆ printHistogram()

template<class data_type , typename stream_type >
void l1tVertexFinder::VertexFinder::printHistogram ( stream_type &  stream,
std::vector< data_type >  data,
int  width = 80,
int  minimum = 0,
int  maximum = -1,
std::string  title = "",
std::string  color = "" 
)

Print an ASCII histogram.

Definition at line 465 of file VertexFinder.cc.

References edmScanValgrind::buffer, data, mps_fire::end, dqmMemoryStats::float, mps_fire::i, writeEcalDQMStatus::interval, mps_splice::line, SiStripPI::max, EcalTangentSkim_cfg::o, MillePedeFileConverter_cfg::out, L1EGammaClusterEmuProducer_cfi::scale, cms::cuda::stream, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, contentValuesCheck::values, ApeEstimator_cff::width, x, and SiPixelPI::zero.

471  {
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  }
::ecal::reco::ComputationScalarType data_type
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: value.py:1
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ PVR()

void l1tVertexFinder::VertexFinder::PVR ( )

Find maximum distance in two clusters of tracks.

Definition at line 246 of file VertexFinder.cc.

References funct::abs(), or, HLT_2022v12_cff::track, bphysicsOniaDQM_cfi::vertex, and l1tVertexFinder::L1Track::z0().

Referenced by VertexProducer::produce().

246  {
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  }
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  }
Definition: start.py:1
FitTrackCollection fitTracks_
Definition: VertexFinder.h:145
std::vector< L1Track > FitTrackCollection
Definition: VertexFinder.h:21
unsigned int debug() const
Definition: AlgoSettings.h:77
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
unsigned int vx_minTracks() const
Definition: AlgoSettings.h:43
void computeAndSetVertexParameters(RecoVertex<> &vertex, const std::vector< float > &bin_centers, const std::vector< unsigned int > &counts)
Vertexing algorithms.
Definition: VertexFinder.cc:7

◆ sortVerticesInPt()

void l1tVertexFinder::VertexFinder::sortVerticesInPt ( )

Sort vertices in pT.

Definition at line 572 of file VertexFinder.cc.

References l1tVertexFinder::RecoVertex< T >::pt(), l1t::VertexWord::pt(), and jetUpdater_cfi::sort.

Referenced by VertexProducer::produce().

572  {
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  }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
double pt() const
Definition: VertexWord.h:158
const AlgoSettings * settings_
Definition: VertexFinder.h:141
Precision vx_precision() const
Definition: AlgoSettings.h:35
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143

◆ sortVerticesInZ0()

void l1tVertexFinder::VertexFinder::sortVerticesInZ0 ( )

Sort vertices in z.

Definition at line 585 of file VertexFinder.cc.

References jetUpdater_cfi::sort, l1tVertexFinder::RecoVertex< T >::z0(), and l1t::VertexWord::z0().

585  {
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  }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142
const AlgoSettings * settings_
Definition: VertexFinder.h:141
Precision vx_precision() const
Definition: AlgoSettings.h:35
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143
double z0() const
Definition: VertexWord.h:156

◆ strided_iota()

template<typename ForwardIterator , typename T >
void l1tVertexFinder::VertexFinder::strided_iota ( ForwardIterator  first,
ForwardIterator  last,
T  value,
T  stride 
)
inline

Definition at line 118 of file VertexFinder.h.

References first, dqmdumpme::last, gpuPixelDoublets::stride, and relativeConstraints::value.

118  {
119  while (first != last) {
120  *first++ = value;
121  value += stride;
122  }
123  }
Definition: value.py:1

◆ vertices()

const std::vector<RecoVertex<> >& l1tVertexFinder::VertexFinder::vertices ( ) const
inline

Returns the z positions of the reconstructed primary vertices.

Definition at line 73 of file VertexFinder.h.

References vertices_.

Referenced by VertexProducer::produce().

73 { return vertices_; }
RecoVertexCollection vertices_
Definition: VertexFinder.h:142

◆ verticesEmulation()

const l1t::VertexWordCollection& l1tVertexFinder::VertexFinder::verticesEmulation ( ) const
inline

Returns the emulation primary vertices.

Definition at line 75 of file VertexFinder.h.

References verticesEmulation_.

Referenced by VertexProducer::produce().

75 { return verticesEmulation_; }
l1t::VertexWordCollection verticesEmulation_
Definition: VertexFinder.h:143

Member Data Documentation

◆ fitTracks_

FitTrackCollection l1tVertexFinder::VertexFinder::fitTracks_
private

Definition at line 145 of file VertexFinder.h.

Referenced by fitTracks(), iterationsPerTrack(), numInputTracks(), and VertexFinder().

◆ iterations_

unsigned int l1tVertexFinder::VertexFinder::iterations_
private

Definition at line 147 of file VertexFinder.h.

Referenced by iterationsPerTrack(), and numIterations().

◆ numMatchedVertices_

unsigned int l1tVertexFinder::VertexFinder::numMatchedVertices_
private

Definition at line 144 of file VertexFinder.h.

◆ pv_index_

unsigned int l1tVertexFinder::VertexFinder::pv_index_
private

Definition at line 146 of file VertexFinder.h.

Referenced by PrimaryVertex(), and primaryVertexId().

◆ settings_

const AlgoSettings* l1tVertexFinder::VertexFinder::settings_
private

Definition at line 141 of file VertexFinder.h.

Referenced by PrimaryVertex(), and VertexFinder().

◆ vertices_

RecoVertexCollection l1tVertexFinder::VertexFinder::vertices_
private

Definition at line 142 of file VertexFinder.h.

Referenced by numVertices(), PrimaryVertex(), and vertices().

◆ verticesEmulation_

l1t::VertexWordCollection l1tVertexFinder::VertexFinder::verticesEmulation_
private

Definition at line 143 of file VertexFinder.h.

Referenced by numVerticesEmulation(), PrimaryVertex(), and verticesEmulation().