Commit 65713124 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Tpx3Clustering: add possibility to search for neighbour pixels in larger radii

parent f6a8c312
......@@ -6,6 +6,8 @@ using namespace std;
Timepix3Clustering::Timepix3Clustering(Configuration config, std::vector<Detector*> detectors)
: Algorithm(std::move(config), std::move(detectors)) {
timingCut = m_config.get<double>("timingCut", Units::convert(100, "ns")); // 100 ns
neighbour_radius_row = m_config.get<int>("neighbour_radius_row", 1);
neighbour_radius_col = m_config.get<int>("neighbour_radius_col", 1);
}
void Timepix3Clustering::initialise() {
......@@ -105,6 +107,7 @@ StatusCode Timepix3Clustering::run(Clipboard* clipboard) {
// Check if they are touching cluster pixels
if(!touching(neighbour, cluster))
continue;
// Add to cluster
cluster->addPixel(neighbour);
clusterTime = neighbour->timestamp();
......@@ -141,11 +144,15 @@ 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++) {
if(abs((*pixels)[iPix]->m_row - neighbour->m_row) <= 1 &&
abs((*pixels)[iPix]->m_column - neighbour->m_column) <= 1) {
for(auto pixel : (*cluster->pixels())) {
int row_distance = abs(pixel->m_row - neighbour->m_row);
int col_distance = abs(pixel->m_column - neighbour->m_column);
if(row_distance <= neighbour_radius_row && col_distance <= neighbour_radius_col) {
if(row_distance > 1 || col_distance > 1) {
cluster->setSplit(true);
}
Touching = true;
break;
}
......
......@@ -35,6 +35,8 @@ namespace corryvreckan {
std::map<std::string, TH2F*> clusterPositionGlobal;
double timingCut;
int neighbour_radius_row;
int neighbour_radius_col;
};
} // namespace corryvreckan
#endif // TIMEPIX3CLUSTERING_H
......@@ -22,6 +22,7 @@ public:
Cluster() {
m_columnWidth = 0.;
m_rowWidth = 0.;
m_split = false;
}
virtual ~Cluster() {}
// Copy constructor
......@@ -33,6 +34,7 @@ public:
m_timestamp = cluster->timestamp();
m_columnWidth = cluster->columnWidth();
m_rowWidth = cluster->rowWidth();
m_split = cluster->isSplit();
}
// Functions
......@@ -54,6 +56,9 @@ public:
double tot() { return m_tot; }
double error() { return m_error; }
bool isSplit() { return m_split; }
void setSplit(bool split) { m_split = split; }
double globalX() { return m_global.X(); }
double globalY() { return m_global.Y(); }
double globalZ() { return m_global.Z(); }
......@@ -96,6 +101,7 @@ private:
double m_error;
double m_columnWidth;
double m_rowWidth;
bool m_split;
ROOT::Math::XYZPoint m_local;
ROOT::Math::XYZPoint m_global;
......@@ -104,7 +110,7 @@ private:
std::map<int, bool> m_columnHits;
// ROOT I/O class definition - update version number when you change this class!
ClassDef(Cluster, 4)
ClassDef(Cluster, 5)
};
// Vector type declaration
......
Supports Markdown
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