From 7a3e5f810fd0588bbe8c45b5a1da339aefba044f Mon Sep 17 00:00:00 2001
From: Paul Schuetze <paul.schuetze@desy.de>
Date: Thu, 23 Mar 2023 17:07:49 +0100
Subject: [PATCH] Introduce graphs cluster uncertainty vs position

---
 src/modules/Clustering4D/Clustering4D.cpp | 18 ++++++++++++++++++
 src/modules/Clustering4D/Clustering4D.h   |  4 ++++
 2 files changed, 22 insertions(+)

diff --git a/src/modules/Clustering4D/Clustering4D.cpp b/src/modules/Clustering4D/Clustering4D.cpp
index 76dae5daa..6fb61525d 100644
--- a/src/modules/Clustering4D/Clustering4D.cpp
+++ b/src/modules/Clustering4D/Clustering4D.cpp
@@ -89,6 +89,22 @@ void Clustering4D::initialize() {
     clusterUncertaintyX = new TH1F("clusterUncertaintyX", title.c_str(), 100, 0, static_cast<double>(Units::convert(m_detector->getPitch().X(), "um")));
     title = m_detector->getName() + " Cluster Uncertainty y;cluster uncertainty y [um];events";
     clusterUncertaintyY = new TH1F("clusterUncertaintyY", title.c_str(), 100, 0, static_cast<double>(Units::convert(m_detector->getPitch().Y(), "um")));
+    title = m_detector->getName() + " Cluster Uncertainty x vs position;column [px];row [px];<cluster uncertainty x> [um]";
+    clusterUncertaintyXvsXY = new TProfile2D("clusterUncertaintyXvsXY", title.c_str(),m_detector->nPixels().X(),
+    -0.5,
+    m_detector->nPixels().X() - 0.5,
+    m_detector->nPixels().Y(),
+    -0.5,
+    m_detector->nPixels().Y() - 0.5);
+    title = m_detector->getName() + " Cluster Uncertainty Y vs position;column [px];row [px];<cluster uncertainty y> [um]";
+    clusterUncertaintyYvsXY = new TProfile2D("clusterUncertaintyYvsXY", title.c_str(),m_detector->nPixels().X(),
+    -0.5,
+    m_detector->nPixels().X() - 0.5,
+    m_detector->nPixels().Y(),
+    -0.5,
+    m_detector->nPixels().Y() - 0.5);
+
+>>>>>>> Stashed changes
     title =
         m_detector->getName() + " pixel - seed pixel timestamp (all pixels w/o seed);ts_{pixel} - ts_ {seed} [ns];events";
     pxTimeMinusSeedTime = new TH1F("pxTimeMinusSeedTime", title.c_str(), 1000, -99.5 * 1.5625, 900.5 * 1.5625);
@@ -213,6 +229,8 @@ StatusCode Clustering4D::run(const std::shared_ptr<Clipboard>& clipboard) {
         clusterTimes->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "ns")));
         clusterUncertaintyX->Fill(static_cast<double>(Units::convert(cluster->errorX(), "um")));
         clusterUncertaintyY->Fill(static_cast<double>(Units::convert(cluster->errorY(), "um")));
+        clusterUncertaintyXvsXY->Fill(cluster->column(), cluster->row(), static_cast<double>(Units::convert(cluster->errorX(), "um")));
+        clusterUncertaintyYvsXY->Fill(cluster->column(), cluster->row(), static_cast<double>(Units::convert(cluster->errorY(), "um")));
 
         // to check that cluster timestamp = earliest pixel timestamp
         if(cluster->size() > 1) {
diff --git a/src/modules/Clustering4D/Clustering4D.h b/src/modules/Clustering4D/Clustering4D.h
index 5dacd9499..85377142a 100644
--- a/src/modules/Clustering4D/Clustering4D.h
+++ b/src/modules/Clustering4D/Clustering4D.h
@@ -15,6 +15,7 @@
 #include <TCanvas.h>
 #include <TH1F.h>
 #include <TH2F.h>
+#include <TProfile2D.h>
 #include <iostream>
 #include "core/module/Module.hpp"
 #include "objects/Cluster.hpp"
@@ -53,8 +54,11 @@ namespace corryvreckan {
         TH2F* clusterPositionLocal;
         TH1F* clusterTimes;
         TH1F* clusterMultiplicity;
+
         TH1F* clusterUncertaintyX;
         TH1F* clusterUncertaintyY;
+        TProfile2D* clusterUncertaintyXvsXY;
+        TProfile2D* clusterUncertaintyYvsXY;
         TH1F* pxTimeMinusSeedTime;
         TH2F* pxTimeMinusSeedTime_vs_pxCharge;
         TH2F* pxTimeMinusSeedTime_vs_pxCharge_2px;
-- 
GitLab