CMS 3D CMS Logo

List of all members | Public Member Functions
RPCClusterizer Class Reference

#include <RPCClusterizer.h>

Public Member Functions

RPCClusterContainer doAction (const RPCDigiCollection::Range &digiRange)
 
 RPCClusterizer ()
 
 ~RPCClusterizer ()
 

Detailed Description

Author
M. Maggi – INFN Bari

Definition at line 11 of file RPCClusterizer.h.

Constructor & Destructor Documentation

RPCClusterizer::RPCClusterizer ( )
inline

Definition at line 13 of file RPCClusterizer.h.

13 {};
RPCClusterizer::~RPCClusterizer ( )
inline

Definition at line 14 of file RPCClusterizer.h.

References doAction().

14 {};

Member Function Documentation

RPCClusterContainer RPCClusterizer::doAction ( const RPCDigiCollection::Range digiRange)

Definition at line 3 of file RPCClusterizer.cc.

References GetRecoTauVFromDQM_MC_cff::cl, SoftLeptonByDistance_cfi::distance, RPCCluster::isAdjacent(), RPCCluster::merge(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by RPCRecHitBaseAlgo::reconstruct(), and ~RPCClusterizer().

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 }
void merge(const RPCCluster &cl)
Definition: RPCCluster.cc:55
std::set< RPCCluster > RPCClusterContainer
bool isAdjacent(const RPCCluster &cl) const
Definition: RPCCluster.cc:35