CMS 3D CMS Logo

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

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

Referenced by clusterizeDetUnit().

106  {
107  for (edm::DetSet<Phase2TrackerDigi>::const_iterator di(begin); di != end; ++di)
108  matrix_.set(di->row(), di->column(), false, false);
109 }
void set(unsigned int, unsigned int, bool, bool)
string end
Definition: dataset.py:937
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit ( const edm::DetSet< Phase2TrackerDigi > &  digis,
Phase2TrackerCluster1DCollectionNew::FastFiller clusters 
)

Definition at line 28 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().

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

Definition at line 95 of file Phase2TrackerClusterizerAlgorithm.cc.

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

Referenced by clusterizeDetUnit().

96  {
97  for (edm::DetSet<Phase2TrackerDigi>::const_iterator di(begin); di != end; ++di)
98  matrix_.set(di->row(), di->column(), true, di->overThreshold());
99 }
void set(unsigned int, unsigned int, bool, bool)
string end
Definition: dataset.py:937
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
void Phase2TrackerClusterizerAlgorithm::setup ( const PixelGeomDetUnit pixDet)

Definition at line 17 of file Phase2TrackerClusterizerAlgorithm.cc.

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

17  {
18  const PixelTopology& topol(pixDet->specificTopology());
19  nrows_ = topol.nrows();
20  ncols_ = topol.ncolumns();
21  matrix_ = decltype(matrix_)(nrows_, ncols_);
22 }
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 24 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit().

unsigned int Phase2TrackerClusterizerAlgorithm::maxNumberClusters_
private

Definition at line 25 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit().

unsigned int Phase2TrackerClusterizerAlgorithm::ncols_
private

Definition at line 27 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit(), and setup().

unsigned int Phase2TrackerClusterizerAlgorithm::nrows_
private

Definition at line 26 of file Phase2TrackerClusterizerAlgorithm.h.

Referenced by clusterizeDetUnit(), and setup().