Commit in lcsim/src/org/lcsim/util/lcio on MAIN
SIOCalorimeterHit.java+80-831.14 -> 1.15
Only write out error if appropriate bit is set.

lcsim/src/org/lcsim/util/lcio
SIOCalorimeterHit.java 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- SIOCalorimeterHit.java	23 Nov 2010 21:39:00 -0000	1.14
+++ SIOCalorimeterHit.java	23 Mar 2011 16:36:55 -0000	1.15
@@ -7,94 +7,91 @@
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.event.base.BaseCalorimeterHit;
-import org.lcsim.util.lcio.LCIOConstants;
 
 /**
  * SIO-based I/O implementation of the CalorimeterHit interface
  *
  * @author Guilherme Lima
- * @version $Id: SIOCalorimeterHit.java,v 1.14 2010/11/23 21:39:00 jeremy Exp $
+ * @version $Id: SIOCalorimeterHit.java,v 1.15 2011/03/23 16:36:55 tonyj Exp $
  */
-class SIOCalorimeterHit extends BaseCalorimeterHit
-{
-	SIOCalorimeterHit(SIOInputStream in, int flags, int version, LCMetaData meta) throws IOException
-	{
-		this.meta = meta;
-		int cellid0 = in.readInt();
-		int cellid1 = 0;
-		if (LCIOUtil.bitTest(flags,LCIOConstants.RCHBIT_ID1) || version==8) {
-			cellid1 = in.readInt();
-		}
-		this.id = ((long) cellid1)<<32 | cellid0;
-		this.corrEnergy = in.readFloat();
-		if (version>=1051 && LCIOUtil.bitTest(flags,LCIOConstants.RCHBIT_ENERGY_ERROR))
-		{
-	        energyError = in.readFloat();
-	    }
-
-		if (version>1002 && (flags&(1<<LCIOConstants.RCHBIT_TIME)) != 0)
-		{
-			time = in.readFloat();
-		}
-		if ((flags & (1 << LCIOConstants.RCHBIT_LONG)) != 0)
-		{
-			position = new double[3];
-			position[0] = in.readFloat();
-			position[1] = in.readFloat();
-			position[2] = in.readFloat();
-		}
-
-		if( version > 1002)
-		{
-			type = in.readInt() ;
-			Object tempHit = in.readPntr();
-
-			// the logic has been reverted in v1.3 !
-			if ( (flags & (1 << LCIOConstants.RCHBIT_NO_PTR)) == 0 )  in.readPTag(this) ;
-		} 
-		else
-		{
-			if ( (flags & (1 << LCIOConstants.RCHBIT_NO_PTR)) != 0 )  in.readPTag(this) ;
-		}
-	}
-
-	static void write(CalorimeterHit hit, SIOOutputStream out, int flags) throws IOException
-	{
-		long cellID = hit.getCellID();
-		out.writeInt( (int)cellID );
-
-		if( LCIOUtil.bitTest( flags, LCIOConstants.RCHBIT_ID1)) {
-			out.writeInt((int) (cellID>>32));
-		}
-
-		out.writeFloat( (float)hit.getCorrectedEnergy() );
-		out.writeFloat( (float)hit.getEnergyError() );
-
-		if( LCIOUtil.bitTest( flags, LCIOConstants.RCHBIT_TIME)) {
-			out.writeFloat( (float)hit.getTime() );
-		}
-
-		if ((flags & (1 << LCIOConstants.CHBIT_LONG)) != 0)
-		{
-			double[] pos;
-			if (hit.getPosition() != null)
-				pos = hit.getPosition();
-			else
-				pos = new double[3];
-			out.writeFloat((float) pos[0]);
-			out.writeFloat((float) pos[1]);
-			out.writeFloat((float) pos[2]);
-		}	
-
-		out.writeInt( hit.getType() );
-
-		// FIXME: Java CalorimeterHit interface does not support getRawHit()
-		if(!LCIOUtil.bitTest(flags,LCIOConstants.RCHBIT_NO_PTR)) {
-			//assert false : "Pointer to raw hit not implemented!";
-			//out.writePntr( hit.getRawHit() );
-			out.writePntr(null);
-		}
+class SIOCalorimeterHit extends BaseCalorimeterHit {
 
-		out.writePTag( hit );
-	}
+    SIOCalorimeterHit(SIOInputStream in, int flags, int version, LCMetaData meta) throws IOException {
+        this.meta = meta;
+        int cellid0 = in.readInt();
+        int cellid1 = 0;
+        if (LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_ID1) || version == 8) {
+            cellid1 = in.readInt();
+        }
+        this.id = ((long) cellid1) << 32 | cellid0;
+        this.corrEnergy = in.readFloat();
+        if (version >= 1051 && LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_ENERGY_ERROR)) {
+            energyError = in.readFloat();
+        }
+
+        if (version > 1002 && (flags & (1 << LCIOConstants.RCHBIT_TIME)) != 0) {
+            time = in.readFloat();
+        }
+        if ((flags & (1 << LCIOConstants.RCHBIT_LONG)) != 0) {
+            position = new double[3];
+            position[0] = in.readFloat();
+            position[1] = in.readFloat();
+            position[2] = in.readFloat();
+        }
+
+        if (version > 1002) {
+            type = in.readInt();
+            Object tempHit = in.readPntr();
+
+            // the logic has been reverted in v1.3 !
+            if ((flags & (1 << LCIOConstants.RCHBIT_NO_PTR)) == 0) {
+                in.readPTag(this);
+            }
+        } else {
+            if ((flags & (1 << LCIOConstants.RCHBIT_NO_PTR)) != 0) {
+                in.readPTag(this);
+            }
+        }
+    }
+
+    static void write(CalorimeterHit hit, SIOOutputStream out, int flags) throws IOException {
+        long cellID = hit.getCellID();
+        out.writeInt((int) cellID);
+
+        if (LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_ID1)) {
+            out.writeInt((int) (cellID >> 32));
+        }
+
+        out.writeFloat((float) hit.getCorrectedEnergy());
+        if (LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_ENERGY_ERROR)) {
+            out.writeFloat((float) hit.getEnergyError());
+        }
+
+        if (LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_TIME)) {
+            out.writeFloat((float) hit.getTime());
+        }
+
+        if ((flags & (1 << LCIOConstants.CHBIT_LONG)) != 0) {
+            double[] pos;
+            if (hit.getPosition() != null) {
+                pos = hit.getPosition();
+            } else {
+                pos = new double[3];
+            }
+            out.writeFloat((float) pos[0]);
+            out.writeFloat((float) pos[1]);
+            out.writeFloat((float) pos[2]);
+        }
+
+        out.writeInt(hit.getType());
+
+        // FIXME: Java CalorimeterHit interface does not support getRawHit()
+        if (!LCIOUtil.bitTest(flags, LCIOConstants.RCHBIT_NO_PTR)) {
+            //assert false : "Pointer to raw hit not implemented!";
+            //out.writePntr( hit.getRawHit() );
+            out.writePntr(null);
+        }
+
+        out.writePTag(hit);
+    }
 }
CVSspam 0.2.8