Commit 2284d720 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'master' into aliases_reso

parents 672cf81f 7af64c09
Pipeline #1259890 passed with stages
in 16 minutes and 21 seconds
......@@ -55,7 +55,7 @@ $ /path/to/corryvreckan/bin/corry \
The \parameter{spatial_cut} in \texttt{[Tracking4D]} should be set to multiple ($\sim4$) pixel pitch.
One can inspect the track $\chi^2$, the correlation in x and y and the residuals with the online monitoring or by opening the generated ROOT file after finishing the script.
These can be found in the modules \texttt{[Tracking4D]} (see Section~\ref{tracking4d}) and \texttt{[TestAlgorithm]} (see Section~\ref{testalgorithm}).
These can be found in the modules \texttt{[Tracking4D]} (see Section~\ref{tracking4d}) and \texttt{[Correlations]} (see Section~\ref{correlations}).
\begin{warning}
\textbf{Tip:} To save time, one can limit the number of processed tracks. For instance, set \parameter{number_of_tracks = 100000} (see Section~\ref{sec:framework_parameters}).
......
......@@ -143,7 +143,6 @@ void AlignmentTrackChi2::finalise() {
// Store the alignment shifts per detector:
std::map<std::string, std::vector<double>> shiftsX;
std::map<std::string, std::vector<double>> shiftsY;
std::map<std::string, std::vector<double>> shiftsZ;
std::map<std::string, std::vector<double>> rotX;
std::map<std::string, std::vector<double>> rotY;
std::map<std::string, std::vector<double>> rotZ;
......@@ -217,8 +216,6 @@ void AlignmentTrackChi2::finalise() {
static_cast<double>(Units::convert(detector->displacement().X() - old_position.X(), "um")));
shiftsY[detectorID].push_back(
static_cast<double>(Units::convert(detector->displacement().Y() - old_position.Y(), "um")));
shiftsZ[detectorID].push_back(
static_cast<double>(Units::convert(detector->displacement().Z() - old_position.Z(), "um")));
rotX[detectorID].push_back(
static_cast<double>(Units::convert(detector->rotation().X() - old_orientation.X(), "deg")));
rotY[detectorID].push_back(
......@@ -279,13 +276,6 @@ void AlignmentTrackChi2::finalise() {
align_correction_shiftY[detector->name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftY[detector->name()]->Write(name.c_str());
name = "alignment_correction_displacementZ_" + detector->name();
align_correction_shiftZ[detector->name()] =
new TGraph(static_cast<int>(shiftsZ[detector->name()].size()), &iterations[0], &shiftsZ[detector->name()][0]);
align_correction_shiftZ[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_shiftZ[detector->name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftZ[detector->name()]->Write(name.c_str());
name = "alignment_correction_rotationX_" + detector->name();
align_correction_rotX[detector->name()] =
new TGraph(static_cast<int>(rotX[detector->name()].size()), &iterations[0], &rotX[detector->name()][0]);
......
......@@ -44,7 +44,6 @@ namespace corryvreckan {
std::map<std::string, TGraph*> align_correction_shiftX;
std::map<std::string, TGraph*> align_correction_shiftY;
std::map<std::string, TGraph*> align_correction_shiftZ;
std::map<std::string, TGraph*> align_correction_rotX;
std::map<std::string, TGraph*> align_correction_rotY;
std::map<std::string, TGraph*> align_correction_rotZ;
......
......@@ -22,7 +22,6 @@ For each detector the following plots are produced:
* Translational shift along X-axis vs. iteration number
* Translational shift along Y-axis vs. iteration number
* Translational shift along Z-axis vs. iteration number
* Rotational shift around X-axis vs. iteration number
* Rotational shift around Y-axis vs. iteration number
* Rotational shift around Z-axis vs. iteration number
......
......@@ -3,8 +3,7 @@ CORRYVRECKAN_DETECTOR_MODULE(MODULE_NAME)
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
TestAlgorithm.cpp
# ADD SOURCE FILES HERE...
Correlations.cpp
)
# Provide standard install target
......
#include "Correlations.h"
using namespace corryvreckan;
using namespace std;
Correlations::Correlations(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
// Backwards compatibilty: also allow timing_cut to be used for time_cut_abs
m_config.setAlias("time_cut_abs", "timing_cut", true);
m_config.setAlias("do_time_cut", "do_timing_cut", true);
do_time_cut_ = m_config.get<bool>("do_time_cut", false);
if(m_config.count({"time_cut_rel", "time_cut_abs"}) > 1) {
throw InvalidCombinationError(
m_config, {"time_cut_rel", "time_cut_abs"}, "Absolute and relative time cuts are mutually exclusive.");
} else if(m_config.has("time_cut_abs")) {
timeCut = m_config.get<double>("time_cut_abs");
} else {
timeCut = m_config.get<double>("time_cut_rel", 3.0) * m_detector->getTimeResolution();
}
m_corr_vs_time = m_config.get<bool>("correlation_vs_time", false);
}
void Correlations::initialise() {
// Do not produce correlations plots for auxiliary devices
if(m_detector->isAuxiliary()) {
return;
}
LOG(DEBUG) << "Booking histograms for detector " << m_detector->name();
// get the reference detector:
std::shared_ptr<Detector> reference = get_reference();
// Simple hit map
std::string title = m_detector->name() + ": hitmap;x [px];y [px];events";
hitmap = new TH2F("hitmap",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
title = m_detector->name() + ": hitmap of clusters;x [px];y [px];events";
hitmap_clusters = new TH2F("hitmap_clusters",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
// Correlation plots
title = m_detector->name() + ": correlation X;x_{ref}-x [mm];events";
correlationX = new TH1F("correlationX", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation Y;y_{ref}-y [mm];events";
correlationY = new TH1F("correlationY", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation XY;y_{ref}-x [mm];events";
correlationXY = new TH1F("correlationXY", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation YX;x_{ref}-y [mm];events";
correlationYX = new TH1F("correlationYX", title.c_str(), 1000, -10., 10.);
// time correlation plot range should cover length of events. nanosecond binning.
title = m_detector->name() + "Reference cluster time stamp - cluster time stamp;t_{ref}-t [ns];events";
correlationTime = new TH1F("correlationTime", title.c_str(), static_cast<int>(2. * timeCut), -1 * timeCut, timeCut);
if(m_corr_vs_time) {
title = m_detector->name() + " Correlation X versus time;t [s];x_{ref}-x [mm];events";
std::string name = "correlationXVsTime";
correlationXVsTime = new TH2F(name.c_str(), title.c_str(), 600, 0, 3e3, 200, -10., 10.);
title = m_detector->name() + " Correlation Y versus time;t [s];y_{ref}-y [mm];events";
name = "correlationYVsTime";
correlationYVsTime = new TH2F(name.c_str(), title.c_str(), 600, 0, 3e3, 200, -10., 10.);
title =
m_detector->name() + "Reference cluster time stamp - cluster time stamp over time;t [s];t_{ref}-t [ns];events";
correlationTimeOverTime = new TH2F(
"correlationTimeOverTime", title.c_str(), 3e3, 0, 3e3, static_cast<int>(2. * timeCut), -1 * timeCut, timeCut);
}
title = m_detector->name() + "Reference pixel time stamp - pixel time stamp;t_{ref}-t [ns];events";
correlationTime_px =
new TH1F("correlationTime_px", title.c_str(), static_cast<int>(2. * timeCut), -1 * timeCut, timeCut);
title = m_detector->name() + "Reference cluster time stamp - cluster time stamp;t_{ref}-t [1/40MHz];events";
correlationTimeInt = new TH1F("correlationTimeInt", title.c_str(), 8000, -40000, 40000);
// 2D correlation plots (pixel-by-pixel, local coordinates):
title = m_detector->name() + ": 2D correlation X (local);x [px];x_{ref} [px];events";
correlationX2Dlocal = new TH2F("correlationX_2Dlocal",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
reference->nPixels().X(),
0,
reference->nPixels().X());
title = m_detector->name() + ": 2D correlation Y (local);y [px];y_{ref} [px];events";
correlationY2Dlocal = new TH2F("correlationY_2Dlocal",
title.c_str(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y(),
reference->nPixels().Y(),
0,
reference->nPixels().Y());
title = m_detector->name() + ": correlation col to col;col [px];col_{ref} [px];events";
correlationColCol_px = new TH2F("correlationColCol_px",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
reference->nPixels().X(),
0,
reference->nPixels().X());
title = m_detector->name() + ": correlation col to row;col [px];row_{ref} [px];events";
correlationColRow_px = new TH2F("correlationColRow_px",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
reference->nPixels().Y(),
0,
reference->nPixels().Y());
title = m_detector->name() + ": correlation row to col;row [px];col_{ref} [px];events";
correlationRowCol_px = new TH2F("correlationRowCol_px",
title.c_str(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y(),
reference->nPixels().X(),
0,
reference->nPixels().X());
title = m_detector->name() + ": correlation row to row;row [px];row_{ref} [px];events";
correlationRowRow_px = new TH2F("correlationRowRow_px",
title.c_str(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y(),
reference->nPixels().Y(),
0,
reference->nPixels().Y());
title = m_detector->name() + ": 2D correlation X (global);x [mm];x_{ref} [mm];events";
correlationX2D = new TH2F("correlationX_2D", title.c_str(), 100, -10., 10., 100, -10., 10.);
title = m_detector->name() + ": 2D correlation Y (global);y [mm];y_{ref} [mm];events";
correlationY2D = new TH2F("correlationY_2D", title.c_str(), 100, -10., 10., 100, -10., 10.);
// Timing plots
title = m_detector->name() + ": event time;t [s];events";
eventTimes = new TH1F("eventTimes", title.c_str(), 3000000, 0, 300);
}
StatusCode Correlations::run(std::shared_ptr<Clipboard> clipboard) {
// Do not attempt plotting for aux devices
if(m_detector->isAuxiliary()) {
return StatusCode::Success;
}
// Get the pixels
auto pixels = clipboard->getData<Pixel>(m_detector->name());
if(pixels == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any pixels on the clipboard";
return StatusCode::NoData;
}
// Loop over all pixels and make hitmaps
for(auto& pixel : (*pixels)) {
// Hitmap
hitmap->Fill(pixel->column(), pixel->row());
// Timing plots
eventTimes->Fill(static_cast<double>(Units::convert(pixel->timestamp(), "s")));
}
// Get the clusters
auto clusters = clipboard->getData<Cluster>(m_detector->name());
if(clusters == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any clusters on the clipboard";
return StatusCode::NoData;
}
for(auto& cluster : (*clusters)) {
hitmap_clusters->Fill(cluster->column(), cluster->row());
}
// Get pixels/clusters from reference detector
auto reference = get_reference();
auto referencePixels = clipboard->getData<Pixel>(reference->name());
auto referenceClusters = clipboard->getData<Cluster>(reference->name());
if(referenceClusters == nullptr) {
LOG(DEBUG) << "Reference detector " << reference->name() << " does not have any clusters on the clipboard";
return StatusCode::NoData;
}
// Loop over all clusters and fill histograms
for(auto& pixel : (*pixels)) {
// Loop over reference plane pixels:
for(auto& refPixel : (*referencePixels)) {
correlationColCol_px->Fill(pixel->column(), refPixel->column());
correlationColRow_px->Fill(pixel->column(), refPixel->row());
correlationRowCol_px->Fill(pixel->row(), refPixel->column());
correlationRowRow_px->Fill(pixel->row(), refPixel->row());
correlationTime_px->Fill(static_cast<double>(Units::convert(refPixel->timestamp() - pixel->timestamp(), "ns")));
}
}
for(auto& cluster : (*clusters)) {
// Check that track is within region of interest using winding number algorithm
if(!m_detector->isWithinROI(cluster)) {
LOG(DEBUG) << " - cluster outside ROI";
} else {
// Loop over reference plane clusters to make correlation plots
for(auto& refCluster : (*referenceClusters)) {
double timeDifference = refCluster->timestamp() - cluster->timestamp();
// in 40 MHz:
long long int timeDifferenceInt = static_cast<long long int>(timeDifference / 25);
// Correlation plots
if(abs(timeDifference) < timeCut || !do_time_cut_) {
correlationX->Fill(refCluster->global().x() - cluster->global().x());
correlationX2D->Fill(cluster->global().x(), refCluster->global().x());
correlationX2Dlocal->Fill(cluster->column(), refCluster->column());
correlationY->Fill(refCluster->global().y() - cluster->global().y());
correlationY2D->Fill(cluster->global().y(), refCluster->global().y());
correlationY2Dlocal->Fill(cluster->row(), refCluster->row());
correlationXY->Fill(refCluster->global().y() - cluster->global().x());
correlationYX->Fill(refCluster->global().x() - cluster->global().y());
}
correlationTime->Fill(timeDifference); // time difference in ns
LOG(DEBUG) << "Time difference: " << Units::display(timeDifference, {"ns", "us"})
<< ", Time ref. cluster: " << Units::display(refCluster->timestamp(), {"ns", "us"})
<< ", Time cluster: " << Units::display(cluster->timestamp(), {"ns", "us"});
if(m_corr_vs_time) {
if(abs(timeDifference) < timeCut || !do_time_cut_) {
correlationXVsTime->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "s")),
refCluster->global().x() - cluster->global().x());
correlationYVsTime->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "s")),
refCluster->global().y() - cluster->global().y());
}
// Time difference in ns
correlationTimeOverTime->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "s")),
timeDifference);
}
correlationTimeInt->Fill(static_cast<double>(timeDifferenceInt));
}
}
}
return StatusCode::Success;
}
#ifndef TESTALGORITHM_H
#define TESTALGORITHM_H 1
#ifndef CORRELATIONS_H
#define CORRELATIONS_H 1
#include <TCanvas.h>
#include <TH1F.h>
......@@ -12,12 +12,12 @@
namespace corryvreckan {
/** @ingroup Modules
*/
class TestAlgorithm : public Module {
class Correlations : public Module {
public:
// Constructors and destructors
TestAlgorithm(Configuration config, std::shared_ptr<Detector> detector);
~TestAlgorithm() {}
Correlations(Configuration config, std::shared_ptr<Detector> detector);
~Correlations() {}
// Functions
void initialise();
......@@ -52,10 +52,9 @@ namespace corryvreckan {
TH2F* correlationYVsTime;
// Parameters which can be set by user
bool makeCorrelations;
double timeCut;
bool do_time_cut_;
bool m_corr_vs_time;
};
} // namespace corryvreckan
#endif // TESTALGORITHM_H
#endif // CORRELATIONS_H
# TestAlgorithm
# Correlations
**Maintainer**: Simon Spannagel (<simon.spannagel@cern.ch>), Daniel Hynds (<daniel.hynds@cern.ch>)
**Module Type**: *DETECTOR*
**Detector Type**: *all*
**Status**: Functional
**Status**: Functional
### Description
This module collects `pixel` and `cluster` objects from the clipboard and creates correlation and timing plots with respect to the reference detector.
### Parameters
* `make_correlations`: Boolean to change if correlation plots should be outputted. Default value is `false`.
* `do_time_cut`: Boolean to switch on/off the cut on cluster times for correlations. Defaults to `false`.
* `time_cut_rel`: Number of standard deviations the `time_resolution` of the detector plane will be multiplied by. This value is then used as the maximum time difference for cluster correlation if `do_time_cut = true`. A relative time cut is applied by default when `do_time_cut = true`. Absolute and relative time cuts are mutually exclusive. Defaults to `3.0`.
* `time_cut_abs`: Specifies an absolute value for the maximum time difference allowed for cluster correlation if `do_time_cut = true`. Absolute and relative time cuts are mutually exclusive. No default value.
......@@ -41,6 +40,5 @@ For each device the following plots are produced:
### Usage
```toml
[TestAlgorithm]
make_correlations = true
[Correlations]
```
......@@ -16,7 +16,7 @@ OnlineMonitor::OnlineMonitor(Configuration config, std::vector<std::shared_ptr<D
canvas_overview = m_config.getMatrix<std::string>("overview",
{{"Tracking4D/trackChi2"},
{"Clustering4D/%REFERENCE%/clusterCharge"},
{"TestAlgorithm/%REFERENCE%/hitmap", "colz"},
{"Correlations/%REFERENCE%/hitmap", "colz"},
{"Tracking4D/%REFERENCE%/residualsX"}});
// Set up individual plots for the DUT
......@@ -34,19 +34,19 @@ OnlineMonitor::OnlineMonitor(Configuration config, std::vector<std::shared_ptr<D
{"Tracking4D/trackChi2ndof"},
{"Tracking4D/tracksPerEvent"},
{"Tracking4D/clustersPerTrack"}});
canvas_hitmaps = m_config.getMatrix<std::string>("hitmaps", {{"TestAlgorithm/%DETECTOR%/hitmap", "colz"}});
canvas_hitmaps = m_config.getMatrix<std::string>("hitmaps", {{"Correlations/%DETECTOR%/hitmap", "colz"}});
canvas_residuals = m_config.getMatrix<std::string>("residuals", {{"Tracking4D/%DETECTOR%/residualsX"}});
canvas_cx = m_config.getMatrix<std::string>("correlation_x", {{"TestAlgorithm/%DETECTOR%/correlationX"}});
canvas_cx = m_config.getMatrix<std::string>("correlation_x", {{"Correlations/%DETECTOR%/correlationX"}});
canvas_cx2d =
m_config.getMatrix<std::string>("correlation_x2d", {{"TestAlgorithm/%DETECTOR%/correlationX_2Dlocal", "colz"}});
canvas_cy = m_config.getMatrix<std::string>("correlation_y", {{"TestAlgorithm/%DETECTOR%/correlationY"}});
m_config.getMatrix<std::string>("correlation_x2d", {{"Correlations/%DETECTOR%/correlationX_2Dlocal", "colz"}});
canvas_cy = m_config.getMatrix<std::string>("correlation_y", {{"Correlations/%DETECTOR%/correlationY"}});
canvas_cy2d =
m_config.getMatrix<std::string>("correlation_y2d", {{"TestAlgorithm/%DETECTOR%/correlationY_2Dlocal", "colz"}});
m_config.getMatrix<std::string>("correlation_y2d", {{"Correlations/%DETECTOR%/correlationY_2Dlocal", "colz"}});
canvas_charge = m_config.getMatrix<std::string>("charge_distributions", {{"Clustering4D/%DETECTOR%/clusterCharge"}});
canvas_time = m_config.getMatrix<std::string>("event_times", {{"TestAlgorithm/%DETECTOR%/eventTimes"}});
canvas_time = m_config.getMatrix<std::string>("event_times", {{"Correlations/%DETECTOR%/eventTimes"}});
}
void OnlineMonitor::initialise() {
......
......@@ -36,15 +36,15 @@ The "corryvreckan" namespace is not required to be added to the plot path.
* `overview`: List of plots to be placed on the "Overview" canvas of the online monitor. The list of plots created in the default configuration is listed below.
* `dut_plots`: List of plots to be placed on the "DUTPlots" canvas of the online monitor. By default, this canvas contains plots collected from the `EventLoaderEUDAQ2` as well as the `AnalysisDUT` modules for the each configured DUT. This canvas should be customized for the respective DUT.
* `hitmaps`: List of plots to be placed on the "HitMaps" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/hitmap` for all detectors.
* `hitmaps`: List of plots to be placed on the "HitMaps" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/hitmap` for all detectors.
* `tracking`: List of plots to be placed on the "Tracking" canvas of the online monitor. The list of plots created in the default configuration is listed below.
* `residuals`: List of plots to be placed on the "Residuals" canvas of the online monitor. By default, this canvas displays `Tracking4D/%DETECTOR%/residualsX` for all detectors.
* `correlation_x`: List of plots to be placed on the "CorrelationX" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/correlationX` for all detectors.
* `correlation_y`: List of plots to be placed on the "CorrelationY" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/correlationY` for all detectors.
* `correlation_x2d`: List of plots to be placed on the "CorrelationX2D" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/correlationX_2Dlocal` for all detectors.
* `correlation_y2d`: List of plots to be placed on the "CorrelationY2D" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/correlationY_2Dlocal` for all detectors.
* `correlation_x`: List of plots to be placed on the "CorrelationX" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/correlationX` for all detectors.
* `correlation_y`: List of plots to be placed on the "CorrelationY" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/correlationY` for all detectors.
* `correlation_x2d`: List of plots to be placed on the "CorrelationX2D" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/correlationX_2Dlocal` for all detectors.
* `correlation_y2d`: List of plots to be placed on the "CorrelationY2D" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/correlationY_2Dlocal` for all detectors.
* `charge_distributions`: List of plots to be placed on the "ChargeDistributions" canvas of the online monitor. By default, this canvas displays `Clustering4D/%DETECTOR%/clusterCharge` for all detectors.
* `event_times`: List of plots to be placed on the "EventTimes" canvas of the online monitor. By default, this canvas displays `TestAlgorithm/%DETECTOR%/eventTimes` for all detectors.
* `event_times`: List of plots to be placed on the "EventTimes" canvas of the online monitor. By default, this canvas displays `Correlations/%DETECTOR%/eventTimes` for all detectors.
### Plots produced
Overview canvas:
......
#include "TestAlgorithm.h"
using namespace corryvreckan;
using namespace std;
TestAlgorithm::TestAlgorithm(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
// Backwards compatibilty: also allow timing_cut to be used for time_cut_abs
m_config.setAlias("time_cut_abs", "timing_cut", true);
m_config.setAlias("do_time_cut", "do_timing_cut", true);
makeCorrelations = m_config.get<bool>("make_correlations", false);
do_time_cut_ = m_config.get<bool>("do_time_cut", false);
if(m_config.count({"time_cut_rel", "time_cut_abs"}) > 1) {
throw InvalidCombinationError(
m_config, {"time_cut_rel", "time_cut_abs"}, "Absolute and relative time cuts are mutually exclusive.");
} else if(m_config.has("time_cut_abs")) {
timeCut = m_config.get<double>("time_cut_abs");
} else {
timeCut = m_config.get<double>("time_cut_rel", 3.0) * m_detector->getTimeResolution();
}
m_corr_vs_time = m_config.get<bool>("correlation_vs_time", false);
}
void TestAlgorithm::initialise() {
if(m_detector->isAuxiliary()) {
return;
}
LOG(DEBUG) << "Booking histograms for detector " << m_detector->name();
// get the reference detector:
std::shared_ptr<Detector> reference = get_reference();
// Simple hit map
std::string title = m_detector->name() + ": hitmap;x [px];y [px];events";
hitmap = new TH2F("hitmap",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
title = m_detector->name() + ": hitmap of clusters;x [px];y [px];events";
hitmap_clusters = new TH2F("hitmap_clusters",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
if(makeCorrelations) {
// Correlation plots
title = m_detector->name() + ": correlation X;x_{ref}-x [mm];events";
correlationX = new TH1F("correlationX", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation Y;y_{ref}-y [mm];events";
correlationY = new TH1F("correlationY", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation XY;y_{ref}-x [mm];events";
correlationXY = new TH1F("correlationXY", title.c_str(), 1000, -10., 10.);
title = m_detector->name() + ": correlation YX;x_{ref}-y [mm];events";
correlationYX = new TH1F("correlationYX", title.c_str(), 1000, -10., 10.);
// time correlation plot range should cover length of events. nanosecond binning.
title = m_detector->name() + "Reference cluster time stamp - cluster time stamp;t_{ref}-t [ns];events";
correlationTime = new TH1F("correlationTime", title.c_str(), static_cast<int>(2. * timeCut), -1 * timeCut, timeCut);
if(m_corr_vs_time) {
title = m_detector->name() + " Correlation X versus time;t [s];x_{ref}-x [mm];events";
std::string name = "correlationXVsTime";
correlationXVsTime = new TH2F(name.c_str(), title.c_str(), 600, 0, 3e3, 200, -10., 10.);
title = m_detector->name() + " Correlation Y versus time;t [s];y_{ref}-y [mm];events";
name = "correlationYVsTime";
correlationYVsTime = new TH2F(name.c_str(), title.c_str(), 600, 0, 3e3, 200, -10., 10.);
title = m_detector->name() +
"Reference cluster time stamp - cluster time stamp over time;t [s];t_{ref}-t [ns];events";
correlationTimeOverTime = new TH2F("correlationTimeOverTime",
title.c_str(),
3e3,
0,
3e3,
static_cast<int>(2. * timeCut),
-1 * timeCut,
timeCut);
}
title = m_detector->name() + "Reference pixel time stamp - pixel time stamp;t_{ref}-t [ns];events";
correlationTime_px =
new TH1F("correlationTime_px", title.c_str(), static_cast<int>(2. * timeCut), -1 * timeCut, timeCut);
title = m_detector->name() + "Reference cluster time stamp - cluster time stamp;t_{ref}-t [1/40MHz];events";
correlationTimeInt = new TH1F("correlationTimeInt", title.c_str(), 8000, -40000, 40000);
// 2D correlation plots (pixel-by-pixel, local coordinates):
title = m_detector->name() + ": 2D correlation X (local);x [px];x_{ref} [px];events";
correlationX2Dlocal = new TH2F("correlationX_2Dlocal",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
reference->nPixels().X(),
0,
reference->nPixels().X());
title = m_detector->name() + ": 2D correlation Y (local);y [px];y_{ref} [px];events";
correlationY2Dlocal = new TH2F("correlationY_2Dlocal",
title.c_str(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y(),
reference->nPixels().Y(),
0,
reference->nPixels().Y());
title = m_detector->name() + ": correlation col to col;col [px];col_{ref} [px];events";
correlationColCol_px = new TH2F("correlationColCol_px",<