Commit in lcsim/src/org/lcsim/recon/muon on MAIN
EndcapCalSegmentFinder.java+23-341.2 -> 1.3
C. Milstene-10October2006-extension to the endcaps

lcsim/src/org/lcsim/recon/muon
EndcapCalSegmentFinder.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- EndcapCalSegmentFinder.java	10 Oct 2006 02:06:20 -0000	1.2
+++ EndcapCalSegmentFinder.java	11 Oct 2006 01:19:27 -0000	1.3
@@ -6,7 +6,7 @@
 import java.io.*;
 import java.util.*;
 import org.lcsim.util.step.TrackStepper;  //  C.M. Stepper
-import org.lcsim.recon.cluster.util.Samplexmlclass;
+//import org.lcsim.recon.cluster.util.Samplexmlclass;
 import org.lcsim.util.step.DeDx;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.geometry.Detector;
@@ -23,7 +23,7 @@
 import org.lcsim.geometry.LayeredSubdetector;
 import org.lcsim.geometry.field.FieldOverlay;
 /**
- * @authors Judith Odili and Caroline Milstene- July 2006
+ * @authors Judith Odili & Caroline Milstene- July 2006
  * Expension of the Muon package to the EndCaps 
  *
  */
@@ -31,8 +31,6 @@
 {
     public EndcapCalSegmentFinder(Detector aDet, String subdetectorName)
     {
-
-        //super(aDet, subdetectorName);
         AIDA aida = AIDA.defaultInstance();
 
         if(dedx==null) dedx = DeDx.instance();
@@ -80,18 +78,20 @@
     //----------------------------------!!!
     {
         stpr    = inStpr;
-        int nz = 0;					// layer counter
+        numLayersHit = 0; int nz = 0;	// layer hits and layer counter
         int nLayerStepped=0;       // curlback layers included
         double dz = (zmax - zmin)/nLayers;		// layer thickness
-        numLayersHit = 0;
-
-
         double z;
         double tmpxyz ; double tmpp;
         String materialName;
         z=zmin;
+        thetaLim = Math.atan2(this.rmax,this.zmin);
+        if (thetaLim < 0.) thetaLim = thetaLim + Math.PI;
         // UPDATE Phase-Space
         rpVect  = stpr.getNewRp();
+        double thetaIn=Math.atan2(stpr.partR(rpVect),rpVect[2]);
+        if (thetaIn<0.) thetaIn = thetaIn + Math.PI;
+        if(thetaIn>=thetaLim)return;
         if(debug)
             System.out.println("findSegment: subd="+subdetName);
         if(stpr.getStopTkELow())
@@ -123,14 +123,14 @@
         if(subdetName.equals(muendcapSubdetName)) {
              System.out.println("In muendcap");
             if(debug)System.out.println(" !!!=== zmin="+zmin+" z="+z);
-            // Then air to r=rmin
+            // Then air to z=zmin
             rpVect   = stpr.getNewRp();
             double d_HDMU = Math.abs(z-rpVect[2]);
             if(debug)System.out.println(" distance between calorimeters HD-MU "+d_HDMU);
             materialName = "Air";
             stpr.tkSteps( z, rmax,"Endcap",bField[2], materialName );
             rpVect  = stpr.getNewRp();
-            // if(r<(rmin-dr))return; // does not enter HCAL
+            // if(z<(zmin-dr))return; // does not enter HCAL
         }
 
         System.out.println("Stepper pos ENTRY of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
@@ -148,26 +148,23 @@
         // the track passes through
         nLayerStepped=0;
         while ((stpr.partR(rpVect)<= rmax )&& (nz < nLayers)) {
-
             long virtualId = segm.findCellContainingXYZ(rpVect);
             cellList.add(virtualId);
             Hep3Vector v = new BasicHep3Vector(rpVect[0],rpVect[1],rpVect[2]);
             hitPos.add(v);
             if(stpr.getStopTkELow()) break;
-
-            if(stpr.getCurlBack()) {
-                //if(debug)System.out.println("!!!BCF:CURLINGBACK old r="+r+" New r="+(r-dr));
-                z=z-dz   ;
+            if(stpr.getCurlBack())
+           {
+	      if(debug &&rpVect[2]<z )
+		 System.out.println("!!!ECF:CURLINGBACK old z="+rpVect[2]+" New z="+(z-dz));
+              if(rpVect[2]<z) z=z-dz   ;
             } else if(nz!=(nLayers-1)) z = z + dz;
             else {
-                z = zmin + nLayers * dz;
+                z = z + nLayers * dz;
                 if(debug)System.out.println("ECF: AT Exit of "+subdetName+", z="+z);
             }
-
             stpr.tkSteps(z, rmax,det, subdetName, nz);
-            rpVect = stpr.getNewRp();
-            // double dThk=(nr!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
-
+            rpVect = stpr.getNewRp(); 
             if(!stpr.getCurlBack())nz++;
             nLayerStepped++;
         }//End of : Go on to the next layer
@@ -181,25 +178,22 @@
             Hep3Vector v =new BasicHep3Vector(rpVect[0],rpVect[1],rpVect[2]);
             hitPos.add(v);
         }
-
         double rr=stpr.partR(rpVect);
         // Now match the cells on this list to calorimeter hits
         if(subdetName.equals(hcalendcapSubdetName))  //C.M.-27Jan03
         {
-
-//  	    System.out.println("BCSF: Doing matchHits in HCal");
+//  	    System.out.println("ECSF: Doing matchHits in HCal");
             matchHitsFast(segm, dataMgr.getCollHitMap(hcalendcapHitmapName) );
 
         }
         else if(subdetName.equals(ecalendcapSubdetName)) //
         {
-//  	    System.out.println("BCSF: Doing matchHits in ECal");
+//  	    System.out.println("ECSF: Doing matchHits in ECal");
             matchHitsFast(segm, dataMgr.getCollHitMap(ecalendcapHitmapName) );
         }
-
         else if(subdetName.equals(muendcapSubdetName)) //
         {
-//  	    System.out.println("BCSF: Doing matchHits in ECal");
+//  	    System.out.println("BCSF: Doing matchHits in Mudet");
             matchHitsFast(segm, dataMgr.getCollHitMap(muendcapHitmapName) );
         }
     }
@@ -377,9 +371,6 @@
         if(debug) System.out.println("Total # hits: virtual="+cellList.size()
         +", real="+nhitsTotal);
     }
-
-
-
     protected Detector det;
     protected CylindricalEndcapCalorimeter endcapCal;
     protected SegmentationBase segm;
@@ -388,17 +379,14 @@
     protected String ecalendcapHitmapName = "EcalEndcapHits";
     protected String hcalendcapHitmapName = "HcalEndcapHits";
     protected String muendcapHitmapName = "MuonEndcapHits";
-
     protected String ecalendcapSubdetName = "EMEndcap";
     protected String hcalendcapSubdetName = "HADEndcap";
     protected String muendcapSubdetName = "MuonEndcap";
-
-
-
     protected boolean debug = false;
     protected int nc=0;
     protected double BField ;// C.M.-Jan03
     protected DeDx dedx;
+    protected double thetaLim;
     protected double []rpVect       = new double[8] ;         // C.M.-4-Vector
     protected String subdetName;      // C.M.-Jan03
     protected double rmin;
@@ -415,11 +403,12 @@
     protected TrackStepper stpr     = new TrackStepper(); //C.M.-Stepper Instance
     //protected double [] stepConditions = new double[4];
     protected Map<String, Double> materials;
-    public static Samplexmlclass xmlReader = new Samplexmlclass();
+   // public static Samplexmlclass xmlReader = new Samplexmlclass();
     private int phiNNCut;
     private int thetaNNCut;
     private List<Hep3Vector> foundHits = new ArrayList<Hep3Vector>();
     protected FieldOverlay Field = new FieldOverlay();
     protected double[] bField = new double[3];
+   
 }
 
CVSspam 0.2.8