Commit e7d908c3 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'newEfficiencyPlots' into 'master'

New efficiency plots

See merge request !429
parents 557f9c66 f8114634
Pipeline #2697696 passed with stages
in 16 minutes and 48 seconds
......@@ -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<double>("inpixel_cut_edge", Units::get<double>(5., "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<double>("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"));
......@@ -84,6 +94,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(),
......@@ -246,6 +268,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 = static_cast<double>(Units::convert(m_detector->getPitch().X(), "um"));
auto pitch_y = static_cast<double>(Units::convert(m_detector->getPitch().Y(), "um"));
// Loop over all tracks
for(auto& track : tracks) {
n_track++;
......@@ -282,7 +307,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;
......@@ -337,6 +362,14 @@ 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))) &&
(pitch_x - abs(xmod * 2) < m_inpixelEdgeCut || pitch_y - abs(ymod * 2) < m_inpixelEdgeCut))
hPixelEfficiencyMatrix_TProfile->Fill(pixel->column(), pixel->row(), 1);
}
auto clusterLocal = m_detector->globalToLocal(cluster->global());
auto distance =
......@@ -354,6 +387,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 &&
(pitch_x - abs(xmod * 2) < m_inpixelEdgeCut || pitch_y - abs(ymod * 2) < m_inpixelEdgeCut))
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());
......@@ -449,11 +487,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,12 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector;
TH1D* hPixelEfficiency;
TH1D* hPixelEfficiencyMatrix;
// Profile version
TProfile2D* hPixelEfficiencyMap_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_trackPos_TProfile;
TProfile2D* hPixelEfficiencyMatrix_TProfile;
TProfile2D* hGlobalEfficiencyMap_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_clustPos_TProfile;
TProfile2D* hGlobalEfficiencyMap_clustPos_TProfile;
......@@ -76,7 +78,8 @@ namespace corryvreckan {
TH2D* hPosDiffPrevTrack_assocCluster;
TH2D* hPosDiffPrevTrack_noAssocCluster;
TH2D* hDistanceCluster_track;
double m_chi2ndofCut, m_timeCutFrameEdge, m_inpixelBinSize;
double m_chi2ndofCut, m_timeCutFrameEdge, m_inpixelBinSize, 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. 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
......@@ -28,6 +30,7 @@ For the DUT, the following plots are produced:
* 2D histograms:
* 2D Map of in-pixel efficiency
* 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 inpixel-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
......
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