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

SpatialTracking: do make associations of DUT clusters with the track

parent baa14461
Pipeline #352955 failed with stages
in 36 seconds
......@@ -8,6 +8,7 @@ This algorithm performs track finding using only positional information (no timi
#### Parameters
* `spatialCut`: Cut on the maximum distance between the track and cluster for them to be considered associated. Default value is `200um`.
* `spatialCutDUT`: Cut on the maximum distance between the track and cluster for them to be considered associated for the DUT. Default value is `200um`.
* `minHitsOnTrack`: The minimum number of planes with clusters associated to a track for it to be stored. Default value is `6`.
* `excludeDUT`: Boolean to set if the DUT should be included in the track fitting. Default value is `true`.
* `DUT`: Name of the DUT plane.
......
......@@ -7,6 +7,7 @@ using namespace std;
SpatialTracking::SpatialTracking(Configuration config, std::vector<Detector*> detectors)
: Algorithm(std::move(config), std::move(detectors)) {
spatialCut = m_config.get<double>("spatialCut", Units::convert(200, "um"));
spatialCut_DUT = m_config.get<double>("spatialCutDUT", Units::convert(200, "um"));
minHitsOnTrack = m_config.get<int>("minHitsOnTrack", 6);
excludeDUT = m_config.get<bool>("excludeDUT", true);
}
......@@ -52,6 +53,7 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
map<string, KDTree*> trees;
vector<string> detectors;
Clusters* referenceClusters;
Clusters dutClusters;
// Output track container
Tracks* tracks = new Tracks();
......@@ -120,8 +122,12 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
continue;
// Check if the DUT should be excluded and obey:
if(excludeDUT && detectorID == m_config.get<std::string>("DUT"))
if(excludeDUT && detectorID == m_config.get<std::string>("DUT")) {
// Keep all DUT clusters, so we can add them as associated clusters later:
Cluster* dutCluster = trees[detectorID]->getClosestNeighbour(cluster);
dutClusters.push_back(dutCluster);
continue;
}
// Get the closest neighbour
LOG(DEBUG) << "- looking for nearest cluster on device " << detectorID;
......@@ -172,6 +178,22 @@ StatusCode SpatialTracking::run(Clipboard* clipboard) {
residualsX[detectorID]->Fill(intercept.X() - trackCluster->globalX());
residualsY[detectorID]->Fill(intercept.Y() - trackCluster->globalY());
}
// Add potential associated clusters from the DUT:
for(auto& dutcluster : dutClusters) {
// Check distance between track and cluster
ROOT::Math::XYZPoint intercept = track->intercept(dutcluster->globalZ());
double xdistance = intercept.X() - dutcluster->globalX();
double ydistance = intercept.Y() - dutcluster->globalY();
if(abs(xdistance) > spatialCut_DUT)
continue;
if(abs(ydistance) > spatialCut_DUT)
continue;
LOG(DEBUG) << "Found associated cluster";
track->addAssociatedCluster(dutcluster);
}
}
// Save the tracks on the clipboard
......
......@@ -40,7 +40,7 @@ namespace corryvreckan {
// Member variables
int m_eventNumber;
double spatialCut;
double spatialCut, spatialCut_DUT;
int minHitsOnTrack;
double nTracksTotal;
bool excludeDUT;
......
Supports Markdown
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