Print

Print


Commit in lcsim/src/org/lcsim/recon/muon on MAIN
BarrelCalSegmentFinder.java+62-751.12 -> 1.13
 CM: Number of steps distance dependant

lcsim/src/org/lcsim/recon/muon
BarrelCalSegmentFinder.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- BarrelCalSegmentFinder.java	12 Dec 2005 22:33:53 -0000	1.12
+++ BarrelCalSegmentFinder.java	18 Dec 2005 16:36:40 -0000	1.13
@@ -27,7 +27,7 @@
     {
 
         AIDA aida = AIDA.defaultInstance();
-        
+
 	if(dedx==null) dedx = DeDx.instance();
 	subdetName = subdetectorName;
 
@@ -75,12 +75,12 @@
 // 	  System.out.println("MY NAME IS "+subdetName+" rin="+rmin+" rout="+rmax+" zmax="+zmax+", phiBinSize="+phiBinSize+", thetaBinSize="+thetaBinSize);
 	  // Set the nearest neighbor cuts to default values
 	if(subdetName.equals(ecalSubdetName)) {
-            phiNNCut =2;
-            thetaNNCut = 2;
+            phiNNCut   = 2; // 2;
+            thetaNNCut = 2; // 2;
 	}
 	else if(subdetName.equals(hcalSubdetName)) {
-	    phiNNCut =3;
-	    thetaNNCut = 3;
+	    phiNNCut   = 3; // 3;
+	    thetaNNCut = 2; // 3;
 	}
 // 	}
 
@@ -92,7 +92,7 @@
  	String sidaug05_tcmt = "layer:7,system:6,barrel:3,phi:32:16,z:-16";
 	String sidaug05 = "layer:7,system:6,barrel:3,theta:32:11,phi:11";
 	try {
-	  IDDescriptor desc = new IDDescriptor(sidaug05);
+	  IDDescriptor desc = new IDDescriptor(sidaug05_tcmt);
 	  encoder = new IDEncoder(desc);
 	}
 	catch(Exception e) {
@@ -119,30 +119,33 @@
         double dr = (rmax - rmin)/nLayers;		// layer thickness
         //double [] rint = new double[3];			// intersection coords.
         numLayersHit = 0;
-
+       //  steplength = distance/xNumsteps used in the stepper --> therefore
+       //  we choose the number ofsteps to be multiple of the distance
         double xNumSteps;
         double r;
         // C.M. Dec-03- Tkparams to stepper
         double tmpxyz ; double tmpp;
         r=rmin;
-	System.out.println("findSegment: subd="+subdetName);
+        // UPDATE Phase-Space
+        rpVect  = stpr.getNewRp();
+	    System.out.println("findSegment: subd="+subdetName);
         if(subdetName.equals(ecalSubdetName))
         {
-	     rpVect  = stpr.getNewRp();
-            // Then do the Tracker up to r=rmin
-	    
+        // Then do the Tracker up to r=rmin
 	    double[] field = det.getFieldMap().getField(rpVect); // C.M.-June-03
 	    System.out.println("BField: ("+field[0]+", "+field[1]+", "+field[2]+")");
 	    BField = field[2];
-            stepConditions = steprConditions(200.,BField,0.);
+	    xNumSteps=Math.abs(r-stpr.partR());
+        stepConditions = steprConditions(xNumSteps,BField,0.);
 	    System.out.println("Barrel Field before 1st stepper call "+BField);
-            System.out.println("Barrel:stepcd="+stepConditions[0]+" "+stepConditions[1]+" "+stepConditions[2]);
-            stpr.tkSteps( r, zmax,stepConditions);
+        System.out.println("Barrel:stepcd="+stepConditions[0]+" "+stepConditions[1]+" "+stepConditions[2]);
+        stpr.tkSteps( r, zmax,stepConditions);
 	    System.out.println("Tracker r=" +r+" zmax="+zmax);
 	    System.out.println("Barrel:out of Tracker");
-	}
+	    rpVect   = stpr.getNewRp();
+	    System.out.println("debug pos: ("+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR());
+	    }
 
-        rpVect   = stpr.getNewRp();
 
         if(subdetName.equals(hcalSubdetName))
         {
@@ -150,18 +153,17 @@
 	    // Then air to r=rmin
 	    double[] field = det.getFieldMap().getField(rpVect);  // C.M.-June-03
 	    BField = field[2];
-            rpVect   = stpr.getNewRp();
-	    double rnow= Math.abs(Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]));
-	    double d_EMHD = Math.abs(r-rnow);
+        rpVect   = stpr.getNewRp();
+	    double d_EMHD = Math.abs(r-stpr.partR());
 	    System.out.println(" distance between calorimeters EM-HD "+d_EMHD);
-            stepConditions = steprConditions((10*d_EMHD),BField,0.0);
-            stpr.tkSteps(r,zmax,stepConditions);
+        stepConditions = steprConditions((10*d_EMHD),BField,0.0);
+        stpr.tkSteps(r,zmax,stepConditions);
+        rpVect  = stpr.getNewRp();
         }
 
-	rpVect  = stpr.getNewRp();
         xNumSteps = 10.;
         stepConditions = steprConditions(xNumSteps,BField,meanDEdxPerLay(subdetName));
-	System.out.println("Barrel:MeanDEdxPerLay="+meanDEdxPerLay(subdetName));
+	    System.out.println("Barrel:MeanDEdxPerLay="+meanDEdxPerLay(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
@@ -174,25 +176,17 @@
         // Get intersections with successive layers as long as track is
         // within the detector, and create a list of the cells that
         // the track passes through
-
         while ((Math.abs(rpVect[2]) < zmax )&& (nr < nLayers))
         {
 //-- replace with a more general way: findCellContainingXYZ.  GL051211
-// 	    int iphi = xyzToPhiBin(rpVect);
-// 	    int itheta = xyzToThetaBin(rpVect);
-// 	    encoder.setValue("layer", nr);
-// 	    encoder.setValue("theta", itheta);
-// 	    encoder.setValue("phi", iphi);
+// 	    int iphi = xyzToPhiBin(rpVect);int itheta = xyzToThetaBin(rpVect);
+// 	    encoder.setValue("layer", nr);encoder.setValue("theta", itheta); encoder.setValue("phi", iphi);
 // 	    long cellid = encoder.getID();
 //-------------------------------------------------------
 
             // Add cell to list
-	    double xx = rpVect[0];
-	    double yy = rpVect[1];
-	    double zz = rpVect[2];
-	    double rho = Math.sqrt(xx*xx+yy*yy);
 
- 	    System.out.println("BCSF.findSegment: ("+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), rho="+rho);
+//  	    System.out.println("BCSF.findSegment: ("+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), rho="+stpr.partR());
 
 //          System.out.println(" virtual cell: layer="+nr+", iphi="+iphi+", itheta="+itheta);
 
@@ -220,26 +214,22 @@
         // Save number of layers track passed through
         numLayersHit = nr;
         rpVect= stpr.getNewRp();
-	double rr=stpr.partR();
-	if((Math.abs(rpVect[2])<=zmax-0.1)|| (rr>=rmax+0.1))
-	   stpr.resetAtZmax(); // reset for next sub-detector
-
-
-        // Now match the cells on this list to calorimeter hits
+	    double rr=stpr.partR();
+       // Now match the cells on this list to calorimeter hits
 // 	System.out.println("Names: subdetName=<"+subdetName+">"
 // 			   +", EcalSubdetName="+ecalSubdetName
 // 			   +", HcalSubdetName="+hcalSubdetName);
         if(subdetName.equals(hcalSubdetName))  //C.M.-27Jan03
         {
             //		HistogramFolder.setDefaultFolder("/HDCal");
- 	    System.out.println("BCSF: Doing matchHits in HCal");
+//  	    System.out.println("BCSF: Doing matchHits in HCal");
             matchHitsFast(segm, dataMgr.getCollHitMap(hcalHitmapName) );
             //		HistogramFolder.setDefaultFolder("..");
         }
         else if(subdetName.equals(ecalSubdetName)) //
         {
             //		HistogramFolder.setDefaultFolder("/EMCal");
- 	    System.out.println("BCSF: Doing matchHits in ECal");
+//  	    System.out.println("BCSF: Doing matchHits in ECal");
             matchHitsFast(segm, dataMgr.getCollHitMap(ecalHitmapName) );
             //		HistogramFolder.setDefaultFolder("..");		// C.M.-27Jan03- Folder
         }
@@ -356,7 +346,7 @@
         }
 	    System.out.println(" MeanDedxPerLay (GeV) ="+matterDEdx);
 
-        return matterDEdx ;
+        return matterDEdx;
     }
 
     //------------------------------------------------------
@@ -385,19 +375,17 @@
 	  if(hit!=null) {
 	    // found real hit at virtual cell
 	    if(debug) System.out.println("matchHits: Adding hit: "+Long.toHexString(cellid));
-	    // if(debug)
-		// {    
-		       double dall=0.;
-		       for(int j=0;j<nLayers;j=j+4)
-		       {
-		         if(ilay==j)
-			 {
+	    if(debug) {
+		double dall=0.;
+		for(int j=0;j<nLayers;j=j+4)
+		{
+		    if(ilay==j)
+		    {
 		        aida.cloud1D(subdetName+" dphi layer "+ilay).fill(dall);
 		        aida.cloud1D(subdetName+" dtheta layer "+ilay).fill(dall);
-			 }
-		       }
- 
-	         //}
+		    }
+		}
+	    }
 	    hitList.add(hit);
 	    nhitsTotal++;
 	  }
@@ -422,27 +410,26 @@
 	    if(hit!=null) {
  		if(debug) System.out.println("matchHits: Adding hit: "+Long.toHexString(neighs[i]));
 		segm.setID( neighs[i] );
-		int jphi = segm.getValue("phi");
-		int jthe = 0;
-		try {
-		    jthe = segm.getValue("theta");
-		}
-		catch(NullPointerException x) {
-		    jthe = segm.getValue("z");
-		}
-		int jlay = segm.getLayer();
-		// if(debug)
-		 //{          
-		       for(int j=0;j<nLayers;j=j+4)
-		       {
-		        if(ilay==j)
-			{
-		        aida.cloud1D(subdetName+" dphi layer "+ilay).fill(jphi-iphi);
-		        aida.cloud1D(subdetName+" dtheta layer "+ilay).fill(jthe-ithe);
-		        }
-		       }  
-		  
-		// }
+// 		int jphi = segm.getValue("phi");
+// 		int jthe = 0;
+// 		try {
+// 		    jthe = segm.getValue("theta");
+// 		}
+// 		catch(NullPointerException x) {
+// 		    jthe = segm.getValue("z");
+// 		}
+// 		int jlay = segm.getLayer();
+// 		// if(debug)
+// 		 //{
+// 		       for(int j=0;j<nLayers;j=j+4)
+// 		       {
+// 		        if(ilay==j)
+// 			{
+// 		        aida.cloud1D(subdetName+" dphi layer "+ilay).fill(jphi-iphi);
+// 		        aida.cloud1D(subdetName+" dtheta layer "+ilay).fill(jthe-ithe);
+// 		        }
+// 		       }
+// 		// }
 		hitList.add(hit);
 		nhitsTotal++;
 	    }
CVSspam 0.2.8