9 modified files
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.2 -r1.3
--- HandleMultiTrackClusters.java 28 Jul 2008 18:06:58 -0000 1.2
+++ HandleMultiTrackClusters.java 6 Sep 2008 23:48:43 -0000 1.3
@@ -50,7 +50,7 @@
// * Find where the clusters start (track calorimeter entry points)
// * Add pieces to each cluster
// For now do it in a fairly dumb way.
- LocalHelixExtrapolationTrackClusterMatcher tmpExtrap = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher tmpExtrap = new LocalHelixExtrapolationTrackClusterMatcher(new LocalHelixExtrapolator());
tmpExtrap.process(event);
List<Cluster> unmatchedClusters = makeFlatClusterList(part);
Map<Track, Cluster> coreMap = new HashMap<Track, Cluster>();
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.1 -r1.2
--- HelixTangentMIPGeometryHandler.java 15 Aug 2008 17:32:33 -0000 1.1
+++ HelixTangentMIPGeometryHandler.java 6 Sep 2008 23:48:43 -0000 1.2
@@ -5,7 +5,7 @@
import org.lcsim.event.util.*;
import org.lcsim.event.*;
import hep.physics.vec.*;
-import org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator;
+import org.lcsim.recon.pfa.identifier.*;
import org.lcsim.recon.cluster.util.BasicCluster;
import org.lcsim.geometry.*;
@@ -20,30 +20,30 @@
* The calculation is based on identifying the outermost hit
* and then checking the track helix near that point.
*
- * @version $Id: HelixTangentMIPGeometryHandler.java,v 1.1 2008/08/15 17:32:33 mcharles Exp $
+ * @version $Id: HelixTangentMIPGeometryHandler.java,v 1.2 2008/09/06 23:48:43 mcharles Exp $
*/
public class HelixTangentMIPGeometryHandler extends MIPGeometryHandler {
private Map<Track, BasicCluster> m_newMapMIP;
- private LocalHelixExtrapolator m_extrap;
+ private HelixExtrapolator m_extrap;
- public HelixTangentMIPGeometryHandler(Map<Track, BasicCluster> trkmipmap, LocalHelixExtrapolator extrap) {
+ public HelixTangentMIPGeometryHandler(Map<Track, BasicCluster> trkmipmap, HelixExtrapolator extrap) {
super();
m_extrap = extrap;
m_newMapMIP = trkmipmap;
}
protected void findPointAndTangentNoCache(Track tr, BasicHep3Vector outputPoint, BasicHep3Vector outputTangentUnit) throws ExtrapolationFailureException {
- m_extrap.performExtrapolation(tr); // Make sure that the extrapolation is valid.
+ HelixExtrapolationResult result = m_extrap.performExtrapolation(tr); // Make sure that the extrapolation is valid.
BasicCluster newmip = m_newMapMIP.get(tr);
List<Hep3Vector> lastTwoPositions = new ArrayList<Hep3Vector>();
Hep3Vector last0pos = null;
Hep3Vector tangent = null;
if(newmip.getCalorimeterHits().size() < 3){ //These is no mip close to track. There should at least two hits.
- last0pos = m_extrap.getLastInterceptPoint();
+ last0pos = result.getInterceptPoint();
if (last0pos != null) {
- tangent = m_extrap.getTangent(last0pos,tr); //tangent obtained using extrapolated track.
+ tangent = result.getTangent(last0pos); //tangent obtained using extrapolated track.
} else {
// Track didn't reach calorimeter
if (newmip.getCalorimeterHits().size()>=2) {
@@ -51,12 +51,12 @@
Hep3Vector last1pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-2).getPosition());
last0pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1).getPosition());
//tangent = VecOp.sub(last0pos, last1pos);
- tangent = m_extrap.getTangent(last0pos,tr); //tangent obtained using extrapolated track.
+ tangent = result.getTangent(last0pos); //tangent obtained using extrapolated track.
} else if (newmip.getCalorimeterHits().size()==1) {
Hep3Vector last1pos = new BasicHep3Vector(0,0,0);
last0pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1).getPosition());
//tangent = VecOp.sub(last0pos, last1pos);
- tangent = m_extrap.getTangent(last0pos,tr); //tangent obtained using extrapolated track.
+ tangent = result.getTangent(last0pos); //tangent obtained using extrapolated track.
} else {
// We don't have any information on the track position or intercept at all
throw new ExtrapolationFailureException("No extrapolation");
@@ -77,7 +77,7 @@
Hep3Vector last1pos = lastTwoPositions.get(1);
//Chose one
boolean usingExtrap = true;
- if(usingExtrap) tangent = m_extrap.getTangent(last0pos, tr); //tangent obtained using extrapoltated track
+ if(usingExtrap) tangent = result.getTangent(last0pos); //tangent obtained using extrapoltated track
else tangent = VecOp.sub(last0pos, last1pos);
}
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.2 -r1.3
--- LayerBasedMIPGeometryHandler.java 21 Aug 2008 18:34:31 -0000 1.2
+++ LayerBasedMIPGeometryHandler.java 6 Sep 2008 23:48:43 -0000 1.3
@@ -5,7 +5,7 @@
import org.lcsim.event.util.*;
import org.lcsim.event.*;
import hep.physics.vec.*;
-import org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator;
+import org.lcsim.recon.pfa.identifier.*;
import org.lcsim.recon.cluster.util.BasicCluster;
import org.lcsim.geometry.*;
@@ -23,15 +23,16 @@
* from the IP, then finding the hits in the outermost layer
* of that subdetector.
*
- * @version $Id: LayerBasedMIPGeometryHandler.java,v 1.2 2008/08/21 18:34:31 mcharles Exp $
+ * @version $Id: LayerBasedMIPGeometryHandler.java,v 1.3 2008/09/06 23:48:43 mcharles Exp $
*/
public class LayerBasedMIPGeometryHandler extends MIPGeometryHandler {
private Map<Track, BasicCluster> m_newMapMIP;
- private LocalHelixExtrapolator m_extrap;
+ private HelixExtrapolator m_extrap;
+ private HelixExtrapolationResult m_result;
- public LayerBasedMIPGeometryHandler(Map<Track, BasicCluster> mapTrackToMIP, LocalHelixExtrapolator extrap) {
+ public LayerBasedMIPGeometryHandler(Map<Track, BasicCluster> mapTrackToMIP, HelixExtrapolator extrap) {
super();
m_extrap = extrap;
m_newMapMIP = mapTrackToMIP;
@@ -39,20 +40,21 @@
protected void findPointAndTangentNoCache(Track tr, BasicHep3Vector outputPoint, BasicHep3Vector outputTangentUnit) throws ExtrapolationFailureException {
// Make sure the extrapolation is done
- m_extrap.performExtrapolation(tr);
+ m_result = m_extrap.performExtrapolation(tr);
// Find the MIP trace for the track
BasicCluster mip = m_newMapMIP.get(tr);
if (mip == null) {
throw new AssertionError("Track of class "+tr.getClass().getName()+" with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" has null mip!");
} else if (mip.getCalorimeterHits().size()==0) {
- Hep3Vector interceptPoint = m_extrap.getLastInterceptPoint();
+ Hep3Vector interceptPoint = null;
+ if (m_result != null) { interceptPoint = m_result.getInterceptPoint(); }
if (interceptPoint == null) {
throw new ExtrapolationFailureException("Failure to extrapolate");
} else {
outputPoint.setV(interceptPoint.x(), interceptPoint.y(), interceptPoint.z());
}
- Hep3Vector tangent = m_extrap.getTangent();
+ Hep3Vector tangent = m_result.getTangent();
outputTangentUnit.setV(tangent.x(), tangent.y(), tangent.z());
return;
}
@@ -82,7 +84,8 @@
outputTangentUnit.setV(tangentUnit.x(), tangentUnit.y(), tangentUnit.z());
} catch (ExtrapolationFailureException x) {
// Failure...
- Hep3Vector tangentUnit = m_extrap.getTangent();
+ Hep3Vector tangentUnit = null;
+ if (m_result != null) { tangentUnit = m_result.getTangent(); }
if (tangentUnit != null) {
// Use tangent at ECAL front surface instead (iffy...)
outputTangentUnit.setV(tangentUnit.x(), tangentUnit.y(), tangentUnit.z());
@@ -109,23 +112,25 @@
// To do the extrapolation, we need to know if we're looking at a barrel or an endcap subdetector.
String calName = outermostSubdet.getName();
- if (calName.compareTo("HADBarrel")==0) {
- trackPointInLayer_N = m_extrap.extendToHCALBarrelLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToHCALBarrelLayer(layerN-1);
- } else if (calName.compareTo("HADEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToHCALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToHCALEndcapLayer(layerN-1);
- } else if (calName.compareTo("EMBarrel")==0) {
- trackPointInLayer_N = m_extrap.extendToECALBarrelLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToECALBarrelLayer(layerN-1);
- } else if (calName.compareTo("EMEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToECALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToECALEndcapLayer(layerN-1);
- } else if (calName.compareTo("MuonEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToMCALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToMCALEndcapLayer(layerN-1);
- } else {
- throw new AssertionError("Calorimeter component "+calName+" not recognized!");
+ if (m_result != null) {
+ if (calName.compareTo("HADBarrel")==0) {
+ trackPointInLayer_N = m_result.extendToHCALBarrelLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToHCALBarrelLayer(layerN-1);
+ } else if (calName.compareTo("HADEndcap")==0) {
+ trackPointInLayer_N = m_result.extendToHCALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToHCALEndcapLayer(layerN-1);
+ } else if (calName.compareTo("EMBarrel")==0) {
+ trackPointInLayer_N = m_result.extendToECALBarrelLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToECALBarrelLayer(layerN-1);
+ } else if (calName.compareTo("EMEndcap")==0) {
+ trackPointInLayer_N = m_result.extendToECALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToECALEndcapLayer(layerN-1);
+ } else if (calName.compareTo("MuonEndcap")==0) {
+ trackPointInLayer_N = m_result.extendToMCALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToMCALEndcapLayer(layerN-1);
+ } else {
+ throw new AssertionError("Calorimeter component "+calName+" not recognized!");
+ }
}
if (trackPointInLayer_N == null || trackPointInLayer_NminusOne==null) {
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.14 -r1.15
--- MIPReassignmentAlgorithm.java 15 Aug 2008 18:01:37 -0000 1.14
+++ MIPReassignmentAlgorithm.java 6 Sep 2008 23:48:43 -0000 1.15
@@ -38,7 +38,7 @@
public class MIPReassignmentAlgorithm extends ReclusterDriver implements ReassignClustersAlgorithm {
private double m_limit;
- private LocalHelixExtrapolator m_extrap;
+ private HelixExtrapolator m_extrap;
private boolean debug = false;
private double m_dist = 0;
private double m_longi = 0;
@@ -54,7 +54,7 @@
private Map<Track, BasicCluster> m_newMapMIP;
private HistReassignment m_Hist = null;
- public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape, HistReassignment Hist) {
+ public MIPReassignmentAlgorithm(double limit, HelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape, HistReassignment Hist) {
m_limit = limit;
m_extrap = findCluster;
m_newMapMIP = MapTrkToMIP;
@@ -62,14 +62,14 @@
m_Hist = Hist;
}
- public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape) {
+ public MIPReassignmentAlgorithm(double limit, HelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape) {
m_limit = limit;
m_extrap = findCluster;
m_newMapMIP = MapTrkToMIP;
m_shape = shape;
}
- public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP) {
+ public MIPReassignmentAlgorithm(double limit, HelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP) {
m_limit = limit;
m_extrap = findCluster;
m_newMapMIP = MapTrkToMIP;
@@ -99,7 +99,8 @@
return bestAmongDaughters;
}
- Hep3Vector interceptPoint = m_extrap.performExtrapolation(tr);
+ HelixExtrapolationResult result = m_extrap.performExtrapolation(tr);
+ Hep3Vector interceptPoint = result.getInterceptPoint();
Hep3Vector last0pos = new BasicHep3Vector();
Hep3Vector tangent = new BasicHep3Vector(); //extrapolated direction
Hep3Vector P = new BasicHep3Vector(tr.getMomentum());
@@ -110,12 +111,12 @@
if(newmip.getCalorimeterHits().size() < 2){ //There should be at least two hits.
last0pos = interceptPoint;
if (last0pos != null) {
- tangent = m_extrap.getTangent(last0pos,tr); //tangent obtained using extrapolated track.
+ tangent = result.getTangent(last0pos); //tangent obtained using extrapolated track.
} else {
// Track didn't reach calorimeter
if (newmip.getCalorimeterHits().size()==1) {
last0pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1).getPosition());
- tangent = m_extrap.getTangent(last0pos, tr);;
+ tangent = result.getTangent(last0pos);
} else {
// We don't have any information on the track position or intercept at all
return null;
@@ -136,13 +137,13 @@
Hep3Vector last1pos = lastTwoPositions.get(1);
//Chose one
boolean usingExtrap = true;
- if(usingExtrap) tangent = m_extrap.getTangent(last0pos, tr); //tangent obtained using extrapoltated track
+ if(usingExtrap) tangent = result.getTangent(last0pos); //tangent obtained using extrapoltated track
else tangent = VecOp.sub(last0pos, last1pos);
}
Hep3Vector tangentUnit = VecOp.unit(tangent);
- Hep3Vector temp = VecOp.mult(800,tangentUnit);
- //going back 500 mm or 800 mm back to get the cone start point
+ double distanceToGoBack = 0.0; // Should be 800 by default
+ Hep3Vector temp = VecOp.mult(distanceToGoBack,tangentUnit);
Hep3Vector imgpos = VecOp.sub(last0pos,temp);
Hep3Vector clusterPosition = new BasicHep3Vector(clus.getPosition());
Hep3Vector displacement = VecOp.sub(clusterPosition, imgpos);
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.35 -r1.36
--- NonTrivialPFA.java 15 Aug 2008 16:56:44 -0000 1.35
+++ NonTrivialPFA.java 6 Sep 2008 23:48:43 -0000 1.36
@@ -363,7 +363,7 @@
// tracks to the same skeleton.
String eventSplitSkeletonClusters = "splitSkeletons";
{
- LocalHelixExtrapolationTrackClusterMatcher extrapolate = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher extrapolate = new LocalHelixExtrapolationTrackClusterMatcher(new LocalHelixExtrapolator());
extrapolate.setCutSeparation(14.0); // about two cells
org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher simpleExtrapolate = new org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher(14.0);
org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher simpleCheatExtrapolate = new org.lcsim.recon.pfa.identifier.CheatHelixTrackClusterMatcher(14.0);
@@ -603,7 +603,7 @@
// Check if they match a track (ugly... don't need to make the particles!)
{
MIPChargedParticleMaker mipHadID = new MIPChargedParticleMaker();
- LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher();
+ LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher(new LocalHelixExtrapolator());
add(mipMatch);
mipHadID.setTrackMatcher(mipMatch);
mipHadID.setInputTrackList(inputTrackList);
@@ -666,7 +666,7 @@
{
// Check if any "photons" have a track match:
SimpleChargedParticleMaker hadID = new SimpleChargedParticleMaker();
- LocalHelixExtrapolationTrackClusterMatcher clusMatch = new LocalHelixExtrapolationTrackClusterMatcher(); // New track matching
+ LocalHelixExtrapolationTrackClusterMatcher clusMatch = new LocalHelixExtrapolationTrackClusterMatcher(new LocalHelixExtrapolator()); // New track matching
add(clusMatch);
hadID.setTrackMatcher(clusMatch);
hadID.setInputTrackList(inputTrackList);
@@ -881,7 +881,7 @@
{
// First try the MIPs...
MIPChargedParticleMaker hadIDmip = new MIPChargedParticleMaker();
- LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher();
+ LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher(new LocalHelixExtrapolator());
mipMatch.setDebug(debug);
//org.lcsim.recon.pfa.identifier.SimpleTrackMIPClusterMatcher mipMatch = new org.lcsim.recon.pfa.identifier.SimpleTrackMIPClusterMatcher();
//org.lcsim.recon.pfa.identifier.SimpleTrackMIPClusterMatcher mipMatch = new org.lcsim.recon.pfa.identifier.CheatHelixTrackMIPClusterMatcher();
@@ -903,7 +903,7 @@
// Then try the clusters generically:
SimpleChargedParticleMaker hadID = new SimpleChargedParticleMaker();
- LocalHelixExtrapolationTrackClusterMatcher clusMatch = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher clusMatch = new LocalHelixExtrapolationTrackClusterMatcher(new LocalHelixExtrapolator());
//org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher clusMatch = new org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher();
//org.lcsim.recon.pfa.identifier.SimpleTrackClusterMatcher clusMatch = new org.lcsim.recon.pfa.identifier.CheatHelixTrackClusterMatcher();
add(clusMatch);
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.47 -r1.48
--- ReclusterDTreeDriver.java 31 Aug 2008 00:42:05 -0000 1.47
+++ ReclusterDTreeDriver.java 6 Sep 2008 23:48:43 -0000 1.48
@@ -24,6 +24,7 @@
import org.lcsim.geometry.subdetector.CylindricalCalorimeter;
import org.lcsim.geometry.*;
import org.lcsim.util.decision.*;
+import org.lcsim.util.aida.AIDA;
/**
* An algorithm to recluster showers using E/p information
@@ -34,7 +35,7 @@
* in this package, which uses the implementation in
* org.lcsim.recon.cluster.directedtree developed by NIU).
*
- * @version $Id: ReclusterDTreeDriver.java,v 1.47 2008/08/31 00:42:05 mcharles Exp $
+ * @version $Id: ReclusterDTreeDriver.java,v 1.48 2008/09/06 23:48:43 mcharles Exp $
* @author Mat Charles <[log in to unmask]>
*/
@@ -66,7 +67,7 @@
protected boolean m_allowPhotonSeeds = true;
protected boolean m_splitPhotonSeeds = true;
protected boolean m_allPhotonsAreValidSeeds = true;
-
+
protected boolean m_allowNeutralCalibForEoverP = false;
protected int m_minHitsToBeTreatedAsClusterECAL = 15;
@@ -85,6 +86,7 @@
protected boolean m_fixSingleTracksWithCone = true;
protected boolean m_fixJetsWithCone = true;
protected boolean m_useSimpleConeForReassignment = false;
+ protected double m_minScoreForReassignment = 0.1;
protected boolean m_debugSeedSplitting = false;
@@ -312,8 +314,7 @@
Map<Cluster, Cluster> treeOfLeftoverHits = new HashMap<Cluster,Cluster>();
// Identify the start point of showers
- org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator findCluster = new org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator();
- findCluster.process(m_event); // picks up geometry
+ m_findCluster.process(m_event); // picks up geometry
// Match tracks
// ------------
@@ -349,7 +350,11 @@
if (leftoverHitClusters.contains(matchedCluster)) {
if (m_debugSeedSplitting) {
// Debug printout
- Hep3Vector interceptPoint = findCluster.performExtrapolation(tr);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPoint = null;
+ if (result != null) {
+ interceptPoint = result.getInterceptPoint();
+ }
if (interceptPoint != null) {
double primaryDist = proximity(matchedCluster, interceptPoint);
int innermostLayerOfMatchedCluster = 99;
@@ -408,7 +413,11 @@
if (m_debugSeedSplitting) {
// Debug printout
System.out.println("DEBUG: -> Rematch failed (no targets passed track-matching)");
- Hep3Vector interceptPoint = findCluster.performExtrapolation(tr);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPoint = null;
+ if (result != null) {
+ interceptPoint = result.getInterceptPoint();
+ }
if (interceptPoint != null) {
for (Cluster target : targets) {
double dist = proximity(target, interceptPoint);
@@ -450,7 +459,7 @@
unmatchedTracks.removeAll(tracksMatchedToClusters.keySet());
List<Track> unmatchedTracksThatDontReachCalorimeter = new Vector<Track>();
for (Track tr : unmatchedTracks) {
- LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher(m_findCluster);
debugTrackMatch.process(m_event);
Cluster debugMatchedCluster = debugTrackMatch.matchTrackToCluster(tr, allMatchableClusters);
if (debugMatchedCluster != null) {
@@ -458,7 +467,11 @@
// In any case, it clearly pointed to the calorimeter so we shouldn't
// add on the track momentum (that would be double-counting)
} else {
- Hep3Vector interceptPoint = debugTrackMatch.getExtrapolator().extendToECALLayer(0);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPoint = null;
+ if (result != null) {
+ interceptPoint = result.getInterceptPoint();
+ }
if (interceptPoint == null) {
// No valid extrap to calorimeter
unmatchedTracksThatDontReachCalorimeter.add(tr);
@@ -475,7 +488,7 @@
}
}
- ShowerPointFinder showerFinder = new ShowerPointFinder(findCluster, allHits, tracksMatchedToClusters);
+ ShowerPointFinder showerFinder = new ShowerPointFinder(m_findCluster, allHits, tracksMatchedToClusters);
Map<Track,BasicCluster> MapTrkToMIP = showerFinder.findMips();
event.put("ShowerFinderMapTrackToMip", MapTrkToMIP);
List<Cluster> preShowerMips = new Vector<Cluster>();
@@ -483,7 +496,6 @@
event.put("ShowerFinderMips", preShowerMips);
event.getMetaData(preShowerMips).setTransient(true);
-
// Figure out whether tracks were uniquely matched or not:
Set<Track> uniquelyMatchedTracks = new HashSet<Track>();
Set<Track> ambiguouslyMatchedTracks = new HashSet<Track>();
@@ -1136,7 +1148,7 @@
ReassignClustersAlgorithm algorithm = null;
if (m_useSimpleConeForReassignment) {
- algorithm = new ConeReassignmentAlgorithm(1.00, findCluster);
+ algorithm = new ConeReassignmentAlgorithm(1.00, m_findCluster);
} else {
String mapName;
if (m_useSteveMipsForConeScoring) {
@@ -1145,7 +1157,7 @@
mapName = "ShowerFinderMapTrackToMip";
}
Map<Track, BasicCluster> mapTrackToMIP = (Map<Track, BasicCluster>) (m_event.get(mapName));
- MIPGeometryHandler geomHandler = new LayerBasedMIPGeometryHandler(mapTrackToMIP, findCluster);
+ MIPGeometryHandler geomHandler = new LayerBasedMIPGeometryHandler(mapTrackToMIP, m_findCluster);
//MIPGeometryHandler geomHandler = new HelixTangentMIPGeometryHandler(mapTrackToMIP, findCluster);
algorithm = new ConeMIPReassignmentAlgorithm(geomHandler, 800.0, Math.PI*0.5);
}
@@ -1164,6 +1176,7 @@
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);
makePlotsOfEoverP(newMapTrackToShowerComponents, newMapJetToShowerComponents, mapTrackToJet, allSharedClusters);
@@ -1286,7 +1299,7 @@
for (Track tr : jet) {
Double angle = reassignAlgorithm.computeFigureOfMerit(tr, clus);
Double score = getBestScore(tr, clus, newMapTrackToShowerComponents);
- if (angle != null && score > 0.1) {
+ if (angle != null && score > m_minScoreForReassignment) {
if (minTrack==null || angle < minAngle) {
minTrack = tr;
minAngle = angle;
@@ -1332,6 +1345,31 @@
boolean passesEoverPafter = testEoverP_twoSided(energyAfter, trackMomentum, tolerance);
boolean passesEoverPafterTight = testEoverP_twoSided(energyAfter, trackMomentum, 1.0);
boolean punchThrough = isPunchThrough(initialClustersPlusAdditions, allSharedClusters);
+ {
+ // Temp debug stuff
+ if (passesEoverPafter || (!passesEoverPafter && energyAfter < trackMomentum)) {
+ double tmpScore = getBestScore(initialShower, value);
+ double trackMassSq = 0.140 * 0.140;
+ double trackMomentumSq = trackMomentum * trackMomentum;
+ double trackEnergySq = trackMomentumSq + trackMassSq;
+ double trackEnergy = Math.sqrt(trackEnergySq);
+ double trackEnergySigma = estimatedEnergyUncertainty(trackMomentum);
+ double normalisedResidualBefore = (energyBefore - trackEnergy)/trackEnergySigma;
+ double normalisedResidualAfter = (energyAfter - trackEnergy)/trackEnergySigma;
+ System.out.print("DEBUG: Score "+tmpScore+" for norm residual of "+normalisedResidualBefore+" -> "+normalisedResidualAfter);
+ List<MCParticle> trackTruth = getMCParticle(jet);
+ MCParticle clusTruth = quoteDominantParticle(value);
+ if (trackTruth.contains(clusTruth)) {
+ System.out.println(" -- good match!");
+ AIDA.defaultInstance().cloud2D("ScoreVsNormResidBeforePassTruthMatch").fill(normalisedResidualBefore, tmpScore);
+ AIDA.defaultInstance().cloud2D("ScoreVsNormResidAfterPassTruthMatch").fill(normalisedResidualAfter, tmpScore);
+ } else {
+ System.out.println(" -- bad match");
+ AIDA.defaultInstance().cloud2D("ScoreVsNormResidBeforeFailTruthMatch").fill(normalisedResidualBefore, tmpScore);
+ AIDA.defaultInstance().cloud2D("ScoreVsNormResidAfterFailTruthMatch").fill(normalisedResidualAfter, tmpScore);
+ }
+ }
+ }
if (passesEoverPafter) {
// OK -- satisfies E/p now
if (m_debug) { System.out.println("DEBUG: E/p now passes... E is "+energyBefore+" -> "+energyAfter); }
@@ -1424,34 +1462,36 @@
}
private int countHitsInClusterInFirstLayers(Track tr, Cluster clus, int nLayers) {
- LocalHelixExtrapolator extrap = new LocalHelixExtrapolator();
- extrap.process(m_event);
Set<Long> allClusterHits = new HashSet<Long>();
for (CalorimeterHit hit : clus.getCalorimeterHits()) {
allClusterHits.add(hit.getCellID());
}
int countMatches = 0;
- for (int iLayer=0; iLayer<nLayers; iLayer++) {
- Long cellID = extrap.extendToECALLayerAndFindCell(iLayer);
- if (allClusterHits.contains(cellID)) {
- countMatches++;
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ if (result != null) {
+ for (int iLayer=0; iLayer<nLayers; iLayer++) {
+ Long cellID = result.extendToECALLayerAndFindCell(iLayer);
+ if (allClusterHits.contains(cellID)) {
+ countMatches++;
+ }
}
}
return countMatches;
}
private int countHitsInCoreInFirstLayers(Track tr, Cluster clus, int nLayers) {
- LocalHelixExtrapolator extrap = new LocalHelixExtrapolator();
- extrap.process(m_event);
Set<Long> coreClusterHits = new HashSet<Long>();
for (CalorimeterHit hit : clus.getClusters().get(0).getCalorimeterHits()) {
coreClusterHits.add(hit.getCellID());
}
int countMatches = 0;
- for (int iLayer=0; iLayer<nLayers; iLayer++) {
- Long cellID = extrap.extendToECALLayerAndFindCell(iLayer);
- if (coreClusterHits.contains(cellID)) {
- countMatches++;
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ if (result != null) {
+ for (int iLayer=0; iLayer<nLayers; iLayer++) {
+ Long cellID = result.extendToECALLayerAndFindCell(iLayer);
+ if (coreClusterHits.contains(cellID)) {
+ countMatches++;
+ }
}
}
return countMatches;
@@ -1476,9 +1516,11 @@
}
private double distanceFromTrackToPhotonCore(Track tr, Cluster clus) {
- LocalHelixExtrapolator extrap = new LocalHelixExtrapolator();
- extrap.process(m_event);
- Hep3Vector interceptPoint = extrap.performExtrapolation(tr);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPoint = null;
+ if (result != null) {
+ interceptPoint = result.getInterceptPoint();
+ }
if (interceptPoint != null) {
Cluster coreSubCluster = clus.getClusters().get(0);
BasicCluster copyOfCoreSubCluster = new BasicCluster();
@@ -1699,7 +1741,7 @@
}
private void findTrackSeedInFirstLayersOnly(Track tr, Map<Integer, Set<CalorimeterHit>> unusedHitsByLayer, List<CalorimeterHit> trackSeedHits, Map<CalorimeterHit, Hep3Vector> mapTrackSeedToTangent, Map<Track, CalorimeterHit> mapTrackToTrackSeed, double cutTrackSeedDist) {
- LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher(m_findCluster);
debugTrackMatch.process(m_event);
List<Cluster> tmpListLayer0 = new Vector<Cluster>();
List<Cluster> tmpListLayer1 = new Vector<Cluster>();
@@ -1722,10 +1764,15 @@
}
}
Cluster seedClusToUse = null;
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPointLayer0 = null;
+ Hep3Vector interceptPointLayer1 = null;
+ if (result != null) {
+ interceptPointLayer0 = result.extendToECALLayer(0);
+ interceptPointLayer1 = result.extendToECALLayer(1);
+ }
Cluster tmpMatchedClusterLayer0 = debugTrackMatch.matchTrackToCluster(tr, tmpListLayer0);
- Hep3Vector interceptPointLayer0 = debugTrackMatch.getExtrapolator().extendToECALLayer(0);
Cluster tmpMatchedClusterLayer1 = debugTrackMatch.matchTrackToCluster(tr, tmpListLayer1);
- Hep3Vector interceptPointLayer1 = debugTrackMatch.getExtrapolator().extendToECALLayer(1);
if (tmpMatchedClusterLayer0 == null && tmpMatchedClusterLayer1 == null) {
// No seed found for this track -- maybe extrapolation is too imprecise.
// Handle it the usual way.
@@ -1738,6 +1785,12 @@
// Look at distance from track intercept point IN LAYER 0 to hit.
// This favours the hits in the innermost layer... which is what we
// want in general.
+ if (tmpMatchedClusterLayer0.getCalorimeterHits().size()==0) { throw new AssertionError("Empty cluster!"); }
+ if (tmpMatchedClusterLayer1.getCalorimeterHits().size()==0) { throw new AssertionError("Empty cluster!"); }
+ if (tmpMatchedClusterLayer0 != null && interceptPointLayer0 == null) {
+ throw new AssertionError("Inconsistency: intercept point null but matched cluster non-null");
+ }
+ if (interceptPointLayer0 == null) { throw new AssertionError("No intercept point in layer 0!"); }
Hep3Vector positionOfMatchedClusterLayer0 = new BasicHep3Vector(tmpMatchedClusterLayer0.getCalorimeterHits().iterator().next().getPosition());
Hep3Vector positionOfMatchedClusterLayer1 = new BasicHep3Vector(tmpMatchedClusterLayer1.getCalorimeterHits().iterator().next().getPosition());
double distFromFaceToHit0 = VecOp.sub(positionOfMatchedClusterLayer0, interceptPointLayer0).magnitude();
@@ -1753,7 +1806,7 @@
seedHitToUse = seedClusToUse.getCalorimeterHits().iterator().next();
// Require within a certain distance (sanity check)
Hep3Vector positionOfSeedHit = new BasicHep3Vector(seedHitToUse.getPosition());
- Hep3Vector trackExtrapPointInLayer = debugTrackMatch.getExtrapolator().extendToECALLayer(getLayer(seedHitToUse));
+ Hep3Vector trackExtrapPointInLayer = result.extendToECALLayer(getLayer(seedHitToUse));
// It's possible (but rare) for trackExtrapPointInLayer to be null -- e.g. if track just clipped the calorimeter
// and never entered layer 2. Watch for that case.
if (trackExtrapPointInLayer != null) {
@@ -1802,7 +1855,7 @@
if (trackSeedsInFirstLayersOnly) {
findTrackSeedInFirstLayersOnly(tr, unusedHitsByLayer, trackSeedHits, mapTrackSeedToTangent, mapTrackToTrackSeed, cutTrackSeedDist);
} else {
- LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackClusterMatcher debugTrackMatch = new LocalHelixExtrapolationTrackClusterMatcher(m_findCluster);
debugTrackMatch.process(m_event);
for (int iLayer=minLayer; iLayer<maxLayer; iLayer++) {
Set<CalorimeterHit> unusedHitsInLayer = unusedHitsByLayer.get(iLayer);
@@ -1816,7 +1869,11 @@
}
}
Cluster bestClusterMatchInLayer = debugTrackMatch.matchTrackToCluster(tr, tmpClusterList);
- Hep3Vector interceptPointInLayer = debugTrackMatch.getExtrapolator().extendToECALLayer(iLayer);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector interceptPointInLayer = null;
+ if (result != null) {
+ interceptPointInLayer = result.extendToECALLayer(iLayer);
+ }
if (bestClusterMatchInLayer != null && interceptPointInLayer != null) {
CalorimeterHit seedHit = bestClusterMatchInLayer.getCalorimeterHits().get(0);
Hep3Vector positionOfMatchedHit = new BasicHep3Vector(seedHit.getPosition());
@@ -1824,7 +1881,7 @@
if (transverseDistance < cutTrackSeedDist) {
// Within 1cm => OK
trackSeedHits.add(seedHit);
- Hep3Vector tangent = debugTrackMatch.getExtrapolator().getTangent(interceptPointInLayer, tr);
+ Hep3Vector tangent = result.getTangent(interceptPointInLayer);
mapTrackSeedToTangent.put(seedHit, tangent);
mapTrackToTrackSeed.put(tr, seedHit);
break; // stop looping over layers
@@ -2888,14 +2945,24 @@
double trackEnergySq = trackMomentumMag*trackMomentumMag + currentParticleMass*currentParticleMass;
HepLorentzVector fourMomentum = new BasicHepLorentzVector(Math.sqrt(trackEnergySq), trackMomentum);
part.set4Vector(fourMomentum);
- part.setMass(mass_piplus);
+ part.setMass(currentParticleMass);
part.setReferencePoint(new BasicHep3Vector(trackOfThisParticle.getReferencePoint()));
if (isElectron) {
- part.addParticleID(pid_electron);
- part.setParticleIdUsed(pid_electron);
+ if (part.getCharge()>0) {
+ part.addParticleID(pid_positron);
+ part.setParticleIdUsed(pid_positron);
+ } else {
+ part.addParticleID(pid_electron);
+ part.setParticleIdUsed(pid_electron);
+ }
} else {
- part.addParticleID(pid_piplus);
- part.setParticleIdUsed(pid_piplus);
+ if (part.getCharge()>0) {
+ part.addParticleID(pid_piplus);
+ part.setParticleIdUsed(pid_piplus);
+ } else {
+ part.addParticleID(pid_piminus);
+ part.setParticleIdUsed(pid_piminus);
+ }
}
}
// Write out as charged track
@@ -3245,8 +3312,13 @@
part.set4Vector(fourMomentum);
part.setMass(mass_piplus);
part.setReferencePoint(new BasicHep3Vector(tr.getReferencePoint()));
- part.addParticleID(pid_piplus);
- part.setParticleIdUsed(pid_piplus);
+ if (part.getCharge()>0) {
+ part.addParticleID(pid_piplus);
+ part.setParticleIdUsed(pid_piplus);
+ } else {
+ part.addParticleID(pid_piminus);
+ part.setParticleIdUsed(pid_piminus);
+ }
chargedParticlesThatDontReachCalorimeter.add(part);
}
if (m_useTracksThatDontReachCalorimeter) {
@@ -3807,38 +3879,44 @@
newMapJetToShowerComponents.put(jet, newShower);
newMapShowerComponentToJet.put(clus, jet);
}
- if (treatAsSingleTrack) {
- boolean truthMatch = false;
- if (trackOfMatchedClusterOfBestLink instanceof BaseTrackMC) {
- MCParticle trackTruth = ((BaseTrackMC)(trackOfMatchedClusterOfBestLink)).getMCParticle();
- truthMatch = (domPartOfClus == trackTruth);
- } else {
- List<Track> tracks = trackOfMatchedClusterOfBestLink.getTracks();
- for (Track tr : tracks) {
- MCParticle trackTruth = ((BaseTrackMC)(tr)).getMCParticle();
- if (domPartOfClus == trackTruth) {
- truthMatch = true;
+ if (m_debug) {
+ if (treatAsSingleTrack) {
+ boolean truthMatch = false;
+ if (trackOfMatchedClusterOfBestLink instanceof BaseTrackMC) {
+ MCParticle trackTruth = ((BaseTrackMC)(trackOfMatchedClusterOfBestLink)).getMCParticle();
+ truthMatch = (domPartOfClus == trackTruth);
+ } else {
+ List<Track> tracks = trackOfMatchedClusterOfBestLink.getTracks();
+ for (Track tr : tracks) {
+ if (tr instanceof BaseTrackMC) {
+ MCParticle trackTruth = ((BaseTrackMC)(tr)).getMCParticle();
+ if (domPartOfClus == trackTruth) {
+ truthMatch = true;
+ }
+ }
}
}
- }
- String mistake = new String(""); // Default: not a mistake
- if (!truthMatch) {
- mistake += " -- MISTAKE";
- boolean clusterComesFromReconstructedTrack = false;
- for (Track eachTrack : tracksMatchedToClusters.keySet()) {
- MCParticle truthForEachTrack = ((BaseTrackMC)(eachTrack)).getMCParticle();
- if (domPartOfClus == truthForEachTrack) {
- clusterComesFromReconstructedTrack = true;
- break;
+ String mistake = new String(""); // Default: not a mistake
+ if (!truthMatch) {
+ mistake += " -- MISTAKE";
+ boolean clusterComesFromReconstructedTrack = false;
+ for (Track eachTrack : tracksMatchedToClusters.keySet()) {
+ if (eachTrack instanceof BaseTrackMC) {
+ MCParticle truthForEachTrack = ((BaseTrackMC)(eachTrack)).getMCParticle();
+ if (domPartOfClus == truthForEachTrack) {
+ clusterComesFromReconstructedTrack = true;
+ break;
+ }
+ }
+ }
+ if (clusterComesFromReconstructedTrack) {
+ mistake += " [but no cost]";
}
}
- if (clusterComesFromReconstructedTrack) {
- mistake += " [but no cost]";
- }
+ System.out.println("DEBUG: Over-rode scoring to make a link: Track with p="+trackMomentum+" to clus with "+clus.getCalorimeterHits().size()+" hits from "+domPDG+" with p="+domMom+mistake);
+ } else {
+ System.out.println("DEBUG: Over-rode scoring to make a link: Jet with p="+jetScalarMomentum(jet)+" to clus with "+clus.getCalorimeterHits().size()+" hits");
}
- if (m_debug) { System.out.println("DEBUG: Over-rode scoring to make a link: Track with p="+trackMomentum+" to clus with "+clus.getCalorimeterHits().size()+" hits from "+domPDG+" with p="+domMom+mistake); }
- } else {
- if (m_debug) { System.out.println("DEBUG: Over-rode scoring to make a link: Jet with p="+jetScalarMomentum(jet)+" to clus with "+clus.getCalorimeterHits().size()+" hits"); }
}
}
}
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.37 -r1.38
--- ReclusterDriver.java 30 Aug 2008 20:07:31 -0000 1.37
+++ ReclusterDriver.java 6 Sep 2008 23:48:43 -0000 1.38
@@ -38,7 +38,7 @@
*
* This version is PRELIMINARY.
*
- * @version $Id: ReclusterDriver.java,v 1.37 2008/08/30 20:07:31 mcharles Exp $
+ * @version $Id: ReclusterDriver.java,v 1.38 2008/09/06 23:48:43 mcharles Exp $
* @author Mat Charles
*/
@@ -88,6 +88,10 @@
protected boolean m_debugLinkPlots = false;
+ protected HelixExtrapolator m_findCluster = new org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator();
+ //protected HelixExtrapolator m_findCluster = new org.lcsim.recon.pfa.identifier.TrackHelixExtrapolator();
+ //protected HelixExtrapolator m_findCluster = new org.lcsim.recon.pfa.identifier.TrackHelixPlusHitExtrapolator();
+
protected ReclusterDriver() {
// Gah, debug only!
}
@@ -120,11 +124,12 @@
protected void initTrackMatch() {
// Track-matching is complex. Use several matchers...
// Try matching with local helix extrap to MIP or generic cluster:
- LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher();
- LocalHelixExtrapolationTrackClusterMatcher genMatch = new LocalHelixExtrapolationTrackClusterMatcher();
+ LocalHelixExtrapolationTrackMIPClusterMatcher mipMatch = new LocalHelixExtrapolationTrackMIPClusterMatcher(m_findCluster);
+ LocalHelixExtrapolationTrackClusterMatcher genMatch = new LocalHelixExtrapolationTrackClusterMatcher(m_findCluster);
DualActionTrackClusterMatcher localHelixMatchers = new DualActionTrackClusterMatcher(mipMatch, genMatch);
add(mipMatch);
add(genMatch);
+ System.out.println("FIXME: Disabled backup tracking for testing purposes!");
// Try matching with full swimming to MIP or generic cluster:
SimpleTrackMIPClusterMatcher mipMatchSimple = new SimpleTrackMIPClusterMatcher();
SimpleTrackClusterMatcher genMatchSimple = new SimpleTrackClusterMatcher();
@@ -1054,9 +1059,7 @@
mipAlg = new SteveMIPReassignmentAlgorithm(m_event, 1.0, mapName);
} else {
Map<Track, BasicCluster> mapTrackToMIP = (Map<Track, BasicCluster>) (m_event.get(mapName));
- LocalHelixExtrapolator findCluster = new LocalHelixExtrapolator();
- findCluster.process(m_event); // picks up geometry
- MIPGeometryHandler geomHandler = new LayerBasedMIPGeometryHandler(mapTrackToMIP, findCluster);
+ MIPGeometryHandler geomHandler = new LayerBasedMIPGeometryHandler(mapTrackToMIP, m_findCluster);
//MIPGeometryHandler geomHandler = new HelixTangentMIPGeometryHandler(mapTrackToMIP, findCluster);
mipAlg = new ConeMIPReassignmentAlgorithm(geomHandler, 800.0, Math.PI*0.5);
}
@@ -1924,6 +1927,16 @@
return outputHits;
}
+ protected List<MCParticle> getMCParticle(Set<Track> jet) {
+ Set<MCParticle> outputSet = new HashSet<MCParticle>();
+ for (Track tr : jet) {
+ outputSet.addAll(getMCParticle(tr));
+ }
+ List<MCParticle> outputList = new Vector<MCParticle>();
+ outputList.addAll(outputSet);
+ return outputList;
+ }
+
protected List<MCParticle> getMCParticle(Track tr) {
List<MCParticle> output = new Vector<MCParticle>();
if (tr instanceof ReconTrack) {
@@ -2099,6 +2112,10 @@
protected double getBestScore(Track tr, Cluster clus, Map<Track, Set<Cluster>> newMapTrackToShowerComponents) {
Set<Cluster> shower = newMapTrackToShowerComponents.get(tr);
+ return getBestScore(shower, clus);
+ }
+
+ protected double getBestScore(Collection<Cluster> shower, Cluster clus) {
double score = -1.0;
for(Cluster trclus : shower){
List<ScoredLink> links = m_potentialLinks.get(trclus);
@@ -2917,9 +2934,11 @@
double pt = Math.sqrt(px*px + py*py);
double cosTheta = pz/pmag;
String printme = new String("Track with p="+p.magnitude()+" (cosTheta="+cosTheta+")");
- LocalHelixExtrapolator extrap = new LocalHelixExtrapolator();
- extrap.process(m_event);
- Hep3Vector point = extrap.performExtrapolation(tr);
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector point = null;
+ if (result != null) {
+ point = result.getInterceptPoint();
+ }
if (point == null) {
printme += " -- extrapolation point is null";
} else {
@@ -2966,7 +2985,7 @@
}
}
}
- }
+ }
}
protected void debugPrintMatchedTrackInfo(Map<Track,Cluster> tracksMatchedToClusters, Collection<Cluster> mips, Collection<Cluster> clumps, Collection<Cluster> photonClusters, Collection<Cluster> largeClustersWithoutSkeletons, Collection<Cluster> smallClustersWithoutSkeletons, List<Cluster> wrappedUnusedHitsIgnoringLargeClustersWithoutSkeletons) {
@@ -3014,10 +3033,12 @@
}
}
printme += " (dominant particle: "+maxParticle.getType().getPDGID()+" with "+clusterTruth.get(maxParticle).size()+" hits)";
-
- LocalHelixExtrapolator extrap = new LocalHelixExtrapolator();
- extrap.process(m_event);
- Hep3Vector point = extrap.performExtrapolation(tr);
+
+ HelixExtrapolationResult result = m_findCluster.performExtrapolation(tr);
+ Hep3Vector point = null;
+ if (result != null) {
+ point = result.getInterceptPoint();
+ }
printme += " -- extrap point is ";
if (point == null) {
printme += "null";
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.8 -r1.9
--- ShowerPointFinder.java 12 Aug 2008 23:09:37 -0000 1.8
+++ ShowerPointFinder.java 6 Sep 2008 23:48:43 -0000 1.9
@@ -27,14 +27,14 @@
import org.lcsim.geometry.*;
import org.lcsim.util.decision.*;
-public class ShowerPointFinder extends ReclusterDriver {
- protected LocalHelixExtrapolator m_extrap;
+public class ShowerPointFinder {
+ protected HelixExtrapolator m_extrap;
protected Map<Track,Cluster> m_tracksMatchedToClusters;
protected Set<CalorimeterHit> m_allhits;
protected int exam = 0; //to test neighbour
protected boolean debug = false;
- public ShowerPointFinder(LocalHelixExtrapolator extrap, Set<CalorimeterHit> allHits, Map<Track,Cluster> tracksMatchedToClusters ) {
+ public ShowerPointFinder(HelixExtrapolator extrap, Set<CalorimeterHit> allHits, Map<Track,Cluster> tracksMatchedToClusters ) {
m_extrap = extrap;
m_allhits = allHits;
m_tracksMatchedToClusters = tracksMatchedToClusters;
@@ -45,7 +45,11 @@
Map<Track, BasicCluster> MapTrkToMIP = new HashMap<Track, BasicCluster>();
for(Track tr : m_tracksMatchedToClusters.keySet()){
BasicCluster mipclus = new BasicCluster(); //for new mip cluster
- Hep3Vector interceptPoint = m_extrap.performExtrapolation(tr); //for debuging
+ HelixExtrapolationResult result = m_extrap.performExtrapolation(tr);
+ Hep3Vector interceptPoint = null; // for debugging
+ if (result != null) {
+ interceptPoint = result.getInterceptPoint();
+ }
Cluster seed = m_tracksMatchedToClusters.get(tr);
if(debug){
@@ -120,10 +124,20 @@
if(EcalToHcal || InSide || EndToBarrelEcal || EndToBarrelHcal ){
Hep3Vector cur = VecOp.sub(curpos, last0);
Hep3Vector curUnit = VecOp.unit(cur);
- Hep3Vector last = VecOp.sub(last0, last1);
- //Since there is only one hit we have at the first, we use a extrapolrated tangent vector
- if( mipclus.getCalorimeterHits().size() > 1) { last = VecOp.sub(last0, last1);}
- else { last = m_extrap.getTangent();}
+ Hep3Vector last = null;
+ if (mipclus.getCalorimeterHits().size() > 1) {
+ last = VecOp.sub(last0, last1);
+ } else {
+ //Since there is only one hit we have at the first, we use a extrapolrated tangent vector
+ if (result != null) {
+ last = result.getTangent();
+ }
+ if (last == null) {
+ // No extrapolation info and only one hit -- fall back to using
+ // a straight line from the origin.
+ last = VecOp.sub(last0, new BasicHep3Vector(0,0,0));
+ }
+ }
Hep3Vector lastUnit = VecOp.unit(last);
double a = Math.acos(VecOp.dot(lastUnit, curUnit));
double d = VecOp.sub(cur,last).magnitude();
lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.3 -r1.4
--- SteveMIPReassignmentAlgorithm.java 21 Aug 2008 18:34:31 -0000 1.3
+++ SteveMIPReassignmentAlgorithm.java 6 Sep 2008 23:48:43 -0000 1.4
@@ -6,12 +6,13 @@
import org.lcsim.event.*;
import hep.physics.vec.*;
import org.lcsim.geometry.Subdetector;
-import org.lcsim.recon.pfa.identifier.LocalHelixExtrapolator;
+import org.lcsim.recon.pfa.identifier.*;
import org.lcsim.recon.cluster.util.BasicCluster;
public class SteveMIPReassignmentAlgorithm implements ReassignClustersAlgorithm {
- protected LocalHelixExtrapolator m_extrap;
+ protected HelixExtrapolator m_extrap;
+ protected HelixExtrapolationResult m_result;
protected EventHeader m_event;
protected double m_limit;
protected String m_mapTrackToMipName;
@@ -20,7 +21,7 @@
public SteveMIPReassignmentAlgorithm(EventHeader event, double limit, String mapTrackToMip) {
m_event = event;
- m_extrap = new LocalHelixExtrapolator();
+ m_extrap = new LocalHelixExtrapolator(); System.out.println("WARNING: HARD-CODED USE OF LOCALHELIXEXTRAPOLATOR");
m_extrap.process(event); // pick up geometry info
m_limit = limit;
m_cachePoint = new HashMap<Track, Hep3Vector>();
@@ -58,7 +59,7 @@
}
} else {
// Only one track -- find track helix parameters
- m_extrap.performExtrapolation(tr);
+ m_result = m_extrap.performExtrapolation(tr);
}
BasicHep3Vector endOfMipPoint = new BasicHep3Vector();
@@ -119,13 +120,13 @@
if (mip == null) {
throw new AssertionError("Track of class "+tr.getClass().getName()+" with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" has null mip!");
} else if (mip.getCalorimeterHits().size()==0) {
- Hep3Vector interceptPoint = m_extrap.getLastInterceptPoint();
+ Hep3Vector interceptPoint = m_result.getInterceptPoint();
if (interceptPoint == null) {
throw new ExtrapolationFailureException("Failure to extrapolate");
} else {
outputPoint.setV(interceptPoint.x(), interceptPoint.y(), interceptPoint.z());
}
- Hep3Vector tangent = m_extrap.getTangent();
+ Hep3Vector tangent = m_result.getTangent();
outputTangentUnit.setV(tangent.x(), tangent.y(), tangent.z());
return;
}
@@ -155,7 +156,7 @@
outputTangentUnit.setV(tangentUnit.x(), tangentUnit.y(), tangentUnit.z());
} catch (ExtrapolationFailureException x) {
// Failure...
- Hep3Vector tangentUnit = m_extrap.getTangent();
+ Hep3Vector tangentUnit = m_result.getTangent();
if (tangentUnit != null) {
// Use tangent at ECAL front surface instead (iffy...)
outputTangentUnit.setV(tangentUnit.x(), tangentUnit.y(), tangentUnit.z());
@@ -183,20 +184,20 @@
// To do the extrapolation, we need to know if we're looking at a barrel or an endcap subdetector.
String calName = outermostSubdet.getName();
if (calName.compareTo("HADBarrel")==0) {
- trackPointInLayer_N = m_extrap.extendToHCALBarrelLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToHCALBarrelLayer(layerN-1);
+ trackPointInLayer_N = m_result.extendToHCALBarrelLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToHCALBarrelLayer(layerN-1);
} else if (calName.compareTo("HADEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToHCALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToHCALEndcapLayer(layerN-1);
+ trackPointInLayer_N = m_result.extendToHCALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToHCALEndcapLayer(layerN-1);
} else if (calName.compareTo("EMBarrel")==0) {
- trackPointInLayer_N = m_extrap.extendToECALBarrelLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToECALBarrelLayer(layerN-1);
+ trackPointInLayer_N = m_result.extendToECALBarrelLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToECALBarrelLayer(layerN-1);
} else if (calName.compareTo("EMEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToECALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToECALEndcapLayer(layerN-1);
+ trackPointInLayer_N = m_result.extendToECALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToECALEndcapLayer(layerN-1);
} else if (calName.compareTo("MuonEndcap")==0) {
- trackPointInLayer_N = m_extrap.extendToMCALEndcapLayer(layerN);
- trackPointInLayer_NminusOne = m_extrap.extendToMCALEndcapLayer(layerN-1);
+ trackPointInLayer_N = m_result.extendToMCALEndcapLayer(layerN);
+ trackPointInLayer_NminusOne = m_result.extendToMCALEndcapLayer(layerN-1);
} else {
throw new AssertionError("Calorimeter component "+calName+" not recognized!");
}
CVSspam 0.2.8