Commit 1f311099 authored by Daniel Hynds's avatar Daniel Hynds
Browse files

changed cluster return value to pointer to member pixels


Former-commit-id: 06aa43f55aa835a6a82f699e7b391d2bf0554278
parent 97da6178
......@@ -431,9 +431,9 @@ void ClicpixAnalysis::fillClusterHistos(Clusters* clusters){
for (itc = clusters->begin(); itc != clusters->end(); ++itc) {
// Loop over pixels and check if there are pixels not known
Pixels pixels = (*itc)->pixels();
Pixels* pixels = (*itc)->pixels();
Pixels::iterator itp;
for (itp = pixels.begin(); itp != pixels.end(); itp++) {
for (itp = pixels->begin(); itp != pixels->end(); itp++) {
// Check if this clicpix frame is still the current
int pixelID = (*itp)->m_column + nCols*(*itp)->m_row;
if( m_hitPixels[pixelID] != (*itp)->m_adc){
......@@ -464,9 +464,9 @@ void ClicpixAnalysis::fillClusterHistos(Clusters* clusters){
void ClicpixAnalysis::fillResponseHistos(double trackInterceptX, double trackInterceptY, Cluster* cluster){
// Loop over pixels in the cluster and show their distance from the track intercept
Pixels pixels = cluster->pixels();
Pixels* pixels = cluster->pixels();
Pixels::iterator itp;
for (itp = pixels.begin(); itp != pixels.end(); itp++) {
for (itp = pixels->begin(); itp != pixels->end(); itp++) {
// Get the pixel
Pixel* pixel = (*itp);
......
......@@ -148,16 +148,16 @@ void Timepix1Clustering::calculateClusterCentre(Cluster* cluster){
double row(0), column(0), tot(0);
// Get the pixels on this cluster
Pixels pixels = cluster->pixels();
string detectorID = pixels[0]->m_detectorID;
if(debug)tcout<<"- cluster has "<<pixels.size()<<" pixels"<<endl;
Pixels* pixels = cluster->pixels();
string detectorID = (*pixels)[0]->m_detectorID;
if(debug)tcout<<"- cluster has "<<(*pixels).size()<<" pixels"<<endl;
// Loop over all pixels
for(int pix=0; pix<pixels.size(); pix++){
tot += pixels[pix]->m_adc;
row += (pixels[pix]->m_row * pixels[pix]->m_adc);
column += (pixels[pix]->m_column * pixels[pix]->m_adc);
if(debug)tcout<<"- pixel row, col: "<<pixels[pix]->m_row<<","<<pixels[pix]->m_column<<endl;
for(int pix=0; pix<pixels->size(); pix++){
tot += (*pixels)[pix]->m_adc;
row += ((*pixels)[pix]->m_row * (*pixels)[pix]->m_adc);
column += ((*pixels)[pix]->m_column * (*pixels)[pix]->m_adc);
if(debug)tcout<<"- pixel row, col: "<<(*pixels)[pix]->m_row<<","<<(*pixels)[pix]->m_column<<endl;
}
// Row and column positions are tot-weighted
......
......@@ -109,11 +109,11 @@ StatusCode Timepix3Clustering::run(Clipboard* clipboard){
bool Timepix3Clustering::touching(Pixel* neighbour,Cluster* cluster){
bool Touching = false;
Pixels pixels = cluster->pixels();
for(int iPix=0;iPix<pixels.size();iPix++){
Pixels* pixels = cluster->pixels();
for(int iPix=0;iPix<pixels->size();iPix++){
if( abs(pixels[iPix]->m_row - neighbour->m_row) <= 1 &&
abs(pixels[iPix]->m_column - neighbour->m_column) <= 1 ){
if( abs((*pixels)[iPix]->m_row - neighbour->m_row) <= 1 &&
abs((*pixels)[iPix]->m_column - neighbour->m_column) <= 1 ){
Touching = true;
break;
}
......@@ -126,10 +126,10 @@ bool Timepix3Clustering::closeInTime(Pixel* neighbour,Cluster* cluster){
bool CloseInTime = false;
Pixels pixels = cluster->pixels();
for(int iPix=0;iPix<pixels.size();iPix++){
Pixels* pixels = cluster->pixels();
for(int iPix=0;iPix<pixels->size();iPix++){
long long int timeDifference = abs(neighbour->m_timestamp - pixels[iPix]->m_timestamp);
long long int timeDifference = abs(neighbour->m_timestamp - (*pixels)[iPix]->m_timestamp);
if(timeDifference < timingCutInt) CloseInTime = true;
}
......@@ -144,16 +144,16 @@ void Timepix3Clustering::calculateClusterCentre(Cluster* cluster){
long long int timestamp;
// Get the pixels on this cluster
Pixels pixels = cluster->pixels();
string detectorID = pixels[0]->m_detectorID;
timestamp = pixels[0]->m_timestamp;
Pixels* pixels = cluster->pixels();
string detectorID = (*pixels)[0]->m_detectorID;
timestamp = (*pixels)[0]->m_timestamp;
// Loop over all pixels
for(int pix=0; pix<pixels.size(); pix++){
tot += pixels[pix]->m_adc;
row += (pixels[pix]->m_row * pixels[pix]->m_adc);
column += (pixels[pix]->m_column * pixels[pix]->m_adc);
if(pixels[pix]->m_timestamp < timestamp) timestamp = pixels[pix]->m_timestamp;
for(int pix=0; pix<pixels->size(); pix++){
tot += (*pixels)[pix]->m_adc;
row += ((*pixels)[pix]->m_row * (*pixels)[pix]->m_adc);
column += ((*pixels)[pix]->m_column * (*pixels)[pix]->m_adc);
if((*pixels)[pix]->m_timestamp < timestamp) timestamp = (*pixels)[pix]->m_timestamp;
}
// Row and column positions are tot-weighted
row /= tot;
......
......@@ -58,7 +58,7 @@ public:
int rowWidth(){return m_rowWidth;}
long long int timestamp(){return m_timestamp;}
std::string detectorID(){return m_detectorID;}
Pixels pixels(){return m_pixels;}
Pixels* pixels(){return (&m_pixels);}
// Set cluster parameters
void setRow(double row){m_row = row;}
......@@ -98,7 +98,7 @@ public:
std::map<int,bool> m_columnHits;
// ROOT I/O class definition - update version number when you change this class!
ClassDef(Cluster,2)
ClassDef(Cluster,3)
};
......
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