CMS 3D CMS Logo

GEMClusterizer.cc
Go to the documentation of this file.
2 
4 {
5  GEMClusterContainer initialCluster, finalCluster;
6  // Return empty container for null input
7  if ( std::distance(digiRange.second, digiRange.first) == 0 ) return finalCluster;
8 
9  // Start from single digi recHits
10  for ( auto digi = digiRange.first; digi != digiRange.second; ++digi ) {
11  GEMCluster cl(digi->strip(), digi->strip(), digi->bx());
12  initialCluster.insert(cl);
13  }
14  if ( initialCluster.empty() ) return finalCluster; // Confirm the collection is valid
15 
16  // Start from the first initial cluster
17  GEMCluster prev = *initialCluster.begin();
18 
19  // Loop over the remaining digis
20  // Note that the last one remains as open in this loop
21  for ( auto cl = std::next(initialCluster.begin()); cl != initialCluster.end(); ++cl ) {
22  if ( prev.isAdjacent(*cl) ) {
23  // Merged digi to the previous one
24  prev.merge(*cl);
25  }
26  else {
27  // Close the previous cluster and start new cluster
28  finalCluster.insert(prev);
29  prev = *cl;
30  }
31  }
32 
33  // Finalize by adding the last cluster
34  finalCluster.insert(prev);
35 
36  return finalCluster;
37 }
std::set< GEMCluster > GEMClusterContainer
GEMClusterContainer doAction(const GEMDigiCollection::Range &digiRange)
void merge(const GEMCluster &cl)
Definition: GEMCluster.cc:50
std::pair< const_iterator, const_iterator > Range
bool isAdjacent(const GEMCluster &cl) const
Definition: GEMCluster.cc:44