Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:09

0001 #include "RecoTracker/FinalTrackSelectors/interface/TrackAlgoPriorityOrder.h"
0002 
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 
0006 #include "trackAlgoPriorityOrder.h"
0007 
0008 TrackAlgoPriorityOrder::TrackAlgoPriorityOrder(const std::vector<reco::TrackBase::TrackAlgorithm>& algoOrder)
0009     : priority_(trackAlgoPriorityOrder) {
0010   // with less than 1 element there is nothing to do
0011   if (algoOrder.size() <= 1)
0012     return;
0013 
0014   // Reordering the algo priorities is just a matter of taking the
0015   // current priorities of the algos, sorting them, and inserting back
0016   //
0017   // iter0  2     2
0018   // iter1  4  -> 3
0019   // iter2  3     4
0020   std::vector<unsigned int> priorities;
0021   priorities.reserve(algoOrder.size());
0022   for (const auto algo : algoOrder) {
0023     priorities.push_back(trackAlgoPriorityOrder[algo]);
0024   }
0025 
0026   std::sort(priorities.begin(), priorities.end());
0027 
0028   for (size_t i = 0, end = priorities.size(); i != end; ++i) {
0029     priority_[algoOrder[i]] = priorities[i];
0030   }
0031 }