CMS 3D CMS Logo

TrackAlgoPriorityOrder.cc
Go to the documentation of this file.
2 
5 
7 
8 
9 TrackAlgoPriorityOrder::TrackAlgoPriorityOrder(const std::vector<reco::TrackBase::TrackAlgorithm>& algoOrder):
10  priority_(trackAlgoPriorityOrder) {
11  // with less than 1 element there is nothing to do
12  if(algoOrder.size() <= 1)
13  return;
14 
15  // Reordering the algo priorities is just a matter of taking the
16  // current priorities of the algos, sorting them, and inserting back
17  //
18  // iter0 2 2
19  // iter1 4 -> 3
20  // iter2 3 4
21  std::vector<unsigned int> priorities;
22  priorities.reserve(algoOrder.size());
23  for(const auto algo: algoOrder) {
24  priorities.push_back(trackAlgoPriorityOrder[algo]);
25  }
26 
27  std::sort(priorities.begin(), priorities.end());
28 
29  for(size_t i=0, end=priorities.size(); i!=end; ++i) {
30  priority_[algoOrder[i]] = priorities[i];
31  }
32 }
TrackAlgoPriorityOrder(const std::vector< reco::TrackBase::TrackAlgorithm > &algoOrder)
std::array< unsigned int, reco::TrackBase::algoSize > priority_
#define end
Definition: vmac.h:37
std::array< unsigned int, reco::TrackBase::algoSize > trackAlgoPriorityOrder