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

HPS-SVN March 2015

Subject:

r2635 - in /java/trunk/evio/src/main/java/org/hps/evio: AbstractSvtEvioReader.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:

Tue, 31 Mar 2015 15:44:43 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1085 lines)

Author: [log in to unmask]
Date: Tue Mar 31 08:44:36 2015
New Revision: 2635

Log:
Add an abstract method used to check if a set of samples is valid.  Implement these methods in the subclasses. Specifically, for the engineering run data, sample sets containing APV headers or tails are filtered out.  For the test run data, nothing is currently being filtered out.

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.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 Mar 31 08:44:36 2015
@@ -41,243 +41,254 @@
     protected static Logger logger = LogUtil.create(AbstractSvtEvioReader.class.getName(), 
             new DefaultLogFormatter(), Level.INFO);
 
-	// A Map from DAQ pair (FPGA/Hybrid or FEB ID/FEB Hybrid ID) to the
-	// corresponding sensor
-	protected Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>,
+    // A Map from DAQ pair (FPGA/Hybrid or FEB ID/FEB Hybrid ID) to the
+    // corresponding sensor
+    protected Map<Pair<Integer /* FPGA */, Integer /* Hybrid */>,
                   HpsSiSensor /* Sensor */> daqPairToSensor 
                       = new HashMap<Pair<Integer, Integer>, HpsSiSensor>();
 
-	// Flag indicating whether the DAQ map has been setup
-	protected boolean isDaqMapSetup = false;
-
-	// Collections and names
-	private static final String SVT_HIT_COLLECTION_NAME = "SVTRawTrackerHits";
-	List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>();
-
-	// Constants
-	private static final String SUBDETECTOR_NAME = "Tracker";
-	private static final String READOUT_NAME = "TrackerHits";
-
-	/**
-	 *	Get the minimum SVT ROC bank tag in the event.
-	 *
-	 *	@return Minimum SVT ROC bank tag
-	 */
-	abstract protected int getMinRocBankTag(); 
-	
-	/**
-	 *	Get the maximum SVT ROC bank tag in the event.
-	 *
-	 *	@return Maximum SVT ROC bank tag
-	 */
-	abstract protected int getMaxRocBankTag(); 
-	
-
-	/**
-	 *	Get the SVT ROC bank number of the bank encapsulating the SVT samples.
-	 * 
-	 *	@return SVT ROC bank number 
-	 */
-	abstract protected int getRocBankNumber(); 
-	
-	/**
-	 *	Get the number of 32 bit integers composing the data block header
-	 *
-	 *	@return The header length
-	 */
-	abstract protected int getDataHeaderLength();
-
-	/**
-	 *	Get the number of 32 bit integers composing the data block tail (the 
-	 *	data inserted after all sample blocks in a data block)
-	 * 
-	 *	@return The tail length 
-	 */
-	abstract protected int getDataTailLength();
-
-	/**
-	 *	A method to setup a mapping between a DAQ pair 
-	 *	(FPGA/Hybrid or FEB ID/FEB Hybrid ID) and the corresponding sensor.
-	 *
-	 *	@param subdetector - The tracker {@link Subdetector} object
-	 */
-	// TODO: This can probably be done when the conditions are loaded.
-	abstract protected void setupDaqMap(Subdetector subdetector);
-
-	/**
-	 *	Get the sensor associated with a set of samples  
-	 *
-	 *	@param data - sample block of data
-	 *	@return The sensor associated with a set of sample 
-	 */
-	abstract protected HpsSiSensor getSensor(int[] data);
-
-
-	/**
-	 *	Check whether a data bank is valid i.e. contains SVT samples only.
-	 * 
-	 * 	@param dataBank - An EVIO bank containing integer data
-	 * 	@return true if the bank is valid, false otherwise
-	 */
-	abstract protected boolean isValidDataBank(BaseStructure dataBank); 	
-	
-	/**
-	 *	Process an EVIO event and extract all information relevant to the SVT.
-	 *	
-	 *	@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) {
-		return this.makeHits(event, lcsimEvent);
-	}
-
-	/**
-	 *	Make {@link RawTrackerHit}s out of all sample sets in an SVT EVIO bank
-	 *	and put them into an LCSim event.
-	 *
-	 *	
-	 *	@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) {
-
-		// Retrieve the ROC banks encapsulated by the physics bank.  The ROC
-		// bank range is set in the subclass.
-		List<BaseStructure> rocBanks = new ArrayList<BaseStructure>();
-		for (int rocBankTag = this.getMinRocBankTag(); 
-				rocBankTag <= this.getMaxRocBankTag(); rocBankTag++) { 
-			
-			logger.fine("Retrieving ROC bank: " + rocBankTag);
-			List<BaseStructure> matchingRocBanks = this.getMatchingBanks(event, rocBankTag);
-			if (matchingRocBanks == null) { 
-			    logger.fine("ROC bank " + rocBankTag + " was not found!");
-			    continue;
-			}
-			rocBanks.addAll(matchingRocBanks);
-		}
-		logger.fine("Total ROC banks found: " + rocBanks.size());
-		
-		// Return false if ROC banks weren't found
-		if (rocBanks.isEmpty()) return false;  
-	
-		// Setup the DAQ map if it's not setup
-		if (!this.isDaqMapSetup)
-			this.setupDaqMap(lcsimEvent.getDetector().getSubdetector(
-					SUBDETECTOR_NAME));
-
-		// Clear the list of raw tracker hits
-		rawHits.clear();
-
-		// Loop over the SVT ROC banks and process all samples
-		for (BaseStructure rocBank : rocBanks) { 
-			
-			logger.fine("ROC bank: " + rocBank.toString());
-			
-			logger.fine("Processing ROC bank " + rocBank.getHeader().getTag());
-			
-			// 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.");
-			}
-			
-			// Get the data banks containing the SVT samples.  
-			List<BaseStructure> dataBanks = rocBank.getChildren(); 
-			logger.fine("Total data banks found: " + dataBanks.size());
-			
-			// Loop over all of the data banks contained by the ROC banks and 
-			// processed them
-			for (BaseStructure dataBank : dataBanks) { 
-		
-				logger.fine("Processing data bank: " + dataBank.toString());
-			
-				// Check that the bank is valid
-				if (!this.isValidDataBank(dataBank)) continue;
-				
-				// Get the int data encapsulated by the data bank
-				int[] data = dataBank.getIntData();
-				logger.fine("Total number of integers contained by the data bank: " + data.length);
-		
-				// Check that a complete set of samples exist
-				int sampleCount = data.length - this.getDataHeaderLength()
-						- this.getDataTailLength();
-				logger.fine("Total number of  samples: " + sampleCount);
-				if (sampleCount % 4 != 0) {
-					throw new RuntimeException("[ "
-							+ this.getClass().getSimpleName()
-							+ " ]: Size of samples array is not divisible by 4");
-				}
-
-				// Loop through all of the samples and make hits
-				for (int samplesN = 0; samplesN < sampleCount; samplesN += 4) {
-
-					int[] samples = new int[4];
-					System.arraycopy(data, this.getDataHeaderLength() + samplesN, samples, 0, samples.length);
-					rawHits.add(this.makeHit(samples));
-				}
-			}
-		}
-		
-		logger.fine("Total number of RawTrackerHits created: " + rawHits.size());
-
-		// Turn on 64-bit cell ID.
-		int flag = LCIOUtil.bitSet(0, 31, true);
-		// Add the collection of raw hits to the LCSim event
-		lcsimEvent.put(SVT_HIT_COLLECTION_NAME, rawHits, RawTrackerHit.class, flag, READOUT_NAME);
-
-		return true;
-	}
-
-	/**
-	 * 	Make a {@link RawTrackerHit} from a set of samples.
-	 * 
-	 *	@param data : sample block of data
-	 * 	@return A raw hit
-	 */
-	protected abstract RawTrackerHit makeHit(int[] data); 
-	
-	/**
-	 * 	Make a {@link RawTrackerHit} from a set of samples.
-	 * 
-	 *	@param data : Sample block of data
-	 *	@param channel : Channel number associated with these samples
-	 * 	@return A raw hit
-	 */
-	protected RawTrackerHit makeHit(int[] data, int channel) { 
-
-		// Get the sensor associated with this sample
-		HpsSiSensor sensor = this.getSensor(data);
-		//logger.fine(sensor.toString());
-		
-		// Use the channel number to create the cell ID
-		long cellID = sensor.makeChannelID(channel);
-		
-		// Set the hit time.  For now this will be zero
-		int hitTime = 0;
-	
-		// Create and return a RawTrackerHit
-		return new BaseRawTrackerHit(hitTime, cellID, SvtEvioUtils.getSamples(data), null, sensor);
-	}
-	
-	/**
-	 *	Retrieve all the banks in an event that match the given tag in their
-	 *	header and are not data banks. 
-	 *
-	 * 	@param structure : The event/bank being queried
-	 * 	@param tag : The tag to match
-	 * 	@return A collection of all bank structures that pass the filter 
-	 * 			provided by the event
-	 */
-	protected List<BaseStructure> getMatchingBanks(BaseStructure structure, final int tag) { 
-		IEvioFilter filter = new IEvioFilter() { 
-			public boolean accept(StructureType type, IEvioStructure struc) { 
-			    return (type == StructureType.BANK) 
-						&& (tag == struc.getHeader().getTag())
-						&& (struc.getHeader().getDataType() == DataType.ALSOBANK);
-			}
-		};
-		return StructureFinder.getMatchingStructures(structure, filter);
-	}
+    // Flag indicating whether the DAQ map has been setup
+    protected boolean isDaqMapSetup = false;
+
+    // Collections and names
+    private static final String SVT_HIT_COLLECTION_NAME = "SVTRawTrackerHits";
+    List<RawTrackerHit> rawHits = new ArrayList<RawTrackerHit>();
+
+    // Constants
+    private static final String SUBDETECTOR_NAME = "Tracker";
+    private static final String READOUT_NAME = "TrackerHits";
+
+    /**
+     *  Get the minimum SVT ROC bank tag in the event.
+     *
+     *  @return Minimum SVT ROC bank tag
+     */
+    abstract protected int getMinRocBankTag(); 
+    
+    /**
+     *  Get the maximum SVT ROC bank tag in the event.
+     *
+     *  @return Maximum SVT ROC bank tag
+     */
+    abstract protected int getMaxRocBankTag(); 
+    
+
+    /**
+     *  Get the SVT ROC bank number of the bank encapsulating the SVT samples.
+     * 
+     *  @return SVT ROC bank number 
+     */
+    abstract protected int getRocBankNumber(); 
+    
+    /**
+     *  Get the number of 32 bit integers composing the data block header
+     *
+     *  @return The header length
+     */
+    abstract protected int getDataHeaderLength();
+
+    /**
+     *  Get the number of 32 bit integers composing the data block tail (the 
+     *  data inserted after all sample blocks in a data block)
+     * 
+     *  @return The tail length 
+     */
+    abstract protected int getDataTailLength();
+
+    /**
+     *  A method to setup a mapping between a DAQ pair 
+     *  (FPGA/Hybrid or FEB ID/FEB Hybrid ID) and the corresponding sensor.
+     *
+     *  @param subdetector - The tracker {@link Subdetector} object
+     */
+    // TODO: This can probably be done when the conditions are loaded.
+    abstract protected void setupDaqMap(Subdetector subdetector);
+
+    /**
+     *  Get the sensor associated with a set of samples  
+     *
+     *  @param data - sample block of data
+     *  @return The sensor associated with a set of sample 
+     */
+    abstract protected HpsSiSensor getSensor(int[] data);
+
+
+    /**
+     *  Check whether a data bank is valid i.e. contains SVT samples only.
+     * 
+     *  @param dataBank - An EVIO bank containing integer data
+     *  @return true if the bank is valid, false otherwise
+     */
+    abstract protected boolean isValidDataBank(BaseStructure dataBank); 
+
+    /**
+     * Check whether the samples are valid
+     * 
+     * @param data : sample block of data
+     * @return true if the samples are valid, false otherwise
+     */
+    abstract protected boolean isValidSampleSet(int[] data);
+    
+    /**
+     *  Process an EVIO event and extract all information relevant to the SVT.
+     *  
+     *  @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) {
+        return this.makeHits(event, lcsimEvent);
+    }
+
+    /**
+     *  Make {@link RawTrackerHit}s out of all sample sets in an SVT EVIO bank
+     *  and put them into an LCSim event.
+     *
+     *  
+     *  @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) {
+
+        // Retrieve the ROC banks encapsulated by the physics bank.  The ROC
+        // bank range is set in the subclass.
+        List<BaseStructure> rocBanks = new ArrayList<BaseStructure>();
+        for (int rocBankTag = this.getMinRocBankTag(); 
+                rocBankTag <= this.getMaxRocBankTag(); rocBankTag++) { 
+            
+            logger.fine("Retrieving ROC bank: " + rocBankTag);
+            List<BaseStructure> matchingRocBanks = this.getMatchingBanks(event, rocBankTag);
+            if (matchingRocBanks == null) { 
+                logger.fine("ROC bank " + rocBankTag + " was not found!");
+                continue;
+            }
+            rocBanks.addAll(matchingRocBanks);
+        }
+        logger.fine("Total ROC banks found: " + rocBanks.size());
+        
+        // Return false if ROC banks weren't found
+        if (rocBanks.isEmpty()) return false;  
+    
+        // Setup the DAQ map if it's not setup
+        if (!this.isDaqMapSetup)
+            this.setupDaqMap(lcsimEvent.getDetector().getSubdetector(
+                    SUBDETECTOR_NAME));
+
+        // Clear the list of raw tracker hits
+        rawHits.clear();
+
+        // Loop over the SVT ROC banks and process all samples
+        for (BaseStructure rocBank : rocBanks) { 
+            
+            logger.fine("ROC bank: " + rocBank.toString());
+            
+            logger.fine("Processing ROC bank " + rocBank.getHeader().getTag());
+            
+            // 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.");
+            }
+            
+            // Get the data banks containing the SVT samples.  
+            List<BaseStructure> dataBanks = rocBank.getChildren(); 
+            logger.fine("Total data banks found: " + dataBanks.size());
+            
+            // Loop over all of the data banks contained by the ROC banks and 
+            // processed them
+            for (BaseStructure dataBank : dataBanks) { 
+        
+                logger.fine("Processing data bank: " + dataBank.toString());
+            
+                // Check that the bank is valid
+                if (!this.isValidDataBank(dataBank)) continue;
+                
+                // Get the int data encapsulated by the data bank
+                int[] data = dataBank.getIntData();
+                logger.fine("Total number of integers contained by the data bank: " + data.length);
+        
+                // Check that a complete set of samples exist
+                int sampleCount = data.length - this.getDataHeaderLength()
+                        - this.getDataTailLength();
+                logger.fine("Total number of  samples: " + sampleCount);
+                if (sampleCount % 4 != 0) {
+                    throw new RuntimeException("[ "
+                            + this.getClass().getSimpleName()
+                            + " ]: Size of samples array is not divisible by 4");
+                }
+
+                // Loop through all of the samples and make hits
+                for (int samplesN = 0; samplesN < sampleCount; samplesN += 4) {
+
+                    int[] samples = new int[4];
+                    System.arraycopy(data, this.getDataHeaderLength() + samplesN, samples, 0, samples.length);
+                    
+                    // If a set of samples is associated with an APV header or tail, skip it
+                    if (!this.isValidSampleSet(samples)) continue;
+                    rawHits.add(this.makeHit(samples));
+                }
+            }
+        }
+        
+        logger.fine("Total number of RawTrackerHits created: " + rawHits.size());
+
+        // Turn on 64-bit cell ID.
+        int flag = LCIOUtil.bitSet(0, 31, true);
+        // Add the collection of raw hits to the LCSim event
+        lcsimEvent.put(SVT_HIT_COLLECTION_NAME, rawHits, RawTrackerHit.class, flag, READOUT_NAME);
+
+        return true;
+    }
+
+    /**
+     *  Make a {@link RawTrackerHit} from a set of samples.
+     * 
+     *  @param data : sample block of data
+     *  @return A raw hit
+     */
+    protected abstract RawTrackerHit makeHit(int[] data); 
+    
+    /**
+     *  Make a {@link RawTrackerHit} from a set of samples.
+     * 
+     *  @param data : Sample block of data
+     *  @param channel : Channel number associated with these samples
+     *  @return A raw hit
+     */
+    protected RawTrackerHit makeHit(int[] data, int channel) { 
+
+        // Get the sensor associated with this sample
+        HpsSiSensor sensor = this.getSensor(data);
+        //logger.fine(sensor.toString());
+        
+        // Use the channel number to create the cell ID
+        long cellID = sensor.makeChannelID(channel);
+        
+        // Set the hit time.  For now this will be zero
+        int hitTime = 0;
+    
+        // Create and return a RawTrackerHit
+        return new BaseRawTrackerHit(hitTime, cellID, SvtEvioUtils.getSamples(data), null, sensor);
+    }
+    
+    /**
+     *  Retrieve all the banks in an event that match the given tag in their
+     *  header and are not data banks. 
+     *
+     *  @param structure : The event/bank being queried
+     *  @param tag : The tag to match
+     *  @return A collection of all bank structures that pass the filter 
+     *          provided by the event
+     */
+    protected List<BaseStructure> getMatchingBanks(BaseStructure structure, final int tag) { 
+        IEvioFilter filter = new IEvioFilter() { 
+            public boolean accept(StructureType type, IEvioStructure struc) { 
+                return (type == StructureType.BANK) 
+                        && (tag == struc.getHeader().getTag())
+                        && (struc.getHeader().getDataType() == DataType.ALSOBANK);
+            }
+        };
+        return StructureFinder.getMatchingStructures(structure, filter);
+    }
 }

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 Mar 31 08:44:36 2015
@@ -10,140 +10,152 @@
 import org.hps.util.Pair;
 
 /**
- *	SVT EVIO reader used to convert SVT bank integer data to LCIO objects.
+ *  SVT EVIO reader used to convert SVT bank integer data to LCIO objects.
  * 
- * 	@author Omar Moreno <[log in to unmask]>
- * 	@data February 03, 2015
+ *  @author Omar Moreno <[log in to unmask]>
+ *  @data February 03, 2015
  *
  */
 public final class SvtEvioReader extends AbstractSvtEvioReader {
 
-	//-----------------//
-	//--- Constants ---//
-	//-----------------//
-	private static final int DATA_HEADER_LENGTH = 1;
-	private static final int DATA_TAIL_LENGTH = 1; 
-	private static final int MIN_ROC_BANK_TAG = 51;
-	private static final int MAX_ROC_BANK_TAG = 66;
-	private static final int ROC_BANK_NUMBER = 0; 
-	
-	/**
-	 *	Get the minimum SVT ROC bank tag in the event.
-	 *
-	 *	@return Minimum SVT ROC bank tag
-	 */
-	@Override
-	protected int getMinRocBankTag() { 
-		return MIN_ROC_BANK_TAG; 
-	}
+    //-----------------//
+    //--- Constants ---//
+    //-----------------//
+    private static final int DATA_HEADER_LENGTH = 1;
+    private static final int DATA_TAIL_LENGTH = 1; 
+    private static final int MIN_ROC_BANK_TAG = 51;
+    private static final int MAX_ROC_BANK_TAG = 66;
+    private static final int ROC_BANK_NUMBER = 0; 
+    
+    /**
+     *  Get the minimum SVT ROC bank tag in the event.
+     *
+     *  @return Minimum SVT ROC bank tag
+     */
+    @Override
+    protected int getMinRocBankTag() { 
+        return MIN_ROC_BANK_TAG; 
+    }
 
-	/**
-	 *	Get the maximum SVT ROC bank tag in the event.
-	 *
-	 *	@return Maximum SVT ROC bank tag
-	 */
-	@Override 
-	protected int getMaxRocBankTag() { 
-		return MAX_ROC_BANK_TAG; 
-	}
-	
-	/**
-	 *	Get the SVT ROC bank number of the bank encapsulating the SVT samples.
-	 * 
-	 *	@return SVT ROC bank number 
-	 */
-	@Override
-	protected int getRocBankNumber() { 
-		return ROC_BANK_NUMBER; 
-	}
+    /**
+     *  Get the maximum SVT ROC bank tag in the event.
+     *
+     *  @return Maximum SVT ROC bank tag
+     */
+    @Override 
+    protected int getMaxRocBankTag() { 
+        return MAX_ROC_BANK_TAG; 
+    }
+    
+    /**
+     *  Get the SVT ROC bank number of the bank encapsulating the SVT samples.
+     * 
+     *  @return SVT ROC bank number 
+     */
+    @Override
+    protected int getRocBankNumber() { 
+        return ROC_BANK_NUMBER; 
+    }
 
-	/**
-	 *	Get the number of 32 bit integers composing the data block header
-	 *
-	 *	@return The header length
-	 */
-	@Override
-	protected int getDataHeaderLength() {
-		return DATA_HEADER_LENGTH;
-	}
+    /**
+     *  Get the number of 32 bit integers composing the data block header
+     *
+     *  @return The header length
+     */
+    @Override
+    protected int getDataHeaderLength() {
+        return DATA_HEADER_LENGTH;
+    }
 
-	/**
-	 *	Get the number of 32 bit integers composing the data block tail (the 
-	 *	data inserted after all sample blocks in a data block)
-	 * 
-	 *	@return The tail length 
-	 */
-	@Override
-	protected int getDataTailLength() {
-		return DATA_TAIL_LENGTH;
-	}
+    /**
+     *  Get the number of 32 bit integers composing the data block tail (the 
+     *  data inserted after all sample blocks in a data block)
+     * 
+     *  @return The tail length 
+     */
+    @Override
+    protected int getDataTailLength() {
+        return DATA_TAIL_LENGTH;
+    }
 
-	/**
-	 *	A method to setup a mapping between a DAQ pair (FEB/FEB Hybrid) and the 
-	 *	corresponding sensor.
-	 *
-	 *	@param subdetector : The tracker {@link Subdetector} object
-	 */
-	// TODO: This can probably be done when the conditions are loaded.
-	@Override
-	protected void setupDaqMap(Subdetector subdetector) {
-	
-		List<HpsSiSensor> sensors 
-			= subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
-		for (HpsSiSensor sensor : sensors) { 
-			Pair<Integer, Integer> daqPair 
-				= new Pair<Integer, Integer>(sensor.getFebID(), sensor.getFebHybridID());
-		logger.fine("FEB ID: " + sensor.getFebID() 
-				  + " Hybrid ID: " + sensor.getFebHybridID());
-			daqPairToSensor.put(daqPair, sensor);
-		}
-		this.isDaqMapSetup = true; 
-	}
+    /**
+     *  A method to setup a mapping between a DAQ pair (FEB/FEB Hybrid) and the 
+     *  corresponding sensor.
+     *
+     *  @param subdetector : The tracker {@link Subdetector} object
+     */
+    // TODO: This can probably be done when the conditions are loaded.
+    @Override
+    protected void setupDaqMap(Subdetector subdetector) {
+    
+        List<HpsSiSensor> sensors 
+            = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
+        for (HpsSiSensor sensor : sensors) { 
+            Pair<Integer, Integer> daqPair 
+                = new Pair<Integer, Integer>(sensor.getFebID(), sensor.getFebHybridID());
+        logger.fine("FEB ID: " + sensor.getFebID() 
+                  + " Hybrid ID: " + sensor.getFebHybridID());
+            daqPairToSensor.put(daqPair, sensor);
+        }
+        this.isDaqMapSetup = true; 
+    }
 
-	/**
-	 *	Get the sensor associated with a set of samples.  The sample block of
-	 *	data is used to extract the FEB ID and FEB Hybrid ID corresponding to 
-	 *	the samples. 
-	 *
-	 *	@param data : sample block of data
-	 *	@return The sensor associated with a set of sample 
-	 */
-	@Override
-	protected HpsSiSensor getSensor(int[] data) {
-		
-		logger.fine("FEB ID: " + SvtEvioUtils.getFebID(data) 
-				  + " Hybrid ID: " + SvtEvioUtils.getFebHybridID(data));
-		
-		Pair<Integer, Integer> daqPair 
-			= new Pair<Integer, Integer>(SvtEvioUtils.getFebID(data), 
-										 SvtEvioUtils.getFebHybridID(data));
-		
-		return daqPairToSensor.get(daqPair);
-	}
-	
-	/**
-	 *	Check whether a data bank is valid i.e. contains SVT samples only.  For
-	 *	the engineering run, a valid data bank has a tag of 1.
-	 * 
-	 * 	@param dataBank - An EVIO bank containing integer data
-	 * 	@return true if the bank is valid, false otherwise
-	 * 
-	 */
-	@Override
-	protected boolean isValidDataBank(BaseStructure dataBank) { 
-		if (dataBank.getHeader().getTag() != 3) return false; 
-		return true; 
-	}
-
-	/**
-	 * 	Make a {@linkplain RawTrackerHit} from a set of samples.
-	 * 
-	 *	@param data : sample block of data
-	 * 	@return A {@linkplain RawTrackerHit}
-	 */
-	@Override
-	protected RawTrackerHit makeHit(int[] data) {
-	    logger.fine("Channel: " + SvtEvioUtils.getPhysicalChannelNumber(data));
-		return makeHit(data, SvtEvioUtils.getPhysicalChannelNumber(data));
-	}
+    /**
+     *  Get the sensor associated with a set of samples.  The sample block of
+     *  data is used to extract the FEB ID and FEB Hybrid ID corresponding to 
+     *  the samples. 
+     *
+     *  @param data : sample block of data
+     *  @return The sensor associated with a set of sample 
+     */
+    @Override
+    protected HpsSiSensor getSensor(int[] data) {
+        
+        logger.fine("FEB ID: " + SvtEvioUtils.getFebID(data) 
+                  + " Hybrid ID: " + SvtEvioUtils.getFebHybridID(data));
+        
+        Pair<Integer, Integer> daqPair 
+            = new Pair<Integer, Integer>(SvtEvioUtils.getFebID(data), 
+                                         SvtEvioUtils.getFebHybridID(data));
+        
+        return daqPairToSensor.get(daqPair);
+    }
+    
+    /**
+     *  Check whether a data bank is valid i.e. contains SVT samples only.  For
+     *  the engineering run, a valid data bank has a tag of 1.
+     * 
+     *  @param dataBank - An EVIO bank containing integer data
+     *  @return true if the bank is valid, false otherwise
+     * 
+     */
+    @Override
+    protected boolean isValidDataBank(BaseStructure dataBank) { 
+        if (dataBank.getHeader().getTag() != 3) return false; 
+        return true; 
+    }
+    
+    /**
+     * Check whether the samples are valid. Specifically, check if the samples
+     * are APV header or tails.
+     * 
+     * @param data : sample block of data
+     * @return true if the samples are valid, false otherwise
+     */
+    protected boolean isValidSampleSet(int[] data) {
+        return !(SvtEvioUtils.isApvHeader(data) || SvtEvioUtils.isApvTail(data));        
+    }
+    
+    /**
+     *  Make a {@linkplain RawTrackerHit} from a set of samples.
+     * 
+     *  @param data : sample block of data
+     *  @return A {@linkplain RawTrackerHit}
+     */
+    @Override
+    protected RawTrackerHit makeHit(int[] data) {
+         
+        logger.fine("Channel: " + SvtEvioUtils.getPhysicalChannelNumber(data));
+        return makeHit(data, SvtEvioUtils.getPhysicalChannelNumber(data));
+    }
 }

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 Mar 31 08:44:36 2015
@@ -10,147 +10,156 @@
 import org.lcsim.geometry.Subdetector;
 
 /**
- *	Test run SVT EVIO reader used to convert SVT bank integer data to LCIO
- *	objects.
+ *  Test run SVT EVIO reader used to convert SVT bank integer data to LCIO
+ *  objects.
  * 
- * 	@author Omar Moreno <[log in to unmask]>
- * 	@date November 20, 2014
+ *  @author Omar Moreno <[log in to unmask]>
+ *  @date November 20, 2014
  *
  */
 public class TestRunSvtEvioReader extends AbstractSvtEvioReader {
 
-	//-----------------//
-	//--- Constants ---//
-	//-----------------//
+    //-----------------//
+    //--- Constants ---//
+    //-----------------//
 
-	private static final int DATA_HEADER_LENGTH = 7;
-	private static final int DATA_TAIL_LENGTH = 1; 
-	private static final int MAX_FPGA_ID = 6;
-	private static final int ROC_BANK_TAG = 3;
-	private static final int ROC_BANK_NUMBER = -1; 
-	
-	/** 
-	 * Default Constructor
-	 */
-	public TestRunSvtEvioReader() { }; 
-	
-	/**
-	 *	Get the minimum SVT ROC bank tag in the event.
-	 *
-	 *	@return Minimum SVT ROC bank tag
-	 */
-	@Override
-	protected int getMinRocBankTag() { 
-		return ROC_BANK_TAG; 
-	}
+    private static final int DATA_HEADER_LENGTH = 7;
+    private static final int DATA_TAIL_LENGTH = 1; 
+    private static final int MAX_FPGA_ID = 6;
+    private static final int ROC_BANK_TAG = 3;
+    private static final int ROC_BANK_NUMBER = -1; 
+    
+    /** 
+     * Default Constructor
+     */
+    public TestRunSvtEvioReader() { }; 
+    
+    /**
+     *  Get the minimum SVT ROC bank tag in the event.
+     *
+     *  @return Minimum SVT ROC bank tag
+     */
+    @Override
+    protected int getMinRocBankTag() { 
+        return ROC_BANK_TAG; 
+    }
 
-	/**
-	 *	Get the maximum SVT ROC bank tag in the event.
-	 *
-	 *	@return Maximum SVT ROC bank tag
-	 */
-	@Override 
-	protected int getMaxRocBankTag() { 
-		return ROC_BANK_TAG; 
-	}
-	
-	/**
-	 *	Get the SVT ROC bank number of the bank encapsulating the SVT samples.
-	 * 
-	 *	@return SVT ROC bank number 
-	 */
-	@Override
-	protected int getRocBankNumber() { 
-		return ROC_BANK_NUMBER; 
-	}
-	
-	/**
-	 *	Get the number of 32 bit integers composing the data block header. For
-	 * 	the test run, the header consisted of 7 32 bit integers.
-	 *
-	 *	@return The header length. 
-	 */
-	@Override
-	protected int getDataHeaderLength() {
-		return DATA_HEADER_LENGTH;
-	}
-	
-	/**
-	 * 	Get the number of 32 bit integers composing the data block tail.  For
-	 * 	the test run, the tail consisted of a single 32 bit integer.
-	 * 
-	 *	@return The tail length
-	 */
-	@Override
-	protected int getDataTailLength() {
-		return DATA_TAIL_LENGTH;
-	}
+    /**
+     *  Get the maximum SVT ROC bank tag in the event.
+     *
+     *  @return Maximum SVT ROC bank tag
+     */
+    @Override 
+    protected int getMaxRocBankTag() { 
+        return ROC_BANK_TAG; 
+    }
+    
+    /**
+     *  Get the SVT ROC bank number of the bank encapsulating the SVT samples.
+     * 
+     *  @return SVT ROC bank number 
+     */
+    @Override
+    protected int getRocBankNumber() { 
+        return ROC_BANK_NUMBER; 
+    }
+    
+    /**
+     *  Get the number of 32 bit integers composing the data block header. For
+     *  the test run, the header consisted of 7 32 bit integers.
+     *
+     *  @return The header length. 
+     */
+    @Override
+    protected int getDataHeaderLength() {
+        return DATA_HEADER_LENGTH;
+    }
+    
+    /**
+     *  Get the number of 32 bit integers composing the data block tail.  For
+     *  the test run, the tail consisted of a single 32 bit integer.
+     * 
+     *  @return The tail length
+     */
+    @Override
+    protected int getDataTailLength() {
+        return DATA_TAIL_LENGTH;
+    }
 
-	/**
-	 *	A method to setup a mapping between a DAQ pair (FPGA/Hybrid) and the 
-	 *	corresponding sensor.
-	 *
-	 *	@param subdetector : The tracker {@link Subdetector} object
-	 */
-	// TODO: This can probably be done when the conditions are loaded.
-	@Override
-	protected void setupDaqMap(Subdetector subdetector) { 
-	
+    /**
+     *  A method to setup a mapping between a DAQ pair (FPGA/Hybrid) and the 
+     *  corresponding sensor.
+     *
+     *  @param subdetector : The tracker {@link Subdetector} object
+     */
+    // TODO: This can probably be done when the conditions are loaded.
+    @Override
+    protected void setupDaqMap(Subdetector subdetector) { 
+    
         List<HpsTestRunSiSensor> sensors 
-        	= subdetector.getDetectorElement().findDescendants(HpsTestRunSiSensor.class);
-		for (HpsTestRunSiSensor sensor : sensors) { 
-			Pair<Integer, Integer> daqPair 
-				= new Pair<Integer, Integer>(sensor.getFpgaID(), sensor.getHybridID());
-			daqPairToSensor.put(daqPair, sensor);
-		}
-		this.isDaqMapSetup = true;
-	}
+            = subdetector.getDetectorElement().findDescendants(HpsTestRunSiSensor.class);
+        for (HpsTestRunSiSensor sensor : sensors) { 
+            Pair<Integer, Integer> daqPair 
+                = new Pair<Integer, Integer>(sensor.getFpgaID(), sensor.getHybridID());
+            daqPairToSensor.put(daqPair, sensor);
+        }
+        this.isDaqMapSetup = true;
+    }
 
-	/**
-	 *	Get the sensor associated with a set of samples.  The sample block of
-	 *	data is used to extract the FPGA ID and Hybrid ID corresponding to 
-	 *	the samples. 
-	 *
-	 *	@param data : sample block of data
-	 *	@return The sensor associated with a set of sample 
-	 */
-	@Override
-	protected HpsSiSensor getSensor(int[] data) {
-		
-		/*this.printDebug("FEB ID: " + SvtEvioUtils.getFpgaID(data) 
-				+ " Hybrid ID: " + SvtEvioUtils.getHybridID(data));*/
+    /**
+     *  Get the sensor associated with a set of samples.  The sample block of
+     *  data is used to extract the FPGA ID and Hybrid ID corresponding to 
+     *  the samples. 
+     *
+     *  @param data : sample block of data
+     *  @return The sensor associated with a set of sample 
+     */
+    @Override
+    protected HpsSiSensor getSensor(int[] data) {
+        
+        /*this.printDebug("FEB ID: " + SvtEvioUtils.getFpgaID(data) 
+                + " Hybrid ID: " + SvtEvioUtils.getHybridID(data));*/
 
-		Pair<Integer, Integer> daqPair 
-        	= new Pair<Integer, Integer>(SvtEvioUtils.getFpgaID(data),
-        								 SvtEvioUtils.getHybridID(data));
-		return daqPairToSensor.get(daqPair);
-	}
+        Pair<Integer, Integer> daqPair 
+            = new Pair<Integer, Integer>(SvtEvioUtils.getFpgaID(data),
+                                         SvtEvioUtils.getHybridID(data));
+        return daqPairToSensor.get(daqPair);
+    }
 
-	/**
-	 *	Check whether a data bank is valid i.e. contains SVT samples only.  For
-	 *	the test run, a valid data bank has a tag in the range 0-6.
-	 * 
-	 * 	@param dataBank - An EVIO bank containing integer data
-	 * 	@return true if the bank is valid, false otherwise
-	 * 
-	 */
-	@Override
-	protected boolean isValidDataBank(BaseStructure dataBank) { 
-		if (dataBank.getHeader().getTag() < 0 
-				|| dataBank.getHeader().getTag() >= MAX_FPGA_ID) return false; 
-		return true; 
-	}
-	
-	
-	/**
-	 * 	Make a {@link RawTrackerHit} from a set of samples.
-	 * 
-	 *	@param data : sample block of data
-	 * 	@return A raw hit
-	 */
-	@Override
-	protected RawTrackerHit makeHit(int[] data) {
-		//this.printDebug("Channel: " + SvtEvioUtils.getTestRunChannelNumber(data));
-		return makeHit(data, SvtEvioUtils.getTestRunChannelNumber(data));
-	}
+    /**
+     *  Check whether a data bank is valid i.e. contains SVT samples only.  For
+     *  the test run, a valid data bank has a tag in the range 0-6.
+     * 
+     *  @param dataBank - An EVIO bank containing integer data
+     *  @return true if the bank is valid, false otherwise
+     * 
+     */
+    @Override
+    protected boolean isValidDataBank(BaseStructure dataBank) { 
+        if (dataBank.getHeader().getTag() < 0 
+                || dataBank.getHeader().getTag() >= MAX_FPGA_ID) return false; 
+        return true; 
+    }
+    
+    /**
+     * Check whether the samples are valid.
+     * 
+     * @param data : sample block of data
+     * @return true if the samples are valid, false otherwise
+     */
+    protected boolean isValidSampleSet(int[] data) { 
+        return true;        
+    }
+    
+    /**
+     *  Make a {@link RawTrackerHit} from a set of samples.
+     * 
+     *  @param data : sample block of data
+     *  @return A raw hit
+     */
+    @Override
+    protected RawTrackerHit makeHit(int[] data) {
+        //this.printDebug("Channel: " + SvtEvioUtils.getTestRunChannelNumber(data));
+        return makeHit(data, SvtEvioUtils.getTestRunChannelNumber(data));
+    }
 }

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