CMS 3D CMS Logo

RPCClusterizer.cc
Go to the documentation of this file.
1 #include "RPCClusterizer.h"
2 
4 {
5  RPCClusterContainer 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  RPCCluster cl(digi->strip(), digi->strip(), digi->bx());
12  if ( digi->hasTime() ) cl.addTime(digi->time());
13  if ( digi->hasY() ) cl.addY(digi->coordinateY());
14  initialCluster.insert(cl);
15  }
16  if ( initialCluster.empty() ) return finalCluster; // Confirm the collection is valid
17 
18  // Start from the first initial cluster
19  RPCCluster prev = *initialCluster.begin();
20 
21  // Loop over the remaining digis
22  // Note that the last one remains as open in this loop
23  for ( auto cl = std::next(initialCluster.begin()); cl != initialCluster.end(); ++cl ) {
24  if ( prev.isAdjacent(*cl) ) {
25  // Merged digi to the previous one
26  prev.merge(*cl);
27  }
28  else {
29  // Close the previous cluster and start new cluster
30  finalCluster.insert(prev);
31  prev = *cl;
32  }
33  }
34 
35  // Finalize by adding the last cluster
36  finalCluster.insert(prev);
37 
38  return finalCluster;
39 }
40 
void merge(const RPCCluster &cl)
Definition: RPCCluster.cc:55
RPCClusterContainer doAction(const RPCDigiCollection::Range &digiRange)
std::pair< const_iterator, const_iterator > Range
std::set< RPCCluster > RPCClusterContainer
bool isAdjacent(const RPCCluster &cl) const
Definition: RPCCluster.cc:35