hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.1 -r1.2
--- HPSNearestNeighborRMS.java 22 Apr 2012 21:14:57 -0000 1.1
+++ HPSNearestNeighborRMS.java 24 Apr 2012 14:09:14 -0000 1.2
@@ -6,9 +6,9 @@
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;
-import org.lcsim.event.base.BaseTrackerHit;
+
/**
*
@@ -118,7 +118,8 @@
* @param base_hits List of RawTrackerHits to be clustered
* @return list of clusters, with a cluster being a list of RawTrackerHits
*/
- public List<List<BaseTrackerHit>> findClusters(List<BaseTrackerHit> base_hits) {
+ @Override
+ public List<List<HPSTrackerHit>> findClusters(List<HPSTrackerHit> base_hits) {
// Check that the seed threshold is at least as large as the neighbor threshold
if (_seed_threshold < _neighbor_threshold) {
@@ -128,24 +129,24 @@
// 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<BaseTrackerHit, Integer> hit_to_channel = new HashMap<BaseTrackerHit, Integer>(mapsize);
- Map<Integer, BaseTrackerHit> channel_to_hit = new HashMap<Integer, BaseTrackerHit>(mapsize);
+ Map<HPSTrackerHit, Integer> hit_to_channel = new HashMap<HPSTrackerHit, Integer>(mapsize);
+ Map<Integer, HPSTrackerHit> channel_to_hit = new HashMap<Integer, HPSTrackerHit>(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 (BaseTrackerHit base_hit : base_hits) {
- RawTrackerHit raw_hit=(RawTrackerHit) base_hit.getRawHits().get(0);
+ for (HPSTrackerHit base_hit : base_hits) {
+
// get the channel number for this hit
- SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) raw_hit.getIdentifierHelper();
- IIdentifier id = raw_hit.getIdentifier();
+ SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) base_hit.getIdentifierHelper();
+ IIdentifier id = base_hit.getIdentifier();
int channel_number = sid_helper.getElectrodeValue(id);
// Check for duplicate RawTrackerHit
- if (hit_to_channel.containsKey(raw_hit)) {
+ if (hit_to_channel.containsKey(base_hit)) {
throw new RuntimeException("Duplicate hit: "+id.toString());
}
@@ -159,8 +160,8 @@
channel_to_hit.put(channel_number, base_hit);
// Get the signal from the readout chip
- double signal = base_hit.getdEdx();
- double noiseRMS = 666; //need to get the noise from the calib. const. class
+ double signal = base_hit.getAmp();
+ double noiseRMS = HPSSVTCalibrationConstants.getNoise((SiSensor)base_hit.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);
@@ -172,7 +173,7 @@
}
// Create a list of clusters
- List<List<BaseTrackerHit>> cluster_list = new ArrayList<List<BaseTrackerHit>>();
+ List<List<HPSTrackerHit>> cluster_list = new ArrayList<List<HPSTrackerHit>>();
// Now loop over the cluster seeds to form clusters
for (int seed_channel : cluster_seeds) {
@@ -181,7 +182,7 @@
if (!clusterable.get(seed_channel)) continue;
// Create a new cluster
- List<BaseTrackerHit> cluster = new ArrayList<BaseTrackerHit>();
+ List<HPSTrackerHit> cluster = new ArrayList<HPSTrackerHit>();
double cluster_signal = 0.;
double cluster_noise_squared = 0.;
@@ -198,9 +199,9 @@
// Pull the next channel off the queue and add it's hit to the cluster
int clustered_cell = unchecked.removeFirst();
cluster.add(channel_to_hit.get(clustered_cell));
- cluster_signal += channel_to_hit.get(clustered_cell).getdEdx();
-// cluster_noise_squared += Math.pow(readout_chip.getChannel(clustered_cell).computeNoise(electrodes.getCapacitance(clustered_cell)),2);
- cluster_noise_squared +=0; //need to get the noise from the calib. const. class
+ 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 +=0; //need to get the noise from the calib. const. class
// Get the neigbor channels
// Set<Integer> neighbor_channels = electrodes.getNearestNeighborCells(clustered_cell);
Set<Integer> neighbor_channels = getNearestNeighborCells(clustered_cell);