Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,46 +64,49 @@ public ArrayList<Cluster> findClusters(List<Hit> hits2) // the number of strips
while (si < nstrip) {
// if there's a hit, it's a cluster candidate
if (HitArray[si][l][s] != null || (si < nstrip - 1 && HitArray[si + 1][l][s] != null)) {
// vector of hits in the cluster candidate
ArrayList<Hit> hits = new ArrayList<>();


Cluster this_cluster = null;
// adding all hits in this and all the subsequent
// strip until there's a strip with no hit
while ((si < nstrip - 1 && HitArray[si + 1][l][s] != null) || (HitArray[si][l][s] != null && si < nstrip)) {
if (HitArray[si][l][s] != null) { // continue clustering skipping over bad hit
hits.add(HitArray[si][l][s]);
if (this_cluster == null) {
Hit seed = HitArray[si][l][s];
this_cluster = new Cluster(seed.getDetector(), seed.getType(), seed.getSector(), l + 1, cid++);
this_cluster.setId(clusters.size() + 1);
}
this_cluster.add(HitArray[si][l][s]);
}
si++;
}

if (this_cluster != null) {

// define new cluster
Cluster this_cluster = new Cluster(hits.get(0).getDetector(), hits.get(0).getType(), hits.get(0).getSector(), l + 1, cid++);
this_cluster.setId(clusters.size() + 1);
// add hits to the cluster
this_cluster.addAll(hits);
if(hits.size()>2) {
for(int hi = 1; hi<hits.size()-1; hi++) { //interpolate between neighboring strips
if(hits.get(hi).getStrip().getEdep()<hits.get(hi-1).getStrip().getEdep()
&& hits.get(hi).getStrip().getEdep()<hits.get(hi+1).getStrip().getEdep()) {
hits.get(hi).getStrip().setEdep(0.5*(hits.get(hi-1).getStrip().getEdep()+hits.get(hi+1).getStrip().getEdep()));
if (this_cluster.size() > 2) {
for(int hi = 1; hi<this_cluster.size()-1; hi++) { //interpolate between neighboring strips
if(this_cluster.get(hi).getStrip().getEdep()<this_cluster.get(hi-1).getStrip().getEdep()
&& this_cluster.get(hi).getStrip().getEdep()<this_cluster.get(hi+1).getStrip().getEdep()) {
this_cluster.get(hi).getStrip().setEdep(0.5*(this_cluster.get(hi-1).getStrip().getEdep()+this_cluster.get(hi+1).getStrip().getEdep()));
}
}
}
for (Hit h : this_cluster) {
h.setAssociatedClusterID(this_cluster.getId());
//h.newClustering = true; //RDV fix me!
}

this_cluster.calc_CentroidParams();
//if(this_cluster.getDetector()==DetectorType.BST) {
// for (Hit h : this_cluster) {
// h.newClustering = false;
// }
//}
Collections.sort(this_cluster);

//make list of clusters
clusters.add(this_cluster);
}
for (Hit h : hits) {
h.setAssociatedClusterID(this_cluster.getId());
//h.newClustering = true; //RDV fix me!
}

this_cluster.calc_CentroidParams();
//if(this_cluster.getDetector()==DetectorType.BST) {
// for (Hit h : this_cluster) {
// h.newClustering = false;
// }
//}
Collections.sort(this_cluster);

//make list of clusters
clusters.add(this_cluster);
}

// if no hits, check for next wire coordinate
Expand Down
Loading