CMS 3D CMS Logo

Phase2TrackerClusterizerAlgorithm.cc
Go to the documentation of this file.
2 
4 
5 /*
6  * Initialise the clusterizer algorithm
7  */
8 
10  unsigned int maxNumberClusters)
11  : maxClusterSize_(maxClusterSize), maxNumberClusters_(maxNumberClusters), nrows_(0), ncols_(0) {}
12 
13 /*
14  * Change the size of the 2D matrix for this module (varies from pixel to strip modules)
15  */
16 
18  const PixelTopology& topol(pixDet->specificTopology());
19  nrows_ = topol.nrows();
20  ncols_ = topol.ncolumns();
21  matrix_ = decltype(matrix_)(nrows_, ncols_);
22 }
23 
24 /*
25  * Go over the Digis and create clusters
26  */
27 
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 }
90 
91 /*
92  * Copy the value of the Digis to the 2D matrix (hit or not).
93  */
94 
97  for (edm::DetSet<Phase2TrackerDigi>::const_iterator di(begin); di != end; ++di)
98  matrix_.set(di->row(), di->column(), true, di->overThreshold());
99 }
100 
101 /*
102  * Clear the array of hits
103  */
104 
107  for (edm::DetSet<Phase2TrackerDigi>::const_iterator di(begin); di != end; ++di)
108  matrix_.set(di->row(), di->column(), false, false);
109 }
Phase2TrackerClusterizerAlgorithm::clearMatrix
void clearMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
Definition: Phase2TrackerClusterizerAlgorithm.cc:105
PixelTopology.h
Phase2TrackerCluster1D
Definition: Phase2TrackerCluster1D.h:10
edm::DetSet
Definition: DetSet.h:23
cuy.col
col
Definition: cuy.py:1010
edm::DetSet::begin
iterator begin()
Definition: DetSet.h:57
Phase2TrackerClusterizerArray::set
void set(unsigned int, unsigned int, bool, bool)
Definition: Phase2TrackerClusterizerArray.h:68
HLTEgPhaseIITestSequence_cff.maxNumberClusters
maxNumberClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2090
Phase2TrackerClusterizerAlgorithm::fillMatrix
void fillMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator, edm::DetSet< Phase2TrackerDigi >::const_iterator)
Definition: Phase2TrackerClusterizerAlgorithm.cc:95
Phase2TrackerClusterizerAlgorithm::matrix_
Phase2TrackerClusterizerArray matrix_
Definition: Phase2TrackerClusterizerAlgorithm.h:23
Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit
void clusterizeDetUnit(const edm::DetSet< Phase2TrackerDigi > &, Phase2TrackerCluster1DCollectionNew::FastFiller &)
Definition: Phase2TrackerClusterizerAlgorithm.cc:28
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
mps_fire.end
end
Definition: mps_fire.py:242
PixelTopology
Definition: PixelTopology.h:10
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
Phase2TrackerClusterizerAlgorithm::maxClusterSize_
unsigned int maxClusterSize_
Definition: Phase2TrackerClusterizerAlgorithm.h:24
HLTEgPhaseIITestSequence_cff.maxClusterSize
maxClusterSize
Definition: HLTEgPhaseIITestSequence_cff.py:2089
Phase2TrackerClusterizerAlgorithm.h
Phase2TrackerClusterizerAlgorithm::Phase2TrackerClusterizerAlgorithm
Phase2TrackerClusterizerAlgorithm(unsigned int, unsigned int)
Definition: Phase2TrackerClusterizerAlgorithm.cc:9
Phase2TrackerClusterizerAlgorithm::ncols_
unsigned int ncols_
Definition: Phase2TrackerClusterizerAlgorithm.h:27
Phase2TrackerDigi
Definition: Phase2TrackerDigi.h:12
Phase2TrackerClusterizerAlgorithm::setup
void setup(const PixelGeomDetUnit *)
Definition: Phase2TrackerClusterizerAlgorithm.cc:17
Phase2TrackerClusterizerAlgorithm::nrows_
unsigned int nrows_
Definition: Phase2TrackerClusterizerAlgorithm.h:26
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
edm::DetSet::end
iterator end()
Definition: DetSet.h:58
Phase2TrackerClusterizerAlgorithm::maxNumberClusters_
unsigned int maxNumberClusters_
Definition: Phase2TrackerClusterizerAlgorithm.h:25
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31