Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
4aea4521
Commit
4aea4521
authored
Jun 09, 2016
by
Daniel Hynds
Browse files
handle trees with pointers, prevent accidental memory cleanup
Former-commit-id: 4186eea555596286f3da3400e4721ac8d73e7277
parent
3f5576b5
Changes
1
Show whitespace changes
Inline
Side-by-side
branches/trunk/algorithms/SpatialTracking.C
View file @
4aea4521
...
...
@@ -49,7 +49,7 @@ void SpatialTracking::initialise(Parameters* par){
StatusCode
SpatialTracking
::
run
(
Clipboard
*
clipboard
){
// Container for all clusters, and detectors in tracking
map
<
string
,
KDTree
>
trees
;
map
<
string
,
KDTree
*
>
trees
;
vector
<
string
>
detectors
;
Clusters
*
referenceClusters
;
...
...
@@ -77,8 +77,8 @@ StatusCode SpatialTracking::run(Clipboard* clipboard){
if
(
tempClusters
->
size
()
==
0
)
continue
;
// Make trees of the clusters on each plane
KDTree
clusterTree
;
clusterTree
.
buildSpatialTree
(
*
tempClusters
);
KDTree
*
clusterTree
=
new
KDTree
()
;
clusterTree
->
buildSpatialTree
(
*
tempClusters
);
trees
[
detectorID
]
=
clusterTree
;
detectors
.
push_back
(
detectorID
);
if
(
debug
)
tcout
<<
"Picked up "
<<
tempClusters
->
size
()
<<
" clusters on device "
<<
detectorID
<<
endl
;
...
...
@@ -120,8 +120,9 @@ StatusCode SpatialTracking::run(Clipboard* clipboard){
// Get the closest neighbour
if
(
debug
)
tcout
<<
"- looking for nearest cluster on device "
<<
detectors
[
det
]
<<
endl
;
Cluster
*
closestCluster
=
trees
[
detectors
[
det
]]
.
getClosestNeighbour
(
cluster
);
Cluster
*
closestCluster
=
trees
[
detectors
[
det
]]
->
getClosestNeighbour
(
cluster
);
if
(
debug
)
tcout
<<
"still alive"
<<
endl
;
// If it is used do nothing
// if(used[closestCluster]) continue;
...
...
@@ -177,6 +178,12 @@ StatusCode SpatialTracking::run(Clipboard* clipboard){
clipboard
->
put
(
"tracks"
,(
TestBeamObjects
*
)
tracks
);
}
// Clean up tree objects
for
(
int
det
=
0
;
det
<
parameters
->
nDetectors
;
det
++
){
string
detectorID
=
parameters
->
detectors
[
det
];
if
(
trees
.
count
(
detectorID
)
!=
0
)
delete
trees
[
detectorID
];
}
return
Success
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment