/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/SIO/SIOTrackerRawDataHandler.cc

Go to the documentation of this file.
00001 #include "SIO/SIOTrackerRawDataHandler.h"
00002 
00003 #include "SIO/LCSIO.h"
00004 
00005 #include "EVENT/TrackerRawData.h"
00006 #include "EVENT/LCIO.h"
00007 #include "IMPL/LCFlagImpl.h"
00008 #include "IOIMPL/TrackerRawDataIOImpl.h"
00009 
00010 #include "SIO_functions.h"
00011 #include "SIO_block.h"
00012 
00013 
00014 using namespace EVENT ;
00015 using namespace IMPL ;
00016 using namespace IOIMPL ;
00017 
00018 
00019 namespace SIO{
00020     
00021   unsigned int SIOTrackerRawDataHandler::read(SIO_stream* stream, 
00022                                       LCObject** objP){
00023     unsigned int status ; 
00024         
00025     // create a new object :
00026     TrackerRawDataIOImpl* hit  = new TrackerRawDataIOImpl ;
00027     *objP = hit ;
00028         
00029     SIO_DATA( stream ,  &(hit->_cellID0) , 1  ) ;
00030     
00031     LCFlagImpl lcFlag(_flag) ;
00032     
00033     if( lcFlag.bitSet( LCIO::TRAWBIT_ID1 ) )
00034       SIO_DATA( stream ,  &(hit->_cellID1) , 1  ) ;
00035 
00036     SIO_DATA( stream ,  &(hit->_time) , 1  ) ;
00037 
00038     int adcSize ;
00039     SIO_DATA( stream ,  &adcSize  , 1 ) ;
00040 
00041     hit->_adc.resize( adcSize  ) ;
00042 
00043     SIO_DATA( stream ,  &(hit->_adc[0])  , adcSize  ) ;
00044 
00045     
00046     SIO_PTAG( stream , dynamic_cast<const TrackerRawData*>(hit) ) ;
00047 
00048     return ( SIO_BLOCK_SUCCESS ) ;
00049   }
00050     
00051     
00052   unsigned int SIOTrackerRawDataHandler::write(SIO_stream* stream, 
00053                                        const LCObject* obj){
00054     
00055     unsigned int status ; 
00056 
00057     const TrackerRawData* hit = dynamic_cast<const TrackerRawData*>(obj)  ;
00058 
00059     LCSIO_WRITE( stream, hit->getCellID0()  ) ;
00060       
00061     LCFlagImpl lcFlag(_flag) ;
00062     if( lcFlag.bitSet( LCIO::TRAWBIT_ID1 ) )
00063       LCSIO_WRITE( stream, hit->getCellID1()  ) ;
00064     
00065 
00066     LCSIO_WRITE( stream, hit->getTime()  ) ;
00067 
00068     const ShortVec& v =  hit->getADCValues() ;
00069     LCSIO_WRITE( stream, v.size()  ) ;
00070     
00071     short* v0 =  const_cast<short*> ( & v[0]  ) ; 
00072     SIO_DATA( stream ,  v0 , v.size() ) ;
00073 
00074     SIO_PTAG( stream , hit ) ;
00075     
00076     return ( SIO_BLOCK_SUCCESS ) ;
00077   }
00078   
00079 } // namespace

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7