00001 /* @version $Revision: 1831 $ * @modifiedby $Author: lcdet $ * @lastmodified $Date: 2012-08-20 11:48:00 +0200 (Mon, 20 Aug 2012) $ */ 00002 #include "event/ChannelHit.hh" 00003 00004 #include "tools/Log.hh" 00005 00006 #include <iostream> 00007 00008 00009 00010 00011 using namespace std; 00012 00013 //--------------- Constructeur -------------// 00014 ChannelHit::ChannelHit(const Channel& aChannel):channel(aChannel) 00015 { 00016 timestamp = 0; 00017 bcIdAbs = bcIdDif = bcIdHit = bcIdHitFine = memoryOrder = 0; 00018 // FILE_LOG(logDEBUG) << "-----ChannelHit constructor"<< endl; 00019 } 00020 00021 //--------------- Constructeur -------------// 00022 ChannelHit::ChannelHit(const Channel& aChannel, const i16 aDigitalValue, const i16 aAnalogValue) : channel(aChannel), digitalValue(aDigitalValue), analogValue(aAnalogValue) 00023 { 00024 timestamp = 0; 00025 bcIdAbs = bcIdDif = bcIdHit = bcIdHitFine = 0; 00026 //threshold_0 = 0; 00027 //threshold_1 = 0; 00028 // threshold_2 = 0; 00029 //FILE_LOG(logDEBUG) << "-----ChannelHit constructor"<< endl; 00030 } 00031 00032 //--------------- Destructeur -------------// 00033 ChannelHit::~ChannelHit() 00034 { 00035 //FILE_LOG(logDEBUG) << "------ChannelHit destructeur:" << endl; 00036 } 00037 //-------------------------------------------// 00038 void ChannelHit::print() const 00039 { 00040 //FILE_LOG(logDEBUG) << "---ChannelHit.print():" << endl; 00041 channel.print(); 00042 FILE_LOG(logINFO) << "Digital value: " << digitalValue << endl; 00043 FILE_LOG(logINFO) << "Analog value: " << analogValue << endl; 00044 } 00045 00046 //-------------------------------------------// 00047 ui32 ChannelHit::getAbsTime(void ) const 00048 { 00049 i32 deltaT = this->getBcIdDif() - this->getBcIdHit(); 00050 ui32 time = 0; 00051 if ( deltaT > 0 ) 00052 { 00053 // temps absolu = BCID_Abs + ( BCID_Dif - BCID_Hit ) 00054 time = this->getBcIdAbs() + deltaT; 00055 } 00056 else 00057 { 00058 // temps absolu = BCID_Abs + ( BCID_Dif + 2e24-1 - BCID_Hit ) 00059 time = this->getBcIdAbs() + ( this->getBcIdDif() + 16777215 - this->getBcIdHit() ); 00060 } 00061 00062 return time; 00063 00064 } 00065