Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN | |||
FieldMap.java | +32 | -23 | 1.1 -> 1.2 |
quiet, seriously
diff -u -r1.1 -r1.2 --- FieldMap.java 23 Jul 2012 21:45:02 -0000 1.1 +++ FieldMap.java 16 Aug 2012 00:08:12 -0000 1.2 @@ -11,8 +11,8 @@
/**
- @author Mathew Graham <[log in to unmask]> $Id: FieldMap.java,v 1.14 - 2012/07/23 23:02:57 mgraham Exp $
+@author Mathew Graham <[log in to unmask]> $Id: FieldMap.java,v 1.14 +2012/07/23 23:02:57 mgraham Exp $
*/ public class FieldMap {
@@ -20,25 +20,28 @@
// TODO: Change all map keys to type SiSensor? public static final double DIPOLE_EDGE = 914; // mm public static Map<Pair<Integer/*
- zbin
+ zbin
*/, Integer/*
- xbin
+ xbin
*/>, Double/*
- b_y - */> fieldMap=new HashMap<Pair<Integer,Integer>,Double>();;
+ b_y + */> fieldMap = new HashMap<Pair<Integer, Integer>, Double>(); + ;
public static Map<Pair<Integer/*
- zbin
+ zbin
*/, Integer/*
- zbin
+ zbin
*/>, Pair<Double/*
- zpos
+ zpos
*/, Double/*
- xpos - */>> fieldBins=new HashMap<Pair<Integer,Integer>,Pair<Double,Double>>();;
+ xpos + */>> fieldBins = new HashMap<Pair<Integer, Integer>, Pair<Double, Double>>(); + ;
private static boolean fieldMapLoaded = false;
+ private static boolean debug = false;
/**
- Default Ctor
+ Default Ctor
*/ private FieldMap() { }
@@ -79,11 +82,11 @@
} private static void loadBField(Reader baselineReader) throws IOException {
-
+
BufferedReader bufferedBaseline = new BufferedReader(baselineReader); String line;
- Double xval=0.0,zval=0.0,bY; - Integer iz=-1,ix=0;
+ Double xval = 0.0, zval = 0.0, bY; + Integer iz = -1, ix = 0;
while (true) { try { line = bufferedBaseline.readLine();
@@ -99,11 +102,15 @@
} StringTokenizer tok = new StringTokenizer(line);
- System.out.println(line.toString());
+ if (debug) { + System.out.println(line.toString()); + }
List<Double> vals = new ArrayList<Double>();
-
+
while ((vals = getNumbersInLine(tok)).size() > 0) {
- System.out.println(getNumbersInLine(tok).size());
+ if (debug) { + System.out.println(getNumbersInLine(tok).size()); + }
for (int i = 0; i < vals.size(); i++) { double val = vals.get(i); if (i == 0 && val >= 0) {
@@ -126,14 +133,14 @@
} } }
- fieldMapLoaded=true;
+ fieldMapLoaded = true;
}
- public static boolean fieldMapLoaded(){
+ public static boolean fieldMapLoaded() {
return fieldMapLoaded; }
-
+
private static List<Double> getNumbersInLine(StringTokenizer tok) throws IOException { List<Double> nums = new ArrayList<Double>(); while (tok.hasMoreTokens()) {
@@ -159,14 +166,16 @@
for (iz = 0; iz < nZ; iz++) { Pair tmp = fieldBins.get(new Pair(iz, 0)); Double zpair = (Double) tmp.getFirstElement();
- if (zpair > zNew)
+ if (zpair > zNew) {
break;
+ }
} for (ix = 0; ix < nX; ix++) { Pair tmp = fieldBins.get(new Pair(1, ix)); Double xpair = (Double) tmp.getSecondElement();
- if (xpair > xNew)
+ if (xpair > xNew) {
break;
+ }
} Pair izix = new Pair(iz, ix); return izix;
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1