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, const EtaPartitionMask &mask)
 
 GEMClusterizer ()
 
 ~GEMClusterizer ()
 

Detailed Description

Author
M. Maggi – INFN Bari

Definition at line 12 of file GEMClusterizer.h.

Constructor & Destructor Documentation

◆ GEMClusterizer()

GEMClusterizer::GEMClusterizer ( )
inline

Definition at line 14 of file GEMClusterizer.h.

14 {};

◆ ~GEMClusterizer()

GEMClusterizer::~GEMClusterizer ( )
inline

Definition at line 15 of file GEMClusterizer.h.

15 {};

Member Function Documentation

◆ doAction()

GEMClusterContainer GEMClusterizer::doAction ( const GEMDigiCollection::Range digiRange,
const EtaPartitionMask mask 
)

Definition at line 3 of file GEMClusterizer.cc.

References haddnano::cl, HLT_2023v12_cff::distance, GEMCluster::isAdjacent(), ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, GEMCluster::merge(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by GEMRecHitBaseAlgo::reconstruct().

3  {
4  GEMClusterContainer initialCluster, finalCluster;
5  // Return empty container for null input
6  if (std::distance(digiRange.second, digiRange.first) == 0)
7  return finalCluster;
8 
9  // Start from single digi recHits
10  for (auto digi = digiRange.first; digi != digiRange.second; ++digi) {
11  if (mask.test(digi->strip()))
12  continue;
13  GEMCluster cl(digi->strip(), digi->strip(), digi->bx());
14  initialCluster.insert(cl);
15  }
16  if (initialCluster.empty())
17  return finalCluster; // Confirm the collection is valid
18 
19  // Start from the first initial cluster
20  GEMCluster prev = *initialCluster.begin();
21 
22  // Loop over the remaining digis
23  // Note that the last one remains as open in this loop
24  for (auto cl = std::next(initialCluster.begin()); cl != initialCluster.end(); ++cl) {
25  if (prev.isAdjacent(*cl)) {
26  // Merged digi to the previous one
27  prev.merge(*cl);
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 }
std::set< GEMCluster > GEMClusterContainer
bool isAdjacent(const GEMCluster &cl) const
Definition: GEMCluster.cc:21
void merge(const GEMCluster &cl)
Definition: GEMCluster.cc:25