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:

r1660 - in /java/trunk/evio/src/main/java/org/hps/evio: ECalEvioReader.java EventConstants.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 9 Dec 2014 13:25:18 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (165 lines)

Author: celentan
Date: Tue Dec  9 05:25:12 2014
New Revision: 1660

Log:
Update the Evio Reader to handle FADC mode 7

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/ECalEvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java

Modified: java/trunk/evio/src/main/java/org/hps/evio/ECalEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/ECalEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/ECalEvioReader.java	Tue Dec  9 05:25:12 2014
@@ -14,6 +14,7 @@
 import org.hps.conditions.ecal.EcalChannel.GeometryId;
 import org.hps.conditions.ecal.EcalConditions;
 import org.hps.recon.ecal.FADCGenericHit;
+import org.hps.recon.ecal.HPSRawCalorimeterHit;
 import org.jlab.coda.jevio.BaseStructure;
 import org.jlab.coda.jevio.BaseStructureHeader;
 import org.jlab.coda.jevio.CompositeData;
@@ -131,8 +132,13 @@
                                             flags = 0;
                                             break;
                                         case EventConstants.ECAL_PULSE_INTEGRAL_BANK_TAG:
-                                            hits.addAll(makeIntegralHits(cdata, crate));
-                                            hitClass = BaseRawCalorimeterHit.class;
+                                            hits.addAll(makeIntegralHitsMode3(cdata, crate));
+                                            hitClass = HPSRawCalorimeterHit.class;
+                                            flags = (1 << LCIOConstants.RCHBIT_TIME); //store timestamp
+                                            break;
+                                        case EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_BANK_TAG:
+                                            hits.addAll(makeIntegralHitsMode7(cdata, crate));
+                                            hitClass = HPSRawCalorimeterHit.class;
                                             flags = (1 << LCIOConstants.RCHBIT_TIME); //store timestamp
                                             break;
                                         default:
@@ -277,8 +283,8 @@
         return hits;
     }
 
-    private List<BaseRawCalorimeterHit> makeIntegralHits(CompositeData cdata, int crate) {
-        List<BaseRawCalorimeterHit> hits = new ArrayList<BaseRawCalorimeterHit>();
+    private List<HPSRawCalorimeterHit> makeIntegralHitsMode3(CompositeData cdata, int crate) {
+        List<HPSRawCalorimeterHit> hits = new ArrayList<HPSRawCalorimeterHit>();
         if (debug) {
             int n = cdata.getNValues().size();
             for (int i = 0; i < n; i++) {
@@ -315,7 +321,7 @@
                         int[] data = {pulseIntegral, pulseTime};
                         processUnrecognizedChannel(new FADCGenericHit(EventConstants.ECAL_PULSE_INTEGRAL_MODE, crate, slot, channel, data));
                     } else {
-                        hits.add(new BaseRawCalorimeterHit(id, pulseIntegral, pulseTime));
+                        hits.add(new HPSRawCalorimeterHit(id, pulseIntegral,pulseTime,0,(short)0,(short)0,EventConstants.ECAL_PULSE_INTEGRAL_MODE));
                     }
                 }
             }
@@ -323,6 +329,60 @@
         return hits;
     }
 
+    
+    
+    private List<HPSRawCalorimeterHit> makeIntegralHitsMode7(CompositeData cdata, int crate) {
+        List<HPSRawCalorimeterHit> hits = new ArrayList<HPSRawCalorimeterHit>();
+        if (debug) {
+            int n = cdata.getNValues().size();
+            for (int i = 0; i < n; i++) {
+                System.out.println("cdata.N[" + i + "]=" + cdata.getNValues().get(i));
+            }
+            int ni = cdata.getItems().size();
+            for (int i = 0; i < ni; i++) {
+                System.out.println("cdata.type[" + i + "]=" + cdata.getTypes().get(i));
+            }
+        }
+        while (cdata.index() + 1 < cdata.getItems().size()) { //the +1 is a hack because sometimes an extra byte gets read (padding)
+            short slot = cdata.getByte();
+            int trigger = cdata.getInt();
+            long timestamp = cdata.getLong();
+            int nchannels = cdata.getNValue();
+            if (debug) {
+                System.out.println("slot#=" + slot + "; trigger=" + trigger + "; timestamp=" + timestamp + "; nchannels=" + nchannels);
+            }
+            for (int j = 0; j < nchannels; j++) {
+                short channel = cdata.getByte();
+                int npulses = cdata.getNValue();
+                if (debug) {
+                    System.out.println("  channel=" + channel + "; npulses=" + npulses);
+                }
+                Long id = daqToGeometryId(crate, slot, channel);
+
+                for (int k = 0; k < npulses; k++) {
+                    short pulseTime = cdata.getShort();
+                    int pulseIntegral = cdata.getInt();
+                    short amplLow = cdata.getShort();
+                    short amplHigh = cdata.getShort();
+                    if (debug) {
+                        System.out.println("    pulseTime=" + pulseTime + "; pulseIntegral=" + pulseIntegral);
+                    }
+                    if (id == null) {
+                        int[] data = {pulseIntegral, pulseTime};
+                        processUnrecognizedChannel(new FADCGenericHit(EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE, crate, slot, channel, data));
+                    } else {
+                        hits.add(new HPSRawCalorimeterHit(id, pulseIntegral,pulseTime,0,amplLow,amplHigh,EventConstants.ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE));
+                    }
+                }
+            }
+        }
+        return hits;
+    }
+    
+    
+    
+    
+    
     private void processUnrecognizedChannel(FADCGenericHit hit) {
         genericHits.add(hit);
 

Modified: java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EventConstants.java	Tue Dec  9 05:25:12 2014
@@ -18,25 +18,33 @@
     public static final int TRIGGER_BANK_NUMBER = 1;
     public static final int ECAL_WINDOW_MODE = 1;
     public static final int ECAL_PULSE_MODE = 2;
-    public static final int ECAL_PULSE_INTEGRAL_MODE = 3;
+    public static final int ECAL_PULSE_INTEGRAL_MODE = 3; //FADC mode 3
+    public static final int ECAL_PULSE_INTEGRAL_HIGHRESTDC_MODE = 4; //FADC mode 7
+
     
-    // The composite data format for window ecal data.
+    // The composite data format for window ecal data. MODE 1
     public static final String ECAL_WINDOW_FORMAT = "c,i,l,N(c,Ns)";
     
     // The composite data format for pulse ecal data.
     public static final String ECAL_PULSE_FORMAT = "c,i,l,N(c,N(c,Ns))";
     
-    // The composite data format for pulse integral ecal data.
+    // The composite data format for pulse integral ecal data. MODE 3
     public static final String ECAL_PULSE_INTEGRAL_FORMAT = "c,i,l,N(c,N(s,i))";
+    
+    // The composite data format for pulse integral ecal data. MODE 7
+    public static final String ECAL_PULSE_INTEGRAL_HIGHRESTDC_FORMAT = "c,i,l,N(c,N(s,i,s,s))";
     
     // The tag for ECal window data.
     public static final int ECAL_WINDOW_BANK_TAG = 0xe101;
     
     // The tag for ECal pulse data.
-    public static final int ECAL_PULSE_BANK_TAG = 0xe102;
+    public static final int ECAL_PULSE_BANK_TAG = 0xe10F; 
     
-    // The tag for ECal pulse integral data.
+    // The tag for ECal pulse integral data mode 3
     public static final int ECAL_PULSE_INTEGRAL_BANK_TAG = 0xe103;
+    
+    // The tag for ECal pulse integral data mode 7
+    public static final int ECAL_PULSE_INTEGRAL_HIGHRESTDC_BANK_TAG = 0xe102;
     
     // The tag for trigger data.
     public static final int TRIGGER_BANK_TAG = 0xe106;

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