lcsim/src/org/lcsim/contrib/uiowa
diff -u -r1.7 -r1.8
--- MIPReassignmentAlgorithm.java 11 Jul 2008 19:12:19 -0000 1.7
+++ MIPReassignmentAlgorithm.java 12 Jul 2008 01:22:11 -0000 1.8
@@ -34,30 +34,30 @@
import hep.aida.ICloud2D;
import org.lcsim.event.EventHeader;
- public class MIPReassignmentAlgorithm implements ReassignClustersAlgorithm {
+ public class MIPReassignmentAlgorithm implements ReassignClustersAlgorithm {
protected double m_limit;
protected LocalHelixExtrapolator m_findCluster;
- protected boolean nomip = false;
- protected boolean debug = true;
- protected double m_distance = 0;
+ protected boolean nomip = false;
+ protected boolean debug = false;
+ protected double m_distance = 0;
protected double m_angle = 0;
- protected double m_degree = 0;
- protected double m_costheta = 0;
- protected double m_trans = 0;
-
- protected ICloud2D m_histo_radian_distance;
- protected ICloud2D m_histo_degree_distance;
- protected ICloud2D m_histo_costheta_distance;
- protected ICloud2D m_histo_trans_longi;
-
- protected Map<Track, BasicCluster> m_newMapMIP;
+ protected double m_degree = 0;
+ protected double m_costheta = 0;
+ protected double m_trans = 0;
+
+ protected ICloud2D m_histo_radian_distance;
+ protected ICloud2D m_histo_degree_distance;
+ protected ICloud2D m_histo_costheta_distance;
+ protected ICloud2D m_histo_trans_longi;
+
+ protected Map<Track, BasicCluster> m_newMapMIP;
public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, ICloud2D histo1, ICloud2D histo2, ICloud2D histo3, ICloud2D histo4) {
- m_limit = limit;
- m_findCluster = findCluster;
- m_newMapMIP = MapTrkToMIP;
- m_histo_radian_distance = histo1;
- m_histo_degree_distance = histo2;
+ m_limit = limit;
+ m_findCluster = findCluster;
+ m_newMapMIP = MapTrkToMIP;
+ m_histo_radian_distance = histo1;
+ m_histo_degree_distance = histo2;
m_histo_costheta_distance = histo3;
m_histo_trans_longi = histo4;
}
@@ -69,71 +69,71 @@
}
- public Double computeFigureOfMerit(Track tr, Cluster clus) {
+ public Double computeFigureOfMerit(Track tr, Cluster clus) {
- Hep3Vector tangent = new BasicHep3Vector(); //extrapolated direction
- Hep3Vector tangentUnit = new BasicHep3Vector();
- Hep3Vector clusterPosition = new BasicHep3Vector(); //cluster position
- Hep3Vector displacement = new BasicHep3Vector(); //displacement between cluster and last point
- Hep3Vector displacementUnit = new BasicHep3Vector();
- Hep3Vector interceptPoint = m_findCluster.performExtrapolation(tr);
-
- BasicCluster newmip = m_newMapMIP.get(tr);
- List<Hep3Vector> lastTwoPositions = new ArrayList<Hep3Vector>();
-
- if(newmip == null || newmip.getCalorimeterHits().size() < 5){ //These is no mip close to track.
- if (interceptPoint != null) {
- tangent = m_findCluster.getTangent(); //tangent obtained using extrapolated track.
- tangentUnit = VecOp.unit(tangent);
- clusterPosition = new BasicHep3Vector(clus.getPosition());
- displacement = VecOp.sub(clusterPosition, interceptPoint);
- displacementUnit = VecOp.unit(displacement);
- }
- }else{ //There is a mip attached to track.
- for(int i=0; i<2 ; i++){
- CalorimeterHit hit = newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1-i);
- IDDecoder id = hit.getIDDecoder();
- id.setID(hit.getCellID());
- double x = id.getPosition()[0];
- double y = id.getPosition()[1];
- double z = id.getPosition()[2];
- Hep3Vector v = new BasicHep3Vector(x,y,z);
- lastTwoPositions.add(v);
- }
- Hep3Vector last0pos = lastTwoPositions.get(0);
- Hep3Vector last1pos = lastTwoPositions.get(1);
+ Hep3Vector tangent = new BasicHep3Vector(); //extrapolated direction
+ Hep3Vector tangentUnit = new BasicHep3Vector();
+ Hep3Vector clusterPosition = new BasicHep3Vector(); //cluster position
+ Hep3Vector displacement = new BasicHep3Vector(); //displacement between cluster and last point
+ Hep3Vector displacementUnit = new BasicHep3Vector();
+ Hep3Vector interceptPoint = m_findCluster.performExtrapolation(tr);
+
+ BasicCluster newmip = m_newMapMIP.get(tr);
+ List<Hep3Vector> lastTwoPositions = new ArrayList<Hep3Vector>();
+
+ if(newmip.getCalorimeterHits().size() < 5){ //These is no mip close to track.
+ if (interceptPoint != null) {
+ tangent = m_findCluster.getTangent(); //tangent obtained using extrapolated track.
+ tangentUnit = VecOp.unit(tangent);
+ clusterPosition = new BasicHep3Vector(clus.getPosition());
+ displacement = VecOp.sub(clusterPosition, interceptPoint);
+ displacementUnit = VecOp.unit(displacement);
+ }
+ }else{ //There is a mip attached to track.
+ for(int i=0; i<2 ; i++){
+ CalorimeterHit hit = newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1-i);
+ IDDecoder id = hit.getIDDecoder();
+ id.setID(hit.getCellID());
+ double x = id.getPosition()[0];
+ double y = id.getPosition()[1];
+ double z = id.getPosition()[2];
+ Hep3Vector v = new BasicHep3Vector(x,y,z);
+ lastTwoPositions.add(v);
+ }
+ Hep3Vector last0pos = lastTwoPositions.get(0);
+ Hep3Vector last1pos = lastTwoPositions.get(1);
- tangent = VecOp.sub(last0pos, last1pos); //tangent obtained using last two points.
+ tangent = VecOp.sub(last0pos, last1pos); //tangent obtained using last two points.
tangentUnit = VecOp.unit(tangent);
- clusterPosition = new BasicHep3Vector(clus.getPosition());
- displacement = VecOp.sub(clusterPosition, last1pos);
- displacementUnit = VecOp.unit(displacement);
- if(debug) {
- System.out.print("Debug: From last two points (" + last0pos.magnitude() + ", " +last1pos.magnitude()+ " )");
- System.out.print(" Displacement from (r="+Math.sqrt(last1pos.x()*last1pos.x()+last1pos.y()*last1pos.y())+", z="+last1pos.z()+")");
- System.out.print(" to (r="+Math.sqrt(clusterPosition.x()*clusterPosition.x()+clusterPosition.y()*clusterPosition.y())+", z="+clusterPosition.z()+")");
- }
+ clusterPosition = new BasicHep3Vector(clus.getPosition());
+ displacement = VecOp.sub(clusterPosition, last1pos);
+ displacementUnit = VecOp.unit(displacement);
+ if(debug) {
+ System.out.print("Debug: From last two points (" + last0pos.magnitude() + ", " +last1pos.magnitude()+ " )");
+ System.out.print(" Displacement from (r="+Math.sqrt(last1pos.x()*last1pos.x()+last1pos.y()*last1pos.y())+", z="+last1pos.z()+")");
+ System.out.print(" to (r="+Math.sqrt(clusterPosition.x()*clusterPosition.x()+clusterPosition.y()*clusterPosition.y())+", z="+clusterPosition.z()+")");
+ }
}
- m_distance=displacement.magnitude()*VecOp.dot(tangentUnit, displacementUnit); //longitudinal distance
- m_angle=Math.acos(VecOp.dot(tangentUnit, displacementUnit));
- m_degree=m_angle*180/3.14;
- m_trans = displacement.magnitude()*Math.sin(m_angle);
- m_costheta = VecOp.dot(tangentUnit, displacementUnit);
-
- if (m_histo_radian_distance != null) { m_histo_radian_distance.fill(m_angle,m_distance); }
- if (m_histo_degree_distance != null) { m_histo_degree_distance.fill(m_degree,m_distance); }
- if (m_histo_costheta_distance != null) { m_histo_costheta_distance.fill(m_costheta,m_distance); }
- if (m_histo_trans_longi != null) { m_histo_trans_longi.fill(m_trans, m_distance); }
-
- if(debug){
- System.out.print(" Angle= " + m_angle);
- System.out.println(" Distance= " + m_distance);
- }
+ m_distance=displacement.magnitude()*VecOp.dot(tangentUnit, displacementUnit); //longitudinal distance
+ m_angle=Math.acos(VecOp.dot(tangentUnit, displacementUnit));
+ m_degree=m_angle*180/3.14;
+ m_trans = displacement.magnitude()*Math.sin(m_angle);
+ m_costheta = VecOp.dot(tangentUnit, displacementUnit);
+
+ if (m_histo_radian_distance != null) { m_histo_radian_distance.fill(m_angle,m_distance); }
+ if (m_histo_degree_distance != null) { m_histo_degree_distance.fill(m_degree,m_distance); }
+ if (m_histo_costheta_distance != null) { m_histo_costheta_distance.fill(m_costheta,m_distance); }
+ if (m_histo_trans_longi != null) { m_histo_trans_longi.fill(m_trans, m_distance); }
+
+ if(debug){
+ System.out.print(" Angle= " + m_angle);
+ System.out.println(" Distance= " + m_distance);
+ }
- if (m_angle < m_limit) return new Double(m_angle); // return the angle if it is below cone angle.
+ if (m_angle < m_limit) return new Double(m_angle); // return the angle if it is below cone angle.
return null;
- }
+ }
}