Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/segmentation on RefactorBranch
NonprojectiveCylinder.java+52-471.15 -> 1.15.2.1
Use SegmentationBase utility functions instead of direct calls to subdetector.  Remove debug prints based on hard-coded field positions.

GeomConverter/src/org/lcsim/geometry/segmentation
NonprojectiveCylinder.java 1.15 -> 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- NonprojectiveCylinder.java	24 Aug 2005 06:10:57 -0000	1.15
+++ NonprojectiveCylinder.java	28 Sep 2005 00:11:33 -0000	1.15.2.1
@@ -19,6 +19,7 @@
 import org.lcsim.geometry.util.IDDescriptor;
 import org.lcsim.geometry.util.IDDecoder;
 import org.lcsim.geometry.util.IDEncoder;
+import org.lcsim.geometry.Layered;
 
 /**
  * @author jeremym
@@ -82,12 +83,14 @@
 
     public double getX()
     {
-        return detector.getLayering().getDistanceToLayerSensorMid( getLayer() ) * cos( getPhi() );
+//        return detector.getLayering().getDistanceToLayerSensorMid( getLayer() ) * cos( getPhi() );
+        return getDistanceToSensitive( getLayer() ) * cos( getPhi() );
     }
 
     public double getY()
     {
-        return detector.getLayering().getDistanceToLayerSensorMid( getLayer() ) * sin( getPhi() );
+//        return detector.getLayering().getDistanceToLayerSensorMid( getLayer() ) * sin( getPhi() );
+        return getDistanceToSensitive( getLayer() ) * sin( getPhi() );
     }
 
     public double getZ()
@@ -97,7 +100,8 @@
 
     public double computeDeltaPhiForLayer(int layer)
     {
-        double circ = detector.getLayering().getDistanceToLayerSensorMid(layer) * ( 2 * PI );
+//        double circ = detector.getLayering().getDistanceToLayerSensorMid(layer) * ( 2 * PI );
+        double circ = getDistanceToSensitive( getLayer() ) * ( 2 * PI );
         int nphi = (int)Math.floor( circ / gridSizePhi );
         double deltaPhi = (2 * PI) / nphi;
         return deltaPhi;
@@ -150,7 +154,7 @@
       for (int i=-layerRange; i<=layerRange; ++i) {
 	int ilay = values[layerIndex] + i;
 
-	if (ilay<0 || ilay>=detector.getLayering().getLayerCount()) continue;
+	if (ilay<0 || ilay>= getNumberOfLayers() ) continue;
 	gnEncoder.setValue(layerIndex,ilay);
 
 	double dphi = this.computeDeltaPhiForLayer(ilay);
@@ -267,10 +271,10 @@
 	// guess the starting layer (based on average thickness), and
 	// then navigate trhough layers until one finds the right one
 	double depth = r - getRMin();
-	double mean_t = (getRMax()-getRMin()) / detector.getLayering().getLayerCount();
+	double mean_t = (getRMax()-getRMin()) / getNumberOfLayers();
 
 	int ilay = (int)Math.floor( depth / mean_t );
-	LayerStack stack = detector.getLayering().getLayers();
+	LayerStack stack = ((Layered)detector).getLayering().getLayers();
 	Layer layer = stack.getLayer(ilay);
 	double depHi = stack.getThicknessToLayerBack(ilay);
 	double depLo = depHi - layer.getThickness();
@@ -314,7 +318,7 @@
      * @param layer layer index
      */
     private double getRadiusSensitiveMid(int ilay) {
-	LayerStack stack = detector.getLayering().getLayers();
+	LayerStack stack = ((Layered)detector).getLayering().getLayers();
 	Layer layer = stack.getLayer(ilay);
 
 	double preLayers = 0;
@@ -323,44 +327,45 @@
 	return this.getRMin() + preLayers + layer.getThicknessToSensitiveMid();
     }
 
-    private String printID(IDDecoder dec, IDEncoder enc) {
-	String ret = "decoder: <"+dec.getValue("layer")
-	    +" "+dec.getValue("z")
-	    +" "+dec.getValue("phi")+">";
-	ret += " --- encoder: "+printID(enc.getID());
-	return ret;
-    }
-
-    public static String printID(long id) {
-	return new String("<"+Long.toHexString(id)
-			  +": "+Integer.toString( getSysBE(id) )
-			  +" "+Integer.toString( getLayer(id) )
-			  +" "+Integer.toString( getThetaBin(id))
-			  +" "+Integer.toString( getPhiBin(id) )
-			  +">");
-    }
-
-    public static int getSysBE( long cellid ) {
-	return (int)((cellid>>16) & 0x3f);
-    }
-
-    public static int getLayer( long cellid ) {
-	int layer = (int)((cellid>>0) & 0xffff);
-	return layer;
-    }
-
-    public static int getThetaBin( long cellid ) {
-	int max = 1<<16;  // for 11 bits
-	int thetabin = (int)((cellid>>48) & 0xffff);
-	if( thetabin > max/2-1 ) thetabin = thetabin - max;
-	return thetabin;
-    }
-
-    public static int getPhiBin( long cellid ) {
-// 	int max = 1<<11;  // for 11 bits
-// 	int phibin = (int)((cellid>>43) & 0x7ff);
-// 	if( phibin > max/2-1 ) phibin = phibin - max;
-// 	return phibin;
- 	return (int)((cellid>>32) & 0xffff);
-    }
+//    private String printID(IDDecoder dec, IDEncoder enc) {
+//	String ret = "decoder: <"+dec.getValue("layer")
+//	    +" "+dec.getValue("z")
+//	    +" "+dec.getValue("phi")+">";
+//	ret += " --- encoder: "+printID(enc.getID());
+//	return ret;
+//    }
+//
+//    public static String printID(long id) {
+//	return new String("<"+Long.toHexString(id)
+//			  +": "+Integer.toString( getSysBE(id) )
+//			  +" "+Integer.toString( getLayer(id) )
+//			  +" "+Integer.toString( getThetaBin(id))
+//			  +" "+Integer.toString( getPhiBin(id) )
+//			  +">");
+//    }
+
+    
+//    public static int getSysBE( long cellid ) {
+//	return (int)((cellid>>16) & 0x3f);
+//    }
+//
+//    public static int getLayer( long cellid ) {
+//	int layer = (int)((cellid>>0) & 0xffff);
+//	return layer;
+//    }
+//
+//    public static int getThetaBin( long cellid ) {
+//	int max = 1<<16;  // for 11 bits
+//	int thetabin = (int)((cellid>>48) & 0xffff);
+//	if( thetabin > max/2-1 ) thetabin = thetabin - max;
+//	return thetabin;
+//    }
+//
+//    public static int getPhiBin( long cellid ) {
+//// 	int max = 1<<11;  // for 11 bits
+//// 	int phibin = (int)((cellid>>43) & 0x7ff);
+//// 	if( phibin > max/2-1 ) phibin = phibin - max;
+//// 	return phibin;
+// 	return (int)((cellid>>32) & 0xffff);
+//    }
 }
CVSspam 0.2.8