Commit in lcsim/src/org/lcsim/recon/muon on MAIN
BarrelCalSegmentFinder.java+42-51.9 -> 1.10
CM: correct Bfield extraction- debugging plots in new Matching

lcsim/src/org/lcsim/recon/muon
BarrelCalSegmentFinder.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- BarrelCalSegmentFinder.java	7 Dec 2005 17:27:14 -0000	1.9
+++ BarrelCalSegmentFinder.java	10 Dec 2005 15:59:03 -0000	1.10
@@ -4,7 +4,7 @@
 import java.util.*;
 import org.lcsim.util.step.TrackStepper;  //  C.M. Stepper
 import org.lcsim.util.step.DeDx;
-
+import org.lcsim.util.aida.AIDA;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.FieldMap;
 import org.lcsim.geometry.subdetector.CylindricalBarrelCalorimeter;
@@ -26,6 +26,8 @@
     public BarrelCalSegmentFinder(Detector aDet, String subdetectorName)
     {
 
+        AIDA aida = AIDA.defaultInstance();
+        
 	if(dedx==null) dedx = DeDx.instance();
 	subdetName = subdetectorName;
 
@@ -127,8 +129,8 @@
         {
 	     rpVect  = stpr.getNewRp();
             // Then do the Tracker up to r=rmin
-	    double[] pos = new double[]{rmin, 0.0, 0.0};
-	    double[] field = det.getFieldMap().getField(pos); // C.M.-June-03
+	    
+	    double[] field = det.getFieldMap().getField(rpVect); // C.M.-June-03
 	    System.out.println("BField: ("+field[0]+", "+field[1]+", "+field[2]+")");
 	    BField = field[2];
             stepConditions = steprConditions(200.,BField,0.);
@@ -139,12 +141,13 @@
 	    System.out.println("Barrel:out of Tracker");
 	}
 
+        rpVect   = stpr.getNewRp();
+
         if(subdetName.equals(hcalSubdetName))
         {
 	    System.out.println(" !!!=== rmin="+rmin+" r="+r);
 	    // Then air to r=rmin
-	    double[] pos = new double[]{rmin, 0.0, 0.0};
-	    double[] field = det.getFieldMap().getField(pos);  // C.M.-June-03
+	    double[] field = det.getFieldMap().getField(rpVect);  // C.M.-June-03
 	    BField = field[2];
             rpVect   = stpr.getNewRp();
 	    double rnow= Math.abs(Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]));
@@ -353,6 +356,7 @@
 				 Map<Long,SimCalorimeterHit> calHits,
 				 boolean debug)
     {
+      AIDA aida = AIDA.defaultInstance();
       int nhitsTotal = 0;
       ProjectiveCylinder projCal = (ProjectiveCylinder)segm;
       if(debug) System.out.println("matchhits: nhits = "+calHits.size());
@@ -360,20 +364,53 @@
 	if(segm instanceof ProjectiveCylinder) {
 	  // check cell itself
 	  SimCalorimeterHit hit = calHits.get(cellid);
+	  projCal.setID(cellid);
+	  int ilay = projCal.getLayer();
 	  if(hit!=null) {
 	    if(debug) System.out.println("matchHits: Adding hit: "+Long.toHexString(cellid));
+	     if(debug)
+		 {    
+		       double dall=0.;
+		       for(int j=0;j<nLayers;j=j+4)
+		       {
+		        aida.cloud1D(subdetName+" dphi layer "+ilay).fill(dall);
+		        aida.cloud1D(subdetName+" dtheta layer "+ilay).fill(dall);
+		       }
+
+		  
+	         }
 	    hitList.add(hit);
 	    nhitsTotal++;
 	  }
 
 	  // now check for the neighbors
 	  projCal.setID(cellid);
+	  int iphi = projCal.getValue("phi");
+	  int ithe = projCal.getValue("theta");
+	  ilay = projCal.getLayer();
 	  long[] neighs = projCal.getNeighbourIDs(0, thetaNNCut, phiNNCut );
 	  for(int i=0; i<neighs.length; ++i) {
 	    hit = calHits.get(neighs[i]);
  	    if(debug) System.out.println("neighb: cellid="+MyTools.printID(neighs[i])+", hit="+hit);
 	    if(hit!=null) {
  		if(debug) System.out.println("matchHits: Adding hit: "+Long.toHexString(cellid));
+		projCal.setID( neighs[i] );
+		int jphi = projCal.getValue("phi");
+		int jthe = projCal.getValue("theta");
+		int jlay = projCal.getLayer();
+		 if(debug)
+		 {    
+		      
+		       for(int j=0;j<nLayers;j=j+4)
+		       {
+		        if(ilay==j)
+			{
+		        aida.cloud1D(subdetName+" dphi layer "+jlay).fill(jphi-iphi);
+		        aida.cloud1D(subdetName+" dtheta layer "+jlay).fill(jthe-ithe);
+		        }
+		       }  
+		  
+		 }
 		hitList.add(hit);
 		nhitsTotal++;
 	    }
CVSspam 0.2.8