Commit 8a9fa957 authored by Morag Jean Williams's avatar Morag Jean Williams
Browse files

Merge branch 'unify_configkeys' into 'master'

Unify Configuration Keys

Closes #46

See merge request !81
parents 98dd6f1f 582cfa5a
Pipeline #652109 passed with stages
in 17 minutes and 55 seconds
......@@ -6,7 +6,7 @@ using namespace std;
Clustering4D::Clustering4D(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
timingCut = m_config.get<double>("timingCut", static_cast<double>(Units::convert(100, "ns"))); // 100 ns
timingCut = m_config.get<double>("timing_cut", static_cast<double>(Units::convert(100, "ns"))); // 100 ns
neighbour_radius_row = m_config.get<int>("neighbour_radius_row", 1);
neighbour_radius_col = m_config.get<int>("neighbour_radius_col", 1);
}
......
......@@ -10,7 +10,7 @@ This module performs clustering on data from a Timepix3 device. The clustering m
Split clusters can be recovered using a larger search radius for neighbouring pixels.
### Parameters
* `timingCut`: The maximum value of the time difference between two pixels for them to be associated in a cluster. Default value is `100ns`.
* `timing_cut`: The maximum value of the time difference between two pixels for them to be associated in a cluster. Default value is `100ns`.
* `neighbour_radius_col`: Search radius for neighbouring pixels in column direction, defaults to `1` (do not allow split clusters)
* `neighbour_radius_row`: Search radius for neighbouring pixels in row direction, defaults to `1` (do not allow split clusters)
......@@ -26,5 +26,5 @@ For each detector the following plots are produced:
### Usage
```toml
[Timepix3Clustering]
timingCut = 0.0000002
timing_cut = 200ns
```
......@@ -6,8 +6,8 @@ using namespace std;
DUTAssociation::DUTAssociation(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
timingCut = m_config.get<double>("timingCut", static_cast<double>(Units::convert(200, "ns")));
spatialCut = m_config.get<XYVector>("spatialCut", 2 * m_detector->pitch());
timingCut = m_config.get<double>("timing_cut", static_cast<double>(Units::convert(200, "ns")));
spatialCut = m_config.get<XYVector>("spatial_cut", 2 * m_detector->pitch());
}
StatusCode DUTAssociation::run(std::shared_ptr<Clipboard> clipboard) {
......
......@@ -9,8 +9,8 @@ Module to establish an association between clusters on a DUT plane and a referen
The association allows for cuts in position and time.
### Parameters
* `spatialCut`: Maximum spatial distance in x- and y-direction allowed between cluster and track for association with the DUT. Expects two values for the two coordinates, defaults to twice the pixel pitch.
* `timingCut`: Maximum time difference allowed between cluster and track for association for the DUT. Default value is `200ns`.
* `spatial_cut`: Maximum spatial distance in x- and y-direction allowed between cluster and track for association with the DUT. Expects two values for the two coordinates, defaults to twice the pixel pitch.
* `timing_cut`: Maximum time difference allowed between cluster and track for association for the DUT. Default value is `200ns`.
### Plots produced
No histograms are produced.
......
......@@ -5,9 +5,9 @@ using namespace std;
EtaCalculation::EtaCalculation(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
m_chi2ndofCut = m_config.get<double>("chi2ndofCut", 100.);
m_etaFormulaX = m_config.get<std::string>("EtaFormulaX", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_etaFormulaY = m_config.get<std::string>("EtaFormulaY", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_chi2ndofCut = m_config.get<double>("chi2ndof_cut", 100.);
m_etaFormulaX = m_config.get<std::string>("eta_formula_x", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_etaFormulaY = m_config.get<std::string>("eta_formula_y", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
}
void EtaCalculation::initialise() {
......@@ -121,9 +121,9 @@ void EtaCalculation::finalise() {
std::stringstream config;
config << std::endl
<< "EtaConstantsX_" << m_detector->name() << " =" << fit(m_etaFitX, "etaFormulaX", m_etaDistributionXprofile);
<< "eta_constants_x_" << m_detector->name() << " =" << fit(m_etaFitX, "etaFormulaX", m_etaDistributionXprofile);
config << std::endl
<< "EtaConstantsY_" << m_detector->name() << " =" << fit(m_etaFitY, "etaFormulaY", m_etaDistributionYprofile);
<< "eta_constants_y_" << m_detector->name() << " =" << fit(m_etaFitY, "etaFormulaY", m_etaDistributionYprofile);
LOG(INFO) << "\"EtaCorrection\":" << config.str();
}
......@@ -11,8 +11,8 @@ At the end of the run, fits to the recorded profiles are performed using the pro
In order to measure the correct $`\eta`$-distribution, no additional $`\eta`$-correction should be applied during this calculation, i.e. by using the EtaCorrection module.
### Parameters
* `chi2ndofCut`: Track quality cut on its Chi2 over numbers of degrees of freedom. Default value is `100`.
* `EtaFormulaX` / `EtaFormulaY`: Formula to for to the recorded $`\eta`$-distributions, defaults to a polynomial of fifth order, i.e. `[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5`.
* `chi2ndof_cut`: Track quality cut on its Chi2 over numbers of degrees of freedom. Default value is `100`.
* `eta_formula_x` / `eta_formula_y`: Formula to for to the recorded $`\eta`$-distributions, defaults to a polynomial of fifth order, i.e. `[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5`.
### Plots produced
For each detector the following plots are produced:
......@@ -23,5 +23,5 @@ For each detector the following plots are produced:
### Usage
```toml
[EtaCalculation]
chi2ndofCut = 100
chi2ndof_cut = 100
```
......@@ -5,8 +5,8 @@ using namespace std;
EtaCorrection::EtaCorrection(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
m_etaFormulaX = m_config.get<std::string>("EtaFormulaX", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_etaFormulaY = m_config.get<std::string>("EtaFormulaY", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_etaFormulaX = m_config.get<std::string>("eta_formula_x", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
m_etaFormulaY = m_config.get<std::string>("eta_formula_y", "[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5");
}
void EtaCorrection::initialise() {
......@@ -16,8 +16,8 @@ void EtaCorrection::initialise() {
double pitchY = m_detector->pitch().Y();
// Get info from configuration:
std::vector<double> m_etaConstantsX = m_config.getArray<double>("EtaConstantsX_" + m_detector->name(), {});
std::vector<double> m_etaConstantsY = m_config.getArray<double>("EtaConstantsY_" + m_detector->name(), {});
std::vector<double> m_etaConstantsX = m_config.getArray<double>("eta_constants_x_" + m_detector->name(), {});
std::vector<double> m_etaConstantsY = m_config.getArray<double>("eta_constants_y_" + m_detector->name(), {});
if(!m_etaConstantsX.empty() || !m_etaConstantsY.empty()) {
LOG(INFO) << "Found Eta correction factors for detector \"" << m_detector->name()
<< "\": " << (m_etaConstantsX.empty() ? "" : "X ") << (m_etaConstantsY.empty() ? "" : "Y ");
......
......@@ -10,8 +10,8 @@ This module applies previously determined $`\eta`$-corrections to cluster positi
This module does not calculate the $`\eta`$ distribution.
### Parameters
* `EtaFormulaX` / `EtaFormulaY`: The formula for the $`\eta`$ correction to be applied for the X an Y coordinate, respectively. It defaults to a polynomial of fifth ordern, i.e. `[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5`.
* `EtaConstantsX_<detector>` / `EtaConstantsY_<detector>`: Vector of correction factors, representing the parameters of the above correction function, in X and Y coordinates, respectively. Defaults to an empty vector, i.e. by default no correction is applied. The `<detector>` part of the variable has to be replaced with the respective unique name of the detector given in the setup file.
* `eta_formula_x` / `eta_formula_y`: The formula for the $`\eta`$ correction to be applied for the X an Y coordinate, respectively. It defaults to a polynomial of fifth ordern, i.e. `[0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5`.
* `eta_constants_x_<detector>` / `eta_constants_y_<detector>`: Vector of correction factors, representing the parameters of the above correction function, in X and Y coordinates, respectively. Defaults to an empty vector, i.e. by default no correction is applied. The `<detector>` part of the variable has to be replaced with the respective unique name of the detector given in the setup file.
### Plots produced
Currently, no plots are produced. The result of the $`\eta`$-correction is best observed in residual distributions of the respective detector.
......@@ -19,6 +19,6 @@ Currently, no plots are produced. The result of the $`\eta`$-correction is best
### Usage
```toml
[EtaCorrection]
EtaFormulaX = [0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5
EtaConstantsX_dut = 0.025 0.038 6.71 -323.58 5950.3 -34437.5
eta_formula_x = [0] + [1]*x + [2]*x^2 + [3]*x^3 + [4]*x^4 + [5]*x^5
eta_constants_x_dut = 0.025 0.038 6.71 -323.58 5950.3 -34437.5
```
......@@ -7,21 +7,21 @@ using namespace std;
EventLoaderATLASpix::EventLoaderATLASpix(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
m_timewalkCorrectionFactors = m_config.getArray<double>("timewalkCorrectionFactors", std::vector<double>());
m_timewalkCorrectionFactors = m_config.getArray<double>("timewalk_correction_factors", std::vector<double>());
m_inputDirectory = m_config.getPath("inputDirectory");
m_inputDirectory = m_config.getPath("input_directory");
if(m_config.has("calibrationFile")) {
m_calibrationFile = m_config.getPath("calibrationFile");
if(m_config.has("calibration_file")) {
m_calibrationFile = m_config.getPath("calibration_file");
}
m_clockCycle = m_config.get<double>("clockCycle", static_cast<double>(Units::convert(6.25, "ns")));
m_clockCycle = m_config.get<double>("clock_cycle", static_cast<double>(Units::convert(6.25, "ns")));
// Allow reading of legacy data format using the Karlsruhe readout system:
m_legacyFormat = m_config.get<bool>("legacyFormat", false);
m_legacyFormat = m_config.get<bool>("legacy_format", false);
m_startTime = m_config.get<double>("startTime", 0.);
m_toaMode = m_config.get<bool>("toaMode", false);
m_startTime = m_config.get<double>("start_time", 0.);
m_toaMode = m_config.get<bool>("toa_mode", false);
// m_clkdivendM = m_config.get<int>("clkdivend", 0.) + 1;
m_clkdivend2M = m_config.get<int>("clkdivend2", 0.) + 1;
......
......@@ -12,9 +12,8 @@ The module opens and reads one data file named `data.bin` in the specified input
This module requires either another event loader of another detector type before which defines the event start and end times (variables `eventStart` and `eventEnd` on the clipboard) or an instance of the Metronome module which provides this information.
### Parameters
* `inputDirectory`: Path to the directory containing the `data.bin` file. This path should lead to the directory above the ALTASpix directory, as this string is added to the input directory in the module.
* `clockCycle`: Period of the clock used to count the trigger timestamps in, defaults to `6.25ns`.
* `DUT`: Name of the DUT plane.
* `input_directory`: Path to the directory containing the `data.bin` file. This path should lead to the directory above the ALTASpix directory, as this string is added to the input directory in the module.
* `clock_cycle`: Period of the clock used to count the trigger timestamps in, defaults to `6.25ns`.
* `clkdivend2`: Value of clkdivend2 register in ATLASPix specifying the speed of TS2 counter. Default is `0`.
### Plots produced
......@@ -25,6 +24,5 @@ This module requires either another event loader of another detector type before
### Usage
```toml
[ATLASpixEventLoader]
DUT = "W0005_H03"
inputDirectory = /user/data/directory
input_directory = /user/data/directory
```
......@@ -13,7 +13,7 @@ void EventLoaderCLICpix::initialise() {
// File structure is RunX/CLICpix/RunX.dat
// Take input directory from global parameters
string inputDirectory = m_config.getPath("inputDirectory") + "/CLICpix";
string inputDirectory = m_config.getPath("input_directory");
// Open the root directory
DIR* directory = opendir(inputDirectory.c_str());
......
......@@ -10,8 +10,7 @@ This module reads in data for a CLICpix device from an input file.
The module opens and reads one data file in the specified input directory with the ending `.dat`. For each hit it stores the detectorID, row, column, and ToT. The shutter rise and fall time information are used to set the current time and event length.
### Parameters
* `inputDirectory`: Path to the directory containing the `.dat` file. This path should lead to the directory above the CLICpix directory, as this string is added onto the input directory in the module.
* `DUT`: Name of the DUT plane. The CLICpix device is assumed to be the DUT device.
* `input_directory`: Path to the directory containing the `.dat` file.
### Plots produced
* 2D Hit map
......@@ -22,6 +21,5 @@ The module opens and reads one data file in the specified input directory with t
### Usage
```toml
[CLICpixEventLoader]
DUT = "W0005_H03"
inputDirectory = /user/data/directory
input_directory = /user/data/directory/CLICpix/
```
......@@ -11,13 +11,13 @@ using namespace clicpix2_utils;
EventLoaderCLICpix2::EventLoaderCLICpix2(Configuration config, std::shared_ptr<Detector> detector)
: Module(std::move(config), detector), m_detector(detector) {
discardZeroToT = m_config.get<bool>("discardZeroToT", false);
discardZeroToT = m_config.get<bool>("discard_zero_tot", false);
}
void EventLoaderCLICpix2::initialise() {
// Take input directory from global parameters
string inputDirectory = m_config.getPath("inputDirectory");
string inputDirectory = m_config.getPath("input_directory");
// Open the root directory
DIR* directory = opendir(inputDirectory.c_str());
......
......@@ -12,20 +12,9 @@ The module opens and reads one data file in the specified input directory.
The input directory is searched for a data file with the file extension `.raw` and a pixel matrix configuration file required for decoding with the file extension `.cfg` and a name starting with `matrix`.
The data is decoded using the CLICpix2 data decoder shipped with the Peary DAQ framework. For each pixel hit, the detectorID, the pixel's column and row address as well as ToT and ToA values are stored, depending on their availability from data. The shutter rise and fall time information are used to set the current time and event length as described above.
### Dependencies
This module is not built by default since it requires an installation of [Peary](https://gitlab.cern.ch/Caribou/peary) with its CLICPix2 component built.
This is used for on-the-fly decoding of raw data.
In order to build this module, Peary should be made available and the module should be explicitely switched on:
```
export PEARY_PATH=/path/to/peary
cmake -DBUILD_eventLoaderCLICpix2=ON ..
```
### Parameters
* `inputDirectory`: Path to the directory containing the `.csv` file. This path should lead to the directory above the CLICpix directory, as this string is added onto the input directory in the module.
* `DUT`: Name of the DUT plane.
* `input_directory`: Path to the directory containing the `.csv` file. This path should lead to the directory above the CLICpix directory, as this string is added onto the input directory in the module.
* `discard_zero_tot`: Discard all pixel hits with a ToT value of zero. Defaults to `false`.
### Plots produced
* 2D Hit map
......@@ -39,6 +28,5 @@ cmake -DBUILD_eventLoaderCLICpix2=ON ..
### Usage
```toml
[CLICpix2EventLoader]
DUT = "W0005_H03"
inputDirectory = /user/data/directory
input_directory = /user/data/directory
```
......@@ -34,7 +34,7 @@ bool EventLoaderTimepix1::sortByTime(string filename1, string filename2) {
void EventLoaderTimepix1::initialise() {
// Take input directory from global parameters
m_inputDirectory = m_config.getPath("inputDirectory");
m_inputDirectory = m_config.getPath("input_directory");
// Each input directory contains a series of .txt files. Each of these
// contains several events (frames) with different times
......
......@@ -7,10 +7,10 @@
This module loads raw data from Timepix1 devices and adds it to the clipboard as `pixel` objects. The input file must have extension `.txt`, and these files are sorted into time order using the file titles.
### Parameters
* `inputDirectory`: Path of the directory above the data files.
* `input_directory`: Path of the directory above the data files.
### Usage
```toml
[Timepix1EventLoader]
inputDirectory = "path/to/directory"
input_directory = "path/to/directory"
```
......@@ -18,16 +18,14 @@ EventLoaderTimepix3::EventLoaderTimepix3(Configuration config, std::shared_ptr<D
m_shutterOpen(false) {
// Take input directory from global parameters
m_inputDirectory = m_config.getPath("inputDirectory");
m_triggerLatency = m_config.get<double>("triggerLatency", 0.0);
m_minNumberOfPlanes = m_config.get<int>("minNumerOfPlanes", 1);
m_inputDirectory = m_config.getPath("input_directory");
// Check whether event length or pixel count should be used to separate events:
m_numberPixelHits = m_config.get<size_t>("number_of_pixelhits", 2000);
// Calibration parameters
if(m_config.has("calibrationPath")) {
calibrationPath = m_config.getPath("calibrationPath");
if(m_config.has("calibration_path")) {
calibrationPath = m_config.getPath("calibration_path");
threshold = m_config.get<std::string>("threshold", "");
}
}
......@@ -161,7 +159,7 @@ void EventLoaderTimepix3::initialise() {
// Calibration
pixelToT_beforecalibration = new TH1F("pixelToT_beforecalibration", "pixelToT_beforecalibration", 100, 0, 200);
if(m_detector->isDUT() && m_config.has("calibrationPath") && m_config.has("threshold")) {
if(m_detector->isDUT() && m_config.has("calibration_path") && m_config.has("threshold")) {
LOG(INFO) << "Applying calibration from " << calibrationPath;
applyCalibration = true;
......@@ -300,7 +298,7 @@ void EventLoaderTimepix3::loadCalibration(std::string path, char delim, std::vec
// check if file is open
if(!f.is_open()) {
LOG(ERROR) << "Cannot open input file:\n\t" << path;
throw InvalidValueError(m_config, "calibrationPath", "Parsing error in calibration file.");
throw InvalidValueError(m_config, "calibration_path", "Parsing error in calibration file.");
}
// read file line by line
......@@ -326,7 +324,7 @@ void EventLoaderTimepix3::loadCalibration(std::string path, char delim, std::vec
// warn if too few entries
if(dat.size() != 256 * 256) {
LOG(ERROR) << "Something went wrong. Found only " << i << " entries. Not enough for TPX3.\n\t";
throw InvalidValueError(m_config, "calibrationPath", "Parsing error in calibration file.");
throw InvalidValueError(m_config, "calibration_path", "Parsing error in calibration file.");
}
f.close();
......
......@@ -43,9 +43,7 @@ namespace corryvreckan {
void maskPixels(std::string);
// configuration paramaters:
double m_triggerLatency;
std::string m_inputDirectory;
int m_minNumberOfPlanes;
bool temporalSplit;
size_t m_numberPixelHits;
......
......@@ -17,11 +17,11 @@ See also the Timepix3 chip manual version 1.9, section 3.2.1 and/or [@timepix3-t
When running in time mode (`number_of_pixelhits` not set), this module requires either another event loader of another detector type before which defines the event start and end times (variables `eventStart` and `eventEnd` on the clipboard) or an instance of the Metronome module which provides this information.
### Parameters
* `inputDirectory`: Path to the directory above the data directory for each device. The device name is added to the path during the module.
* `minNumberOfPlanes`: Minimum number of planes with loaded data required for each event to be stored. Default value is `1`.
* `input_directory`: Path to the directory above the data directory for each device. The device name is added to the path during the module.
* `number_of_pixelhits`: Maximum number of pixel hits on each detector per event. Default value is `2000`. This is only used if this parameter is present in the configuration file, otherwise the data is split into events using the event length information from the clipboard.
* `calibrationPath`: Path to the calibration directory. If this parameter is set, calibration will be applied to the DUT. Assumed folder structure is `"[calibrationPath]/[detector name]/cal_thr_[thr dac]_ik_[ikrum dac]/[detector name]_cal_[tot/toa].txt"`. The assumed file structure is `[col | row | val1 | val2 | etc.]`.
* `DUT`: Name of the DUT plane.
* `trigger_latency`:
* `calibration_path`: Path to the calibration directory. If this parameter is set, calibration will be applied to the DUT. Assumed folder structure is `[calibration_path]/[detector name]/cal_thr_[threshold]_ik_[ikrum dac]/[detector name]_cal_[tot/toa].txt`. The assumed file structure is `[col | row | val1 | val2 | etc.]`.
* `threshold`: String defining the `[threshold]` DAC value for loading the appropriate calibration file, See above.
### Plots produced
* Histogram with pixel ToT before and after calibration
......@@ -30,13 +30,10 @@ When running in time mode (`number_of_pixelhits` not set), this module requires
### Usage
```toml
[Timepix3EventLoader]
inputDirectory = "path/to/directory"
calibrationPath = "path/to/calibration"
input_directory = "path/to/directory"
calibration_path = "path/to/calibration"
threshold = 1148
minNumberOfPlanes = 5
eventLength = 0.0000002
number_of_pixelhits = 0
DUT = "W0005_H03"
```
[@timepix-talk] X. Llopart, The Timepix3 chip, EP-ESE seminar, https://indico.cern.ch/event/267425,
......@@ -6,14 +6,14 @@ using namespace std;
FileReader::FileReader(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)) {
m_readPixels = m_config.get<bool>("readPixels", true);
m_readClusters = m_config.get<bool>("readClusters", false);
m_readTracks = m_config.get<bool>("readTracks", false);
m_fileName = m_config.getPath("fileName", true);
m_timeWindow = m_config.get<double>("timeWindow", static_cast<double>(Units::convert(1., "s")));
m_readMCParticles = m_config.get<bool>("readMCParticles", false);
m_readPixels = m_config.get<bool>("read_pixels", true);
m_readClusters = m_config.get<bool>("read_clusters", false);
m_readTracks = m_config.get<bool>("read_tracks", false);
m_fileName = m_config.getPath("file_name", true);
m_timeWindow = m_config.get<double>("time_window", static_cast<double>(Units::convert(1., "s")));
m_readMCParticles = m_config.get<bool>("read_mcparticles", false);
// checking if DUT parameter is in the configuration file, if so then check if should only output the DUT
m_onlyDUT = m_config.get<bool>("onlyDUT", false);
m_onlyDUT = m_config.get<bool>("only_dut", false);
m_currentTime = 0.;
}
......
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