Author: [log in to unmask]
Date: Thu Feb 5 20:41:30 2015
New Revision: 2061
Log:
Fixed bug where ix = -1 was read as ix = 0.
Modified:
java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java
Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java
=============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java (original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/triggerbank/SSPData.java Thu Feb 5 20:41:30 2015
@@ -115,7 +115,7 @@
// If the first bit of the index is 1, then it is a
// negative number and needs to be converted using
// two's complement to get the proper value.
- if(((iy >> 3) & 0x1) == 0x1) {
+ if(((iy >> 3) & 0x1) == 0x1) {
// Perform the two's complement. ('^' is the bit
// wise inversion operator).
iy = iy ^ (0xf);
@@ -135,13 +135,13 @@
ix = ix ^ (0x3f);
ix += 1;
ix *=-1;
-
- // Values are encoded from -22 to 23; since LCSIM
- // defines them from -23 to -1 and 1 to 23, negative
- // values need to be shifted down by an additional
- // step to be accurate.
- ix -= 1;
- }
+ }
+
+ // X-index values are encoded from -22 to 23; since
+ // LCSIM defines these values in a range from -23 to
+ // 23, zero and negative values need be shifted down
+ // by an additional step to be accurate.
+ if(ix <= 0) { ix -= 1; }
// Get the cluster time. Time is 4 ns clock-cycles.
int time = (bank[ii + 1]) & 0x3ff;
|