LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIOTrackerRawDataHandler.cc
Go to the documentation of this file.
2 
3 #include "EVENT/TrackerRawData.h"
4 #include "EVENT/LCIO.h"
5 #include "IMPL/LCFlagImpl.h"
7 
8 // -- sio headers
9 #include <sio/io_device.h>
10 #include <sio/version.h>
11 
12 namespace SIO {
13 
15  SIOObjectHandler( EVENT::LCIO::TRACKERRAWDATA ) {
16  /* nop */
17  }
18 
19  //----------------------------------------------------------------------------
20 
21  void SIOTrackerRawDataHandler::read( sio::read_device& device, EVENT::LCObject* objP, sio::version_type /*vers*/ ) {
22  auto hit = dynamic_cast<IOIMPL::TrackerRawDataIOImpl*>(objP) ;
23  SIO_DATA( device , &(hit->_cellID0) , 1 ) ;
24  IMPL::LCFlagImpl lcFlag(_flag) ;
25  if( lcFlag.bitSet( EVENT::LCIO::TRAWBIT_ID1 ) ) {
26  SIO_DATA( device , &(hit->_cellID1) , 1 ) ;
27  }
28  SIO_DATA( device , &(hit->_time) , 1 ) ;
29  SIO_SDATA( device , hit->_adc ) ;
30  SIO_PTAG( device , dynamic_cast<const EVENT::TrackerRawData*>(hit) ) ;
31  }
32 
33  //----------------------------------------------------------------------------
34 
35  void SIOTrackerRawDataHandler::write( sio::write_device& device, const EVENT::LCObject* obj ) {
36  auto hit = dynamic_cast<const EVENT::TrackerRawData*>(obj) ;
37  SIO_SDATA( device, hit->getCellID0() ) ;
38  IMPL::LCFlagImpl lcFlag(_flag) ;
39  if( lcFlag.bitSet( EVENT::LCIO::TRAWBIT_ID1 ) ) {
40  SIO_SDATA( device, hit->getCellID1() ) ;
41  }
42  SIO_SDATA( device, hit->getTime() ) ;
43  SIO_SDATA( device, hit->getADCValues() ) ;
44  SIO_PTAG( device , hit ) ;
45  }
46 
47  //----------------------------------------------------------------------------
48 
50  return new IOIMPL::TrackerRawDataIOImpl() ;
51  }
52 
53 } // namespace
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
virtual bool bitSet(int index) const
Returns true if bit at given index is set.
Definition: LCFlagImpl.cc:13
Interface for all lcio object SIO-handlers, has to be implemented for all event entities (hits...
unsigned int _flag
The collection flag.
void write(sio::write_device &device, const EVENT::LCObject *obj) override
Writes lcio objects to an SIO stream.
EVENT::LCObject * create() const override
Factory method to create an object of the type of the collection.
Implementation of helper class to create and interpret the 32-bit flag word in LCCollections.
Definition: LCFlagImpl.h:15
Generic class for raw tracker data.
Adding stuff needed for io (friend declarations, etc.)
void read(sio::read_device &device, EVENT::LCObject *objP, sio::version_type vers) override
Reads lcio objects from an SIO stream.