CMS 3D CMS Logo

List of all members | Public Member Functions
GEMClusterizer Class Reference

#include <GEMClusterizer.h>

Public Member Functions

GEMClusterContainer doAction (const GEMDigiCollection::Range &digiRange)
 
 GEMClusterizer ()
 
 ~GEMClusterizer ()
 

Detailed Description

Author
M. Maggi – INFN Bari

Definition at line 11 of file GEMClusterizer.h.

Constructor & Destructor Documentation

GEMClusterizer::GEMClusterizer ( )
inline

Definition at line 13 of file GEMClusterizer.h.

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

Definition at line 14 of file GEMClusterizer.h.

References doAction().

14 {};

Member Function Documentation

GEMClusterContainer GEMClusterizer::doAction ( const GEMDigiCollection::Range digiRange)

Definition at line 3 of file GEMClusterizer.cc.

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

Referenced by GEMRecHitBaseAlgo::reconstruct(), and ~GEMClusterizer().

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
void merge(const GEMCluster &cl)
Definition: GEMCluster.cc:50
bool isAdjacent(const GEMCluster &cl) const
Definition: GEMCluster.cc:44