CMS 3D CMS Logo

LayerQuadruplets.cc
Go to the documentation of this file.
1 #include "LayerQuadruplets.h"
2 
3 namespace LayerQuadruplets {
4 std::vector<LayerSetAndLayers> layers(const SeedingLayerSetsHits& sets) {
5  std::vector<LayerSetAndLayers> result;
6  if(sets.numberOfLayersInSet() != 4)
7  return result;
8 
9  for(LayerSet set: sets) {
10  bool added = false;
11 
12  for(auto ir = result.begin(); ir < result.end(); ++ir) {
13  const LayerSet & resTriplet = ir->first;
14  if(resTriplet[0].index() == set[0].index() &&
15  resTriplet[1].index() == set[1].index() &&
16  resTriplet[2].index() == set[2].index()) {
17  std::vector<Layer>& fourths = ir->second;
18  fourths.push_back( set[3] );
19  added = true;
20  break;
21  }
22  }
23  if (!added) {
24  LayerSetAndLayers ltl = std::make_pair(set, std::vector<Layer>(1, set[3]) );
25  result.push_back(ltl);
26  }
27  }
28  return result;
29 }
30 }
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
std::pair< LayerSet, std::vector< Layer > > LayerSetAndLayers
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)