/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/IMPL/TPCHitImpl.cc

Go to the documentation of this file.
00001 #include "IMPL/TPCHitImpl.h"
00002 #include "Exceptions.h"
00003 #include <cstring>  // needed for memcpy
00004 
00005 namespace IMPL{
00006 
00007   TPCHitImpl::TPCHitImpl() : 
00008     _cellID(0) ,
00009     _time(0) ,
00010     _charge(0) ,
00011     _quality(0) ,
00012     _rawSize(0) ,
00013     _rawArray(0) {
00014   }    
00015 
00016   /// Destructor.
00017   TPCHitImpl::~TPCHitImpl() {
00018     delete[] _rawArray ;
00019   }
00020   
00021   int TPCHitImpl::getCellID() const { return  _cellID ; }  
00022 
00023   float TPCHitImpl::getTime() const { return _time ; }
00024 
00025   float TPCHitImpl::getCharge() const { return _charge ; }
00026 
00027   int TPCHitImpl::getQuality() const { return _quality ; }
00028 
00029   int TPCHitImpl::getNRawDataWords() const { return _rawSize ; }
00030 
00031   int TPCHitImpl::getRawDataWord(int i) const { 
00032 
00033     if( i < 0 || i >= _rawSize )
00034       throw EVENT::DataNotAvailableException("TPCHitImpl::getRawDataWord: index out of range") ;
00035 
00036     return  _rawArray[i] ; 
00037   }
00038   
00039 
00040   void TPCHitImpl::setCellID(int cellID){
00041     checkAccess("TPCHitImpl::setCellID") ;
00042     _cellID = cellID ;
00043   }
00044   
00045   void TPCHitImpl::setTime(float time){
00046     checkAccess("TPCHitImpl::setTime") ;
00047     _time = time ;
00048   }
00049 
00050   void TPCHitImpl::setCharge(float charge){
00051     checkAccess("TPCHitImpl::setCharge") ;
00052     _charge = charge ;
00053   }
00054 
00055   void TPCHitImpl::setQuality(int quality){
00056    checkAccess("TPCHitImpl::setQuality") ;
00057    _quality = quality ;
00058   }
00059 
00060   void TPCHitImpl::setRawData(const int* raw, int size ){
00061    checkAccess("TPCHitImpl::setRawData") ;
00062    if( _rawArray  != 0 ) {
00063      delete[] _rawArray ;
00064      _rawArray = 0 ;
00065    }
00066    _rawArray = new int[size] ;
00067    _rawSize = size ;
00068    memcpy( _rawArray,  raw , size*sizeof(int) ) ;
00069   }
00070 
00071   void TPCHitImpl::initRawArray(int size){
00072    if( _rawArray  != 0 ) {
00073      delete[] _rawArray ;
00074      _rawArray = 0 ;
00075    }
00076     _rawArray = new int[size] ;
00077     _rawSize = size ;
00078   }
00079 
00080 
00081 } // namespace IMPL

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