lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.2 -r1.3
--- ClusteringAlgorithm.java 7 May 2009 23:57:17 -0000 1.2
+++ ClusteringAlgorithm.java 8 May 2009 18:56:36 -0000 1.3
@@ -24,13 +24,12 @@
* of clusters is returned, with each cluster being a list of RawTrackerHits
* the form the cluster.
*
- * @param sensor sensor to cluster
* @param electodes electrodes on this sensor to cluster
* @param readout readout chip for these electrodes
* @param hits raw hits
* @return list of clusters, with each cluster being a list of RawTrackerHits
*/
- public List<List<RawTrackerHit>> findClusters(SiSensor sensor, SiSensorElectrodes electrodes,
+ public List<List<RawTrackerHit>> findClusters(SiSensorElectrodes electrodes,
ReadoutChip readout, List<RawTrackerHit> hits);
}
\ No newline at end of file
lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.2 -r1.3
--- NearestNeighbor.java 7 May 2009 23:57:17 -0000 1.2
+++ NearestNeighbor.java 8 May 2009 18:56:36 -0000 1.3
@@ -10,7 +10,6 @@
import java.util.Map;
import java.util.Set;
import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
import org.lcsim.event.RawTrackerHit;
@@ -112,13 +111,12 @@
/**
* Find clusters using the nearest neighbor algorithm.
*
- * @param sensor sensor containing the electrodes
* @param electrodes electrodes we are clustering
* @param readout_chip readout chip for these electrodes
* @param raw_hits List of RawTrackerHits to be clustered
* @return list of clusters, with a cluster being a list of RawTrackerHits
*/
- public List<List<RawTrackerHit>> findClusters(SiSensor sensor, SiSensorElectrodes electrodes,
+ public List<List<RawTrackerHit>> findClusters(SiSensorElectrodes electrodes,
ReadoutChip readout_chip, List<RawTrackerHit> raw_hits) {
// Check that the seed threshold is at least as large as the neighbor threshold
@@ -126,13 +124,11 @@
throw new RuntimeException("Tracker hit clustering error: seed threshold below neighbor threshold");
}
- // Get the identifier helper for this sensor
- SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
-
// Create maps that show the channel status and relate the channel number to the raw hit and vice versa
- Map<Integer, Boolean> clusterable = new HashMap<Integer, Boolean>();
- Map<RawTrackerHit, Integer> hit_to_channel = new HashMap<RawTrackerHit, Integer>();
- Map<Integer, RawTrackerHit> channel_to_hit = new HashMap<Integer, RawTrackerHit>();
+ int mapsize = 2 * raw_hits.size();
+ Map<Integer, Boolean> clusterable = new HashMap<Integer, Boolean>(mapsize);
+ Map<RawTrackerHit, Integer> hit_to_channel = new HashMap<RawTrackerHit, Integer>(mapsize);
+ Map<Integer, RawTrackerHit> channel_to_hit = new HashMap<Integer, RawTrackerHit>(mapsize);
// Create list of channel numbers to be used as cluster seeds
List<Integer> cluster_seeds = new ArrayList<Integer>();
@@ -142,6 +138,7 @@
for (RawTrackerHit raw_hit : raw_hits) {
// get the channel number for this hit
+ SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) raw_hit.getIdentifierHelper();
IIdentifier id = raw_hit.getIdentifier();
int channel_number = sid_helper.getElectrodeValue(id);
@@ -161,7 +158,9 @@
clusterable.put(channel_number, signal >= _neighbor_threshold);
// Add this hit to the list of seeds if it is above the seed threshold
- if (signal >= _seed_threshold) cluster_seeds.add(channel_number);
+ if (signal >= _seed_threshold) {
+ cluster_seeds.add(channel_number);
+ }
}
// Create a list of clusters
@@ -196,23 +195,27 @@
// Now loop over the neighbors and see if we can add them to the cluster
for (int channel : neighbor_channels) {
- // First see if this neighbor channel is in our clusterable hit map
- if (clusterable.containsKey(channel)) {
+ // Get the status of this channel
+ Boolean addhit = clusterable.get(channel);
+
+ // If the map entry is null, there is no raw hit for this channel
+ if (addhit == null) continue;
- // Now check if this neighbor channel is still available for clustering
- if (clusterable.get(channel)) {
+ // Check if this neighbor channel is still available for clustering
+ if (!addhit) continue;
+
+ // Add channel to the list of unchecked clustered channels
+ // and mark it unavailable for clustering
+ unchecked.addLast(channel);
+ clusterable.put(channel, false);
- // Add channel to the list of unchecked clustered channels
- // and mark it unavailable for clustering
- unchecked.addLast(channel);
- clusterable.put(channel, false);
- }
- }
} // end of loop over neighbor cells
} // end of loop over unchecked cells
// Finished with this cluster - add it to the list of clusters
- if (cluster.size() > 0) cluster_list.add(cluster);
+ if (cluster.size() > 0) {
+ cluster_list.add(cluster);
+ }
} // End of loop over seeds
lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.4 -r1.5
--- PixelHitMaker.java 7 May 2009 23:57:17 -0000 1.4
+++ PixelHitMaker.java 8 May 2009 18:56:36 -0000 1.5
@@ -179,7 +179,7 @@
{
// Call the clustering algorithm to make clusters
- List<List<RawTrackerHit>> cluster_list = _clustering.findClusters(sensor, electrodes, _readout_chip, raw_hits);
+ List<List<RawTrackerHit>> cluster_list = _clustering.findClusters(electrodes, _readout_chip, raw_hits);
// Create an empty list for the pixel hits to be formed from clusters
List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.4 -r1.5
--- StripHitMaker.java 7 May 2009 23:57:17 -0000 1.4
+++ StripHitMaker.java 8 May 2009 18:56:36 -0000 1.5
@@ -184,7 +184,7 @@
{
// Call the clustering algorithm to make clusters
- List<List<RawTrackerHit>> cluster_list = _clustering.findClusters(sensor, electrodes, _readout_chip, raw_hits);
+ List<List<RawTrackerHit>> cluster_list = _clustering.findClusters(electrodes, _readout_chip, raw_hits);
// Create an empty list for the pixel hits to be formed from clusters
List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();