CMS 3D CMS Logo

List of all members | Public Member Functions
CPPFClusterizer Class Reference

#include <CPPFClusterizer.h>

Public Member Functions

 CPPFClusterizer ()
 
CPPFClusterContainer doAction (const RPCDigiCollection::Range &digiRange)
 
 ~CPPFClusterizer ()
 

Detailed Description

Author
M. Maggi – INFN Bari

Definition at line 11 of file CPPFClusterizer.h.

Constructor & Destructor Documentation

◆ CPPFClusterizer()

CPPFClusterizer::CPPFClusterizer ( )
inline

Definition at line 13 of file CPPFClusterizer.h.

13 {};

◆ ~CPPFClusterizer()

CPPFClusterizer::~CPPFClusterizer ( )
inline

Definition at line 14 of file CPPFClusterizer.h.

14 {};

Member Function Documentation

◆ doAction()

CPPFClusterContainer CPPFClusterizer::doAction ( const RPCDigiCollection::Range digiRange)

Definition at line 3 of file CPPFClusterizer.cc.

References haddnano::cl, HLT_2023v12_cff::distance, CPPFCluster::isAdjacent(), CPPFCluster::merge(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by RecHitProcessor::process(), and RecHitProcessor::processLook().

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