View Javadoc

1   package org.lcsim.lcio;
2   
3   import hep.io.sio.SIOInputStream;
4   import hep.io.sio.SIOOutputStream;
5   import java.io.IOException;
6   
7   import org.lcsim.event.CalorimeterHit;
8   import org.lcsim.event.EventHeader.LCMetaData;
9   
10  /**
11   * Block handler for calorimeter hits.
12   * 
13   * @author Guilherme Lima
14   * @version $Id: SIOCalorimeterHitBlockHandler.java,v 1.2 2005/08/02 17:18:06
15   *          tonyj Exp $
16   */
17  class SIOCalorimeterHitBlockHandler extends AbstractBlockHandler
18  {
19      public String getType()
20      {
21          return "CalorimeterHit";
22      }
23  
24      public Class getClassForType()
25      {
26          return CalorimeterHit.class;
27      }
28  
29      LCIOCallback addCollectionElements(LCIOEvent event, LCIOCollection collection, SIOInputStream in, int n, int version)
30              throws IOException
31      {
32          LCMetaData meta = event.getMetaData(collection);
33          for (int i = 0; i < n; i++)
34              collection.add(new SIOCalorimeterHit(in, collection.getFlags(), version, meta));
35          return null;
36      }
37  
38      void writeCollectionElement(Object element, SIOOutputStream out, int flags) throws IOException
39      {
40          SIOCalorimeterHit.write((CalorimeterHit) element, out, flags);
41      }
42  }