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 ...@@ -37,12 +37,40 @@ AnalysisDUT::AnalysisDUT(Configuration& config, std::shared_ptr<Detector> detect
void AnalysisDUT::initialize() { void AnalysisDUT::initialize() {
if(correlations_) { if(correlations_) {
hTrackCorrelationX = new TH1F( trackCorrelationX_beforeCuts =
"hTrackCorrelationX", "Track residual X, all clusters;x_{track}-x_{hit} [#mum];# entries", 8000, -1000.5, 999.5); new TH1F("trackCorrelationX_beforeCuts",
hTrackCorrelationY = new TH1F( "Track residual X (tracks before cuts), all clusters;x_{track}-x_{hit} [#mum];# entries",
"hTrackCorrelationY", "Track residual Y, all clusters;y_{track}-y_{hit} [#mum];# entries", 8000, -1000.5, 999.5); 8000,
hTrackCorrelationTime = new TH1F("hTrackCorrelationTime", -1000.5,
"Track time residual, all clusters;time_{track}-time_{hit} [ns];# entries", 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_,
-(n_timebins_ + 1) / 2. * time_binning_, -(n_timebins_ + 1) / 2. * time_binning_,
(n_timebins_ - 1) / 2. * time_binning_); (n_timebins_ - 1) / 2. * time_binning_);
...@@ -391,6 +419,54 @@ void AnalysisDUT::initialize() { ...@@ -391,6 +419,54 @@ void AnalysisDUT::initialize() {
-pitch_y / 2., -pitch_y / 2.,
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", residualsTime = new TH1F("residualsTime",
"Time residual;time_{track}-time_{hit} [ns];#entries", "Time residual;time_{track}-time_{hit} [ns];#entries",
n_timebins_, n_timebins_,
...@@ -525,15 +601,15 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -525,15 +601,15 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
auto globalIntercept = m_detector->getIntercept(track.get()); auto globalIntercept = m_detector->getIntercept(track.get());
auto localIntercept = m_detector->globalToLocal(globalIntercept); auto localIntercept = m_detector->globalToLocal(globalIntercept);
// Fill correlation plots before applying any cuts: // Fill correlation plots BEFORE applying any cuts:
if(correlations_) { if(correlations_) {
auto clusters = clipboard->getData<Cluster>(m_detector->getName()); auto clusters = clipboard->getData<Cluster>(m_detector->getName());
for(auto& cls : clusters) { for(auto& cls : clusters) {
double xdistance_um = (globalIntercept.X() - cls->global().x()) * 1000.; double xdistance_um = (globalIntercept.X() - cls->global().x()) * 1000.;
double ydistance_um = (globalIntercept.Y() - cls->global().y()) * 1000.; double ydistance_um = (globalIntercept.Y() - cls->global().y()) * 1000.;
hTrackCorrelationX->Fill(xdistance_um); trackCorrelationX_beforeCuts->Fill(xdistance_um);
hTrackCorrelationY->Fill(ydistance_um); trackCorrelationY_beforeCuts->Fill(ydistance_um);
hTrackCorrelationTime->Fill(track->timestamp() - cls->timestamp()); trackCorrelationTime_beforeCuts->Fill(track->timestamp() - cls->timestamp());
} }
} }
...@@ -550,7 +626,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -550,7 +626,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
} }
// Check if it intercepts the DUT // Check if it intercepts the DUT
if(!m_detector->hasIntercept(track.get(), 0.5)) { if(!m_detector->hasIntercept(track.get(), 0.5)) {
LOG(DEBUG) << " - track outside DUT area"; LOG(DEBUG) << " - track outside DUT area";
hCutHisto->Fill(2); hCutHisto->Fill(2);
...@@ -571,6 +646,18 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -571,6 +646,18 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
continue; 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: // Get the event:
auto event = clipboard->getEvent(); auto event = clipboard->getEvent();
...@@ -595,8 +682,8 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -595,8 +682,8 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
// Calculate in-pixel position of track in microns // Calculate in-pixel position of track in microns
auto inpixel = m_detector->inPixel(localIntercept); auto inpixel = m_detector->inPixel(localIntercept);
auto xmod = inpixel.X() * 1000.; // convert mm -> um auto xmod_um = inpixel.X() * 1000.; // convert mm -> um
auto ymod = inpixel.Y() * 1000.; // convert mm -> um auto ymod_um = inpixel.Y() * 1000.; // convert mm -> um
// Loop over all associated DUT clusters: // Loop over all associated DUT clusters:
for(auto assoc_cluster : track->getAssociatedClusters(m_detector->getName())) { for(auto assoc_cluster : track->getAssociatedClusters(m_detector->getName())) {
...@@ -713,11 +800,11 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -713,11 +800,11 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
clusterWidthColAssoc->Fill(static_cast<double>(assoc_cluster->columnWidth())); clusterWidthColAssoc->Fill(static_cast<double>(assoc_cluster->columnWidth()));
// Fill in-pixel plots: (all as function of track position within pixel cell) // Fill in-pixel plots: (all as function of track position within pixel cell)
qvsxmym->Fill(xmod, ymod, cluster_charge); // cluster charge profile qvsxmym->Fill(xmod_um, ymod_um, cluster_charge); // cluster charge profile
qMoyalvsxmym->Fill(xmod, ymod, exp(-normalized_charge / 3.5)); // norm. cluster charge profile qMoyalvsxmym->Fill(xmod_um, ymod_um, exp(-normalized_charge / 3.5)); // norm. cluster charge profile
// mean charge of cluster seed // 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) { if(assoc_cluster->size() > 1) {
for(auto& px : assoc_cluster->pixels()) { for(auto& px : assoc_cluster->pixels()) {
...@@ -751,20 +838,28 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) { ...@@ -751,20 +838,28 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
} }
// mean cluster size // mean cluster size
npxvsxmym->Fill(xmod, ymod, static_cast<double>(assoc_cluster->size())); npxvsxmym->Fill(xmod_um, ymod_um, static_cast<double>(assoc_cluster->size()));
if(assoc_cluster->size() == 1) if(assoc_cluster->size() == 1) {
npx1vsxmym->Fill(xmod, ymod); npx1vsxmym->Fill(xmod_um, ymod_um);
if(assoc_cluster->size() == 2) qvsxmym_1px->Fill(xmod_um, ymod_um, cluster_charge);
npx2vsxmym->Fill(xmod, ymod); }
if(assoc_cluster->size() == 3) if(assoc_cluster->size() == 2) {
npx3vsxmym->Fill(xmod, ymod); npx2vsxmym->Fill(xmod_um, ymod_um);
if(assoc_cluster->size() == 4) qvsxmym_2px->Fill(xmod_um, ymod_um, cluster_charge);
npx4vsxmym->Fill(xmod, ymod); }
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)) // residual MAD x, y, combined (sqrt(x*x + y*y))
rmsxvsxmym->Fill(xmod, ymod, xabsdistance); rmsxvsxmym->Fill(xmod_um, ymod_um, xabsdistance);
rmsyvsxmym->Fill(xmod, ymod, yabsdistance); rmsyvsxmym->Fill(xmod_um, ymod_um, yabsdistance);
rmsxyvsxmym->Fill(xmod, ymod, fabs(sqrt(xdistance * xdistance + ydistance * ydistance))); rmsxyvsxmym->Fill(xmod_um, ymod_um, fabs(sqrt(xdistance * xdistance + ydistance * ydistance)));
hAssociatedTracksGlobalPosition->Fill(globalIntercept.X(), globalIntercept.Y()); hAssociatedTracksGlobalPosition->Fill(globalIntercept.X(), globalIntercept.Y());
hAssociatedTracksLocalPosition->Fill(m_detector->getColumn(localIntercept), m_detector->getRow(localIntercept)); hAssociatedTracksLocalPosition->Fill(m_detector->getColumn(localIntercept), m_detector->getRow(localIntercept));
......
...@@ -38,9 +38,8 @@ namespace corryvreckan { ...@@ -38,9 +38,8 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector; std::shared_ptr<Detector> m_detector;
// Histograms // Histograms
TH1F* hTrackCorrelationX; TH1F *trackCorrelationX_beforeCuts, *trackCorrelationY_beforeCuts, *trackCorrelationTime_beforeCuts;
TH1F* hTrackCorrelationY; TH1F *trackCorrelationX_afterCuts, *trackCorrelationY_afterCuts, *trackCorrelationTime_afterCuts;
TH1F* hTrackCorrelationTime;
TH2F *hClusterMapAssoc, *hHitMapAssoc; TH2F *hClusterMapAssoc, *hHitMapAssoc;
TProfile2D *hClusterSizeMapAssoc, *hClusterChargeMapAssoc; TProfile2D *hClusterSizeMapAssoc, *hClusterChargeMapAssoc;
...@@ -75,6 +74,7 @@ namespace corryvreckan { ...@@ -75,6 +74,7 @@ namespace corryvreckan {
TProfile2D *rmsxvsxmym, *rmsyvsxmym, *rmsxyvsxmym; TProfile2D *rmsxvsxmym, *rmsyvsxmym, *rmsxyvsxmym;
TProfile2D *qvsxmym, *qMoyalvsxmym, *pxqvsxmym; TProfile2D *qvsxmym, *qMoyalvsxmym, *pxqvsxmym;
TProfile2D *qvsxmym_1px, *qvsxmym_2px, *qvsxmym_3px, *qvsxmym_4px;
TProfile2D* npxvsxmym; TProfile2D* npxvsxmym;
TH2F *npx1vsxmym, *npx2vsxmym, *npx3vsxmym, *npx4vsxmym; TH2F *npx1vsxmym, *npx2vsxmym, *npx3vsxmym, *npx4vsxmym;
......
...@@ -14,7 +14,7 @@ If a region of interest (ROI) is defined for the detector under investigation, o ...@@ -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`. * `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`. * `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`. * `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 ### Plots produced
......
...@@ -23,11 +23,15 @@ AnalysisEfficiency::AnalysisEfficiency(Configuration& config, std::shared_ptr<De ...@@ -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>("time_cut_frameedge", Units::get<double>(20, "ns"));
config_.setDefault<double>("chi2ndof_cut", 3.); config_.setDefault<double>("chi2ndof_cut", 3.);
config_.setDefault<double>("inpixel_bin_size", Units::get<double>(1.0, "um")); 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_timeCutFrameEdge = config_.get<double>("time_cut_frameedge");
m_chi2ndofCut = config_.get<double>("chi2ndof_cut"); m_chi2ndofCut = config_.get<double>("chi2ndof_cut");
m_inpixelBinSize = config_.get<double>("inpixel_bin_size"); m_inpixelBinSize = config_.get<double>("inpixel_bin_size");
require_associated_cluster_on_ = config_.getArray<std::string>("require_associated_cluster_on", {}); 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() { void AnalysisEfficiency::initialize() {
...@@ -35,6 +39,12 @@ void AnalysisEfficiency::initialize() { ...@@ -35,6 +39,12 @@ void AnalysisEfficiency::initialize() {
hPixelEfficiency = new TH1D( hPixelEfficiency = new TH1D(
"hPixelEfficiency", "hPixelEfficiency; single pixel efficiency; # entries", 201, 0, 1.005); // get 0.5%-wide bins "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_x = static_cast<double>(Units::convert(m_detector->getPitch().X(), "um"));
auto pitch_y = static_cast<double>(Units::convert(m_detector->getPitch().Y(), "um")); auto pitch_y = static_cast<double>(Units::convert(m_detector->getPitch().Y(), "um"));
...@@ -64,6 +74,19 @@ void AnalysisEfficiency::initialize() { ...@@ -64,6 +74,19 @@ void AnalysisEfficiency::initialize() {
-pitch_y / 2., -pitch_y / 2.,
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"; title = m_detector->getName() + " Chip efficiency map;x [px];y [px];#epsilon";
hChipEfficiencyMap_trackPos_TProfile = new TProfile2D("chipEfficiencyMap_trackPos_TProfile", hChipEfficiencyMap_trackPos_TProfile = new TProfile2D("chipEfficiencyMap_trackPos_TProfile",
title.c_str(), title.c_str(),
...@@ -84,6 +107,18 @@ void AnalysisEfficiency::initialize() { ...@@ -84,6 +107,18 @@ void AnalysisEfficiency::initialize() {
-0.5, -0.5,
m_detector->nPixels().Y() - 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"; title = m_detector->getName() + " Global efficiency map;x [mm];y [mm];#epsilon";
hGlobalEfficiencyMap_trackPos_TProfile = new TProfile2D("globalEfficiencyMap_trackPos_TProfile", hGlobalEfficiencyMap_trackPos_TProfile = new TProfile2D("globalEfficiencyMap_trackPos_TProfile",
title.c_str(), title.c_str(),
...@@ -158,6 +193,8 @@ void AnalysisEfficiency::initialize() { ...@@ -158,6 +193,8 @@ void AnalysisEfficiency::initialize() {
-1.5 * m_detector->getPitch().y(), -1.5 * m_detector->getPitch().y(),
1.5 * m_detector->getPitch().y()); 1.5 * m_detector->getPitch().y());
eTotalEfficiency = new TEfficiency("eTotalEfficiency", "totalEfficiency;;#epsilon", 1, 0, 1); 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", efficiencyColumns = new TEfficiency("efficiencyColumns",
"Efficiency vs. column number; column; #epsilon", "Efficiency vs. column number; column; #epsilon",
...@@ -169,6 +206,7 @@ void AnalysisEfficiency::initialize() { ...@@ -169,6 +206,7 @@ void AnalysisEfficiency::initialize() {
m_detector->nPixels().Y(), m_detector->nPixels().Y(),
-0.5, -0.5,
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 = hTrackTimeToPrevHit_matched =
new TH1D("trackTimeToPrevHit_matched", "trackTimeToPrevHit_matched;time to prev hit [us];# events", 1e6, 0, 1e6); 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) ...@@ -245,6 +283,9 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Get the telescope tracks from the clipboard // Get the telescope tracks from the clipboard
auto tracks = clipboard->getData<Track>(); auto tracks = clipboard->getData<Track>();
auto pitch_x = m_detector->getPitch().X();
auto pitch_y = m_detector->getPitch().Y();
// Loop over all tracks // Loop over all tracks
for(auto& track : tracks) { for(auto& track : tracks) {
n_track++; n_track++;
...@@ -281,7 +322,7 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard) ...@@ -281,7 +322,7 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Check that it doesn't go through/near a masked pixel // Check that it doesn't go through/near a masked pixel
LOG(TRACE) << " Checking if track is close to 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++; n_masked++;
LOG(DEBUG) << " - track close to masked pixel"; LOG(DEBUG) << " - track close to masked pixel";
continue; continue;
...@@ -327,8 +368,13 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard) ...@@ -327,8 +368,13 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// Calculate in-pixel position of track in microns // Calculate in-pixel position of track in microns
auto inpixel = m_detector->inPixel(localIntercept); auto inpixel = m_detector->inPixel(localIntercept);
auto xmod = static_cast<double>(Units::convert(inpixel.X(), "um")); auto xmod = inpixel.X();
auto ymod = static_cast<double>(Units::convert(inpixel.Y(), "um")); 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 // Get the DUT clusters from the clipboard, that are assigned to the track
auto associated_clusters = track->getAssociatedClusters(m_detector->getName()); auto associated_clusters = track->getAssociatedClusters(m_detector->getName());
...@@ -336,6 +382,16 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard) ...@@ -336,6 +382,16 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
auto cluster = track->getClosestCluster(m_detector->getName()); auto cluster = track->getClosestCluster(m_detector->getName());
has_associated_cluster = true; has_associated_cluster = true;
matched_tracks++; 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 clusterLocal = m_detector->globalToLocal(cluster->global());
auto distance = auto distance =
...@@ -353,6 +409,11 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard) ...@@ -353,6 +409,11 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
has_associated_cluster, m_detector->getColumn(clusterLocal), m_detector->getRow(clusterLocal)); 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_TProfile->Fill(globalIntercept.X(), globalIntercept.Y(), has_associated_cluster);
hGlobalEfficiencyMap_trackPos->Fill(has_associated_cluster, globalIntercept.X(), globalIntercept.Y()); hGlobalEfficiencyMap_trackPos->Fill(has_associated_cluster, globalIntercept.X(), globalIntercept.Y());
...@@ -363,11 +424,17 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard) ...@@ -363,11 +424,17 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
// For pixels, only look at the ROI: // For pixels, only look at the ROI:
if(is_within_roi) { if(is_within_roi) {
hPixelEfficiencyMap_trackPos_TProfile->Fill(xmod, ymod, has_associated_cluster); hPixelEfficiencyMap_trackPos_TProfile->Fill(xmod_um, ymod_um, has_associated_cluster);
hPixelEfficiencyMap_trackPos->Fill(has_associated_cluster, xmod, ymod); hPixelEfficiencyMap_trackPos->Fill(has_associated_cluster, xmod_um, ymod_um);
eTotalEfficiency->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency eTotalEfficiency->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency
efficiencyColumns->Fill(has_associated_cluster, m_detector->getColumn(localIntercept)); efficiencyColumns->Fill(has_associated_cluster, m_detector->getColumn(localIntercept));
efficiencyRows->Fill(has_associated_cluster, m_detector->getRow(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)); auto intercept_col = static_cast<size_t>(m_detector->getColumn(localIntercept));
...@@ -447,11 +514,16 @@ void AnalysisEfficiency::finalize(const std::shared_ptr<ReadonlyClipboard>&) { ...@@ -447,11 +514,16 @@ void AnalysisEfficiency::finalize(const std::shared_ptr<ReadonlyClipboard>&) {
for(int irow = 1; irow < m_detector->nPixels().Y() + 1; irow++) { for(int irow = 1; irow < m_detector->nPixels().Y() + 1; irow++) {
// calculate total efficiency: (just to double check the other calculation) // calculate total efficiency: (just to double check the other calculation)
const int bin = hChipEfficiencyMap_trackPos->GetGlobalBin(icol, irow); const int bin = hChipEfficiencyMap_trackPos->GetGlobalBin(icol, irow);
const double eff = hChipEfficiencyMap_trackPos->GetEfficiency(bin); double eff = hChipEfficiencyMap_trackPos->GetEfficiency(bin);
if(eff > 0) { if(eff > 0) {
LOG(TRACE) << "col/row = " << icol << "/" << irow << ", binContent = " << eff; LOG(TRACE) << "col/row = " << icol << "/" << irow << ", binContent = " << eff;
hPixelEfficiency->Fill(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 { ...@@ -44,10 +44,13 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector; std::shared_ptr<Detector> m_detector;
TH1D* hPixelEfficiency; TH1D* hPixelEfficiency;
TH1D* hPixelEfficiencyMatrix;
// Profile version // Profile version
TProfile2D* hPixelEfficiencyMap_trackPos_TProfile; TProfile2D* hPixelEfficiencyMap_trackPos_TProfile;
TProfile2D* hPixelEfficiencyMap_inPixelROI_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_trackPos_TProfile; TProfile2D* hChipEfficiencyMap_trackPos_TProfile;
TProfile2D* hPixelEfficiencyMatrix_TProfile;
TProfile2D* hGlobalEfficiencyMap_trackPos_TProfile; TProfile2D* hGlobalEfficiencyMap_trackPos_TProfile;
TProfile2D* hChipEfficiencyMap_clustPos_TProfile; TProfile2D* hChipEfficiencyMap_clustPos_TProfile;
TProfile2D* hGlobalEfficiencyMap_clustPos_TProfile; TProfile2D* hGlobalEfficiencyMap_clustPos_TProfile;
...@@ -59,8 +62,10 @@ namespace corryvreckan { ...@@ -59,8 +62,10 @@ namespace corryvreckan {
TEfficiency* hGlobalEfficiencyMap_clustPos; TEfficiency* hGlobalEfficiencyMap_clustPos;
TEfficiency* eTotalEfficiency; TEfficiency* eTotalEfficiency;