lcsim/src/org/lcsim/recon/cluster/mipfinder
diff -u -r1.3 -r1.4
--- ShowerPointFinder.java 19 Aug 2008 14:57:36 -0000 1.3
+++ ShowerPointFinder.java 6 Sep 2008 23:47:39 -0000 1.4
@@ -28,13 +28,13 @@
import org.lcsim.util.decision.*;
public class ShowerPointFinder{
- protected LocalHelixExtrapolator m_extrap;
+ 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();