Commit c3c2f87a authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'add-mask_dead_pixels-parameter-to-MaskCreator' into 'master'

“add-mask_dead_pixels-parameter-to-MaskCreator”

See merge request !416
parents c1ad382d 0e8ccdc2
Pipeline #2557753 passed with stages
in 28 minutes and 31 seconds
......@@ -62,6 +62,7 @@ The following authors, in alphabetical order, have contributed to Corryvreckan:
* Katharina Dort, University of Giessen/CERN, @kdort
* Alexander Ferk, CERN, @aferk
* Adrian Fiergolski, CERN, @afiergol
* Sejla Hadzic, MPP, @sehadzic
* Daniel Hynds, Nikhef, @dhynds
* Magnus Mager, CERN, @mmager
* Andreas Matthias Nürnberg, KIT, @nurnberg
......
......@@ -23,6 +23,7 @@ MaskCreator::MaskCreator(Configuration& config, std::shared_ptr<Detector> detect
config_.setDefault<double>("density_bandwidth", 2.);
config_.setDefault<double>("sigma_above_avg_max", 5.);
config_.setDefault<double>("rate_max", 1.);
config_.setDefault<bool>("mask_dead_pixels", false);
m_method = config_.get<std::string>("method");
m_frequency = config_.get<double>("frequency_cut");
......@@ -30,6 +31,7 @@ MaskCreator::MaskCreator(Configuration& config, std::shared_ptr<Detector> detect
bandwidth = config_.get<double>("density_bandwidth");
m_sigmaMax = config_.get<double>("sigma_above_avg_max");
m_rateMax = config_.get<double>("rate_max");
m_maskDeadPixels = config_.get<bool>("mask_dead_pixels");
}
void MaskCreator::initialize() {
......@@ -132,6 +134,11 @@ void MaskCreator::finalize(const std::shared_ptr<ReadonlyClipboard>&) {
// Use global frequency filter to detect noisy pixels:
globalFrequencyFilter();
}
if(m_maskDeadPixels) {
LOG(INFO) << "Masking dead pixels";
// Mask dead pixels:
deadPixelFinder();
}
// Write updated files out:
writeMaskFiles();
......@@ -217,6 +224,25 @@ void MaskCreator::globalFrequencyFilter() {
LOG(INFO) << " of which newly masked: " << new_masked;
}
void MaskCreator::deadPixelFinder() {
// Loop over all pixels and find ones that did not receive any hits
int new_masked = 0;
for(int col = 0; col < m_detector->nPixels().X(); col++) {
for(int row = 0; row < m_detector->nPixels().Y(); row++) {
if(!m_detector->masked(col, row) && m_occupancy->GetBinContent(col + 1, row + 1) == 0) {
LOG(DEBUG) << "Masking dead pixel " << col << "," << row << " on detector " << m_detector->getName();
maskmap->Fill(col, row);
new_masked++;
}
}
}
LOG(INFO) << "Detector " << m_detector->getName() << ":";
LOG(INFO) << " total masked pixels: " << maskmap->GetEntries();
LOG(INFO) << " of which newly masked: " << new_masked;
}
void MaskCreator::writeMaskFiles() {
// Get the mask file from detector or use default name:
......
......@@ -48,6 +48,9 @@ namespace corryvreckan {
void globalFrequencyFilter();
// Finds pixels that did not receive any hits (dead or disabled pixels during tuning)
void deadPixelFinder();
// Write out mask files for all detectors]
void writeMaskFiles();
......@@ -65,6 +68,7 @@ namespace corryvreckan {
int m_bandwidthCol, m_bandwidthRow;
double m_sigmaMax, m_rateMax;
int m_numEvents, binsOccupancy;
bool m_maskDeadPixels;
static inline void fillDist(const TH2D* values, TH1D* dist);
};
......
......@@ -23,6 +23,7 @@ No masks are applied in this module as this is done by the respective event load
* `density_bandwidth`: Bandwidth for local density estimator, defaults to `2` and is only used in `localdensity` mode.
* `sigma_above_avg_max`: Cut for noisy pixels, number of standard deviations above average, defaults to `5`. Only used in `localdensity` mode.
* `rate_max`: Maximum rate, defaults to `1`. Only used in `localdensity` mode.
* `mask_dead_pixels`: If `true`, the module will search for pixels without any recorded hits and add them to the mask file. Default is `false`.
### Plots produced
For each detector the following plots are produced:
......
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