CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 93 of file Phase2TrackerClusterizerAlgorithm.cc.

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

Referenced by clusterizeDetUnit().

93  {
94  for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), false);
95 }
void set(unsigned int, unsigned int, 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 
37  // Loop over the Digis
38  // for the S modules, 1 column = 1 strip, so adjacent digis are along the rows
39  // same for P modules
40  for (unsigned int col(0); col < ncols_; ++col) {
41  for (unsigned int row(0); row < nrows_; ++row) {
42 
43  // If the Digi is hit
44  if (matrix_(row, col)) {
45  // No cluster is open, create a new one
46  if (sizeCluster == 0) {
47  // Define first digi
48  firstDigi = Phase2TrackerDigi(row, col);
49  sizeCluster = 1;
50  }
51  // A cluster is open, increase its size
52  else ++sizeCluster;
53  // Check if we reached the maximum size of the cluster and need to close it
54  closeCluster = ((maxClusterSize_ != 0 and sizeCluster >= maxClusterSize_) ? true : false);
55  }
56  // Otherwise check if we need to close a cluster (end of cluster)
57  else closeCluster = ((sizeCluster != 0) ? true : false);
58 
59  // Always close a cluster if we reach the end of the loop
60  if (sizeCluster != 0 and row == (nrows_ - 1)) closeCluster = true;
61 
62  // If we have to close a cluster, do it
63  if (closeCluster) {
64  // Add the cluster to the list
65  clusters.push_back(Phase2TrackerCluster1D(firstDigi, sizeCluster));
66  // Reset the variables
67  sizeCluster = 0;
68  // Increase the number of clusters
69  ++numberClusters;
70  }
71 
72  // Check if we hit the maximum number of clusters per module
73  if (maxNumberClusters_ != 0 and numberClusters > maxNumberClusters_) return;
74  }
75  }
76 
77  // Reset the matrix
78  clearMatrix(digis.begin(), digis.end());
79 }
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
int col
Definition: cuy.py:1008
void Phase2TrackerClusterizerAlgorithm::fillMatrix ( edm::DetSet< Phase2TrackerDigi >::const_iterator  begin,
edm::DetSet< Phase2TrackerDigi >::const_iterator  end 
)
private

Definition at line 85 of file Phase2TrackerClusterizerAlgorithm.cc.

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

Referenced by clusterizeDetUnit().

85  {
86  for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), true);
87 }
void set(unsigned int, unsigned int, 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_, Phase2TrackerClusterizerArray::setSize(), and PixelGeomDetUnit::specificTopology().

15  {
16  const PixelTopology& topol(pixDet->specificTopology());
17  nrows_ = topol.nrows();
18  ncols_ = topol.ncolumns();
19  matrix_.setSize(nrows_, ncols_);
20 }
void setSize(unsigned int, unsigned int)
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().