Commit e6829560 authored by Alexander Ferk's avatar Alexander Ferk
Browse files

implemented clusteriing ROI rejection and reworked tracking ROI rejection

parent 558a6445
......@@ -33,6 +33,7 @@ Clustering4D::Clustering4D(Configuration config, std::shared_ptr<Detector> detec
neighborRadiusRow = m_config.get<int>("neighbor_radius_row", 1);
neighborRadiusCol = m_config.get<int>("neighbor_radius_col", 1);
chargeWeighting = m_config.get<bool>("charge_weighting", true);
rejectByROI = m_config.get<bool>("reject_by_roi", false);
}
void Clustering4D::initialise() {
......@@ -184,6 +185,11 @@ StatusCode Clustering4D::run(std::shared_ptr<Clipboard> clipboard) {
static_cast<double>(Units::convert(px->timestamp() - cluster->timestamp(), "ns")));
}
}
//check if the cluster is within ROI
if(rejectByROI && !m_detector->isWithinROI(cluster)) {
delete cluster;
continue;
}
deviceClusters->push_back(cluster);
}
......
......@@ -59,6 +59,7 @@ namespace corryvreckan {
int neighborRadiusRow;
int neighborRadiusCol;
bool chargeWeighting;
bool rejectByROI=false;
};
} // namespace corryvreckan
#endif // CLUSTERING4D_H
......@@ -19,6 +19,7 @@ Split clusters can be recovered using a larger search radius for neighboring pix
* `neighbor_radius_col`: Search radius for neighboring pixels in column direction, defaults to `1` (do not allow split clusters)
* `neighbor_radius_row`: Search radius for neighboring pixels in row direction, defaults to `1` (do not allow split clusters)
* `charge_weighting`: If true, calculate a charge-weighted mean for the cluster centre. If false, calculate the simple arithmetic mean. Defaults to `true`.
* `reject_by_roi`: If true, clusters positioned outside the ROI set for the detector will be rejected. Defaults to `false`.
### Plots produced
For each detector the following plots are produced:
......
......@@ -19,6 +19,7 @@ ClusteringSpatial::ClusteringSpatial(Configuration config, std::shared_ptr<Detec
useTriggerTimestamp = m_config.get<bool>("use_trigger_timestamp", false);
chargeWeighting = m_config.get<bool>("charge_weighting", true);
rejectByROI = m_config.get<bool>("reject_by_roi", false);
}
void ClusteringSpatial::initialise() {
......@@ -167,6 +168,13 @@ StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
clusterPositionLocal->Fill(cluster->column(), cluster->row());
clusterTimes->Fill(static_cast<double>(Units::convert(cluster->timestamp(), "ns")));
LOG(DEBUG) << "cluster local: " << cluster->local();
//check if the cluster is within ROI
if(rejectByROI && !m_detector->isWithinROI(cluster)) {
delete cluster;
continue;
}
deviceClusters->push_back(cluster);
}
......
......@@ -49,6 +49,7 @@ namespace corryvreckan {
bool useTriggerTimestamp;
bool chargeWeighting;
bool rejectByROI=false;
};
} // namespace corryvreckan
#endif // ClusteringSpatial_H
......@@ -14,6 +14,7 @@ These clusters are stored on the clipboard for each device.
### Parameters
* `use_trigger_timestamp`: If true, set trigger timestamp of Corryvreckan event as cluster timestamp. If false, set pixel timestamp. Default value is `false`.
* `charge_weighting`: If true, calculate a charge-weighted mean for the cluster center. If false, calculate the simple arithmetic mean. Defaults to `true`.
* `reject_by_roi`: If true, clusters positioned outside the ROI set for the detector will be rejected. Defaults to `false`.
### Plots produced
For each detector the following plots are produced:
......
......@@ -24,6 +24,7 @@ The DUT plane can be excluded from the track finding.
* `momentum`: Set the beam momentum. Defaults to 5 GeV
* `volume_scattering`: Select if volume scattering will be taken into account - defaults to false
* `volume_radiation_length`: Define the radiation length of the volume around the telescope. Defaults to dry air with a radiation length of`304.2 m`
* `reject_by_roi`: If true, tracks intercepting any detector outside its ROI will be rejected. Defaults to `false`.
### Plots produced
......
......@@ -338,12 +338,11 @@ StatusCode Tracking4D::run(std::shared_ptr<Clipboard> clipboard) {
track->fit();
if(rejectByROI && track->isFitted()) {
// check if the track is within ROI for all detectors
bool reject = false;
for(auto& detector : get_detectors()) {
reject = (detector->isWithinROI(track) ? reject : true);
}
if(reject) {
//check if the track is within ROI for all detectors
auto ds = get_detectors();
auto out_of_roi = std::find_if(ds.begin(),ds.end(),[track](const auto& d) {
return !d->isWithinROI(track);});
if(out_of_roi != ds.end()) {
delete track;
continue;
}
......
......@@ -61,7 +61,7 @@ namespace corryvreckan {
size_t minHitsOnTrack;
bool excludeDUT;
bool useVolumeScatterer{};
bool rejectByROI{};
bool rejectByROI=false;
std::vector<std::string> requireDetectors;
std::map<std::shared_ptr<Detector>, double> time_cuts_;
std::map<std::shared_ptr<Detector>, XYVector> spatial_cuts_;
......
......@@ -14,6 +14,7 @@ This module performs track finding using only positional information (no timing
* `exclude_dut`: Boolean to set if the DUT should be included in the track fitting. Default value is `true`.
* `track_model`: Select the track model used for reconstruction. Defaults to
the only supported fit at the "straightline"
* `reject_by_roi`: If true, tracks intercepting any detector outside its ROI will be rejected. Defaults to `false`.
### Plots produced
......
......@@ -208,12 +208,11 @@ StatusCode TrackingSpatial::run(std::shared_ptr<Clipboard> clipboard) {
track->fit();
if(rejectByROI && track->isFitted()) {
// check if the track is within ROI for all detectors
bool reject = false;
for(auto& detector : get_detectors()) {
reject = (detector->isWithinROI(track) ? reject : true);
}
if(reject) {
//check if the track is within ROI for all detectors
auto ds = get_detectors();
auto out_of_roi = std::find_if(ds.begin(),ds.end(),[track](const auto& d) {
return !d->isWithinROI(track);});
if(out_of_roi != ds.end()) {
delete track;
continue;
}
......
......@@ -51,7 +51,7 @@ namespace corryvreckan {
std::map<std::shared_ptr<Detector>, XYVector> spatial_cuts_;
size_t minHitsOnTrack;
bool excludeDUT;
bool rejectByROI{};
bool rejectByROI=false;
std::string trackModel;
};
} // namespace corryvreckan
......
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