Commit 1db7f219 authored by Lennart Huth's avatar Lennart Huth
Browse files

merged master

parent 7c0e2381
......@@ -37,12 +37,40 @@ AnalysisDUT::AnalysisDUT(Configuration& config, std::shared_ptr<Detector> detect
void AnalysisDUT::initialize() {
if(correlations_) {
hTrackCorrelationX = new TH1F(
"hTrackCorrelationX", "Track residual X, all clusters;x_{track}-x_{hit} [#mum];# entries", 8000, -1000.5, 999.5);
hTrackCorrelationY = new TH1F(
"hTrackCorrelationY", "Track residual Y, all clusters;y_{track}-y_{hit} [#mum];# entries", 8000, -1000.5, 999.5);
hTrackCorrelationTime = new TH1F("hTrackCorrelationTime",
"Track time residual, all clusters;time_{track}-time_{hit} [ns];# entries",
trackCorrelationX_beforeCuts =
new TH1F("trackCorrelationX_beforeCuts",
"Track residual X (tracks before cuts), all clusters;x_{track}-x_{hit} [#mum];# entries",
8000,
-1000.5,
999.5);
trackCorrelationY_beforeCuts =
new TH1F("trackCorrelationY_beforeCuts",
"Track residual Y (tracks before cuts), all clusters;y_{track}-y_{hit} [#mum];# entries",
8000,
-1000.5,
999.5);
trackCorrelationTime_beforeCuts =
new TH1F("trackCorrelationTime_beforeCuts",
"Track time residual (tracks before cuts), all clusters;time_{track}-time_{hit} [ns];# entries",
n_timebins_,
-(n_timebins_ + 1) / 2. * time_binning_,
(n_timebins_ - 1) / 2. * time_binning_);
trackCorrelationX_afterCuts =
new TH1F("trackCorrelationX_afterCuts",
"Track residual X (tracks after cuts), all clusters;x_{track}-x_{hit} [#mum];# entries",
8000,
-1000.5,
999.5);
trackCorrelationY_afterCuts =
new TH1F("trackCorrelationY_afterCuts",
"Track residual Y (tracks after cuts), all clusters;y_{track}-y_{hit} [#mum];# entries",
8000,
-1000.5,
999.5);
trackCorrelationTime_afterCuts =
new TH1F("trackCorrelationTime_afterCuts",
"Track time residual (tracks after cuts), all clusters;time_{track}-time_{hit} [ns];# entries",
n_timebins_,
-(n_timebins_ + 1) / 2. * time_binning_,
(n_timebins_ - 1) / 2. * time_binning_);
......@@ -391,6 +419,54 @@ void AnalysisDUT::initialize() {
-pitch_y / 2.,
pitch_y / 2.);
title = "Mean cluster charge map (1-pixel);" + mod_axes + "<cluster charge> [ke]";
qvsxmym_1px = new TProfile2D("qvsxmym_1px",
title.c_str(),
static_cast<int>(pitch_x),
-pitch_x / 2.,
pitch_x / 2.,
static_cast<int>(pitch_y),
-pitch_y / 2.,
pitch_y / 2.,
0,
250);
title = "Mean cluster charge map (2-pixel);" + mod_axes + "<cluster charge> [ke]";
qvsxmym_2px = new TProfile2D("qvsxmym_2px",
title.c_str(),
static_cast<int>(pitch_x),
-pitch_x / 2.,
pitch_x / 2.,
static_cast<int>(pitch_y),
-pitch_y / 2.,
pitch_y / 2.,
0,
250);
title = "Mean cluster charge map (3-pixel);" + mod_axes + "<cluster charge> [ke]";
qvsxmym_3px = new TProfile2D("qvsxmym_3px",
title.c_str(),
static_cast<int>(pitch_x),
-pitch_x / 2.,
pitch_x / 2.,
static_cast<int>(pitch_y),
-pitch_y / 2.,
pitch_y / 2.,
0,
250);
title = "Mean cluster charge map (4-pixel);" + mod_axes + "<cluster charge> [ke]";
qvsxmym_4px = new TProfile2D("qvsxmym_4px",
title.c_str(),
static_cast<int>(pitch_x),
-pitch_x / 2.,
pitch_x / 2.,
static_cast<int>(pitch_y),
-pitch_y / 2.,
pitch_y / 2.,
0,
250);
residualsTime = new TH1F("residualsTime",
"Time residual;time_{track}-time_{hit} [ns];#entries",
n_timebins_,
......@@ -525,15 +601,15 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
auto globalIntercept = m_detector->getIntercept(track.get());
auto localIntercept = m_detector->globalToLocal(globalIntercept);
// Fill correlation plots before applying any cuts:
// Fill correlation plots BEFORE applying any cuts:
if(correlations_) {
auto clusters = clipboard->getData<Cluster>(m_detector->getName());
for(auto& cls : clusters) {
double xdistance_um = (globalIntercept.X() - cls->global().x()) * 1000.;
double ydistance_um = (globalIntercept.Y() - cls->global().y()) * 1000.;
hTrackCorrelationX->Fill(xdistance_um);
hTrackCorrelationY->Fill(ydistance_um);
hTrackCorrelationTime->Fill(track->timestamp() - cls->timestamp());
trackCorrelationX_beforeCuts->Fill(xdistance_um);
trackCorrelationY_beforeCuts->Fill(ydistance_um);
trackCorrelationTime_beforeCuts->Fill(track->timestamp() - cls->timestamp());
}
}
......@@ -550,7 +626,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
}
// Check if it intercepts the DUT
if(!m_detector->hasIntercept(track.get(), 0.5)) {
LOG(DEBUG) << " - track outside DUT area";
hCutHisto->Fill(2);
......@@ -571,6 +646,18 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
continue;
}
// Fill correlation plots after applying cuts:
if(correlations_) {
auto clusters = clipboard->getData<Cluster>(m_detector->getName());
for(auto& cls : clusters) {
double xdistance_um = (globalIntercept.X() - cls->global().x()) * 1000.;
double ydistance_um = (globalIntercept.Y() - cls->global().y()) * 1000.;
trackCorrelationX_afterCuts->Fill(xdistance_um);
trackCorrelationY_afterCuts->Fill(ydistance_um);
trackCorrelationTime_afterCuts->Fill(track->timestamp() - cls->timestamp());
}
}
// Get the event:
auto event = clipboard->getEvent();
......@@ -595,8 +682,8 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
// Calculate in-pixel position of track in microns
auto inpixel = m_detector->inPixel(localIntercept);
auto xmod = inpixel.X() * 1000.; // convert mm -> um
auto ymod = inpixel.Y() * 1000.; // convert mm -> um
auto xmod_um = inpixel.X() * 1000.; // convert mm -> um
auto ymod_um = inpixel.Y() * 1000.; // convert mm -> um
// Loop over all associated DUT clusters:
for(auto assoc_cluster : track->getAssociatedClusters(m_detector->getName())) {
......@@ -713,11 +800,11 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
clusterWidthColAssoc->Fill(static_cast<double>(assoc_cluster->columnWidth()));
// Fill in-pixel plots: (all as function of track position within pixel cell)
qvsxmym->Fill(xmod, ymod, cluster_charge); // cluster charge profile
qMoyalvsxmym->Fill(xmod, ymod, exp(-normalized_charge / 3.5)); // norm. cluster charge profile
qvsxmym->Fill(xmod_um, ymod_um, cluster_charge); // cluster charge profile
qMoyalvsxmym->Fill(xmod_um, ymod_um, exp(-normalized_charge / 3.5)); // norm. cluster charge profile
// mean charge of cluster seed
pxqvsxmym->Fill(xmod, ymod, assoc_cluster->getSeedPixel()->charge());
pxqvsxmym->Fill(xmod_um, ymod_um, assoc_cluster->getSeedPixel()->charge());
if(assoc_cluster->size() > 1) {
for(auto& px : assoc_cluster->pixels()) {
......@@ -751,20 +838,28 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
}
// mean cluster size
npxvsxmym->Fill(xmod, ymod, static_cast<double>(assoc_cluster->size()));
if(assoc_cluster->size() == 1)
npx1vsxmym->Fill(xmod, ymod);
if(assoc_cluster->size() == 2)
npx2vsxmym->Fill(xmod, ymod);
if(assoc_cluster->size() == 3)
npx3vsxmym->Fill(xmod, ymod);
if(assoc_cluster->size() == 4)
npx4vsxmym->Fill(xmod, ymod);
npxvsxmym->Fill(xmod_um, ymod_um, static_cast<double>(assoc_cluster->size()));
if(assoc_cluster->size() == 1) {
npx1vsxmym->Fill(xmod_um, ymod_um);
qvsxmym_1px->Fill(xmod_um, ymod_um, cluster_charge);
}
if(assoc_cluster->size() == 2) {
npx2vsxmym->Fill(xmod_um, ymod_um);
qvsxmym_2px->Fill(xmod_um, ymod_um, cluster_charge);
}
if(assoc_cluster->size() == 3) {
npx3vsxmym->Fill(xmod_um, ymod_um);
qvsxmym_3px->Fill(xmod_um, ymod_um, cluster_charge);
}
if(assoc_cluster->size() == 4) {
npx4vsxmym->Fill(xmod_um, ymod_um);
qvsxmym_4px->Fill(xmod_um, ymod_um, cluster_charge);
}
// residual MAD x, y, combined (sqrt(x*x + y*y))
rmsxvsxmym->Fill(xmod, ymod, xabsdistance);
rmsyvsxmym->Fill(xmod, ymod, yabsdistance);
rmsxyvsxmym->Fill(xmod, ymod, fabs(sqrt(xdistance * xdistance + ydistance * ydistance)));
rmsxvsxmym->Fill(xmod_um, ymod_um, xabsdistance);
rmsyvsxmym->Fill(xmod_um, ymod_um, yabsdistance);
rmsxyvsxmym->Fill(xmod_um, ymod_um, fabs(sqrt(xdistance * xdistance + ydistance * ydistance)));
hAssociatedTracksGlobalPosition->Fill(globalIntercept.X(), globalIntercept.Y());
hAssociatedTracksLocalPosition->Fill(m_detector->getColumn(localIntercept), m_detector->getRow(localIntercept));
......
......@@ -38,9 +38,8 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector;
// Histograms
TH1F* hTrackCorrelationX;
TH1F* hTrackCorrelationY;
TH1F* hTrackCorrelationTime;
TH1F *trackCorrelationX_beforeCuts, *trackCorrelationY_beforeCuts, *trackCorrelationTime_beforeCuts;
TH1F *trackCorrelationX_afterCuts, *trackCorrelationY_afterCuts, *trackCorrelationTime_afterCuts;
TH2F *hClusterMapAssoc, *hHitMapAssoc;
TProfile2D *hClusterSizeMapAssoc, *hClusterChargeMapAssoc;
......@@ -75,6 +74,7 @@ namespace corryvreckan {
TProfile2D *rmsxvsxmym, *rmsyvsxmym, *rmsxyvsxmym;
TProfile2D *qvsxmym, *qMoyalvsxmym, *pxqvsxmym;
TProfile2D *qvsxmym_1px, *qvsxmym_2px, *qvsxmym_3px, *qvsxmym_4px;
TProfile2D* npxvsxmym;
TH2F *npx1vsxmym, *npx2vsxmym, *npx3vsxmym, *npx4vsxmym;
......
......@@ -14,7 +14,7 @@ If a region of interest (ROI) is defined for the detector under investigation, o
* `use_closest_cluster`: If `true` the cluster with the smallest distance to the track is used if a track has more than one associated cluster. If `false`, loop over all associated clusters. Defaults to `true`.
* `n_time_bins`: Number of bins in the time residual and correlation histograms. Defaults to `20000`.
* `time_binning`: Bin width in the time residual and correlation histograms. Defaults to `0.1ns`.
* `correlations`: If `true`, correlation plots between all tracks and all clusters on the DUT (i.e. associated + non-associated) are created. Defaults to `false`.
* `correlations`: If `true`, correlation plots between all (before and after applying cuts) tracks and all clusters on the DUT (i.e. associated + non-associated) are created. Defaults to `false`.
### Plots produced
......
......@@ -23,11 +23,15 @@ AnalysisEfficiency::AnalysisEfficiency(Configuration& config, std::shared_ptr<De
config_.setDefault<double>("time_cut_frameedge", Units::get<double>(20, "ns"));
config_.setDefault<double>("chi2ndof_cut", 3.);
config_.setDefault<double>("inpixel_bin_size", Units::get<double>(1.0, "um"));
config_.setDefault<XYVector>("inpixel_cut_edge", {Units::get(5.0, "um"), Units::get(5.0, "um")});
config_.setDefault<double>("masked_pixel_distance_cut", 1.);
m_timeCutFrameEdge = config_.get<double>("time_cut_frameedge");
m_chi2ndofCut = config_.get<double>("chi2ndof_cut");
m_inpixelBinSize = config_.get<double>("inpixel_bin_size");
require_associated_cluster_on_ = config_.getArray<std::string>("require_associated_cluster_on", {});
m_inpixelEdgeCut = config_.get<XYVector>("inpixel_cut_edge");
m_maskedPixelDistanceCut = config_.get<int>("masked_pixel_distance_cut");
}
void AnalysisEfficiency::initialize() {
......@@ -35,6 +39,12 @@ void AnalysisEfficiency::initialize() {
hPixelEfficiency = new TH1D(
"hPixelEfficiency", "hPixelEfficiency; single pixel efficiency; # entries", 201, 0, 1.005); // get 0.5%-wide bins
hPixelEfficiencyMatrix = new TH1D("hPixelEfficiencyMatrix",
"hPixelEfficiencyMatrix; single pixel efficiency; # entries",
201,
0,
1.005); // get 0.5%-wide bins
auto pitch_x = static_cast<double>(Units::convert(m_detector->getPitch().X(), "um"));
auto pitch_y = static_cast<double>(Units::convert(m_detector->getPitch().Y(), "um"));
......@@ -64,6 +74,19 @@ void AnalysisEfficiency::initialize() {
-pitch_y / 2.,
pitch_y / 2.);
title = m_detector->getName() +
" Pixel efficiency map (in-pixel ROI);in-pixel x_{track} [#mum];in-pixel y_{track} #mum;#epsilon";
hPixelEfficiencyMap_inPixelROI_trackPos_TProfile = new TProfile2D("pixelEfficiencyMap_inPixelROI_trackPos_TProfile",
title.c_str(),
nbins_x,
-pitch_x / 2.,
pitch_x / 2.,
nbins_y,
-pitch_y / 2.,
pitch_y / 2.,
0,
1);
title = m_detector->getName() + " Chip efficiency map;x [px];y [px];#epsilon";
hChipEfficiencyMap_trackPos_TProfile = new TProfile2D("chipEfficiencyMap_trackPos_TProfile",
title.c_str(),
......@@ -84,6 +107,18 @@ void AnalysisEfficiency::initialize() {
-0.5,
m_detector->nPixels().Y() - 0.5);
title = m_detector->getName() + " Pixel efficiency matrix;x [px];y [px];#epsilon";
hPixelEfficiencyMatrix_TProfile = new TProfile2D("hPixelEfficiencyMatrix",
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,
0,
1);
title = m_detector->getName() + " Global efficiency map;x [mm];y [mm];#epsilon";
hGlobalEfficiencyMap_trackPos_TProfile = new TProfile2D("globalEfficiencyMap_trackPos_TProfile",
title.c_str(),
......@@ -158,6 +193,8 @@ void AnalysisEfficiency::initialize() {
-1.5 * m_detector->getPitch().y(),
1.5 * m_detector->getPitch().y());
eTotalEfficiency = new TEfficiency("eTotalEfficiency", "totalEfficiency;;#epsilon", 1, 0, 1);
eTotalEfficiency_inPixelROI = new TEfficiency(
"eTotalEfficiency_inPixelROI", "eTotalEfficiency_inPixelROI;;#epsilon (within in-pixel ROI)", 1, 0, 1);
efficiencyColumns = new TEfficiency("efficiencyColumns",
"Efficiency vs. column number; column; #epsilon",
......@@ -169,6 +206,7 @@ void AnalysisEfficiency::initialize() {
m_detector->nPixels().Y(),
-0.5,
m_detector->nPixels().Y() - 0.5);
efficiencyVsTime = new TEfficiency("efficiencyVsTime", "Efficiency vs. time; time [s]; #epsilon", 3000, 0, 3000);
hTrackTimeToPrevHit_matched =
new TH1D("trackTimeToPrevHit_matched", "trackTimeToPrevHit_matched;time to prev hit [us];# events", 1e6, 0, 1e6);
......@@ -245,6 +283,9 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Get the telescope tracks from the clipboard
auto tracks = clipboard->getData<Track>();
auto pitch_x = m_detector->getPitch().X();
auto pitch_y = m_detector->getPitch().Y();
// Loop over all tracks
for(auto& track : tracks) {
n_track++;
......@@ -281,7 +322,7 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Check that it doesn't go through/near a masked pixel
LOG(TRACE) << " Checking if track is close to masked pixel";
if(m_detector->hitMasked(track.get(), 1.)) {
if(m_detector->hitMasked(track.get(), m_maskedPixelDistanceCut)) {
n_masked++;
LOG(DEBUG) << " - track close to masked pixel";
continue;
......@@ -327,8 +368,13 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Calculate in-pixel position of track in microns
auto inpixel = m_detector->inPixel(localIntercept);
auto xmod = static_cast<double>(Units::convert(inpixel.X(), "um"));
auto ymod = static_cast<double>(Units::convert(inpixel.Y(), "um"));
auto xmod = inpixel.X();
auto ymod = inpixel.Y();
auto xmod_um = xmod * 1000.; // mm->um (for plotting)
auto ymod_um = ymod * 1000.; // mm->um (for plotting)
bool isWithinInPixelROI =
(pitch_x - abs(xmod * 2) > m_inpixelEdgeCut.x()) && (pitch_y - abs(ymod * 2) > m_inpixelEdgeCut.y());
// Get the DUT clusters from the clipboard, that are assigned to the track
auto associated_clusters = track->getAssociatedClusters(m_detector->getName());
......@@ -336,6 +382,16 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
auto cluster = track->getClosestCluster(m_detector->getName());
has_associated_cluster = true;
matched_tracks++;
auto pixels = cluster->pixels();
for(auto& pixel : pixels) {
if((pixel->column() == static_cast<int>(m_detector->getColumn(localIntercept)) &&
pixel->row() == static_cast<int>(m_detector->getRow(localIntercept))) &&
isWithinInPixelROI) {
hPixelEfficiencyMatrix_TProfile->Fill(pixel->column(), pixel->row(), 1);
break; // There cannot be a second pixel within the cluster through which the track goes.
}
}
auto clusterLocal = m_detector->globalToLocal(cluster->global());
auto distance =
......@@ -353,6 +409,11 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
has_associated_cluster, m_detector->getColumn(clusterLocal), m_detector->getRow(clusterLocal));
}
if(!has_associated_cluster && isWithinInPixelROI) {
hPixelEfficiencyMatrix_TProfile->Fill(
m_detector->getColumn(localIntercept), m_detector->getRow(localIntercept), 0);
}
hGlobalEfficiencyMap_trackPos_TProfile->Fill(globalIntercept.X(), globalIntercept.Y(), has_associated_cluster);
hGlobalEfficiencyMap_trackPos->Fill(has_associated_cluster, globalIntercept.X(), globalIntercept.Y());
......@@ -363,11 +424,17 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// For pixels, only look at the ROI:
if(is_within_roi) {
hPixelEfficiencyMap_trackPos_TProfile->Fill(xmod, ymod, has_associated_cluster);
hPixelEfficiencyMap_trackPos->Fill(has_associated_cluster, xmod, ymod);
hPixelEfficiencyMap_trackPos_TProfile->Fill(xmod_um, ymod_um, has_associated_cluster);
hPixelEfficiencyMap_trackPos->Fill(has_associated_cluster, xmod_um, ymod_um);
eTotalEfficiency->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency
efficiencyColumns->Fill(has_associated_cluster, m_detector->getColumn(localIntercept));
efficiencyRows->Fill(has_associated_cluster, m_detector->getRow(localIntercept));
efficiencyVsTime->Fill(has_associated_cluster, track->timestamp() / 1e9); // convert nanoseconds to seconds
if(isWithinInPixelROI) {
hPixelEfficiencyMap_inPixelROI_trackPos_TProfile->Fill(xmod_um, ymod_um, has_associated_cluster);
eTotalEfficiency_inPixelROI->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency
}
}
auto intercept_col = static_cast<size_t>(m_detector->getColumn(localIntercept));
......@@ -447,11 +514,16 @@ void AnalysisEfficiency::finalize(const std::shared_ptr<ReadonlyClipboard>&) {
for(int irow = 1; irow < m_detector->nPixels().Y() + 1; irow++) {
// calculate total efficiency: (just to double check the other calculation)
const int bin = hChipEfficiencyMap_trackPos->GetGlobalBin(icol, irow);
const double eff = hChipEfficiencyMap_trackPos->GetEfficiency(bin);
double eff = hChipEfficiencyMap_trackPos->GetEfficiency(bin);
if(eff > 0) {
LOG(TRACE) << "col/row = " << icol << "/" << irow << ", binContent = " << eff;
hPixelEfficiency->Fill(eff);
}
eff = hPixelEfficiencyMatrix_TProfile->GetBinContent(bin);
if(eff > 0) {
LOG(TRACE) << "col/row = " << icol << "/" << irow << ", binContent = " << eff;
hPixelEfficiencyMatrix->Fill(eff);
}
}
}
}
......@@ -44,10 +44,13 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector;
TH1D* hPixelEfficiency;
TH1D* hPixelEfficiencyMatrix;
// Profile version
TProfile2D* hPixelEfficiencyMap_trackPos_TProfile;
TProfile2D* hPixelEfficiencyMap_inPixelROI_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_trackPos_TProfile;
TProfile2D* hPixelEfficiencyMatrix_TProfile;
TProfile2D* hGlobalEfficiencyMap_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_clustPos_TProfile;
TProfile2D* hGlobalEfficiencyMap_clustPos_TProfile;
......@@ -59,8 +62,10 @@ namespace corryvreckan {
TEfficiency* hGlobalEfficiencyMap_clustPos;
TEfficiency* eTotalEfficiency;
TEfficiency* eTotalEfficiency_inPixelROI;
TEfficiency* efficiencyColumns;
TEfficiency* efficiencyRows;
TEfficiency* efficiencyVsTime;
TH1D* hDistanceCluster;
TH1D* hTimeDiffPrevTrack_assocCluster;
......@@ -76,6 +81,8 @@ namespace corryvreckan {
TH2D* hPosDiffPrevTrack_noAssocCluster;
TH2D* hDistanceCluster_track;
double m_chi2ndofCut, m_timeCutFrameEdge, m_inpixelBinSize;
XYVector m_inpixelEdgeCut;
int m_maskedPixelDistanceCut = 1;
int total_tracks = 0;
int matched_tracks = 0;
......
......@@ -19,6 +19,8 @@ More information can be found in the ROOT `TEfficiency` class reference, section
* `time_cut_frameedge`: Parameter to discard telescope tracks at the frame edges (start and end of the current event window). Defaults to `20ns`.
* `chi2ndof_cut`: Acceptance criterion for telescope tracks, defaults to a value of `3`.
* `inpixel_bin_size`: Parameter to set the bin size of the in-pixel 2D efficiency histogram. This should be given in units of distance and the same value is used in both axes. Defaults to `1.0um`.
* `inpixel_cut_edge`: Parameter to exclude tracks going within a cut-distance to the pixel edge. Effectively defines an in-pixel ROI. Defaults to `5um`.
* `masked_pixel_distance_cut`: Distance (in pixels) to exclude tracks passing close to masked pixel. Defaults to `1`.
* `require_associated_cluster_on`: Names of detectors which are required to have an associated cluster to the telescope tracks. Detectors listed here must be marked as `role = DUT` in the detector configuration file. Only tracks satisfying this requirement are accepted for the efficiency measurement. If empty, no detector is required. Default is empty.
### Plots produced
......@@ -26,8 +28,9 @@ More information can be found in the ROOT `TEfficiency` class reference, section
For the DUT, the following plots are produced:
* 2D histograms:
* 2D Map of in-pixel efficiency
* 2D Map of in-pixel efficiency and in-pixel efficiency within in-pixel ROI
* 2D Maps of chip efficiency in local and global coordinates, filled at the position of the track intercept point or at the position of the associated cluster center
* 2D Map of pixel efficiency, for the full matrix, filled at the pixel (of the associated cluster) through which the track goes, constrained to an in-pixel ROI defined by `inpixel_cut_edge`.
* 2D Maps of the position difference of a track with and without associated cluster to the previous track
* 2D Map of the distance between track intersection and associated cluster
......@@ -39,8 +42,8 @@ For the DUT, the following plots are produced:
* Distribution of cluster-track distances
* Other:
* Value of total efficiency as `TEfficiency` including (asymmetric) error bars
* Efficiency as function of column and row
* Value of total efficiency as `TEfficiency` including (asymmetric) error bars (total and restricted to in-pixel ROI)
* Efficiency as function of column and row, and vs. time
### Usage
......
......@@ -31,15 +31,15 @@ DUTAssociation::DUTAssociation(Configuration& config, std::shared_ptr<Detector>
}
// timing cut, relative (x * time_resolution) or absolute:
timeCut = corryvreckan::calculate_cut<double>("time_cut", config_, m_detector);
time_cut_ = corryvreckan::calculate_cut<double>("time_cut", config_, m_detector);
// spatial cut, relative (x * spatial_resolution) or absolute:
spatialCut = corryvreckan::calculate_cut<XYVector>("spatial_cut", config_, m_detector);
useClusterCentre = config_.get<bool>("use_cluster_centre");
spatial_cut_ = corryvreckan::calculate_cut<XYVector>("spatial_cut", config_, m_detector);
use_cluster_centre_ = config_.get<bool>("use_cluster_centre");
LOG(DEBUG) << "time_cut = " << Units::display(timeCut, {"ms", "us", "ns"});
LOG(DEBUG) << "spatial_cut = " << Units::display(spatialCut, {"um", "mm"});
LOG(DEBUG) << "use_cluster_centre = " << useClusterCentre;
LOG(DEBUG) << "time_cut = " << Units::display(time_cut_, {"ms", "us", "ns"});
LOG(DEBUG) << "spatial_cut = " << Units::display(spatial_cut_, {"um", "mm"});
LOG(DEBUG) << "use_cluster_centre = " << use_cluster_centre_;
}
void DUTAssociation::initialize() {
......@@ -99,7 +99,7 @@ void DUTAssociation::initialize() {
// Nr of associated clusters per track
title = m_detector->getName() + ": number of associated clusters per track;associated clusters;events";
hNoAssocCls = new TH1F("no_assoc_cls", title.c_str(), 10, -0.5, 9.5);
LOG(DEBUG) << "DUT association time cut = " << Units::display(timeCut, {"ms", "ns"});
LOG(DEBUG) << "DUT association time cut = " << Units::display(time_cut_, {"ms", "ns"});
}
StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
......@@ -165,8 +165,8 @@ StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
}
// Check if the cluster is close in space (either use cluster centre of closest pixel to track)
auto xdistance = (useClusterCentre ? xdistance_centre : xdistance_nearest);
auto ydistance = (useClusterCentre ? ydistance_centre : ydistance_nearest);
auto xdistance = (use_cluster_centre_ ? xdistance_centre : xdistance_nearest);
auto ydistance = (use_cluster_centre_ ? ydistance_centre : ydistance_nearest);
auto distance = sqrt(xdistance * xdistance + ydistance * ydistance);
// Check if track-cluster distance lies within ellipse defined by spatial cuts, following this example:
// https://www.geeksforgeeks.org/check-if-a-point-is-inside-outside-or-on-the-ellipse/
......@@ -175,8 +175,8 @@ StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
// > 1: outside,
// < 1: inside
// Discard track if outside of ellipse:
auto norm = (xdistance * xdistance) / (spatialCut.x() * spatialCut.x()) +
(ydistance * ydistance) / (spatialCut.y() * spatialCut.y());
auto norm = (xdistance * xdistance) / (spatial_cut_.x() * spatial_cut_.x()) +
(ydistance * ydistance) / (spatial_cut_.y() * spatial_cut_.y());
if(norm > 1) {
LOG(DEBUG) << "Discarding DUT cluster with distance (" << Units::display(std::abs(xdistance), {"um", "mm"})
<< "," << Units::display(std::abs(ydistance), {"um", "mm"}) << ")"
......@@ -187,7 +187,7 @@ StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
}
// Check if the cluster is close in time
if(std::abs(cluster->timestamp() - track->timestamp()) > timeCut) {
if(std::abs(cluster->timestamp() - track->timestamp()) > time_cut_) {
LOG(DEBUG) << "Discarding DUT cluster with time difference "
<< Units::display(std::abs(cluster->timestamp() - track->timestamp()), {"ms", "s"});
hCutHisto->Fill(2);
......
......@@ -37,9 +37,9 @@ namespace corryvreckan {
private:
std::shared_ptr<Detector> m_detector;
double timeCut;
ROOT::Math::XYVector spatialCut;
bool useClusterCentre;
double time_cut_;
ROOT::Math::XYVector spatial_cut_;
bool use_cluster_centre_;
TH1F* hCutHisto;
......
......@@ -82,6 +82,14 @@ void EventLoaderATLASpix::initialize() {
m_file.open(m_filename.c_str(), ios::in | ios::binary);
LOG(DEBUG) << "Opening file " << m_filename;
std::string title = m_detector->getName() + ": number of different messages;message type;# events";
hMessages = new TH1F("hMessages", title.c_str(), 5, 1, 6);
hMessages->GetXaxis()->SetBinLabel(1, "UNKNOWN_MESSAGE");
hMessages->GetXaxis()->SetBinLabel(2, "BUFFER_OVERFLOW");
hMessages->GetXaxis()->SetBinLabel(3, "SERDES_LOCK_ESTABLISHED");
hMessages->GetXaxis()->SetBinLabel(4, "SERDES_LOCK_LOST");
hMessages->GetXaxis()->SetBinLabel(5, "WEIRD_DATA");
// Make histograms for debugging
hHitMap = new TH2F("hitMap",
"hitMap; pixel column; pixel row; # events",
......@@ -174,8 +182,6 @@ void EventLoaderATLASpix::initialize() {
LOG(INFO) << "Using clock cycle length of " << m_clockCycle << " ns." << std::endl;
m_oldtoa = 0;