Commit in lcsim/src/org/lcsim/recon/muon on MAIN
BarrelCalSegmentFinder.java+47-591.26 -> 1.27
C.M.-Oct-2-06CurlBack- Decrease the layer number each time the previous layer is reached

lcsim/src/org/lcsim/recon/muon
BarrelCalSegmentFinder.java 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- BarrelCalSegmentFinder.java	13 Sep 2006 23:07:57 -0000	1.26
+++ BarrelCalSegmentFinder.java	3 Oct 2006 05:25:54 -0000	1.27
@@ -44,26 +44,26 @@
 {
    public BarrelCalSegmentFinder(Detector aDet, String subdetectorName)
    {
-      
+
       AIDA aida = AIDA.defaultInstance();
-      
+
       if(dedx==null) dedx = DeDx.instance();
       subdetName = subdetectorName;
-      
+
       // Get the parameters that describe this detector component
       det = aDet;
       String a_nam = det.getHeader().getDetectorName();
       calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
-      
+
       Layering layers = ((Layered) calsub).getLayering();
-     
-      
+
+
       rmin = calsub.getInnerRadius();
       rmax = calsub.getOuterRadius();
       zmax = calsub.getZMax();
       nLayers = layers.getLayerCount();
       rLayer0Mid = calsub.getLayering().getDistanceToLayerSensorMid(0);
-      
+
       dataMgr = CalHitMapMgr.getInstance();
       segm = (SegmentationBase)calsub.getReadout().getSegmentation();
       // Set the nearest neighbor cuts to default values
@@ -77,22 +77,12 @@
          phiNNCut   = 3; // 3;
          thetaNNCut = 2; // 2;
       }
+
       Subdetector subDet = aDet.getSubdetector(subdetName);
       int nLayers = ((Layered) subDet).getLayering().getLayerCount();
       SegmentationBase base = ((SegmentationBase) subDet.getIDDecoder());
-        String readoutseg = xmlReader.getReadoutID();
-        System.out.println(" BCF: Readoutseg ===" + readoutseg);
-       
-	try {
-	  IDDescriptor desc = new IDDescriptor(readoutseg);
-          encoder = new IDEncoder(desc);
-          }
-	catch(Exception e) {
-	  System.out.println("Some exception caught! "+e);
-	}
-	if(debug)System.out.println("BCSF constructor: subdetName="+subdetName);     
+      if(debug)System.out.println("BCSF constructor: subdetName="+subdetName);
    }
-   
    //----------------------------------!!!
    public void findSegment(EventHeader event, TrackStepper inStpr)
    //----------------------------------!!!
@@ -102,8 +92,6 @@
       int nLayerStepped=0;       // curlback layers included
       double dr = (rmax - rmin)/nLayers;		// layer thickness
       numLayersHit = 0;
-      
-      
       double r;
       // C.M. Dec-03- Tkparams to stepper
       double tmpxyz ; double tmpp;
@@ -141,7 +129,7 @@
          // 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));
-      
+
       // 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
@@ -161,11 +149,12 @@
          long virtualID = segm.findCellContainingXYZ( rpVect );
          cellList.add(virtualID);
          if(stpr.getStopTkELow()) break;
-         
+
          if(stpr.getCurlBack())
          {
-            if(debug)System.out.println("!!!BCF:CURLINGBACK old r="+r+" New r="+(r-dr));
-            r=r-dr   ;
+            if(debug &&(stpr.partR(rpVect)-dr)<(r-dr) )
+               System.out.println("!!!BCF:CURLINGBACK old r="+r+" New r="+(r-dr));
+            if(stpr.partR(rpVect)<r) r=r-dr   ;
          }
          else if(nr!=(nLayers-1)) r = r + dr;
          else
@@ -173,11 +162,10 @@
             r = rmin + nLayers * dr;
             if(debug)System.out.println("BCF: AT Exit of "+subdetName+", r="+r);
          }
-         
          stpr.tkSteps(r, zmax,det, subdetName, nr);
          rpVect = stpr.getNewRp();
          // double dThk=(nr!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
-         
+
          if(!stpr.getCurlBack())nr++;
          nLayerStepped++;
       }//End of : Go on to the next layer
@@ -192,74 +180,74 @@
          long virtualID = segm.findCellContainingXYZ( rpVect );
          cellList.add(virtualID);
       }
-      
+
       double rr=stpr.partR(rpVect);
       // Now match the cells on this list to calorimeter hits
       if(subdetName.equals(hcalSubdetName))  //C.M.-27Jan03
       {
-         
+
   	 if (debug) System.out.println("BCSF: Doing matchHits in HCal");
          matchHitsFast(segm, dataMgr.getCollHitMap(hcalHitmapName) );
-         
+
       }
       else if(subdetName.equals(ecalSubdetName)) //
       {
   	 if (debug) System.out.println("BCSF: Doing matchHits in ECal");
          matchHitsFast(segm, dataMgr.getCollHitMap(ecalHitmapName) );
       }
-      
+
       event.put(subdetName+"FoundHits",foundHits);
    }
-   
+
    public void reset()
    {
       // Erase lists of hits and cells
       hitList.removeAllElements();
       cellList.removeAllElements();
-      
+
    }
-    
-   
+
+
    public void setPhiNNCut(int cut)
    {
-      
+
       // Set the number of nearest neighbors cut in phi. Cells
       // with abs(phi_track - phi_cell) <=  cut will be added
       // to the list
-      
+
       phiNNCut = cut;
    }
-   
+
    public void setThetaNNCut(int cut)
    {
-      
+
       // Set the number of nearest neighbors cut in theta. Cells
       // with abs(theta_track - theta_cell) <=  cut will be added
       // to the list
-      
+
       thetaNNCut = cut;
    }
-   
+
    public double[] getNNCuts()
    {
       // Return the number of nearest neighbors cuts in phi and theta
-      
+
       return(new double[]
       {phiNNCut, thetaNNCut});
    }
-   
+
    public int getNLayersHit()
    {
       // Return the number of layers the track passed through
-      
+
       return(numLayersHit);
    }
-   
-   
+
+
 //     public int xyzToPhiBin(double[] r)
 //     {
 //         // Determine phi bin corresponding to this Cartesian coordinate
-   
+
 //         double phi;
 //         int bin;
 //         nc++;
@@ -269,7 +257,7 @@
 //         bin = (int)(phi/phiBinSize);
 //         return(bin);
 //     }
-   
+
 //     public int xyzToThetaBin(double[] r)
 //     {
 //         // Determine theta bin corresponding to this Cartesian coordinate
@@ -282,10 +270,10 @@
 //         bin = (int)(theta/thetaBinSize);
 //         return(bin);
 //     }
-   
-   
+
+
    // The following two methods implement the CalorimeterHits interface
-   
+
    public Enumeration getHits()
    {
       return(hitList.elements());
@@ -294,7 +282,7 @@
    {
       return(hitPos.elements());
    }
-   
+
    public int getNHits()
    {
       return(hitList.size());
@@ -303,13 +291,13 @@
    {
       return(hitPos.size());
    }
-   
+
    protected void matchHitsFast(SegmentationBase cell,
            Map<Long,CalorimeterHit> calHits)
    {
       this.matchHitsFast(cell, calHits, false);
    }
-   
+
    protected void matchHitsFast(SegmentationBase cell,
            Map<Long,CalorimeterHit> calHits,
            boolean debug)
@@ -323,7 +311,7 @@
       {
 // 	if(segm instanceof ProjectiveCylinder) {
          // check cell itself
-         
+
          CalorimeterHit hit = calHits.get(cellid);
          segm.setID(cellid);
          int ilay = segm.getLayer();
@@ -365,7 +353,7 @@
          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)
             {
@@ -382,7 +370,7 @@
                {
                   jthe = segm.getValue("z");
                }
-               
+
                int jlay = segm.getLayer();
                if(debug)
                {
@@ -405,8 +393,8 @@
       if(debug) System.out.println("Total # hits: virtual="+cellList.size()
       +", real="+nhitsTotal);
    }
-   
-   
+
+
    protected Detector det;
    protected CylindricalBarrelCalorimeter calsub;
    protected SegmentationBase segm;
CVSspam 0.2.8