Commit 325c1681 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

AnalysisDUT: only create track correlation plots when configured (+updated README)

parent 6a26d966
Pipeline #2615027 passed with stages
in 16 minutes and 24 seconds
......@@ -24,16 +24,32 @@ AnalysisDUT::AnalysisDUT(Configuration& config, std::shared_ptr<Detector> detect
config_.setDefault<bool>("use_closest_cluster", true);
config_.setDefault<int>("n_time_bins", 20000);
config_.setDefault<double>("time_binning", Units::get<double>(0.1, "ns"));
config_.setDefault<bool>("get_correlations", false);
time_cut_frameedge_ = config_.get<double>("time_cut_frameedge");
chi2_ndof_cut_ = config_.get<double>("chi2ndof_cut");
use_closest_cluster_ = config_.get<bool>("use_closest_cluster");
n_timebins_ = config_.get<int>("n_time_bins");
time_binning_ = config_.get<double>("time_binning");
if(config_.has("get_correlations")) {
get_correlations_ = config_.get<bool>("get_correlations");
}
}
void AnalysisDUT::initialize() {
if(get_correlations_) {
hTrackCorrelationX = new TH1F(
"hTrackCorrelationX", "Track residual X, all clusters;x_{track}-x_{hit} [mm];# entries", 10000, -5.005, 4.995);
hTrackCorrelationY = new TH1F(
"hTrackCorrelationY", "Track residual Y, all clusters;y_{track}-y_{hit} [mm];# entries", 10000, -5.005, 4.995);
hTrackCorrelationTime = new TH1F("hTrackCorrelationTime",
"Track time residual, all clusters;time_{track}-time_{hit} [ns];# entries",
n_timebins_,
-(n_timebins_ + 1) / 2. * time_binning_,
(n_timebins_ - 1) / 2. * time_binning_);
}
hClusterMapAssoc = new TH2F("clusterMapAssoc",
"Map of associated clusters; cluster col; cluster row",
m_detector->nPixels().X(),
......@@ -383,30 +399,6 @@ void AnalysisDUT::initialize() {
-(n_timebins_ + 1) / 2. * time_binning_,
(n_timebins_ - 1) / 2. * time_binning_);
hTrackCorrelationX =
new TH1F("hTrackCorrelationX", "Track residual X, all clusters;x_{track}-x_{hit} [mm];# entries", 4000, -10., 10.);
hTrackCorrelationY =
new TH1F("hTrackCorrelationY", "Track residual Y, all clusters;y_{track}-y_{hit} [mm];# entries", 4000, -10., 10.);
hTrackCorrelationPos = new TH1F("hTrackCorrelationPos",
"Track residual (absolute), all clusters;|pos_{track}-pos_{hit}| [mm];# entries",
2100,
-1.,
10.);
hTrackCorrelationTime = new TH1F("hTrackCorrelationTime",
"Track time residual, all clusters;time_{track}-time_{hit} [ns];# entries",
20000,
-5000,
5000);
hTrackCorrelationPosVsCorrelationTime =
new TH2F("hTrackCorrelationPosVsCorrelationTime",
"Track time vs. distance residual;time_{track}-time_{hit} [ns];|pos_{track}-pos_{hit}| [mm];# entries",
20000,
-5000,
5000,
2100,
-1.,
10.);
residualsTimeVsTime = new TH2F("residualsTimeVsTime",
"Time residual vs. time;time [s];time_{track}-time_{hit} [ns];# entries",
20000,
......@@ -532,6 +524,21 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
// Loop over all tracks
for(auto& track : tracks) {
auto globalIntercept = m_detector->getIntercept(track.get());
auto localIntercept = m_detector->globalToLocal(globalIntercept);
// Fill correlation plots before applying any cuts:
if(get_correlations_) {
auto clusters = clipboard->getData<Cluster>(m_detector->getName());
for(auto& cls : clusters) {
double xdistance = (globalIntercept.X() - cls->global().x());
double ydistance = (globalIntercept.Y() - cls->global().y());
hTrackCorrelationX->Fill(xdistance);
hTrackCorrelationY->Fill(ydistance);
hTrackCorrelationTime->Fill(track->timestamp() - cls->timestamp());
}
}
// Flags to select clusters and tracks
bool has_associated_cluster = false;
LOG(DEBUG) << "Looking at next track";
......@@ -545,8 +552,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
}
// Check if it intercepts the DUT
auto globalIntercept = m_detector->getIntercept(track.get());
auto localIntercept = m_detector->globalToLocal(globalIntercept);
if(!m_detector->hasIntercept(track.get(), 0.5)) {
LOG(DEBUG) << " - track outside DUT area";
......@@ -621,13 +626,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
(intercept.Y() - assoc_cluster->global().y()) * (intercept.Y() - assoc_cluster->global().y()));
double posDiff_um = posDiff * 1000.;
// Correlation plots
hTrackCorrelationX->Fill(xdistance);
hTrackCorrelationY->Fill(ydistance);
hTrackCorrelationTime->Fill(tdistance);
hTrackCorrelationPos->Fill(posDiff);
hTrackCorrelationPosVsCorrelationTime->Fill(track->timestamp() - assoc_cluster->timestamp(), posDiff);
hClusterMapAssoc->Fill(assoc_cluster->column(), assoc_cluster->row());
hClusterSizeMapAssoc->Fill(
assoc_cluster->column(), assoc_cluster->row(), static_cast<double>(assoc_cluster->size()));
......
......@@ -38,6 +38,10 @@ namespace corryvreckan {
std::shared_ptr<Detector> m_detector;
// Histograms
TH1F* hTrackCorrelationX;
TH1F* hTrackCorrelationY;
TH1F* hTrackCorrelationTime;
TH2F *hClusterMapAssoc, *hHitMapAssoc;
TProfile2D *hClusterSizeMapAssoc, *hClusterChargeMapAssoc;
TProfile *hClusterSizeVsColAssoc, *hClusterSizeVsRowAssoc;
......@@ -74,11 +78,6 @@ namespace corryvreckan {
TProfile2D* npxvsxmym;
TH2F *npx1vsxmym, *npx2vsxmym, *npx3vsxmym, *npx4vsxmym;
TH1F* hTrackCorrelationX;
TH1F* hTrackCorrelationY;
TH1F* hTrackCorrelationPos;
TH2F* hTrackCorrelationPosVsCorrelationTime;
TH1F* hTrackCorrelationTime;
TH1F* hTrackZPosDUT;
TH1F* residualsTime;
TH2F* residualsTimeVsTot;
......@@ -102,6 +101,7 @@ namespace corryvreckan {
bool use_closest_cluster_;
int n_timebins_;
double time_binning_;
bool get_correlations_;
int num_tracks_;
};
} // namespace corryvreckan
......
......@@ -14,6 +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 histograms. Defaults to `20000`.
* `time_binning`: Bin width in the time residual histograms. Defaults to `0.1ns`.
* `get_correlations`: If `true`, correlation plots between all tracks and all clusters on the DUT (i.e. associated + non-associated) are created. Defaults to `false`.
### Plots produced
......@@ -28,7 +29,7 @@ For the DUT, the following plots are produced:
* 1D histograms:
* Histograms of the cluster size of associated clusters in X/Y
* Histogram of the charge/raw values of associated clusters
* Various histograms for track residuals for different cluster sizes
* Various histograms for track residuals and correlations for different cluster sizes
* Histograms of pixel timestamp minus seed pixel timestamp for different cluster sizes
* Profiles of cluster charge vs. column/row
......
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