hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.2 -r1.3
--- HPSNearestNeighborRMS.java 24 Apr 2012 14:09:14 -0000 1.2
+++ HPSNearestNeighborRMS.java 24 Apr 2012 17:46:01 -0000 1.3
@@ -1,13 +1,10 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.lcsim.hps.recon.tracking;
import java.util.*;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.event.RawTrackerHit;
/**
@@ -119,7 +116,7 @@
* @return list of clusters, with a cluster being a list of RawTrackerHits
*/
@Override
- public List<List<HPSTrackerHit>> findClusters(List<HPSTrackerHit> base_hits) {
+ public List<List<HPSFittedRawTrackerHit>> findClusters(List<HPSFittedRawTrackerHit> base_hits) {
// Check that the seed threshold is at least as large as the neighbor threshold
if (_seed_threshold < _neighbor_threshold) {
@@ -129,20 +126,20 @@
// Create maps that show the channel status and relate the channel number to the raw hit and vice versa
int mapsize = 2 * base_hits.size();
Map<Integer, Boolean> clusterable = new HashMap<Integer, Boolean>(mapsize);
- Map<HPSTrackerHit, Integer> hit_to_channel = new HashMap<HPSTrackerHit, Integer>(mapsize);
- Map<Integer, HPSTrackerHit> channel_to_hit = new HashMap<Integer, HPSTrackerHit>(mapsize);
+ Map<HPSFittedRawTrackerHit, Integer> hit_to_channel = new HashMap<HPSFittedRawTrackerHit, Integer>(mapsize);
+ Map<Integer, HPSFittedRawTrackerHit> channel_to_hit = new HashMap<Integer, HPSFittedRawTrackerHit>(mapsize);
// Create list of channel numbers to be used as cluster seeds
List<Integer> cluster_seeds = new ArrayList<Integer>();
// Loop over the raw hits and construct the maps used to relate cells and hits, initialize the
// clustering status map, and create a list of possible cluster seeds
- for (HPSTrackerHit base_hit : base_hits) {
+ for (HPSFittedRawTrackerHit base_hit : base_hits) {
-
+ RawTrackerHit rth=base_hit.getRawTrackerHit();
// get the channel number for this hit
- SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) base_hit.getIdentifierHelper();
- IIdentifier id = base_hit.getIdentifier();
+ SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) rth.getIdentifierHelper();
+ IIdentifier id = rth.getIdentifier();
int channel_number = sid_helper.getElectrodeValue(id);
// Check for duplicate RawTrackerHit
@@ -161,7 +158,7 @@
// Get the signal from the readout chip
double signal = base_hit.getAmp();
- double noiseRMS = HPSSVTCalibrationConstants.getNoise((SiSensor)base_hit.getDetectorElement(),channel_number);
+ double noiseRMS = HPSSVTCalibrationConstants.getNoise((SiSensor)rth.getDetectorElement(),channel_number);
// Mark this hit as available for clustering if it is above the neighbor threshold
clusterable.put(channel_number, signal/noiseRMS >= _neighbor_threshold);
@@ -173,7 +170,7 @@
}
// Create a list of clusters
- List<List<HPSTrackerHit>> cluster_list = new ArrayList<List<HPSTrackerHit>>();
+ List<List<HPSFittedRawTrackerHit>> cluster_list = new ArrayList<List<HPSFittedRawTrackerHit>>();
// Now loop over the cluster seeds to form clusters
for (int seed_channel : cluster_seeds) {
@@ -182,7 +179,7 @@
if (!clusterable.get(seed_channel)) continue;
// Create a new cluster
- List<HPSTrackerHit> cluster = new ArrayList<HPSTrackerHit>();
+ List<HPSFittedRawTrackerHit> cluster = new ArrayList<HPSFittedRawTrackerHit>();
double cluster_signal = 0.;
double cluster_noise_squared = 0.;
@@ -200,7 +197,7 @@
int clustered_cell = unchecked.removeFirst();
cluster.add(channel_to_hit.get(clustered_cell));
cluster_signal += channel_to_hit.get(clustered_cell).getAmp();
- cluster_noise_squared += Math.pow(HPSSVTCalibrationConstants.getNoise((SiSensor)(channel_to_hit.get(clustered_cell)).getDetectorElement(),clustered_cell),2);
+ cluster_noise_squared += Math.pow(HPSSVTCalibrationConstants.getNoise((SiSensor)(channel_to_hit.get(clustered_cell)).getRawTrackerHit().getDetectorElement(),clustered_cell),2);
// cluster_noise_squared +=0; //need to get the noise from the calib. const. class
// Get the neigbor channels
// Set<Integer> neighbor_channels = electrodes.getNearestNeighborCells(clustered_cell);