Commit in lcsim/src/org/lcsim/recon/muon on MAIN
BarrelCalSegmentFinder.java+36-791.22 -> 1.23
New modifications by Judith Odili and Caroline Milstene - 07/13/06 - 
 Modified so the Stepper information get read 
 directly from StepConditions class.

lcsim/src/org/lcsim/recon/muon
BarrelCalSegmentFinder.java 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- BarrelCalSegmentFinder.java	22 Jun 2006 21:47:24 -0000	1.22
+++ BarrelCalSegmentFinder.java	13 Jul 2006 23:35:30 -0000	1.23
@@ -16,14 +16,21 @@
 import org.lcsim.geometry.util.IDDescriptor;
 import org.lcsim.geometry.layer.LayerSlice;
 import org.lcsim.recon.cluster.util.CalHitMapMgr;
+import org.lcsim.geometry.layer.*;
+import org.lcsim.geometry.Layered;
 /**
  @author Rich Markeloff, 
  Modified by Caroline Milstene - January-02-04 - To include the electromagnetic calorimeter
  and to include the loss of energy by the De/Dx and the effect of the magnetic field by using
  stepper - January-05. 
  
- New modifications by Judith Odili - 06/22/06 - For the lcsim format - To read the detector information directly from the \
+ New modifications by Judith Odili - 06/22/06 - For the lcsim format - 
+ To read the detector information directly from the \
  Compact.xml file by calling the Samplexmlclass methods
+ 
+ New modifications by Judith Odili and Caroline Milstene - 07/13/06 - 
+ Modified so the Stepper information get read 
+ directly from StepConditions class.
  */
 // Muon Segment Finder for barrel calorimeter
 // Modified to include the EM Calorimeter- C.Milstene
@@ -49,41 +56,15 @@
         // Get the parameters that describe this detector component
         det = aDet;
         String a_nam = det.getHeader().getDetectorName();
-        //System.out.println("              DETECTOR "+a_nam);
         calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
 
-        /** NEXT:to be done This will be part of new class StepperConditions.java located in
-         * util/step -with a fuction calculating dE/dx=f(p) Sternheimer getting all
-         * the materiel related business, radiation lenght interaction length
-         *
-         * Get materials (of 1st layer only) from LayeredCalorimeter class.
-         * NEXT :to be changed by getting materiel information layer by layer
-         * when called by the stepper which will provide sunDetName and Layer number
-         *
-         * WARNING: This approach is prone to error, because the slices are
-         * not guaranteed to be the same thickness in every layer.
-         */
-        materials = new HashMap<String, Double>();
-        for ( Object o : calsub.getLayering().getLayers().getLayer(0).getSlices() )
-        {
-            LayerSlice ls = (LayerSlice) o;
-	    String sublayerMat = ls.getMaterial().getName();
-	    if( materials.containsKey(sublayerMat) ) {
-		// if material exists, just add to thickness
-		double thickness = materials.get( sublayerMat );
-		thickness += ls.getThickness();
-		materials.put( sublayerMat, thickness );
-	    }
-	    else {
-		// a new material in this cal component
-		materials.put(ls.getMaterial().getName(), ls.getThickness() );
-	    }
-        }
-
+       
+        Layering layers = ((Layered) calsub).getLayering();
+       
         rmin = calsub.getInnerRadius();
         rmax = calsub.getOuterRadius();
         zmax = calsub.getZMax();
-        nLayers = calsub.getLayering().getLayerCount();
+        nLayers = layers.getLayerCount();
 	rLayer0Mid = calsub.getLayering().getDistanceToLayerSensorMid(0);
 
 	dataMgr = CalHitMapMgr.getInstance();
@@ -98,10 +79,7 @@
 	    thetaNNCut = 0; // 2;
 	}
 
-	//NEXT This will be read from- org.lcsim.geometry.compact.Detector
-	// <detector>/compact.xml for descriptions (under EcalBarrHits and
-	//similars)
-	// This is sidaug05 description (for all cal components)-from GL
+	
         //The purpose of this statement is to specify the xml file the data should be read from
         String filename = "C:\\work\\LCDetectors\\detectors\\" + a_nam +"\\compact.xml";
         File f = new File(filename);
@@ -134,12 +112,12 @@
         int nLayerStepped=0;       // curlback layers included
         double dr = (rmax - rmin)/nLayers;		// layer thickness
         numLayersHit = 0;
-       //  steplength = distance/xNumsteps used in the stepper --> therefore
-       //  we choose the number ofsteps to be multiple of the distance
+       
 
         double r;
         // C.M. Dec-03- Tkparams to stepper
         double tmpxyz ; double tmpp;
+        String materialName;
         r=rmin;
         // UPDATE Phase-Space
         rpVect  = stpr.getNewRp();
@@ -153,8 +131,10 @@
         double dTracker=(r-stpr.partR(rpVect));
         stpr.setDTOF(rpVect,dTracker);
         double dtTracker=stpr.getDTOF();
-	    stepConditions = steprConditions(dTracker,BField,0.,dtTracker);
-	    stpr.tkSteps( r, zmax,stepConditions);
+	    //stepConditions = steprConditions(dTracker,BField,0.,dtTracker);
+	    //stpr.tkSteps( r, zmax,stepConditions);
+          materialName = "Air";
+           stpr.tkSteps( r, zmax,det, materialName );
 	    if(debug)System.out.println("Tracker r=" +r+" zmax="+zmax+"Barrel:out of Tracker");
 	    rpVect   = stpr.getNewRp();
         if(debug)System.out.println(" CHECK NOW at Exit of Tracker rmin="+rmin+" dr="+dr) ;
@@ -169,22 +149,21 @@
         stpr.setDTOF(rpVect,d_EMHD);
         double dt_EMHD=stpr.getDTOF();
 	    if(debug)System.out.println(" distance between calorimeters EM-HD "+d_EMHD);
-	    stepConditions = steprConditions(d_EMHD,BField,0.,dt_EMHD);
-	    stpr.tkSteps(r,zmax,stepConditions);
+	    //stepConditions = steprConditions(d_EMHD,BField,0.,dt_EMHD);
+	    //stpr.tkSteps(r,zmax,stepConditions);
+            materialName = "Air";
+           stpr.tkSteps( r, zmax,det, materialName );
 	    rpVect  = stpr.getNewRp();
         // if(r<(rmin-dr))return; // does not enter HCAL
         }
         if(debug)System.out.println("Stepper pos ENTRY of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
-        stpr.setDTOF(rpVect,dr);
-        double dt_r=stpr.getDTOF();
-        stepConditions = steprConditions(dr,BField,meanDEdxPerLay(subdetName),dt_r);
-        if(debug)System.out.println("ENTRY CALOS Barrel:MeanDEdxPerLay="+meanDEdxPerLay(subdetName)+ subdetName);
+        
         // Forms a muon segment by looking for calorimeter hits that match
         // cells which the track passes through
         // Begin by finding intersection of track with innermost layer
 	    if(debug)System.out.println("subdet="+subdetName+", sensormid="+rLayer0Mid);
-        r          = rLayer0Mid;
-        stpr.tkSteps(r, zmax,stepConditions);
+        r    = rLayer0Mid;
+         stpr.tkSteps(r, zmax,det, subdetName, nr);
         rpVect  = stpr.getNewRp();
         if(debug)System.out.println(subdetName+" !!!!!! rmin="+rmin);
         // Get intersections with successive layers as long as track is
@@ -205,14 +184,15 @@
 	      else {
 	       r = rmin + nLayers * dr;
 	       if(debug)System.out.println("BCF: AT Exit of "+subdetName+", r="+r);
-	     }	 // Go on to the next layer
-	       stpr.tkSteps(r, zmax,stepConditions);
+	     }
+	      
+            stpr.tkSteps(r, zmax,det, subdetName, nr);
 	       rpVect = stpr.getNewRp();
-           double dThk=(nr!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
-           stepConditions = steprConditions(dThk,BField,meanDEdxPerLay(subdetName),dt_r);
-	      if(!stpr.getCurlBack())nr++;
+          // double dThk=(nr!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
+           
+              if(!stpr.getCurlBack())nr++;
 	      nLayerStepped++;
-        }
+        }//End of : Go on to the next layer
         // Save number of layers track passed through
         numLayersHit = nr;
 	     if(debug)System.out.println("Stepper pos EXIT of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
@@ -339,31 +319,8 @@
         {dthick, theField,theMeanDEdx,DTOF0});
     }
     //--------------------------------------------C.M.- Get DE/dx per Calorimeter Layer
-    protected double meanDEdxPerLay(String name)
-    {
-//          String compoundMaterial = name+"_Material";
-        double matterDEdx=0.;
-//         MaterialList emml = (MaterialList) det.get(name+"_Material");
-         int i=0;
-        for( String mat : materials.keySet() )
-        {
-//             Material emmat = emml.getMaterial(i);
-//             String mat     = emml.getName();
-//             double tthk    = emml.getThickness();
-//             i++;
-            double tthk    = materials.get(mat).doubleValue();
-            double e1      = tthk * (dedx.getDeDx(mat)/10);  // energy loss this material
-//            System.out.println("mat="+mat+", tth="+tthk+", e1="+e1);
-	    //System.out.println("matName="+mat+", thickness="+tthk+", dEdx="+dedx.getDeDx(mat));
-              matterDEdx    += e1;                       // sum energy loss per material
-	    //System.out.println(" DedxPerMateriel (GeV/cm) ="+dedx.getDeDx(mat)+" thickness(mm)="+tthk+ " element="+i);
-        }
-	  //  System.out.println(" MeanDedxPerLay (GeV) ="+matterDEdx);
-
-        return matterDEdx;
-    }
-
-    //------------------------------------------------------
+    
+   
 
     protected void matchHitsFast(SegmentationBase cell,
 				 Map<Long,CalorimeterHit> calHits)
@@ -473,7 +430,7 @@
     protected double []rpVect       = new double[8] ;         // C.M.-4-Vector
     protected String subdetName;      // C.M.-Jan03
     protected double rmin;
-    protected double rLayer0Mid;
+    protected double rLayer0Mid, totalthickness;
     protected double rmax;
     protected double zmax;
     protected int nLayers;
CVSspam 0.2.8