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  December 2014

HPS-SVN December 2014

Subject:

r1705 - /java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 12 Dec 2014 10:54:52 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (170 lines)

Author: celentan
Date: Fri Dec 12 02:54:47 2014
New Revision: 1705

Log:
Update SSPData to reflect current SSP evio format

Modified:
    java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java

Modified: java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java
 =============================================================================
--- java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java	(original)
+++ java/trunk/ecal-readout-sim/src/main/java/org/hps/readout/ecal/SSPData.java	Fri Dec 12 02:54:47 2014
@@ -26,20 +26,31 @@
     public static final int TRIG_TYPE = 0x15;
     public static final int CLUSTER_TYPE = 0x14;
 
+    public static final int TRIG_TYPE_COSMIC_TOP = 0x0;
+    public static final int TRIG_TYPE_COSMIC_BOT = 0x1;
+    public static final int TRIG_TYPE_SINGLES0_TOP = 0x2;
+    public static final int TRIG_TYPE_SINGLES0_BOT = 0x3;
+    public static final int TRIG_TYPE_SINGLES1_TOP = 0x4;
+    public static final int TRIG_TYPE_SINGLES1_BOT = 0x5;
+    public static final int TRIG_TYPE_PAIR0 = 0x6;
+    public static final int TRIG_TYPE_PAIR1 = 0x7;
+    
+    
+    
+    
     public static final String TRIG_COLLECTION = "TriggerBank";
-//    private int[] 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;
-
+    private List<Integer> trigType,trigTypeData,trigTypeTime; //SSP can report more than 1 trigger type (if the event satisfies more than 1 trigger equation)
+    
     public SSPData(int[] bank) {
         super(bank);
 
@@ -49,9 +60,13 @@
         clusterT = new ArrayList<Integer>();
         clusterNhits = new ArrayList<Integer>();
 
+        trigType = new ArrayList<Integer>();
+        trigTypeData = new ArrayList<Integer>();
+        trigTypeTime = new ArrayList<Integer>();
+      
         trigTime = 0;
-        trigType = -1;
-        trigTypeData = 0;
+        
+        
 
         nCluster = nClusterTop = nClusterBottom = 0;
 
@@ -59,10 +74,9 @@
         this.decodeTriggerBank();
 
     }
-
     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*/
+        /*A. C.: decode here the trigger bank*/
+        /*We do not need to handle block header, block trailer since these are disentagled in the secondary CODA readout list*/
         int this_word;
         int this_clusterX, this_clusterY, this_clusterE, this_clusterT, this_clusterNhits;
 
@@ -76,10 +90,10 @@
             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;
+            else if (((this_word >> 27) & (0x1f)) == TRIG_TYPE) {         
+                trigType.add((this_word >> 23) & 0xf); //this is the trigbit, from 0 to 7
+                trigTypeData.add((this_word >> 16) & 0x7f);
+                trigTypeTime.add((this_word) & 0x3ff);
             } //cluster 
             else if (((this_word >> 27) & (0x1f)) == CLUSTER_TYPE) {
                 this_clusterNhits = (this_word >> 23) & 0xf;
@@ -100,12 +114,13 @@
                 clusterX.add(this_clusterX);
 
                 this_clusterT = (bank[ii + 1]) & 0x3ff;
-                clusterT.add(this_clusterT);
+                clusterT.add(this_clusterT*4); //*4 since the time is reported in 4 ns ticks
 
                 nCluster++;
             }
-
         }
+        
+        
     }
 
     @Override
@@ -114,18 +129,48 @@
     }
 
     @Override
+    /*
+     * Returns the trigger time, relative to the SSP window, of the FIRST Cluster singles trigger (0/1) (any crate)
+     * Returns in ns.
+     */ 
     public int getOrTrig() {
-        return 0;
-    }
-
+        int TopTime = this.getTopTrig();
+        int BotTime = this.getBotTrig();
+        
+        if (TopTime<=BotTime) return TopTime;
+        else return BotTime;
+
+    }
+
+    /*
+     * Returns the trigger time, relative to the SSP window, of the FIRST Cluster singles trigger (0/1) from TOP crate 
+     * Returns in ns.
+     */ 
     @Override
     public int getTopTrig() {
-        return 0;
-    }
-
-    @Override
-    public int getBotTrig() {
-        return 0;
+       int TopTime=1025; //time is 10 bits, so is always smaller than 1024.
+       for (int ii = 0; ii < trigType.size(); ii++){
+    	   if  (((trigType.get(ii)==TRIG_TYPE_SINGLES0_TOP)||(trigType.get(ii)==TRIG_TYPE_SINGLES1_TOP))&&(trigTypeTime.get(ii)<TopTime)){
+    		   TopTime=trigTypeTime.get(ii);
+    	   }
+       }
+       return TopTime*4;
+    }
+
+
+    /*
+     * Returns the trigger time, relative to the SSP window, of the FIRST Cluster singles trigger (0/1) from BOT crate 
+     * Returns in ns.
+     */ 
+    @Override
+    public int getBotTrig(){
+        int BotTime=1025; //time is 10 bits, so is always smaller than 1024.
+        for (int ii = 0; ii < trigType.size(); ii++){
+     	   if  (((trigType.get(ii)==TRIG_TYPE_SINGLES0_BOT)||(trigType.get(ii)==TRIG_TYPE_SINGLES1_BOT))&&(trigTypeTime.get(ii)<BotTime)){
+     		   BotTime=trigTypeTime.get(ii);
+     	   }
+        }
+        return BotTime*4;
     }
 
     @Override

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