Print

Print


Commit in lcsim/src/org/lcsim/recon/muon on MAIN
MuonCalSegmentFinder.java+25-221.4 -> 1.5
 GL : fix some bugs 

lcsim/src/org/lcsim/recon/muon
MuonCalSegmentFinder.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- MuonCalSegmentFinder.java	12 Dec 2005 05:45:28 -0000	1.4
+++ MuonCalSegmentFinder.java	12 Dec 2005 22:35:39 -0000	1.5
@@ -44,21 +44,21 @@
          * not guaranteed to be the same thickness in every layer.
          */
 	LayerStack layers = coilsub.getLayering().getLayers();
-	double[] rmin = coilsub.getInnerR();
-	double[] zmax = coilsub.getOuterZ();
+	double[] tmpRmin = coilsub.getInnerR();
+	double[] tmpZmax = coilsub.getOuterZ();
 
 	int nsublayers = layers.getNumberOfLayers();
         coilSlices = new Vector<CoilSubLayer>();
  	for(int i=0; i<nsublayers; ++i) {
 	  List<LayerSlice> slices
 	      = coilsub.getLayering().getLayers().getLayer(i).getSlices();
-	  double raux = rmin[i];
+	  double raux = tmpRmin[i];
 	  for ( Object o : slices ) {
 	    LayerSlice ls = (LayerSlice) o;
 	    String matName = ls.getMaterial().getName();
 	    double thickness = ls.getThickness();
 	    double matdedx = dedx.getDeDx(matName)/10;  // Eloss this material
-	    coilSlices.add( new CoilSubLayer(matName, thickness, raux, zmax[i], matdedx) );
+	    coilSlices.add( new CoilSubLayer(matName, thickness, raux, tmpZmax[i], matdedx) );
 	    raux += thickness;
 	  }
 	}
@@ -79,14 +79,14 @@
         
         numLayersHit = 0;
         double rr=0.;
-        double zmxCoil= 0.;
+        double zmxField = 0.;
 	FieldMap fm = det.getFieldMap();
         if( fm instanceof Solenoid)
         {
            Solenoid sol = (Solenoid) fm;
-           zmxCoil= sol.getZMax();
+           zmxField = sol.getZMax();
            rr = Math.sqrt(sol.getOuterRadius2());
-	   System.out.println("MCSF: Coil outer_radius="+rr+" zmxCoil="+zmxCoil);
+	   System.out.println("MCSF: Coil outer_radius="+rr+" zmxCoil="+zmxField);
          }
 
         // Forms a muon segment by looking for calorimeter hits that match
@@ -113,12 +113,13 @@
         
         double muField =-0.6;
         double zCoil;
-       // double zmxCoil=s.getZMax();
+	double zmxCoil = coilSlices.get(0).getZmax();
         int atZMax = stpr.getAtZmax();
         boolean hitsCoil;
         if(rpVect[2]== zmxCoil||stpr.getAtZmax()==1||stpr.getStopTkELow())
         {
             hitsCoil = false;
+	    System.out.println("*** Aborting at the coil");
             return;    // does not hit the coil
         }
         
@@ -127,13 +128,15 @@
 
 	for(int ii=0; ii<coilSlices.size(); ++ii) {
 	    CoilSubLayer slice = coilSlices.get(ii);
-	    if(stpr.getStopTkELow()) break; // C.M.
-	    double zmax = slice.getZmax();
-	    double rmin = slice.getRmin();
+	    if(stpr.getStopTkELow()) {
+		return; // C.M.
+	    }
+	    double zmaxSlice = slice.getZmax();
+	    double rminSlice = slice.getRmin();
 	    dr = slice.getThickness();
 	    double totalDedx = slice.getdEdx() * dr;
 
-	    if( Math.abs(rpVect[2])>zmax ) break;
+	    if( Math.abs(rpVect[2])>zmaxSlice ) break;
 	    // Go on to the next layer
 	    r = r + dr;
 	    xNSteps=(r-Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]))*10.;
@@ -142,14 +145,14 @@
 	    double radius = Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
 // 	    System.out.println("slice "+islice+", mat="+slice.getMaterial()
 // 			       +", r="+r
-// 			       +", zmax="+zmax+", rmin="+rmin
+// 			       +", zmax="+zmaxSlice+", rmin="+rminSlice
 // 			       +", dr="+dr
 // 			       +", totalDedx="+totalDedx
 // 			       +", field="+field[2]
 // 			       +", rad="+radius+", z="+rpVect[2] );
 
 	    stepConditions = steprConditions(xNSteps, field[2], totalDedx);
-	    stpr.tkSteps(r,zmax,stepConditions);
+	    stpr.tkSteps(r,zmaxSlice,stepConditions);
 	    rpVect   = stpr.getNewRp();
 	    ++islice;
 	}
@@ -163,14 +166,17 @@
         rpVect          = stpr.getNewRp();
 	//System.out.println("spot 2: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr);
         
-        if(rpVect[2]==zmxCoil|| stpr.getAtZmax()==1||stpr.getStopTkELow())
+        if(rpVect[2]>=zmxCoil|| stpr.getAtZmax()==1||stpr.getStopTkELow())
             hitsCoil = false;
         else
         {
             hitsCoil = true;
             zCoil = rpVect[2];
         }
-        if(!hitsCoil)return;
+        if(!hitsCoil) {
+	    System.out.println("*** hitcoil=false, aborting further processing");
+	    return;
+	}
 
         rNow=Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
         
@@ -193,9 +199,9 @@
         // Get intersections with succesive layers as long as track is
         // within the detector, and create a list of the cells that
         // the track passes through
-        int activLayers=32;
+        //int activLayers=32;
 	System.out.println("Problem: rpVect2="+rpVect[2]+", zmax="+zmax+", nr="+nr);
-        while (Math.abs(rpVect[2]) < zmax && nr < activLayers )
+        while (Math.abs(rpVect[2]) < zmax && nr < nLayers )
         {
 //             // Add cell to list            
 // 	    int iphi = xyzToPhiBin(rpVect);
@@ -218,12 +224,9 @@
 			       +MyTools.printID(virtualID));
 	    cellList.add(virtualID);
 
- 	    System.out.println("adding to cellList: cellid="+MyTools.printID(virtualID));
-	    cellList.add(virtualID);
-
 	    if(stpr.getStopTkELow())break; // C.M.
 	    // Go on to the next layer
-	    if(nr!=(activLayers-1)) r = r + dr;
+	    if(nr!=(nLayers-1)) r = r + dr;
 	    else                    {r=r+0.5*dr;}
 	    xNSteps=(r-Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]))*10.;
 	    stepConditions = steprConditions(xNSteps,muFieldNorm,meanDEdxPerLay(subdetName));
CVSspam 0.2.8