lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.31 -r1.32
--- ReclusterDriver.java 6 Aug 2008 20:44:28 -0000 1.31
+++ ReclusterDriver.java 12 Aug 2008 23:01:56 -0000 1.32
@@ -38,7 +38,7 @@
*
* This version is PRELIMINARY.
*
- * @version $Id: ReclusterDriver.java,v 1.31 2008/08/06 20:44:28 mcharles Exp $
+ * @version $Id: ReclusterDriver.java,v 1.32 2008/08/12 23:01:56 tjkim Exp $
* @author Mat Charles
*/
@@ -1037,14 +1037,17 @@
// Special!
// May over-ride some previous links, giving them a better score
- protected void initPotentialLinks_Cone(Collection<Cluster> seeds, Collection<Cluster> linkableClusters, Map<Cluster, Track> clustersMatchedToTweakedTracks, double scaleOK, double scaleMin) {
+ protected void initPotentialLinks_Cone(Collection<Cluster> seeds, Collection<Cluster> linkableClusters, Set<CalorimeterHit> allHits, Map<Track,Cluster> tracksMatchedToClusters, Map<Cluster, Track> clustersMatchedToTweakedTracks, double scaleOK, double scaleMin) {
String mapName;
if (m_useSteveMipsForConeScoring) {
mapName = "TrackMipMap";
} else {
mapName = "ShowerFinderMapTrackToMip";
}
- SteveMIPReassignmentAlgorithm mipAlg = new SteveMIPReassignmentAlgorithm(m_event, 1.0, mapName);
+ Map<Track, BasicCluster> MapTrkToMIP = (Map<Track, BasicCluster>) (m_event.get(mapName));
+ LocalHelixExtrapolator findCluster = new LocalHelixExtrapolator();
+ findCluster.process(m_event); // picks up geometry
+ MIPReassignmentAlgorithm mipAlg = new MIPReassignmentAlgorithm(3.14, findCluster, MapTrkToMIP, 7);
for (Cluster seed : seeds) {
// Setup: Find what track the seed is connected to.
Track tr = clustersMatchedToTweakedTracks.get(seed);
@@ -2080,6 +2083,23 @@
double score() { return m_score; }
}
+ protected double getBestScore(Track tr, Cluster clus, Map<Track, Set<Cluster>> newMapTrackToShowerComponents) {
+ Set<Cluster> shower = newMapTrackToShowerComponents.get(tr);
+ double score = -1.0;
+ for(Cluster trclus : shower){
+ List<ScoredLink> links = m_potentialLinks.get(trclus);
+ if (links != null && links.size()>0) {
+ for(ScoredLink link : links){
+ Cluster tmpclus = link.counterpart(trclus);
+ if (tmpclus == clus && link.score() > score) {
+ score = link.score();
+ }
+ }
+ }
+ }
+ return score;
+ }
+
private class Path {
Vector<Cluster> m_steps;
public Path() { m_steps = new Vector<Cluster>(); }
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.38 -r1.39
--- ReclusterDTreeDriver.java 6 Aug 2008 00:34:57 -0000 1.38
+++ ReclusterDTreeDriver.java 12 Aug 2008 23:01:56 -0000 1.39
@@ -34,7 +34,7 @@
* in this package, which uses the implementation in
* org.lcsim.recon.cluster.directedtree developed by NIU).
*
- * @version $Id: ReclusterDTreeDriver.java,v 1.38 2008/08/06 00:34:57 mcharles Exp $
+ * @version $Id: ReclusterDTreeDriver.java,v 1.39 2008/08/12 23:01:56 tjkim Exp $
* @author Mat Charles <[log in to unmask]>
*/
@@ -80,8 +80,8 @@
protected boolean m_fixSingleTracksWithCone = true;
protected boolean m_fixJetsWithCone = true;
- protected boolean m_useSimpleConeForReassignment = true;
-
+ protected boolean m_useSimpleConeForReassignment = false;
+
protected boolean m_debugSeedSplitting = false;
public void writeExtraEventOutput(boolean writeExtra) {
@@ -680,7 +680,7 @@
initPotentialLinks_MiscSelf(treesWithNoStructure, thresholdForProximityClump, "LargeStructurelessTree", false);
// TEST
- initPotentialLinks_Cone(seeds, linkableClustersExcludingPhotons, clustersMatchedToTweakedTracks, 0.95, 0.9);
+ initPotentialLinks_Cone(seeds, linkableClustersExcludingPhotons, allHits, tracksMatchedToClusters, clustersMatchedToTweakedTracks, 0.95, 0.9);
}
// Done making links. Prep & build skeletons:
@@ -995,9 +995,9 @@
ReassignClustersAlgorithm algorithm = null;
if (m_useSimpleConeForReassignment) {
- algorithm = new ConeReassignmentAlgorithm(1.0, findCluster);
+ algorithm = new ConeReassignmentAlgorithm(1.05, findCluster);
} else {
- algorithm = new MIPReassignmentAlgorithm(1.05, findCluster, MapTrkToMIP, 7);
+ algorithm = new MIPReassignmentAlgorithm(3.14, findCluster, MapTrkToMIP, 7);
}
if (m_fixSingleTracksWithCone) {
// First, try to fix the simplest case: single tracks with E/p < 1
@@ -1005,21 +1005,18 @@
// Only process tracks that aren't part of a jet:
Set<Track> jetOfTrack = mapTrackToJet.get(tr);
if (jetOfTrack == null) {
- checkTrackForReassignments(tr, newMapTrackToShowerComponents, newMapShowerComponentToTrack, allSharedClusters, unassignedClusters, newMapTrackToTolerance.get(tr), algorithm);
+ checkTrackForReassignments(tr, newMapTrackToShowerComponents, newMapShowerComponentToTrack, allSharedClusters, unassignedClusters, newMapTrackToTolerance.get(tr), algorithm, tweakedTracksMatchedToClusters);
}
}
}
if (m_fixJetsWithCone) {
for (Set<Track> jet : jets) {
- checkJetForReassignments(jet, newMapJetToShowerComponents, newMapShowerComponentToJet, allSharedClusters, unassignedClusters, algorithm);
+ checkJetForReassignments(jet, newMapJetToShowerComponents, newMapShowerComponentToJet, allSharedClusters, unassignedClusters, algorithm, newMapShowerComponentToTrack, tweakedTracksMatchedToClusters, newMapTrackToShowerComponents);
}
}
+ printStatus("FINAL STATUS:", tracksSortedByMomentum, allSharedClusters, newMapTrackToShowerComponents, newMapShowerComponentToTrack, newMapTrackToThreshold, newMapTrackToTolerance, newMapJetToShowerComponents, newMapShowerComponentToJet, mapTrackToJet, modifiedPhotonClusters, mips, clumps, treesWithNoStructure, seedLeftoverHitClusters, newMapTrackToVetoedAdditions);
- // if (m_debug) {
- printStatus("FINAL STATUS:", tracksSortedByMomentum, allSharedClusters, newMapTrackToShowerComponents, newMapShowerComponentToTrack, newMapTrackToThreshold, newMapTrackToTolerance, newMapJetToShowerComponents, newMapShowerComponentToJet, mapTrackToJet, modifiedPhotonClusters, mips, clumps, treesWithNoStructure, seedLeftoverHitClusters, newMapTrackToVetoedAdditions);
- // }
-
- makePlotsOfEoverP(newMapTrackToShowerComponents, newMapJetToShowerComponents, mapTrackToJet, allSharedClusters);
+ makePlotsOfEoverP(newMapTrackToShowerComponents, newMapJetToShowerComponents, mapTrackToJet, allSharedClusters);
// Outputs
makeParticlesAndWriteOut(trackList, tracksSortedByMomentum, unmatchedTracksThatDontReachCalorimeter, mapOrigTrackToTweakedTrack,
@@ -1072,13 +1069,14 @@
List<SharedClusterGroup> allSharedClusters,
Set<Cluster> unassignedClusters,
double toleranceOfTrack,
- ReassignClustersAlgorithm algorithm)
+ ReassignClustersAlgorithm algorithm,
+ Map<Track, Cluster> tweakedTracksMatchedToClusters)
{
Set<Cluster> showerComponents = newMapTrackToShowerComponents.get(tr);
Set<Track> tmpJet = new HashSet<Track>();
tmpJet.add(tr);
if ( checkIfReassignmentNeeded(tmpJet, showerComponents, allSharedClusters, toleranceOfTrack) ) {
- List<Cluster> reassignedClusters = reassignClustersToTrack(tr, showerComponents, unassignedClusters, allSharedClusters, toleranceOfTrack, algorithm);
+ List<Cluster> reassignedClusters = reassignClustersToTrack(tr, showerComponents, unassignedClusters, allSharedClusters, toleranceOfTrack, algorithm, newMapShowerComponentToTrack, tweakedTracksMatchedToClusters, newMapTrackToShowerComponents);
if (reassignedClusters != null && reassignedClusters.size()>0) {
for (Cluster clus : reassignedClusters) {
showerComponents.add(clus);
@@ -1094,11 +1092,14 @@
Map<Cluster, Set<Track>> newMapShowerComponentToJet,
List<SharedClusterGroup> allSharedClusters,
Set<Cluster> unassignedClusters,
- ReassignClustersAlgorithm algorithm)
+ ReassignClustersAlgorithm algorithm,
+ Map<Cluster, Track> newMapShowerComponentToTrack,
+ Map<Track, Cluster> tweakedTracksMatchedToClusters,
+ Map<Track, Set<Cluster>> newMapTrackToShowerComponents)
{
Set<Cluster> showerComponents = newMapJetToShowerComponents.get(jet);
if ( checkIfReassignmentNeeded(jet, showerComponents, allSharedClusters, m_jetTolerance) ) {
- List<Cluster> reassignedClusters = reassignClustersToJet(jet, showerComponents, unassignedClusters, allSharedClusters, m_jetTolerance, algorithm);
+ List<Cluster> reassignedClusters = reassignClustersToJet(jet, showerComponents, unassignedClusters, allSharedClusters, m_jetTolerance, algorithm, newMapShowerComponentToTrack, tweakedTracksMatchedToClusters,newMapTrackToShowerComponents);
if (reassignedClusters != null && reassignedClusters.size()>0) {
for (Cluster clus : reassignedClusters) {
showerComponents.add(clus);
@@ -1110,14 +1111,14 @@
}
- protected List<Cluster> reassignClustersToTrack (Track tr, Collection<Cluster> initialShower, Collection<Cluster> unassignedClusters, List<SharedClusterGroup> allSharedClusters, double tolerance, ReassignClustersAlgorithm reassignAlgorithm)
+ protected List<Cluster> reassignClustersToTrack (Track tr, Collection<Cluster> initialShower, Collection<Cluster> unassignedClusters, List<SharedClusterGroup> allSharedClusters, double tolerance, ReassignClustersAlgorithm reassignAlgorithm, Map<Cluster, Track> newMapShowerComponentToTrack, Map<Track, Cluster> tweakedTracksMatchedToClusters, Map<Track, Set<Cluster>> newMapTrackToShowerComponents)
{
Set<Track> tmpJet = new HashSet<Track>();
tmpJet.add(tr);
- return reassignClustersToJet(tmpJet, initialShower, unassignedClusters, allSharedClusters, tolerance, reassignAlgorithm);
+ return reassignClustersToJet(tmpJet, initialShower, unassignedClusters, allSharedClusters, tolerance, reassignAlgorithm, newMapShowerComponentToTrack, tweakedTracksMatchedToClusters, newMapTrackToShowerComponents);
}
- protected List<Cluster> reassignClustersToJet (Set<Track> jet, Collection<Cluster> initialShower, Collection<Cluster> unassignedClusters, List<SharedClusterGroup> allSharedClusters, double tolerance, ReassignClustersAlgorithm reassignAlgorithm)
+ protected List<Cluster> reassignClustersToJet (Set<Track> jet, Collection<Cluster> initialShower, Collection<Cluster> unassignedClusters, List<SharedClusterGroup> allSharedClusters, double tolerance, ReassignClustersAlgorithm reassignAlgorithm, Map<Cluster, Track> newMapShowerComponentToTrack, Map<Track, Cluster> tweakedTracksMatchedToClusters, Map<Track, Set<Cluster>> newMapTrackToShowerComponents)
{
// Truth info debug
List<MCParticle> mcList = m_event.get(MCParticle.class, m_mcList);
@@ -1140,8 +1141,9 @@
double minAngle = 0;
for (Track tr : jet) {
Double angle = reassignAlgorithm.computeFigureOfMerit(tr, clus);
- if (angle != null) {
- if (minTrack==null || angle<minAngle) {
+ Double score = getBestScore(tr, clus, newMapTrackToShowerComponents);
+ if (angle != null && score > 0.1) {
+ if (minTrack==null || angle < minAngle) {
minTrack = tr;
minAngle = angle;
}
@@ -1199,9 +1201,9 @@
output.add(value);
}
} else if (!passesEoverPafter && energyAfter < trackMomentum) {
+ previousIterationOK = true;
if (punchThrough) {
// Raw energy < target, but punches through so that's OK -- stop
- previousIterationOK = true;
if (m_debug) { System.out.println("DEBUG: Punch-through now passes... E is "+energyBefore+" -> "+energyAfter); }
output.add(value);
} else {
@@ -1231,6 +1233,7 @@
throw new AssertionError("Internal consistency failure");
}
}
+
return output;
}