Commit e6686013 authored by Daniel Hynds's avatar Daniel Hynds
Browse files

if pixel tot is 0 then give it weight 1 (binary weighting)

parent 1d1f7ba2
...@@ -176,17 +176,18 @@ void Timepix3Clustering::calculateClusterCentre(Cluster* cluster) { ...@@ -176,17 +176,18 @@ void Timepix3Clustering::calculateClusterCentre(Cluster* cluster) {
// Loop over all pixels // Loop over all pixels
for(int pix = 0; pix < pixels->size(); pix++) { for(int pix = 0; pix < pixels->size(); pix++) {
tot += (*pixels)[pix]->m_adc; double pixelToT = (*pixels)[pix]->m_adc;
row += ((*pixels)[pix]->m_row * (*pixels)[pix]->m_adc); if(pixelToT == 0){
column += ((*pixels)[pix]->m_column * (*pixels)[pix]->m_adc); LOG(DEBUG) << "Pixel with ToT 0!";
pixelToT = 1;
}
tot += pixelToT;
row += ((*pixels)[pix]->m_row * pixelToT);
column += ((*pixels)[pix]->m_column * pixelToT);
if((*pixels)[pix]->m_timestamp < timestamp) if((*pixels)[pix]->m_timestamp < timestamp)
timestamp = (*pixels)[pix]->m_timestamp; timestamp = (*pixels)[pix]->m_timestamp;
} }
// Row and column positions are tot-weighted // Row and column positions are tot-weighted
if(tot == 0){
LOG(WARNING) << "Cluster with ToT 0!";
tot = 1.;
}
row /= tot; row /= tot;
column /= tot; column /= tot;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment