3 added + 3 removed, total 6 files
hps-java/src/test/java/org/lcsim
diff -N HPSDetectorTag.java
--- HPSDetectorTag.java 18 Feb 2012 16:49:18 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.lcsim;
-
-/**
- *
- * @author neal
- */
-public enum HPSDetectorTag {
- TRACKERTAG (600),
- EMCTAG (0x1);
-
-
- private int value;
-
- private HPSDetectorTag(int value) {
- this.value = value;
- }
-
- /**
- * Get the enum's value.
- *
- * @return the value, e.g., 0xe for a BANK
- */
- public int getValue() {
- return value;
- }
-}
\ No newline at end of file
hps-java/src/test/java/org/lcsim
diff -N HPSTrackerEvent.java
--- HPSTrackerEvent.java 18 Feb 2012 16:49:18 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,185 +0,0 @@
-/*
- * Description : based on the C++ version from Ryan Herbst
- *
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- * Description :
- * Event Container
- * Event Data consists of the following: Z[xx:xx] = Zeros
- * Frame Size = 1 x 32-bits (32-bit dwords)
- * Header = 8 x 32-bits
- * Header[0] = T[0], Z[14:0], FpgaAddress[15:0] - T = 1 For TI FPGA
- * Header[1] = Sequence[31:0]
-//
- * The rest of the event header depends on the T flag, For T = 0:
-//
- * Header[2] = TempB[15:0], TempA[15:0]
- * Header[3] = TempD[15:0], TempC[15:0]
- * Header[4] = TempF[15:0], TempE[15:0]
- * Header[5] = TempH[15:0], TempG[15:0]
- * Header[6] = TempJ[15:0], TempI[15:0]
- * Header[7] = TempL[15:0], TempK[15:0]
- * Samples... (See HPSTrackerSample.java)
- * Tail = 1 x 32-bits
- * Should be zero
- */
-package org.lcsim;
-
-import org.lcsim.HPSTrackerSample;
-
-/**
- *
- * @author neal
- */
-public class HPSTrackerEvent extends HPSTrackerSample {
-
- double temp;
- double tk;
- double res;
- double volt;
- int idx;
-
- // Temperature Constants
- double coeffA_ = -1.4141963e1;
- double coeffB_ = 4.4307830e3;
- double coeffC_ = -3.4078983e4;
- double coeffD_ = -8.8941929e6;
- double t25_ = 10000.0;
- double k0_ = 273.15;
- double vmax_ = 2.5;
- double vref_ = 2.5;
- double rdiv_ = 10000;
- double minTemp_ = -50;
- double maxTemp_ = 150;
- double incTemp_ = 0.01;
- int adcCnt_ = 4096;
-
- // Temperature lookup table
- double tempTable_[] = new double[adcCnt_];
-
- // Local trigger data
- int tiData_[] = new int[7]; // What size can this grow to????
-
- // Frame Constants
- int headSize_ = 8;
- int tailSize_ = 1;
- int sampleSize_ = 4;
-
- // frame size must be set externally
- int size_ = 0;
-
- public void TrackerEvent() {
-
- // Fill temperature lookup table
- temp = minTemp_;
- while (temp < maxTemp_) {
- tk = k0_ + temp;
- res = t25_ * Math.exp(coeffA_ + (coeffB_ / tk) + (coeffC_ / (tk * tk)) + (coeffD_ / (tk * tk * tk)));
- volt = (res * vmax_) / (rdiv_ + res);
- idx = (int) ((volt / vref_) * (double) (adcCnt_ - 1));
- if (idx < adcCnt_) {
- tempTable_[idx] = temp;
- }
- temp += incTemp_;
- }
- }
-
- // Get TI flag from header
- public boolean isTiFrame() {
- return ((data_[0] & 0x80000000) != 0);
- }
-
-// Get FpgaAddress value from header.
- public int fpgaAddress() {
- return (data_[0] & 0xFFFF);
- }
-
-// Get sequence count from header.
- public int sequence() {
- return (data_[1]);
- }
-
-// Get trigger block from header.
- int[] tiData() {
- for (int iti = 0; iti < tiData_.length; iti++) {
- tiData_[iti] = data_[2 + iti];
- }
- return (tiData_);
- }
-
- // Set address of data buffer
- public void setData(int indat[]) {
- data_ = indat;
- }
-
-// Set frame size
- public void setSize(int sz) {
- size_ = sz;
- }
-
- // Get sample size value from header.
- public int sampleSize() {
- return ((data_[0] >> 8) & 0xF);
- }
-
-// Get temperature values from header.
- public double temperature(int index) {
- if (isTiFrame()) {
- return (0.0);
- } else {
- switch (index) {
- case 0:
- return (tempTable_[(data_[2] & 0x3FFF)]);
- case 1:
- return (tempTable_[((data_[2] >> 16) & 0x3FFF)]);
- case 2:
- return (tempTable_[(data_[3] & 0x3FFF)]);
- case 3:
- return (tempTable_[((data_[3] >> 16) & 0x3FFF)]);
- case 4:
- return (tempTable_[(data_[4] & 0x3FFF)]);
- case 5:
- return (tempTable_[((data_[4] >> 16) & 0x3FFF)]);
- case 6:
- return (tempTable_[(data_[5] & 0x3FFF)]);
- case 7:
- return (tempTable_[((data_[5] >> 16) & 0x3FFF)]);
- case 8:
- return (tempTable_[(data_[6] & 0x3FFF)]);
- case 9:
- return (tempTable_[((data_[6] >> 16) & 0x3FFF)]);
- case 10:
- return (tempTable_[(data_[7] & 0x3FFF)]);
- case 11:
- return (tempTable_[((data_[7] >> 16) & 0x3FFF)]);
- default:
- return (0.0);
- }
- }
-
- }
-
-// Get sample count
- public int count() {
-// return (128);
-// int size_ = sampleSize();
-// System.out.println("count: size_ = " + size_);
- return ((size_ - (headSize_ + tailSize_)) / sampleSize_);
- }
-// Get sample at index
-
- public HPSTrackerSample sample(int index) {
- if (index >= count()) { // should be count()
- return (null);
- } else {
- HPSTrackerSample sample_ = new HPSTrackerSample();
- for (int ii = 0; ii < sampleSize_; ii++) {
- ldata_[ii] = data_[headSize_ + (index * sampleSize_) + ii];
-// System.out.println("ldata[" + ii + "] = " + ldata_[ii]);
- }
-// sample_.setData(data_[headSize_ + (index * sampleSize_)]);
- sample_.setData(ldata_);
- return (sample_);
- }
- }
-}
hps-java/src/test/java/org/lcsim
diff -N HPSTrackerSample.java
--- HPSTrackerSample.java 14 Feb 2012 03:19:57 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-/*
- * Description : based on the C++ version from Ryan Herbst
- * Sample Container
- * Sample Data consists of the following: Z[xx:xx] = Zeros, O[xx:xx] = Ones
- * Sample[0] = O[0], Z[0], Hybrid[1:0], Z[0], ApvChip[2:0], Z[0], Channel[6:0], FpgaAddress[15:0]
- * Sample[1] = Z[1:0], Sample1[13:0]], Z[1:0], Sample0[13:0]
- * Sample[2] = Z[1:0], Sample3[13:0]], Z[1:0], Sample2[13:0]
- * Sample[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0]
- *
- */
-package org.lcsim;
-
-/**
- *
- * @author neal
- */
-public class HPSTrackerSample {
- // Local data
-
- protected int ldata_[] = new int[4];
- // Data pointer
- protected int data_[];
-
- public void setData(int data[]) {
- data_ = data;
- }
- //! Get hybrid index.
- public int hybrid() {
- return ((data_[0] >> 28) & 0x3);
- }
- //! Get apv index.
-
- public int apv() {
- return ((data_[0] >> 24) & 0x7);
- }
-
- //! Get channel index.
- public int channel() {
- return ((data_[0] >> 16) & 0x7F);
- }
-
- //! Get FpgaAddress value from header.
- public int fpgaAddress() {
- return (data_[0] & 0xFFFF);
- }
- //! Get adc value at index.
-
- public int value(int index) {
- switch (index) {
- case 0:
- return (data_[1] & 0x3FFF);
- case 1:
- return ((data_[1] >> 16) & 0x3FFF);
- case 2:
- return (data_[2] & 0x3FFF);
- case 3:
- return ((data_[2] >> 16) & 0x3FFF);
- case 4:
- return (data_[3] & 0x3FFF);
- case 5:
- return ((data_[3] >> 16) & 0x3FFF);
- default:
- return (0);
- }
- }
-}
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -N HPSDetectorTag.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSDetectorTag.java 28 Mar 2012 18:40:01 -0000 1.1
@@ -0,0 +1,30 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.tracking;
+
+/**
+ *
+ * @author neal
+ */
+public enum HPSDetectorTag {
+ TRACKERTAG (600),
+ EMCTAG (0x1);
+
+
+ private int value;
+
+ private HPSDetectorTag(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the enum's value.
+ *
+ * @return the value, e.g., 0xe for a BANK
+ */
+ public int getValue() {
+ return value;
+ }
+}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -N HPSTrackerEvent.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSTrackerEvent.java 28 Mar 2012 18:40:01 -0000 1.1
@@ -0,0 +1,185 @@
+/*
+ * Description : based on the C++ version from Ryan Herbst
+ *
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ * Description :
+ * Event Container
+ * Event Data consists of the following: Z[xx:xx] = Zeros
+ * Frame Size = 1 x 32-bits (32-bit dwords)
+ * Header = 8 x 32-bits
+ * Header[0] = T[0], Z[14:0], FpgaAddress[15:0] - T = 1 For TI FPGA
+ * Header[1] = Sequence[31:0]
+//
+ * The rest of the event header depends on the T flag, For T = 0:
+//
+ * Header[2] = TempB[15:0], TempA[15:0]
+ * Header[3] = TempD[15:0], TempC[15:0]
+ * Header[4] = TempF[15:0], TempE[15:0]
+ * Header[5] = TempH[15:0], TempG[15:0]
+ * Header[6] = TempJ[15:0], TempI[15:0]
+ * Header[7] = TempL[15:0], TempK[15:0]
+ * Samples... (See HPSTrackerSample.java)
+ * Tail = 1 x 32-bits
+ * Should be zero
+ */
+package org.lcsim.hps.recon.tracking;
+
+import org.lcsim.hps.recon.tracking.HPSTrackerSample;
+
+/**
+ *
+ * @author neal
+ */
+public class HPSTrackerEvent extends HPSTrackerSample {
+
+ double temp;
+ double tk;
+ double res;
+ double volt;
+ int idx;
+
+ // Temperature Constants
+ double coeffA_ = -1.4141963e1;
+ double coeffB_ = 4.4307830e3;
+ double coeffC_ = -3.4078983e4;
+ double coeffD_ = -8.8941929e6;
+ double t25_ = 10000.0;
+ double k0_ = 273.15;
+ double vmax_ = 2.5;
+ double vref_ = 2.5;
+ double rdiv_ = 10000;
+ double minTemp_ = -50;
+ double maxTemp_ = 150;
+ double incTemp_ = 0.01;
+ int adcCnt_ = 4096;
+
+ // Temperature lookup table
+ double tempTable_[] = new double[adcCnt_];
+
+ // Local trigger data
+ int tiData_[] = new int[7]; // What size can this grow to????
+
+ // Frame Constants
+ int headSize_ = 8;
+ int tailSize_ = 1;
+ int sampleSize_ = 4;
+
+ // frame size must be set externally
+ int size_ = 0;
+
+ public void TrackerEvent() {
+
+ // Fill temperature lookup table
+ temp = minTemp_;
+ while (temp < maxTemp_) {
+ tk = k0_ + temp;
+ res = t25_ * Math.exp(coeffA_ + (coeffB_ / tk) + (coeffC_ / (tk * tk)) + (coeffD_ / (tk * tk * tk)));
+ volt = (res * vmax_) / (rdiv_ + res);
+ idx = (int) ((volt / vref_) * (double) (adcCnt_ - 1));
+ if (idx < adcCnt_) {
+ tempTable_[idx] = temp;
+ }
+ temp += incTemp_;
+ }
+ }
+
+ // Get TI flag from header
+ public boolean isTiFrame() {
+ return ((data_[0] & 0x80000000) != 0);
+ }
+
+// Get FpgaAddress value from header.
+ public int fpgaAddress() {
+ return (data_[0] & 0xFFFF);
+ }
+
+// Get sequence count from header.
+ public int sequence() {
+ return (data_[1]);
+ }
+
+// Get trigger block from header.
+ int[] tiData() {
+ for (int iti = 0; iti < tiData_.length; iti++) {
+ tiData_[iti] = data_[2 + iti];
+ }
+ return (tiData_);
+ }
+
+ // Set address of data buffer
+ public void setData(int indat[]) {
+ data_ = indat;
+ }
+
+// Set frame size
+ public void setSize(int sz) {
+ size_ = sz;
+ }
+
+ // Get sample size value from header.
+ public int sampleSize() {
+ return ((data_[0] >> 8) & 0xF);
+ }
+
+// Get temperature values from header.
+ public double temperature(int index) {
+ if (isTiFrame()) {
+ return (0.0);
+ } else {
+ switch (index) {
+ case 0:
+ return (tempTable_[(data_[2] & 0x3FFF)]);
+ case 1:
+ return (tempTable_[((data_[2] >> 16) & 0x3FFF)]);
+ case 2:
+ return (tempTable_[(data_[3] & 0x3FFF)]);
+ case 3:
+ return (tempTable_[((data_[3] >> 16) & 0x3FFF)]);
+ case 4:
+ return (tempTable_[(data_[4] & 0x3FFF)]);
+ case 5:
+ return (tempTable_[((data_[4] >> 16) & 0x3FFF)]);
+ case 6:
+ return (tempTable_[(data_[5] & 0x3FFF)]);
+ case 7:
+ return (tempTable_[((data_[5] >> 16) & 0x3FFF)]);
+ case 8:
+ return (tempTable_[(data_[6] & 0x3FFF)]);
+ case 9:
+ return (tempTable_[((data_[6] >> 16) & 0x3FFF)]);
+ case 10:
+ return (tempTable_[(data_[7] & 0x3FFF)]);
+ case 11:
+ return (tempTable_[((data_[7] >> 16) & 0x3FFF)]);
+ default:
+ return (0.0);
+ }
+ }
+
+ }
+
+// Get sample count
+ public int count() {
+// return (128);
+// int size_ = sampleSize();
+// System.out.println("count: size_ = " + size_);
+ return ((size_ - (headSize_ + tailSize_)) / sampleSize_);
+ }
+// Get sample at index
+
+ public HPSTrackerSample sample(int index) {
+ if (index >= count()) { // should be count()
+ return (null);
+ } else {
+ HPSTrackerSample sample_ = new HPSTrackerSample();
+ for (int ii = 0; ii < sampleSize_; ii++) {
+ ldata_[ii] = data_[headSize_ + (index * sampleSize_) + ii];
+// System.out.println("ldata[" + ii + "] = " + ldata_[ii]);
+ }
+// sample_.setData(data_[headSize_ + (index * sampleSize_)]);
+ sample_.setData(ldata_);
+ return (sample_);
+ }
+ }
+}
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -N HPSTrackerSample.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSTrackerSample.java 28 Mar 2012 18:40:01 -0000 1.1
@@ -0,0 +1,66 @@
+/*
+ * Description : based on the C++ version from Ryan Herbst
+ * Sample Container
+ * Sample Data consists of the following: Z[xx:xx] = Zeros, O[xx:xx] = Ones
+ * Sample[0] = O[0], Z[0], Hybrid[1:0], Z[0], ApvChip[2:0], Z[0], Channel[6:0], FpgaAddress[15:0]
+ * Sample[1] = Z[1:0], Sample1[13:0]], Z[1:0], Sample0[13:0]
+ * Sample[2] = Z[1:0], Sample3[13:0]], Z[1:0], Sample2[13:0]
+ * Sample[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0]
+ *
+ */
+package org.lcsim.hps.recon.tracking;
+
+/**
+ *
+ * @author neal
+ */
+public class HPSTrackerSample {
+ // Local data
+
+ protected int ldata_[] = new int[4];
+ // Data pointer
+ protected int data_[];
+
+ public void setData(int data[]) {
+ data_ = data;
+ }
+ //! Get hybrid index.
+ public int hybrid() {
+ return ((data_[0] >> 28) & 0x3);
+ }
+ //! Get apv index.
+
+ public int apv() {
+ return ((data_[0] >> 24) & 0x7);
+ }
+
+ //! Get channel index.
+ public int channel() {
+ return ((data_[0] >> 16) & 0x7F);
+ }
+
+ //! Get FpgaAddress value from header.
+ public int fpgaAddress() {
+ return (data_[0] & 0xFFFF);
+ }
+ //! Get adc value at index.
+
+ public int value(int index) {
+ switch (index) {
+ case 0:
+ return (data_[1] & 0x3FFF);
+ case 1:
+ return ((data_[1] >> 16) & 0x3FFF);
+ case 2:
+ return (data_[2] & 0x3FFF);
+ case 3:
+ return ((data_[2] >> 16) & 0x3FFF);
+ case 4:
+ return (data_[3] & 0x3FFF);
+ case 5:
+ return ((data_[3] >> 16) & 0x3FFF);
+ default:
+ return (0);
+ }
+ }
+}
CVSspam 0.2.12