LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIOTrackerHitZCylinderHandler.cc
Go to the documentation of this file.
2 
3 // -- lcio headers
4 #include "EVENT/LCIO.h"
7 #include "IMPL/LCFlagImpl.h"
8 
9 // -- sio headers
10 #include <sio/io_device.h>
11 #include <sio/version.h>
12 
13 namespace SIO {
14 
16  SIOObjectHandler( EVENT::LCIO::TRACKERHITZCYLINDER ) {
17  /* nop */
18  }
19 
20  //----------------------------------------------------------------------------
21 
22  void SIOTrackerHitZCylinderHandler::read( sio::read_device& device, EVENT::LCObject* objP, sio::version_type vers ) {
23  auto hit = dynamic_cast<IOIMPL::TrackerHitZCylinderIOImpl*>(objP) ;
24  IMPL::LCFlagImpl lcFlag(_flag) ;
25  if(vers > SIO_VERSION_ENCODE( 1, 51) ) {
26  SIO_DATA( device , &(hit->_cellID0) , 1 ) ;
27  if( lcFlag.bitSet( EVENT::LCIO::RTHZBIT_ID1 ) ){
28  SIO_DATA( device , &(hit->_cellID1) , 1 ) ;
29  }
30  }
31  SIO_DATA( device, &(hit->_type) , 1 ) ;
32  SIO_DATA( device, hit->_pos , 3 ) ;
33  SIO_DATA( device, hit->_center , 2 ) ;
34  SIO_DATA( device, &(hit->_drphi), 1 ) ;
35  SIO_DATA( device, &(hit->_dz) , 1 ) ;
36  SIO_DATA( device, &(hit->_EDep) , 1 ) ;
37  SIO_DATA( device, &(hit->_EDepError) , 1 ) ;
38  SIO_DATA( device, &(hit->_time) , 1 ) ;
39  SIO_DATA( device, &(hit->_quality) , 1 ) ;
40  int numberOfRawHits = 1 ;
41  SIO_DATA( device , &numberOfRawHits , 1 ) ;
42  hit->_rawHits.resize( numberOfRawHits ) ;
43  for( int i=0 ; i<numberOfRawHits ; i++ ) {
44  SIO_PNTR( device , &(hit->_rawHits[i] ) ) ;
45  }
46  SIO_PTAG( device , dynamic_cast<const EVENT::TrackerHitZCylinder*>(hit) ) ;
47  }
48 
49  //----------------------------------------------------------------------------
50 
51  void SIOTrackerHitZCylinderHandler::write( sio::write_device& device, const EVENT::LCObject* obj ) {
52  auto hit = dynamic_cast<const EVENT::TrackerHitZCylinder*>(obj) ;
53  IMPL::LCFlagImpl lcFlag(_flag) ;
54  SIO_SDATA( device, hit->getCellID0() ) ;
55  if( lcFlag.bitSet( EVENT::LCIO::RTHZBIT_ID1 ) ) {
56  SIO_SDATA( device, hit->getCellID1() ) ;
57  }
58  SIO_SDATA( device , hit->getType() ) ;
59  SIO_DATA( device, hit->getPosition() , 3 ) ;
60  SIO_DATA( device, hit->getCenter() , 2 ) ;
61  SIO_SDATA( device, hit->getdRPhi() ) ;
62  SIO_SDATA( device, hit->getdZ() ) ;
63  SIO_SDATA( device, hit->getEDep() ) ;
64  SIO_SDATA( device, hit->getEDepError() ) ;
65  SIO_SDATA( device, hit->getTime() ) ;
66  SIO_SDATA( device, hit->getQuality() ) ;
67  const EVENT::LCObjectVec& rawHits = hit->getRawHits() ;
68  int nrawhits = rawHits.size() ;
69  SIO_SDATA( device, nrawhits ) ;
70  for(unsigned int i=0; i < rawHits.size() ; i++){
71  SIO_PNTR( device , &(rawHits[i]) ) ;
72  }
73  SIO_PTAG( device , hit ) ;
74  }
75 
76  //----------------------------------------------------------------------------
77 
80  }
81 
82 } // namespace
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
Adding stuff needed for io (friend declarations, etc.)
virtual bool bitSet(int index) const
Returns true if bit at given index is set.
Definition: LCFlagImpl.cc:13
void write(sio::write_device &device, const EVENT::LCObject *obj) override
Writes lcio objects to an SIO stream.
Interface for all lcio object SIO-handlers, has to be implemented for all event entities (hits...
unsigned int _flag
The collection flag.
void read(sio::read_device &device, EVENT::LCObject *objP, sio::version_type vers) override
Reads lcio objects from an SIO stream.
Implementation of helper class to create and interpret the 32-bit flag word in LCCollections.
Definition: LCFlagImpl.h:15
T size(T...args)
A tracker hit on a cylindrical surface that runs parallel to the z-axis - the hit is stored as: x...
EVENT::LCObject * create() const override
Factory method to create an object of the type of the collection.