Print

Print


Author: [log in to unmask]
Date: Thu Feb  5 18:55:16 2015
New Revision: 3515

Log:
Adding offset static members.

Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/MilleParameter.java	Thu Feb  5 18:55:16 2015
@@ -23,6 +23,9 @@
 		hMap = new HashMap<Integer,String>();
 		hMap.put(1, "t");hMap.put(2, "b");
 		}
+	public static final int half_offset = 10000;
+	public static final int type_offset = 1000; 
+	public static final int dimension_offset = 100;
 	
 	public MilleParameter(String line) {
 		String[] vals = StringUtils.split(line);// line.split("\\s+");
@@ -59,25 +62,25 @@
 	}
 
 	public int getDim() {
-		int h = (int) (getHalf() * 1e4);
-		int t = (int) (getType() * 1e3);
-		return (int) Math.floor((id- h -t)/1e2);
+		int h = (int) (getHalf() * half_offset);
+		int t = (int) (getType() * type_offset);
+		return (int) Math.floor((id- h -t)/(double)dimension_offset);
 	}
 	
 	public int getSensor() {
-		int h = (int) (getHalf() * 1e4);
-		int t = (int) (getType() * 1e3);
-		int d = (int) (getDim() * 1e2);
+		int h = (int) (getHalf() * half_offset);
+		int t = (int) (getType() * type_offset);
+		int d = (int) (getDim() * dimension_offset);
 		return (id - h - t -d);
 	}
 
 	public int getType() {
-		int h = (int) (getHalf() * 1e4);
-		return (int) Math.floor((id -h)/1e3);
+		int h = (int) (getHalf() * half_offset);
+		return (int) Math.floor((id -h)/(double)type_offset);
 	}
 
 	public int getHalf() {
-		return (int)Math.floor(id/1e4);
+		return (int)Math.floor(id/(double)half_offset);
 	}
 
 	public int getId() {

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1