Commit 8955e5a5 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'desy-fixed-to-be-reviewed' into 'master'

Bits & Pieces from the DESY Testbeam

See merge request !181
parents 888bb77f 94915411
Pipeline #1147303 passed with stages
in 23 minutes and 6 seconds
This diff is collapsed.
#ifndef AnalysisCLICpix_H
#define AnalysisCLICpix_H 1
#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TProfile2D.h>
#include <iostream>
#include <sstream>
#include "core/module/Module.hpp"
namespace corryvreckan {
/** @ingroup Modules
*/
class AnalysisCLICpix : public Module {
public:
// Constructors and destructors
AnalysisCLICpix(Configuration config, std::shared_ptr<Detector> detector);
// Functions
void initialise();
StatusCode run(std::shared_ptr<Clipboard> clipboard);
void finalise();
private:
std::shared_ptr<Detector> m_detector;
bool checkMasked(double, double);
void fillClusterHistos(std::shared_ptr<ClusterVector>);
bool checkProximity(Track*, std::shared_ptr<TrackVector>);
void fillResponseHistos(double, double, Cluster*);
// Cluster/pixel histograms
TH2F* hHitPixels;
TH1F* hColumnHits;
TH1F* hRowHits;
TH1F* hClusterSizeAll;
TH1F* hClusterChargeAll;
TH1F* hClustersPerEvent;
TH1F* hClustersVersusEventNo;
TH1F* hClusterWidthRow;
TH1F* hClusterWidthCol;
// Track histograms
TH1F* hGlobalTrackDifferenceX;
TH1F* hGlobalTrackDifferenceY;
TH1F* hGlobalResidualsX;
TH1F* hGlobalResidualsY;
TH1F* hAbsoluteResiduals;
TH2F* hGlobalResidualsXversusX;
TH2F* hGlobalResidualsXversusY;
TH2F* hGlobalResidualsYversusY;
TH2F* hGlobalResidualsYversusX;
TH2F* hGlobalResidualsXversusColWidth;
TH2F* hGlobalResidualsXversusRowWidth;
TH2F* hGlobalResidualsYversusColWidth;
TH2F* hGlobalResidualsYversusRowWidth;
TH1F* hTrackInterceptRow;
TH1F* hTrackInterceptCol;
TH2F* hAbsoluteResidualMap;
TH2F* hXresidualVersusYresidual;
TH1F* hAssociatedClustersPerEvent;
TH1F* hAssociatedClustersVersusEventNo;
TH1F* hAssociatedClustersVersusTriggerNo;
TH1F* hAssociatedClusterRow;
TH1F* hAssociatedClusterColumn;
TH1F* hFrameEfficiency;
TH1F* hFrameTracks;
TH1F* hFrameTracksAssociated;
TH1F* hClusterSizeAssociated;
TH1F* hClusterWidthRowAssociated;
TH1F* hClusterWidthColAssociated;
TH1F* hClusterChargeAssociated;
TH1F* hClusterChargeAssociated1pix;
TH1F* hClusterChargeAssociated2pix;
TH1F* hClusterChargeAssociated3pix;
TH1F* hClusterChargeAssociated4pix;
TH1F* hPixelResponseX;
TH1F* hPixelResponseGlobalX;
TH1F* hPixelResponseXOddCol;
TH1F* hPixelResponseXEvenCol;
TH1F* hPixelResponseY;
TH1F* hPixelResponseGlobalY;
TH1F* hPixelResponseYOddCol;
TH1F* hPixelResponseYEvenCol;
TH2F* hEtaDistributionX;
TH2F* hEtaDistributionY;
TH1F* hResidualsLocalRow2pix;
TH1F* hResidualsLocalCol2pix;
TH1F* hClusterChargeRow2pix;
TH1F* hClusterChargeCol2pix;
TH1F* hPixelTOTRow2pix;
TH1F* hPixelTOTCol2pix;
TH1F* hClusterChargeRatioRow2pix;
TH1F* hClusterChargeRatioCol2pix;
// Maps
TH2F* hTrackIntercepts;
TH2F* hTrackInterceptsAssociated;
TH2F* hGlobalClusterPositions;
TH2F* hGlobalAssociatedClusterPositions;
TH2F* hTrackInterceptsPixel;
TH2F* hTrackInterceptsPixelAssociated;
TH2F* hTrackInterceptsChip;
TH2F* hTrackInterceptsChipAssociated;
TH2F* hTrackInterceptsChipUnassociated;
TH2F* hTrackInterceptsChipLost;
TH2F* hPixelEfficiencyMap;
TH2F* hChipEfficiencyMap;
TH2F* hGlobalEfficiencyMap;
TH2F* hInterceptClusterSize1;
TH2F* hInterceptClusterSize2;
TH2F* hInterceptClusterSize3;
TH2F* hInterceptClusterSize4;
TProfile2D* hPixelToTMap;
TH2F* hMapClusterSizeAssociated;
int m_nBinsX;
int m_nBinsY;
std::map<int, TH1F*> hMapClusterChargeAssociated1pix;
// Member variables
int m_eventNumber;
int m_triggerNumber;
std::map<int, double> m_hitPixels;
double m_associationCut;
double m_proximityCut;
int m_lostHits;
bool timepix3Telescope;
};
} // namespace corryvreckan
#endif // AnalysisCLICpix_H
# Define module and return the generated name as MODULE_NAME
CORRYVRECKAN_DUT_MODULE(MODULE_NAME)
CORRYVRECKAN_DETECTOR_TYPE(${MODULE_NAME} "CLICpix")
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
AnalysisCLICpix.cpp
)
# Provide standard install target
CORRYVRECKAN_MODULE_INSTALL(${MODULE_NAME})
# AnalysisCLICpix
**Maintainer**: Daniel Hynds (<daniel.hynds@cern.ch>)
**Module Type**: *DUT*
**Detector Type**: *CLICpix*
**Status**: Outdated
### Description
This module associates CLICpix2 DUT clusters to tracks using a spatial cut (device type not checked). A significant number of analysis plots are produced.
### Parameters
* `association_cut`: Maximum distance between a track and cluster for them to be associated. Units of mm. Default value is `50um`.
* `proximity_cut`: Maximum distance apart two tracks are for them to be 'close' to each other. If at the CLICpix plane there are two tracks close to each other, the DUT cluster is not associated with either track. Units of mm. Default value is `0.5um`.
* `timepix3_telescope`: Boolean to set whether the Timepix3 telescope is being used. Default value is `false`.
### Plots produced
The following plots are produced: (Quite many of them are not filled currently!)
* 2D hitmap
* Column hits histogram
* Row hits histogram
* Cluster size histogram
* Cluster charge histogram
* Clusters per event histogram
* Clusters vs event number
* Cluster width histogram (rows, Y-axis)
* Cluster width histogram (columns, X-axis)
* Global track difference in X
* Global track difference in Y
* Global residuals in X
* Global residuals in Y
* Absolute residuals
* Global residuals in X vs X
* Global residuals in X vs Y
* Global residuals in Y vs X
* Global residuals in Y vs Y
* Global residuals in X vs column width
* Global residuals in X vs row width
* Global residuals in Y vs column width
* Global residuals in Y vs row width
* Track intercept in rows
* Track intercept in columns
* Absolute residual map histogram
* X residual vs Y residual
* Associated clusters per event histogram
* Associated clusters vs event number
* Associated clusters vs trigger number
* Associated cluster row
* Associated cluster column
* Frame efficiency histogram
* Frame tracks
* Associated frame tracks
* Associated cluster size
* Associated cluster width (row)
* Associated cluster width (column)
* Associated 1-pixel cluster charge
* Associated 2-pixel cluster charge
* Associated 3-pixel cluster charge
* Associated 4-pixel cluster charge
* Pixel response in X
* Pixel response in X in global coordinates
* Pixel response in X for odd columns
* Pixel response in X for even columns
* Pixel response in Y
* Pixel response in Y in global coordinates
* Pixel response in Y for odd columns
* Pixel response in Y for even columns
* 2D eta distribution in X
* 2D eta distribution in Y
* Local residual for rows for 2-pixel clusters
* Local residual for columns for 2-pixel clusters
* Cluster charge for rows for 2-pixel clusters
* Cluster charge for columns for 2-pixel clusters
* Pixel ToT for rows for 2-pixel clusters
* Pixel ToT for columns for 2-pixel clusters
* Cluster charge ratio for rows for 2-pixel clusters
* Cluster charge ratio for rows for 2-pixel clusters
* Local residuals for rows for 2-pixel clusters
* 2D track intercepts
* 2D associated track intercepts
* 2D cluster positions in global coordinates
* 2D associated cluster positions in global coordinates
* 2D track-pixel intercepts
* 2D track-associated pixel intercepts
* 2D track-chip intercepts
* 2D track-associated chip intercepts
* 2D track-unassociated chip intercepts
* 2D track-chip intercepts lost
* 2D pixel efficiency
* 2D chip efficiency
* 2D global efficiency
* 2D intercepts for cluster size of 1-pixel
* 2D intercepts for cluster size of 2-pixel
* 2D intercepts for cluster size of 3-pixel
* 2D intercepts for cluster size of 4-pixel
* 2D Associated cluster size map
### Usage
```toml
[CLICpixAnalysis]
association_cut = 0.005mm
proximity_cut = 0.005mm
timepix3Telescope = true
```
......@@ -53,6 +53,16 @@ void EventLoaderEUDAQ2::initialise() {
0,
m_detector->nPixels().Y());
title = "rawValues; column; row; raw values";
hRawValuesMap = new TProfile2D("hRawValuesMap",
title.c_str(),
m_detector->nPixels().X(),
0,
m_detector->nPixels().X(),
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
title = ";hit time [ms];# events";
hPixelTimes = new TH1F("hPixelTimes", title.c_str(), 3e6, 0, 3e3);
......@@ -238,6 +248,8 @@ Event::Position EventLoaderEUDAQ2::is_within_event(std::shared_ptr<Clipboard> cl
} else if(trigger_position == Event::Position::UNKNOWN) {
LOG(DEBUG) << "Trigger ID " << evt->GetTriggerN() << " within Corryvreckan event range but not registered";
} else {
evt->SetTimeBegin(static_cast<uint64_t>(clipboard->getEvent()->getTriggerTime(evt->GetTriggerN()) * 1000));
evt->SetTimeEnd(static_cast<uint64_t>(clipboard->getEvent()->getTriggerTime(evt->GetTriggerN()) * 1000));
LOG(DEBUG) << "Trigger ID " << evt->GetTriggerN() << " found in Corryvreckan event";
}
return trigger_position;
......@@ -332,7 +344,13 @@ std::shared_ptr<PixelVector> EventLoaderEUDAQ2::get_pixel_data(std::shared_ptr<e
auto col = static_cast<int>(plane.GetX(i));
auto row = static_cast<int>(plane.GetY(i));
auto raw = static_cast<int>(plane.GetPixel(i)); // generic pixel raw value (could be ToT, ADC, ...)
auto ts = static_cast<double>(plane.GetTimestamp(i)) / 1000 + m_detector->timingOffset();
double ts;
if(plane.GetTimestamp(i) == 0) {
ts = static_cast<double>(evt->GetTimeBegin()) / 1000 + m_detector->timingOffset();
} else {
ts = static_cast<double>(plane.GetTimestamp(i)) / 1000 + m_detector->timingOffset();
}
if(col >= m_detector->nPixels().X() || row >= m_detector->nPixels().Y()) {
LOG(WARNING) << "Pixel address " << col << ", " << row << " is outside of pixel matrix with size "
......@@ -353,6 +371,7 @@ std::shared_ptr<PixelVector> EventLoaderEUDAQ2::get_pixel_data(std::shared_ptr<e
hPixelTimes->Fill(static_cast<double>(Units::convert(ts, "ms")));
hPixelTimes_long->Fill(static_cast<double>(Units::convert(ts, "s")));
hPixelRawValues->Fill(raw);
hRawValuesMap->Fill(col, row, raw);
pixels->push_back(pixel);
}
......
......@@ -18,6 +18,7 @@
#include <TH1F.h>
#include <TH2F.h>
#include <TProfile.h>
#include <TProfile2D.h>
#include "core/module/Module.hpp"
#include "eudaq/FileReader.hh"
......@@ -141,6 +142,9 @@ namespace corryvreckan {
// 2D histograms
TH2F* hitmap;
// 2D profiles
TProfile2D* hRawValuesMap;
// 1D histograms
TH1F* hPixelTimes;
TH1F* hPixelTimes_long;
......
......@@ -25,6 +25,9 @@ If yes, the corresponding pixels are added to the clipboard for this event.
If earlier, the next event is read until a matching event is found.
If later, the pointer to this event is kept and it continues with the next detector.
Data from detectors with triggered readout and without timestamps are matched against trigger IDs stored in the currently defined Corryvreckan event.
In case of a match, the timestamp of the respective trigger is assigned to all pixels of the device.
If no detector is capable of defining events, the `[Metronome]` model needs to be used.
Tags stores in the EUDAQ2 event header are read, a conversion to a double value is attempted and, if successful, a profile with the value over the number of events in the respective run is automatically allocated and filled. This feature can e.g. be used to log temperatures of the devices during data taking, simply storing the temperature as event tags.
......@@ -82,7 +85,7 @@ Also, more complex constructs such as arrays or matrices read by the Corryvrecka
* 2D hitmap
* 1D pixel hit times (3 second range)
* 1D pixel hit times (3000 second range)
* 1D pixel raw value histogram (corresponds to chip-specific charge equivalent measurement, e.g. ToT)
* 1D and 2D pixel raw value histograms (corresponding to chip-specific charge equivalent measurement, e.g. ToT)
* 1D pixel multiplicity per Corryvreckan event histogram
* 1D eudaq event start histogram (3 second range)
* 1D eudaq event start histogram (3000 second range)
......
......@@ -12,6 +12,7 @@ This module collects `pixel` and `cluster` objects from the clipboard and create
* `make_correlations`: Boolean to change if correlation plots should be outputted. Default value is `false`.
* `do_timing_cut`: Boolean to switch on/off the cut on cluster times for correlations. Defaults to `false`.
* `timing_cut`: maximum time difference between clusters to be taken into account. Only used if `do_timing_cut` is set to `true`, defaults to `100ns`.
* `correlation_time_vs_time`: Enable plotting of time correlation as a function of time. Default value is `false` because of the time required to fill the histogram with many bins.
### Plots produced
For each device the following plots are produced:
......
......@@ -9,6 +9,7 @@ TestAlgorithm::TestAlgorithm(Configuration config, std::shared_ptr<Detector> det
makeCorrelations = m_config.get<bool>("make_correlations", false);
timingCut = m_config.get<double>("timing_cut", Units::get<double>(100, "ns"));
do_timing_cut_ = m_config.get<bool>("do_timing_cut", false);
m_time_vs_time = m_config.get<bool>("correlation_time_vs_time", false);
}
void TestAlgorithm::initialise() {
......@@ -52,16 +53,19 @@ void TestAlgorithm::initialise() {
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. * timingCut), -1 * timingCut, timingCut);
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. * timingCut),
-1 * timingCut,
timingCut);
if(m_time_vs_time) {
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. * timingCut),
-1 * timingCut,
timingCut);
}
title = m_detector->name() + "Reference pixel time stamp - pixel time stamp;t_{ref}-t [ns];events";
correlationTime_px =
......@@ -213,10 +217,17 @@ StatusCode TestAlgorithm::run(std::shared_ptr<Clipboard> clipboard) {
correlationXY->Fill(refCluster->global().y() - cluster->global().x());
correlationYX->Fill(refCluster->global().x() - cluster->global().y());
}
// correlationTime[m_detector->name()]->Fill(Units::convert(timeDifference, "s"));
correlationTime->Fill(timeDifference); // time difference in ns
// correlationTimeOverTime->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "s")),
// 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_time_vs_time) {
// Time difference in ns
correlationTimeOverTime->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "s")),
timeDifference);
}
correlationTimeInt->Fill(static_cast<double>(timeDifferenceInt));
}
}
......
......@@ -53,6 +53,7 @@ namespace corryvreckan {
bool makeCorrelations;
double timingCut;
bool do_timing_cut_;
bool m_time_vs_time;
};
} // namespace corryvreckan
#endif // TESTALGORITHM_H
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