Commit in lcsim/src/org/lcsim/recon/cluster/density on MAIN
MyTools.java+33-161.2 -> 1.3
GL: Changes for easier changes in decoder description

lcsim/src/org/lcsim/recon/cluster/density
MyTools.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MyTools.java	27 Sep 2005 20:46:25 -0000	1.2
+++ MyTools.java	12 Dec 2005 05:27:02 -0000	1.3
@@ -14,6 +14,8 @@
  */
 public class MyTools
 {
+    // 1=sidaug05;  2=sidaug05_tcmt
+    static int detector = 2;
 //     // This returns the index of object obj in collection col
 //     public static int indexOf( LCObject obj, LCCollection col )
 //     {
@@ -35,33 +37,48 @@
 // 	}
 //     }
 
-    public static int getSysno( long cellid ) {
-      int sysno = (int)(cellid>>7)&0x7;
-      return sysno;
+    public static int getSystem( long cellid ) {
+	if(detector==1)	     return (int)(cellid>>7)&0x3f;
+	else if(detector==2) return (int)(cellid>>7)&0x3f;
+	else return 0;
     }
 
-    public static int getSysBE( long cellid ) {
-	return (int)((cellid>>7) & 0x3f);
+    public static int getSystemBarrel( long cellid ) {
+	if(detector==1)	     return (int)((cellid>>7) & 0x1ff);
+	else if(detector==2) return (int)((cellid>>7) & 0x1ff);
+	else return 0;
     }
 
     public static int getLayer( long cellid ) {
-	int layer = (int)((cellid>>0) & 0x7f);
-	return layer;
+	if(detector==1)	     return (int)((cellid>>0) & 0x7f);
+	else if(detector==2) return (int)((cellid>>0) & 0x7f);
+	else return 0;
     }
 
     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;
+	int thetabin = 0;
+	if(detector==1) {
+	    int max = 1<<11;  // for 11 bits
+	    thetabin = (int)((cellid>>32) & 0x7ff);
+	}
+	if(detector==2) {
+	    int max = 1<<16;  // for 16 bits
+	    thetabin = (int)((cellid>>48) & 0xffff);
+	    // sign bit
+	    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);
+	int phibin = 0;
+	if(detector==1) {
+	    int max = 1<<11;  // for 11 bits
+	    phibin = (int)((cellid>>43) & 0x7ff);
+	    if( phibin > max/2-1 ) phibin = phibin - max;
+	}
+	if(detector==2) phibin = (int)((cellid>>32) & 0xffff);
+ 	return phibin;
     }
 
     public static int getECalLayerTB( float[] pos ) {
@@ -80,7 +97,7 @@
 
     public static String printID(long id) {
 	return new String("<"+Long.toHexString(id)
-			  +": "+Integer.toString( getSysBE(id) )
+			  +": "+Integer.toString( getSystemBarrel(id) )
 			  +" "+Integer.toString( getLayer(id) )
 			  +" "+Integer.toString( getThetaBin(id))
 			  +" "+Integer.toString( getPhiBin(id) )
CVSspam 0.2.8