Commit 89cb0f61 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'master' into documentation

parents 3d6e9b6e 957827d5
......@@ -31,6 +31,10 @@ Detector::Detector(const Configuration& config) {
auto npixels = config.get<ROOT::Math::DisplacementVector2D<Cartesian2D<int>>>("number_of_pixels");
// Size of the pixels
m_pitch = config.get<ROOT::Math::XYVector>("pixel_pitch");
// Intrinsic position resolution, defaults to 4um:
m_resolution = config.get<ROOT::Math::XYVector>("resolution", ROOT::Math::XYVector(0.004, 0.004));
m_detectorName = config.getName();
if(Units::convert(m_pitch.X(), "mm") >= 1 or Units::convert(m_pitch.Y(), "mm") >= 1 or
......@@ -165,6 +169,9 @@ Configuration Detector::getConfiguration() {
// Size of the pixels
config.set("pixel_pitch", m_pitch, {"um"});
// Intrinsic resolution:
config.set("resolution", m_resolution, {"um"});
if(m_timingOffset != 0.) {
config.set("time_offset", m_timingOffset, {"ns", "us", "ms", "s"});
}
......
......@@ -43,6 +43,7 @@ namespace corryvreckan {
ROOT::Math::XYVector size() { return ROOT::Math::XYVector(m_pitch.X() * m_nPixelsX, m_pitch.Y() * m_nPixelsY); }
ROOT::Math::XYVector pitch() { return m_pitch; }
ROOT::Math::XYVector resolution() { return m_resolution; }
int nPixelsX() { return m_nPixelsX; }
int nPixelsY() { return m_nPixelsY; }
......@@ -112,6 +113,7 @@ namespace corryvreckan {
std::string m_detectorType;
std::string m_detectorName;
ROOT::Math::XYVector m_pitch;
ROOT::Math::XYVector m_resolution;
int m_nPixelsX;
int m_nPixelsY;
double m_timingOffset;
......
......@@ -199,8 +199,10 @@ void SpatialClustering::calculateClusterCentre(Detector* detector, Cluster* clus
cluster->setRow(row);
cluster->setColumn(column);
cluster->setTot(tot);
cluster->setErrorX(0.004);
cluster->setErrorY(0.004);
// Set uncertainty on position from intrinstic detector resolution:
cluster->setError(detector->resolution());
cluster->setDetectorID(detectorID);
cluster->setClusterCentre(positionGlobal.X(), positionGlobal.Y(), positionGlobal.Z());
cluster->setClusterCentreLocal(positionLocal.X(), positionLocal.Y(), positionLocal.Z());
......
......@@ -214,8 +214,10 @@ void Timepix3Clustering::calculateClusterCentre(Cluster* cluster) {
cluster->setRow(row);
cluster->setColumn(column);
cluster->setTot(tot);
cluster->setErrorX(0.004);
cluster->setErrorY(0.004);
// Set uncertainty on position from intrinstic detector resolution:
cluster->setError(detector->resolution());
cluster->setTimestamp(timestamp);
cluster->setDetectorID(detectorID);
cluster->setClusterCentre(positionGlobal.X(), positionGlobal.Y(), positionGlobal.Z());
......
#ifndef CLUSTER_H
#define CLUSTER_H 1
#include <Math/Point3D.h>
#include <Math/Vector2D.h>
#include <iostream>
#include "Math/Point3D.h"
#include "Pixel.h"
/*
......@@ -29,8 +30,7 @@ namespace corryvreckan {
Cluster(Cluster* cluster) {
m_global = cluster->global();
m_local = cluster->local();
m_error_x = cluster->errorX();
m_error_y = cluster->errorY();
m_error = ROOT::Math::XYVector(cluster->errorX(), cluster->errorY());
m_detectorID = cluster->detectorID();
m_timestamp = cluster->timestamp();
m_columnWidth = cluster->columnWidth();
......@@ -56,9 +56,9 @@ namespace corryvreckan {
double row() { return m_row; }
double column() { return m_column; }
double tot() { return m_tot; }
double error() { return sqrt(m_error_x * m_error_x + m_error_y * m_error_y); }
double errorX() { return m_error_x; }
double errorY() { return m_error_y; }
double error() { return sqrt(m_error.X() * m_error.X() + m_error.Y() * m_error.Y()); }
double errorX() { return m_error.X(); }
double errorY() { return m_error.Y(); }
bool isSplit() { return m_split; }
void setSplit(bool split) { m_split = split; }
......@@ -107,8 +107,9 @@ namespace corryvreckan {
m_local.SetY(y);
m_local.SetZ(z);
}
void setErrorX(double error) { m_error_x = error; }
void setErrorY(double error) { m_error_y = error; }
void setErrorX(double error) { m_error.SetX(error); }
void setErrorY(double error) { m_error.SetY(error); }
void setError(ROOT::Math::XYVector error) { m_error = error; }
private:
// Member variables
......@@ -116,8 +117,7 @@ namespace corryvreckan {
double m_row;
double m_column;
double m_tot;
double m_error_x;
double m_error_y;
ROOT::Math::XYVector m_error;
double m_columnWidth;
double m_rowWidth;
bool m_split;
......@@ -129,7 +129,7 @@ namespace corryvreckan {
std::map<int, bool> m_columnHits;
// ROOT I/O class definition - update version number when you change this class!
ClassDef(Cluster, 6)
ClassDef(Cluster, 7)
};
// Vector type declaration
......
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