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  September 2015

HPS-SVN September 2015

Subject:

r3672 - in /java/trunk/evio/src/main/java/org/hps/evio: AbstractSvtEvioReader.java EvioReader.java LCSimEngRunEventBuilder.java SvtEvioReader.java TestRunSvtEvioReader.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 23 Sep 2015 00:30:35 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (188 lines)

Author: [log in to unmask]
Date: Tue Sep 22 17:30:32 2015
New Revision: 3672

Log:
Use exception types for future flexibility. Add check for errors in the SVT header.

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java
    java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java
    java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java

Modified: java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java	Tue Sep 22 17:30:32 2015
@@ -140,8 +140,9 @@
      *  @param event - EVIO event to process
      *  @param lcsimEvent - LCSim event to put collections into 
      *  @return true if the EVIO was processed successfully, false otherwise 
-     */
-    public boolean processEvent(EvioEvent event, EventHeader lcsimEvent) {
+     * @throws SvtEvioReaderException 
+     */
+    public boolean processEvent(EvioEvent event, EventHeader lcsimEvent) throws SvtEvioReaderException {
         return this.makeHits(event, lcsimEvent);
     }
 
@@ -153,8 +154,9 @@
      *  @param event - EVIO event to process
      *  @param lcsimEvent - LCSim event to put collections into 
      *  @return true if the raw hits were created successfully, false otherwise 
-     */
-    public boolean makeHits(EvioEvent event, EventHeader lcsimEvent) {
+     * @throws SvtEvioReaderException 
+     */
+    public boolean makeHits(EvioEvent event, EventHeader lcsimEvent) throws SvtEvioReaderException {
 
         logger.fine("Physics Event: " + event.toString());
         
@@ -197,8 +199,8 @@
             
             // If the ROC bank doesn't contain any data, raise an exception
             if (rocBank.getChildCount() == 0) { 
-                throw new RuntimeException("[ " + this.getClass().getSimpleName() 
-                        + " ]: SVT bank doesn't contain any data banks.");
+                throw new SvtEvioReaderException("[ " + this.getClass().getSimpleName() 
+                                + " ]: SVT bank doesn't contain any data banks.");
             }
             
             // Get the data banks containing the SVT samples.  
@@ -223,13 +225,17 @@
                         - this.getDataTailLength();
                 logger.fine("Total number of  samples: " + sampleCount);
                 if (sampleCount % 4 != 0) {
-                    throw new RuntimeException("[ "
+                    throw new SvtEvioReaderException("[ "
                             + this.getClass().getSimpleName()
                             + " ]: Size of samples array is not divisible by 4");
                 }
                 
                 // extract header and tail information
                 SvtHeaderDataInfo headerData = this.extractSvtHeader(dataBank.getHeader().getNumber(), data);
+                
+                // Check the integrity of the SVT header data
+                this.checkSvtHeaderData(headerData);
+                
                     
                 // Check that the multisample count is consistent
                 if( sampleCount != SvtEvioUtils.getSvtTailMultisampleCount(headerData.getTail())*4)
@@ -271,11 +277,19 @@
 
         // Add SVT header data to the event
         this.addSvtHeadersToEvents(headers, lcsimEvent);
-        
+
+        
+
         return true;
     }
 
     
+    /**
+     * Check if the SVT headers are as expected.
+     * @param headers - list of headers to check
+     */
+    protected abstract void checkSvtHeaderData(SvtHeaderDataInfo header) throws SvtEvioHeaderException;
+
     /**
      * Extract the header information and store it in a {@link SvtHeaderDataInfo} object.
      * @param num - bank num (ROC id)

Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/EvioReader.java	Tue Sep 22 17:30:32 2015
@@ -24,9 +24,10 @@
 	 * 	@param event : The EVIO event to read the raw data from
 	 * 	@param lcsimEvent : The LCSim event to write the collections to
 	 * 	@return True if the appropriate EVIO bank is found, false otherwise	
+	 * @throws Exception 
 	 * 
 	 */
-	abstract boolean makeHits(EvioEvent event, EventHeader lcsimEvent);
+	abstract boolean makeHits(EvioEvent event, EventHeader lcsimEvent) throws Exception;
 
 	/**
 	 *	Set the hit collection name.

Modified: java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/LCSimEngRunEventBuilder.java	Tue Sep 22 17:30:32 2015
@@ -135,8 +135,12 @@
         // Make SVT RawTrackerHits.
         try {
             svtReader.makeHits(evioEvent, lcsimEvent);
+        } catch (final SvtEvioHeaderException e) {
+            LOGGER.log(Level.SEVERE, "Error reading header information from the SVT.",e);
+        } catch (final SvtEvioReaderException e) {
+            LOGGER.log(Level.SEVERE, "Error making SVT hits.",e);
         } catch (final Exception e) {
-            LOGGER.log(Level.SEVERE, "Error making SVT hits.", e);
+            LOGGER.log(Level.SEVERE, "Error making SVT hits. Don't think I should be able to get here?", e);
         }
         
         // Write the current EPICS data into this event.

Modified: java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java	Tue Sep 22 17:30:32 2015
@@ -164,9 +164,10 @@
      *  @param event - EVIO event to process
      *  @param lcsimEvent - LCSim event to put collections into 
      *  @return true if the EVIO was processed successfully, false otherwise 
-     */
-    @Override
-    public boolean processEvent(EvioEvent event, EventHeader lcsimEvent) {
+     * @throws SvtEvioReaderException 
+     */
+    @Override
+    public boolean processEvent(EvioEvent event, EventHeader lcsimEvent) throws SvtEvioReaderException {
         
         // Make RawTrackerHits.  This will also search for and store banks containing
         // the configuration of the SVT.
@@ -215,5 +216,19 @@
         return new SvtHeaderDataInfo(num, svtHeader, svtTail);
     }
 
+    @Override
+    protected void checkSvtHeaderData(SvtHeaderDataInfo header) throws SvtEvioHeaderException {
+        int tail = header.getTail();
+        if( SvtEvioUtils.getSvtTailSyncErrorBit(tail) != 0) {
+            throw new SvtEvioHeaderException("This header had a SyncError");
+        }
+        else if( SvtEvioUtils.getSvtTailOFErrorBit(tail) != 0) {
+            throw new SvtEvioHeaderException("This header had a OverFlowError");
+        }
+        else if( SvtEvioUtils.getSvtTailMultisampleSkipCount(tail) != 0) {
+            throw new SvtEvioHeaderException("This header had a skipCount " + SvtEvioUtils.getSvtTailMultisampleSkipCount(tail));
+        }
+    }
+
     
 }

Modified: java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/TestRunSvtEvioReader.java	Tue Sep 22 17:30:32 2015
@@ -170,6 +170,13 @@
         return null;
     }
 
+    @Override
+    protected void checkSvtHeaderData(SvtHeaderDataInfo header)
+            throws SvtEvioHeaderException {
+        // TODO Auto-generated method stub
+        
+    }
+
  
 
     

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