Commit in lcsim/src/org/lcsim/util/step on MAIN
StepConditions.java+46-461.2 -> 1.3
C. Milstene-Sept-08-06-Correct for a negative distance

lcsim/src/org/lcsim/util/step
StepConditions.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- StepConditions.java	14 Jul 2006 15:54:08 -0000	1.2
+++ StepConditions.java	8 Sep 2006 18:22:14 -0000	1.3
@@ -31,7 +31,7 @@
 /**
  To get the Step Conditions for the Stepper, and to reconstuct the track in the Calorimeters, ECAL, HCAL, and MUDET,
  and in the medium in between
- @author Judith Odili 
+ @author Judith Odili
  @version 1- 07/13/06 - 18:05
  Called by @see org.lcsim.util.step.TrackStepper
  */
@@ -55,7 +55,7 @@
         public static AIDA aida = AIDA.defaultInstance();
         public TrackStepper stpr = new TrackStepper();
         public double rmin,  rLayer0Mid, rmax,  nLayers, zmax;
-        
+
 	/**
          Constructor for the Subdetectors
          @param det The Detector
@@ -84,13 +84,13 @@
                 raux += thickness;
                 }
             }
-                
-           
+
+
         }
         /**
          Constructor for the Subdetectors
-        
-         @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed. 
+
+         @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed.
          @param det The Detector
          @param subdetName The subdetector  name, EMBarrel, HCALBarrel, MuonBarrel
          @param layerN The layer number in the subdetector.
@@ -103,11 +103,11 @@
                 this.det = det;
                 name = subdetName;
                 this.rNow = stpr.partR(rpVect);
-                layerthickness = r - rNow; 
-                
-                
+                layerthickness =Math.abs(r - rNow);
+
+
                 calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
-                
+
                 materials = new HashMap<String, Double>();
 		Layering layers = ((Layered) calsub).getLayering();
                 for ( LayerSlice ls : layers.getLayerStack().getLayer(layerN).getSlices() )
@@ -121,12 +121,12 @@
                     }
                     else
                         materials.put(ls.getMaterial().getName(), ls.getThickness());
-                    
+
                 }
-                 
+
                 String compoundMaterial = name+"_Material";
                 layerDEdx=0.;
-                //layerthickness = 0.; 
+                //layerthickness = 0.;
                 int i=0;
                 for( String mat : materials.keySet() )
                 {
@@ -134,7 +134,7 @@
                        double tthk    = materials.get(mat).doubleValue();
                        double a1 = (dedx.getDeDx(mat)/10);
                        double e1      = tthk * a1;  // energy loss this material
-                       
+
                        //layerthickness += tthk;
                        layerDEdx    += e1;                       // sum energy loss per material
                 }
@@ -146,12 +146,12 @@
                 //rLayer0Mid = calsub.getLayering().getDistanceToLayerSensorMid(0);
                 //double dr = (rmax - rmin)/nLayers;
                // layerthickness =(layerN!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
-		
+
 	}
         /**
          Constructor for the Materials between the subdetectors.
-        
-         @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed. 
+
+         @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed.
          @param det The Detector
          @param materialName The name of the material e.g Air, Aluminum
          @param rToGo The radius to reach.
@@ -168,11 +168,11 @@
                 for (i=0; i<3; i++)
                 {
                     pp[i]= rpvect[i+j];
-                    
+
                 }
                 mass = rpVect[6];
                 charge = rpVect[7];
-                this.distance = rToGo - rNow;
+                this.distance = Math.abs(rToGo - rNow);
                 try
                     {
                         manager = MaterialManager.instance();
@@ -185,72 +185,72 @@
                     catch (MaterialNotFoundException e)
                     {
                         System.out.println("Error: "+e);
-                        
+
                     }
 	}
-	
+
         /**
-         
+
          @return The thickness of the layer in the Subdetector
-         
-         */	
+
+         */
         public double getLayerThickness()
         {
-            
+
             return layerthickness;
-           
+
         }
         /**
-         
+
          @return The thickness of the material in the Subdetector
-         
-         */	
+
+         */
         public double getMaterialThickness()
         {
             materialthickness = distance;
             return materialthickness;
-           
+
         }
         /**
-         
+
          @return The material in the Subdetector
-         
-         */	
+
+         */
          public String getMaterial()
         {
             return sublayerMat;
-           
+
         }
        /**
-         
+
          @return The DEDX of the material in the Subdetector
-         
-         */	
+
+         */
         public double getMatterDeDx()
         {
              return (matterDEdx/(distance * 10.))/1000.;
         }
         /**
-         
+
          @return The DEDX of the layer in the Subdetector
-         
-         */	
+
+         */
          public double getlayerDeDx()
         {
              return layerDEdx;
         }
          /**
-         
+
          @return The magntic field  at the position.
-         
-         */	
+
+         */
          public double[] getField(double [] rpvect)
          {
              this.rpVect = rpvect;
-             double[] b = det.getFieldMap().getField(rpVect);    
-             
+             double[] b = det.getFieldMap().getField(rpVect);
+
              return b;
-                 
+
          }
          /**
           @return coilSlices
CVSspam 0.2.8