hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.3 -r1.4
--- HPSSVTDataBuffer.java 21 Apr 2012 07:37:45 -0000 1.3
+++ HPSSVTDataBuffer.java 25 Apr 2012 05:11:37 -0000 1.4
@@ -13,7 +13,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSVTDataBuffer.java,v 1.3 2012/04/21 07:37:45 omoreno Exp $
+ * @version $Id: HPSSVTDataBuffer.java,v 1.4 2012/04/25 05:11:37 omoreno Exp $
*/
public class HPSSVTDataBuffer {
@@ -23,8 +23,9 @@
// Singleton
private static final HPSSVTDataBuffer instance = new HPSSVTDataBuffer();
- int[] header = new int[8];
+ int[] header = new int[6];
int temp = 23; // C
+ int nErrors = 0;
/**
* Default constructor; Set to private to prevent instantiation
@@ -58,6 +59,9 @@
*/
public static int[] readoutBuffer(int fpga)
{
+ // Add the tail to the data
+ instance.addTail(fpga);
+
// Copy the data in the map so that the buffer can be cleared
int[] data = new int[instance.fpgaToData.get(fpga).size()];
int index = 0;
@@ -85,7 +89,7 @@
if(fpga == 7) return;
// If the FPGA data block is empty, add the header information
- if(instance.fpgaToData.isEmpty()){
+ if(instance.fpgaToData.get(fpga).isEmpty()){
// Insert the temperature information. All temperatures are currently
// set to 23 C
@@ -107,22 +111,27 @@
header[5] = (header[5] &= ~TEMP_MASK) | (temp & TEMP_MASK);
header[5] = (header[5] &= ~(TEMP_MASK << 16)) | ((temp & TEMP_MASK) << 16);
- header[6] = (header[6] &= ~TEMP_MASK) | (temp & TEMP_MASK);
- header[6] = (header[6] &= ~(TEMP_MASK << 16)) | ((temp & TEMP_MASK) << 16);
-
- header[7] = (header[7] &= ~TEMP_MASK) | (temp & TEMP_MASK);
- header[7] = (header[7] &= ~(TEMP_MASK << 16)) | ((temp & TEMP_MASK) << 16);
-
for(int index = 0; index < header.length; index++) fpgaToData.get(fpga).add(header[index]);
+
}
-
+
// Add all samples emerging from this FPGA
if(!svtData.isEmpty()){
for(HPSSVTData svtDatum : svtData){
+ System.out.println("FPGA: " + svtDatum.getFPGAAddress() + " Hybrid: " + svtDatum.getHybridNumber() + " APV: " + svtDatum.getAPVNumber() + " Channel: " + svtDatum.getChannelNumber());
for(int index = 0; index < svtDatum.getData().length; index++){
fpgaToData.get(fpga).add(svtDatum.getData()[index]);
}
}
}
}
+
+ /**
+ *
+ */
+ private void addTail(int fpga)
+ {
+ // For now just make it zero
+ instance.fpgaToData.get(fpga).add(0);
+ }
}