Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/mipfinder on MAIN
ShowerPointFinder.java+20-101.6 -> 1.7
Fixed bug which caused straight jump from the middle of the ECAL into the HCAL.

lcsim/src/org/lcsim/recon/cluster/mipfinder
ShowerPointFinder.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- ShowerPointFinder.java	13 Oct 2008 18:33:52 -0000	1.6
+++ ShowerPointFinder.java	22 Jan 2010 13:40:22 -0000	1.7
@@ -31,7 +31,7 @@
     protected HelixExtrapolator m_extrap;
     protected Map<Track,Cluster> m_tracksMatchedToClusters;
     protected Set<CalorimeterHit> m_allhits;
-    protected int exam = 0; //to test neighbour
+    protected int exam = 0; //to test neighbour hits
     protected boolean debug = false;
 
     public ShowerPointFinder(HelixExtrapolator extrap, Set<CalorimeterHit> allHits, Map<Track,Cluster> tracksMatchedToClusters ) {
@@ -64,13 +64,13 @@
          
 	    // first hit of seed 
 	    mipclus.addHit(seed.getCalorimeterHits().get(0));
-	    //test for neighbour
+	    //test for neighbour hits
             examPosition(seed.getCalorimeterHits().get(0));
 
 	    int lastIterationWithFoundHit = -1;
 	    int maxSkippedLayers = 3;
-	    for( int iIteration = 0 ; iIteration < 70 ; iIteration++){ // 70? until finding shower starting point
-		//To get the information from last hit
+	    for( int iIteration = 0 ; iIteration < 70 ; iIteration++){ // 70~layers ECAL+HCAL until finding shower starting point
+		// Get the information from last hit
 		CalorimeterHit hit = mipclus.getCalorimeterHits().get( mipclus.getCalorimeterHits().size()-1);
 		IDDecoder id = hit.getIDDecoder();
 		id.setID(hit.getCellID());
@@ -99,7 +99,9 @@
 	            last1 = hitPosition(hit1);
 		}
 
-		//Searh cur hit in cur layer and arrange in angular order
+		//Search current hit in current layer and arrange in angular order
+		SortedMap<Double, CalorimeterHit> sortedHitbyPosInside   = new TreeMap();
+		SortedMap<Double, CalorimeterHit> sortedHitbyPosCrossing = new TreeMap();
 		SortedMap<Double, CalorimeterHit> sortedHitbyPos= new TreeMap();
 		for (CalorimeterHit curhit : m_allhits){
 		    IDDecoder curid = curhit.getIDDecoder();
@@ -131,7 +133,7 @@
 			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 	
+			    //Since there is only one hit we have at first, we use a extrapolated tangent vector 	
 			    if (result != null) {
 				last = result.getTangent();
 			    }
@@ -144,12 +146,20 @@
 			Hep3Vector lastUnit = VecOp.unit(last);
 			double a = Math.acos(VecOp.dot(lastUnit, curUnit));
 			double d = VecOp.sub(cur,last).magnitude();
-			if(a < 1.05 && d < 100){ //next hit in the range of angle 90 degree and less than 100mm(?)
-			    sortedHitbyPos.put(a, curhit);
+			if(a < 1.05 && d < 100){ //next hit in the range of angle 60 degree and less than 100mm
+                           if (InSide){
+				sortedHitbyPosInside.put(a, curhit);
+			    }else{
+				sortedHitbyPosCrossing.put(a, curhit);
+			    }
 			}
 		    }		
 
 		}		
+		if (sortedHitbyPosInside.size() ==0 ) 
+		    sortedHitbyPos = sortedHitbyPosCrossing;
+		else
+		    sortedHitbyPos = sortedHitbyPosInside;
 		
 		if(sortedHitbyPos.size() == 0) {
 		    // No hit found in this layer.
@@ -167,7 +177,7 @@
 		mipclus.addHit(hitAdd);
 
 		if (exam > 2) {
-		    if(debug) System.out.println("Debug: showering is already started " + exam + " layers ago" );
+		    if(debug) System.out.println("Debug: showering has already started " + exam + " layers ago" );
                     double numRemove = 0;
 		    if(mipclus.getCalorimeterHits().size() < 4) {
                         numRemove = mipclus.getCalorimeterHits().size() - 1 ; 
@@ -211,7 +221,7 @@
 		if (allHitIDs.contains(neighbourID)) count[i]++;
 	}
 	if ( count[2] >=1 ) exam++ ; // if number of neighbour hits in 5x5 is larger than 1, count 1 
-	else exam = 0; // if number of neighbour is none, set to zero and start again from 0 
+	else exam = 0; // if number of neighbour hits is 0, set to zero and start again from 0 
 
 	if(debug){
 	    Hep3Vector v = hitPosition(hit);
CVSspam 0.2.8