CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Phase2TrackerClusterizerAlgorithm Class Reference

#include <Phase2TrackerClusterizerAlgorithm.h>

Public Member Functions

void clusterizeDetUnit (const edm::DetSet< Phase2TrackerDigi > &, Phase2TrackerCluster1DCollectionNew::FastFiller &)
 
 Phase2TrackerClusterizerAlgorithm (unsigned int, unsigned int)
 
void setup (const PixelGeomDetUnit *)
 

Private Member Functions

void clearMatrix (edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
 
void fillMatrix (edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
 

Private Attributes

Phase2TrackerClusterizerArray matrix_
 
unsigned int maxClusterSize_
 
unsigned int maxNumberClusters_
 
unsigned int ncols_
 
unsigned int nrows_
 

Detailed Description

Definition at line 13 of file Phase2TrackerClusterizerAlgorithm.h.

Constructor & Destructor Documentation

Phase2TrackerClusterizerAlgorithm::Phase2TrackerClusterizerAlgorithm ( unsigned int  maxClusterSize,
unsigned int  maxNumberClusters 
)

Member Function Documentation

void Phase2TrackerClusterizerAlgorithm::clearMatrix ( edm::DetSet< Phase2TrackerDigi >::const_iterator  begin,
edm::DetSet< Phase2TrackerDigi >::const_iterator  end 
)
private

Definition at line 98 of file Phase2TrackerClusterizerAlgorithm.cc.

References end, matrix_, and Phase2TrackerClusterizerArray::set().

Referenced by clusterizeDetUnit().

98  {
99  for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), false, false);
100 }
void set(unsigned int, unsigned int, bool, bool)
#define end
Definition: vmac.h:37
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit ( const edm::DetSet< Phase2TrackerDigi > &  digis,
Phase2TrackerCluster1DCollectionNew::FastFiller clusters 
)

Definition at line 26 of file Phase2TrackerClusterizerAlgorithm.cc.

References edm::DetSet< T >::begin(), clearMatrix(), cuy::col, edm::DetSet< T >::end(), fillMatrix(), matrix_, maxClusterSize_, maxNumberClusters_, ncols_, nrows_, and edmNew::DetSetVector< T >::FastFiller::push_back().

26  {
27 
28  // Fill the 2D matrix with the hit information : (hit or not)
29  fillMatrix(digis.begin(), digis.end());
30 
31  // Number of clusters
32  unsigned int numberClusters(0);
33  Phase2TrackerDigi firstDigi;
34  unsigned int sizeCluster(0);
35  bool closeCluster(false);
36  bool HIPbit(false);
37 
38  // Loop over the Digis
39  // for the S modules, 1 column = 1 strip, so adjacent digis are along the rows
40  // same for P modules
41  for (unsigned int col(0); col < ncols_; ++col) {
42  for (unsigned int row(0); row < nrows_; ++row) {
43 
44  // If the Digi is hit
45  if (matrix_(row, col)) {
46  // No cluster is open, create a new one
47  if (sizeCluster == 0) {
48  // Define first digi
49  firstDigi = Phase2TrackerDigi(row, col);
50  sizeCluster = 1;
51  }
52  // A cluster is open, increase its size
53  else ++sizeCluster;
54  // Check if we reached the maximum size of the cluster and need to close it
55  closeCluster = ((maxClusterSize_ != 0 and sizeCluster >= maxClusterSize_) ? true : false);
56  }
57  // Otherwise check if we need to close a cluster (end of cluster)
58  else closeCluster = ((sizeCluster != 0) ? true : false);
59 
60  // update the HIP bit
61  HIPbit |= (matrix_(row, col)==2);
62 
63  // Always close a cluster if we reach the end of the loop
64  if (sizeCluster != 0 and row == (nrows_ - 1)) closeCluster = true;
65 
66  // If we have to close a cluster, do it
67  if (closeCluster) {
68  // Add the cluster to the list
69  clusters.push_back(Phase2TrackerCluster1D(firstDigi, sizeCluster, HIPbit));
70  // Reset the variables
71  sizeCluster = 0;
72  // Increase the number of clusters
73  ++numberClusters;
74  HIPbit = false;
75  }
76 
77  // Check if we hit the maximum number of clusters per module
78  if (maxNumberClusters_ != 0 and numberClusters > maxNumberClusters_) return;
79  }
80  }
81 
82  // Reset the matrix
83  clearMatrix(digis.begin(), digis.end());
84 }
iterator end()
Definition: DetSet.h:60
void push_back(data_type const &d)
void fillMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
void clearMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
iterator begin()
Definition: DetSet.h:59
col
Definition: cuy.py:1008
void Phase2TrackerClusterizerAlgorithm::fillMatrix ( edm::DetSet< Phase2TrackerDigi >::const_iterator  begin,
edm::DetSet< Phase2TrackerDigi >::const_iterator  end 
)
private

Definition at line 90 of file Phase2TrackerClusterizerAlgorithm.cc.

References end, matrix_, and Phase2TrackerClusterizerArray::set().

Referenced by clusterizeDetUnit().

90  {
91  for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), true, di->overThreshold());
92 }
void set(unsigned int, unsigned int, bool, bool)
#define end
Definition: vmac.h:37
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
void Phase2TrackerClusterizerAlgorithm::setup ( const PixelGeomDetUnit pixDet)

Definition at line 15 of file Phase2TrackerClusterizerAlgorithm.cc.

References matrix_, ncols_, nrows_, and PixelGeomDetUnit::specificTopology().

15  {
16  const PixelTopology& topol(pixDet->specificTopology());
17  nrows_ = topol.nrows();
18  ncols_ = topol.ncolumns();
19  matrix_ = decltype(matrix_)(nrows_, ncols_);
20 }
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.

Member Data Documentation

Phase2TrackerClusterizerArray Phase2TrackerClusterizerAlgorithm::matrix_
private
unsigned int Phase2TrackerClusterizerAlgorithm::maxClusterSize_
private

Definition at line 27 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit().

unsigned int Phase2TrackerClusterizerAlgorithm::maxNumberClusters_
private

Definition at line 28 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit().

unsigned int Phase2TrackerClusterizerAlgorithm::ncols_
private

Definition at line 30 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit(), and setup().

unsigned int Phase2TrackerClusterizerAlgorithm::nrows_
private

Definition at line 29 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit(), and setup().