1 package org.lcsim.lcio; 2 3 import hep.io.sio.SIOInputStream; 4 import hep.io.sio.SIOOutputStream; 5 import hep.io.sio.SIORef; 6 import java.io.IOException; 7 import org.lcsim.event.TrackerData; 8 import org.lcsim.event.TrackerPulse; 9 10 class SIOTrackerPulse implements TrackerPulse 11 { 12 private SIORef data; 13 private long cellid; 14 private double time; 15 private double charge; 16 private int quality; 17 18 SIOTrackerPulse(SIOInputStream in, int flags, int version) throws IOException 19 { 20 int cellid0 = in.readInt(); 21 int cellid1 = 0; 22 if (LCIOUtil.bitTest(flags,LCIOConstants.TRAWBIT_ID1)) 23 { 24 cellid1 = in.readInt(); 25 } 26 this.cellid = ((long) cellid1)<<32 | cellid0; 27 28 time = in.readFloat(); 29 charge = in.readFloat(); 30 quality = in.readInt(); 31 data = in.readPntr(); 32 in.readPTag(this); 33 } 34 static void write(TrackerPulse hit, SIOOutputStream out, int flags) throws IOException 35 { 36 long cellid = hit.getCellID(); 37 out.writeInt((int) cellid); 38 if (LCIOUtil.bitTest(flags,LCIOConstants.TRAWBIT_ID1)) 39 { 40 out.writeInt((int) (cellid>>32)); 41 } 42 out.writeFloat((float) hit.getTime()); 43 out.writeFloat((float) hit.getCharge()); 44 out.writeInt(hit.getQuality()); 45 out.writePntr(hit.getTrackerData()); 46 out.writePTag(hit); 47 } 48 49 public TrackerData getTrackerData() 50 { 51 return (TrackerData) data.getObject(); 52 } 53 54 public long getCellID() 55 { 56 return cellid; 57 } 58 59 public double getTime() 60 { 61 return time; 62 } 63 64 public double getCharge() 65 { 66 return charge; 67 } 68 69 public int getQuality() 70 { 71 return quality; 72 } 73 }