LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  November 2014

HPS-SVN November 2014

Subject:

r1430 - in /java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal: SSPData.java TriggerData.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 5 Nov 2014 04:47:26 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (252 lines)

Author: [log in to unmask]
Date: Tue Nov  4 20:47:24 2014
New Revision: 1430

Log:
extend TriggerData with Andrea's reader for the new SSP bank format

Added:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java
      - copied, changed from r1425, java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java
Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java

Copied: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java (from r1425, java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java)
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java	Tue Nov  4 20:47:24 2014
@@ -2,73 +2,160 @@
 
 import org.lcsim.event.GenericObject;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  *
  * @author Sho Uemura <[log in to unmask]>
+ * @author Andrea Celentano <[log in to unmask]>
  * @version $Id: TriggerData.java,v 1.3 2012/08/03 23:14:39 meeg Exp $
  */
-public class TriggerData implements GenericObject {
+public class SSPData extends TriggerData {
 
-    public static final int OR_TRIG = 3;
-    public static final int TOP_TRIG = 4;
-    public static final int BOT_TRIG = 5;
-    public static final int AND_TRIG = 6;
-    public static final int TIME = 7;
-    public static final int TRIG_BANK_SIZE = 8;
+//    public static final int OR_TRIG = 3;
+//    public static final int TOP_TRIG = 4;
+//    public static final int BOT_TRIG = 5;
+//    public static final int AND_TRIG = 6;
+//    public static final int TIME = 7;
+//    public static final int TRIG_BANK_SIZE = 8;
+    //Here goes the 5-bit identifiers for the word type
+    public static final int TRIG_HEADER = 0x12;
+    public static final int TRIG_TIME = 0x13;
+    public static final int TRIG_TYPE = 0x15;
+    public static final int CLUSTER_TYPE = 0x14;
+
     public static final String TRIG_COLLECTION = "TriggerBank";
     private int[] bank;
 
-    public TriggerData(int[] bank) {
-        this.bank = bank;
+    private long trigTime;
+    private int eventNum;
+
+    private int trigType;
+    private int trigTypeData;
+    private int trigTypeTime;
+
+    private int nCluster, nClusterTop, nClusterBottom;
+
+    private List<Integer> clusterX, clusterY, clusterE, clusterT, clusterNhits;
+
+    public SSPData(int[] bank) {
+        super(bank);
+
+        clusterX = new ArrayList<Integer>();
+        clusterY = new ArrayList<Integer>();
+        clusterE = new ArrayList<Integer>();
+        clusterT = new ArrayList<Integer>();
+        clusterNhits = new ArrayList<Integer>();
+
+        trigTime = 0;
+        trigType = -1;
+        trigTypeData = 0;
+
+        nCluster = nClusterTop = nClusterBottom = 0;
+
+        this.bank = Arrays.copyOf(bank, bank.length);
+        this.decodeTriggerBank();
+
     }
 
-    public int getTime() {
-        return getIntVal(TIME);
+    private void decodeTriggerBank() {
+        /*A. Celentano: decode here the trigger bank*/
+        /*We do not need to handle block header, block trayler since these are disentagled in the secondary CODA readout list*/
+        int this_word;
+        int this_clusterX, this_clusterY, this_clusterE, this_clusterT, this_clusterNhits;
+
+        for (int ii = 0; ii < bank.length; ii++) {
+            this_word = bank[ii];
+
+            //event header
+            if (((this_word >> 27) & (0x1f)) == TRIG_HEADER) {
+                eventNum = this_word & 0x7FFFFFF;
+            } //trigger time
+            else if (((this_word >> 27) & (0x1f)) == TRIG_TIME) {
+                trigTime = (bank[ii + 1] << 24) | (this_word & 0xffffff);
+            } //trigger type
+            else if (((this_word >> 27) & (0x1f)) == TRIG_TYPE) {
+                trigType = (this_word >> 23) & 0xf; //this is the trigbit, from 0 to 7
+                trigTypeData = (this_word >> 16) & 0x7f;
+                trigTypeTime = (this_word >> 16) & 0x3ff;
+            } //cluster 
+            else if (((this_word >> 27) & (0x1f)) == CLUSTER_TYPE) {
+                this_clusterNhits = (this_word >> 23) & 0xf;
+                clusterNhits.add(this_clusterNhits);
+
+                this_clusterE = (this_word >> 10) & 0x1fff;
+                clusterE.add(this_clusterE);
+
+                this_clusterY = (this_word >> 6) & 0xf;
+                clusterY.add(this_clusterY);
+                if (this_clusterY > 0) {
+                    nClusterTop++;
+                } else if (this_clusterY < 0) {
+                    nClusterBottom++;
+                }
+
+                this_clusterX = (this_word) & 0x3f;
+                clusterX.add(this_clusterX);
+
+                this_clusterT = (bank[ii + 1]) & 0x3ff;
+                clusterT.add(this_clusterT);
+
+                nCluster++;
+            }
+
+        }
     }
 
-    public int getOrTrig() {
-        return getIntVal(OR_TRIG);
+    @Override
+    public long getTime() {
+        return trigTime;
     }
 
-    public int getTopTrig() {
-        return getIntVal(TOP_TRIG);
-    }
-
-    public int getBotTrig() {
-        return getIntVal(BOT_TRIG);
-    }
-
-    public int getAndTrig() {
-        return getIntVal(AND_TRIG);
-    }
-
+//    public int getOrTrig() {
+//        return 0;
+//    }
+//
+//    public int getTopTrig() {
+//        return 0;
+//    }
+//
+//    public int getBotTrig() {
+//        return 0;
+//    }
+//
+//    public int getAndTrig() {
+//        return 0;
+//    }
     public int[] getBank() {
         return bank;
     }
 
-    public static int getTime(GenericObject object) {
-        return object.getIntVal(TIME);
+    public static long getTime(GenericObject object) {
+        return ((TriggerData) object).getTime();
     }
 
     public static int getOrTrig(GenericObject object) {
-        return object.getIntVal(OR_TRIG);
+        return ((TriggerData) object).getOrTrig();
     }
 
     public static int getTopTrig(GenericObject object) {
-        return object.getIntVal(TOP_TRIG);
+        return ((TriggerData) object).getTopTrig();
     }
 
     public static int getBotTrig(GenericObject object) {
-        return object.getIntVal(BOT_TRIG);
+        return ((TriggerData) object).getBotTrig();
     }
 
     public static int getAndTrig(GenericObject object) {
-        return object.getIntVal(AND_TRIG);
+        return ((TriggerData) object).getAndTrig();
     }
 
     public static int[] getBank(GenericObject object) {
-        int[] bank = new int[8];
-        for (int i = 0; i < 8; i++) {
+        int N = ((SSPData) object).bank.length;
+        int[] bank = new int[N];
+        for (int i = 0; i < N; i++) {
             bank[i] = object.getIntVal(i);
         }
         return bank;
@@ -76,7 +163,7 @@
 
     @Override
     public int getNInt() {
-        return TRIG_BANK_SIZE;
+        return bank.length;
     }
 
     @Override
@@ -106,6 +193,6 @@
 
     @Override
     public boolean isFixedSize() {
-        return true;
+        return false;
     }
 }

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/TriggerData.java	Tue Nov  4 20:47:24 2014
@@ -22,7 +22,7 @@
         this.bank = bank;
     }
 
-    public int getTime() {
+    public long getTime() {
         return getIntVal(TIME);
     }
 
@@ -46,7 +46,7 @@
         return bank;
     }
 
-    public static int getTime(GenericObject object) {
+    public static long getTime(GenericObject object) {
         return object.getIntVal(TIME);
     }
 

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use