Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:50

0001 #include "RecoPixelVertexing/PixelTriplets/interface/LayerTriplets.h"
0002 
0003 namespace LayerTriplets {
0004   std::vector<LayerSetAndLayers> layers(const SeedingLayerSetsHits& sets) {
0005     std::vector<LayerSetAndLayers> result;
0006     if (sets.numberOfLayersInSet() < 3)
0007       return result;
0008 
0009     for (LayerSet set : sets) {
0010       bool added = false;
0011 
0012       for (auto ir = result.begin(); ir < result.end(); ++ir) {
0013         const LayerSet& resSet = ir->first;
0014         if (resSet[0].index() == set[0].index() && resSet[1].index() == set[1].index()) {
0015           std::vector<Layer>& thirds = ir->second;
0016           // 3rd layer can already be there if we are dealing with quadruplet layer sets
0017           auto found =
0018               std::find_if(thirds.begin(), thirds.end(), [&](const Layer& l) { return l.index() == set[2].index(); });
0019           if (found == thirds.end())
0020             thirds.push_back(set[2]);
0021           added = true;
0022           break;
0023         }
0024       }
0025       if (!added) {
0026         LayerSetAndLayers lpl = std::make_pair(set, std::vector<Layer>(1, set[2]));
0027         result.push_back(lpl);
0028       }
0029     }
0030     return result;
0031   }
0032 }  // namespace LayerTriplets