Skip to content

Commit

Permalink
Merge pull request #16200 from delaere/othBitClusters
Browse files Browse the repository at this point in the history
Propagate the overthreshold / high charge bit to phase2 clusters
  • Loading branch information
davidlange6 committed Oct 23, 2016
2 parents 8a1f9c2 + 6221f82 commit af91ba3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Expand Up @@ -10,18 +10,19 @@ class Phase2TrackerClusterizerArray {
Phase2TrackerClusterizerArray();
Phase2TrackerClusterizerArray(unsigned int, unsigned int);
void setSize(unsigned int, unsigned int);
bool operator()(unsigned int, unsigned int) const;
int operator()(unsigned int, unsigned int) const;
unsigned int rows() const;
unsigned int columns() const;
bool inside(unsigned int, unsigned int) const;
void set(unsigned int, unsigned int, bool);
void set(unsigned int, unsigned int, bool, bool);
unsigned int size() const;
unsigned int index(unsigned int, unsigned int) const;

private:

unsigned int nrows_, ncols_;
std::vector< bool > matrix_;
std::vector< bool > hipmatrix_;

};

Expand Down
Expand Up @@ -33,6 +33,7 @@ void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit(const edm::DetSet< Pha
Phase2TrackerDigi firstDigi;
unsigned int sizeCluster(0);
bool closeCluster(false);
bool HIPbit(false);

// Loop over the Digis
// for the S modules, 1 column = 1 strip, so adjacent digis are along the rows
Expand All @@ -56,13 +57,16 @@ void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit(const edm::DetSet< Pha
// Otherwise check if we need to close a cluster (end of cluster)
else closeCluster = ((sizeCluster != 0) ? true : false);

// update the HIP bit
HIPbit |= (matrix_(row, col)==2);

// Always close a cluster if we reach the end of the loop
if (sizeCluster != 0 and row == (nrows_ - 1)) closeCluster = true;

// If we have to close a cluster, do it
if (closeCluster) {
// Add the cluster to the list
clusters.push_back(Phase2TrackerCluster1D(firstDigi, sizeCluster));
clusters.push_back(Phase2TrackerCluster1D(firstDigi, sizeCluster, HIPbit));
// Reset the variables
sizeCluster = 0;
// Increase the number of clusters
Expand All @@ -83,14 +87,14 @@ void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit(const edm::DetSet< Pha
*/

void Phase2TrackerClusterizerAlgorithm::fillMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator begin, edm::DetSet< Phase2TrackerDigi >::const_iterator end) {
for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), true);
for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), true, di->overThreshold());
}

/*
* Clear the array of hits
*/

void Phase2TrackerClusterizerAlgorithm::clearMatrix(edm::DetSet< Phase2TrackerDigi >::const_iterator begin, edm::DetSet< Phase2TrackerDigi >::const_iterator end) {
for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), false);
for (edm::DetSet< Phase2TrackerDigi >::const_iterator di(begin); di != end; ++di) matrix_.set(di->row(), di->column(), false, false);
}

Expand Up @@ -18,16 +18,23 @@ void Phase2TrackerClusterizerArray::setSize(unsigned int nrows, unsigned int nco
nrows_ = nrows;
ncols_ = ncols;
matrix_.resize(nrows * ncols);
hipmatrix_.resize(nrows * ncols);
for (std::vector< bool >::iterator it(matrix_.begin()); it != matrix_.end(); ++it) *it = false;
for (std::vector< bool >::iterator it(hipmatrix_.begin()); it != hipmatrix_.end(); ++it) *it = false;
}

/*
* Return the value of an element in the Array
*/

bool Phase2TrackerClusterizerArray::operator()(unsigned int row, unsigned int col) const {
if (inside(row, col)) return matrix_[index(row, col)];
else return false;
int Phase2TrackerClusterizerArray::operator()(unsigned int row, unsigned int col) const {
if (inside(row, col)) {
if (matrix_[index(row, col)]) {
if (hipmatrix_[index(row, col)]) return 2;
else return 1;
} else return 0;
}
else return 0;
}

/*
Expand Down Expand Up @@ -58,8 +65,9 @@ bool Phase2TrackerClusterizerArray::inside(unsigned int row, unsigned int col) c
* Change the value of an element of the Array
*/

void Phase2TrackerClusterizerArray::set(unsigned int row, unsigned int col, bool state) {
void Phase2TrackerClusterizerArray::set(unsigned int row, unsigned int col, bool state, bool hip) {
matrix_[index(row, col)] = state;
hipmatrix_[index(row, col)] = hip;
}

/*
Expand Down

0 comments on commit af91ba3

Please sign in to comment.