My Project
T0TreatToolsBase.hh
00001 #ifndef T0TREATTOOLSBASE
00002 #define T0TREATTOOLSBASE
00003 
00004 #include <time.h>
00005 #include "Header.hh"
00006 
00008 // T0TreatToolsBase
00011 
00019 class T0TreatToolsBase
00020 {
00021 
00022 private:
00023     vector<UInt8> pulseId_n;  
00024     vector<Double> t0Time_n;  // unit is [sec]
00025     vector<UInt4> t0Index_n;  // unit is [events]
00026     vector<UInt8> pulseId_m;
00027     vector<Double> t0Time_m;  // unit is [sec]
00028     vector<UInt4> t0Index_m;  // unit is [events]
00029     vector<Double> t0Time_diff;
00030     vector<Double> t0Time_diff_tmp;
00031     
00032     bool is_ReliableClock;
00033 
00034     static const UInt4 BytesOfT0Event = 8;
00035     UInt4 BytesOfOrgEvent; //This is used on reading orginal Event [inamura 130227]
00036 
00037     virtual UInt4 checkHeaderT0( UChar aByte ){ return 0; }
00039 
00044     virtual UInt4 checkHeaderClock( UChar aByte ){ return 0; }
00046 
00051     virtual UInt8 decodePulseIdEvent(UChar buf[]){ return 0;}
00053 
00057     virtual Double decodeInstClockEvent(UChar buf[]){ return 0.;}
00059 
00064     void encodePidClockEvent(UChar eventPid[], UChar eventClock[], UInt8 pid, Double clock );
00065     void decodePidClockEvent(UChar eventPid[], UChar eventClock[], UInt8 *pid, Double *clock );
00066     void encodeT0InfoEvent(UChar event[], UInt4 num, Double clock);
00067     void decodeT0InfoEvent(UChar event[], UInt4 *num, Double *clock);
00068 
00069     void encodeClockIncEvent(UChar event[], Double ClockInc );
00070     void decodeClockIncEvent(UChar event[], Double *ClockInc, bool is4e=true );
00071 
00072     UInt4 putIndexByPid(UInt8 start_pid, UInt8 end_pid, UInt4 *start_ret_id, UInt4 *end_ret_id );
00073     UInt4 putIndexByClock(Double start_clock, Double end_clock, UInt4 *start_ret_id, UInt4 *end_ret_id );
00074 
00075     
00076 public:
00077     T0TreatToolsBase(UInt4 bytes_of_org_event=8);
00079 
00082     virtual ~T0TreatToolsBase();
00084 
00088     UInt4 readOrgEvent(string filename);
00090 
00097     UInt4 saveT0IndexEvent(string filename);
00099 
00104     UInt4 readT0IndexEvent(string filename);
00106 
00111     vector<UInt4> putVectorT0Index();
00113 
00117     vector<UInt4> putVectorT0IndexBySec(Double start_sec, Double end_sec);
00119 
00124     vector<UInt8> putVectorPulseId();
00126 
00130     vector<UInt8> putVectorPulseIdBySec(Double start_sec, Double end_sec);
00132 
00137     vector<Double> putVectorT0Clock();
00139 
00143     vector<UInt4> putT0IndexByPid(UInt8 start_pid, UInt8 end_pid);
00145 
00150     vector<UInt4> putT0IndexByClock(Double start_clock, Double end_clock);
00152 
00157     vector<Double> putT0ClockRegion();
00159 
00162     vector<UInt8> putPidRegion();
00164 
00168     vector<Double> putT0ClockDiffAll();
00169     vector<Double> putT0ClockDiff();
00170     
00171     void decodeT0ClockEvt(UChar eventClock[], Double *clock);
00172     bool CheckReliable(){ return is_ReliableClock; }
00173     vector<Double> convertInstClockToDateTime( Double inst_clock );
00175 
00179     Double convertDateTimeToInstClock( vector<Double> date_time );
00181 
00185     vector<Double> putMeasPeriodFromT0();
00187 
00193     void SetBytesOfOrgEvent( UInt4 bytes_of_org_event ); //[inamura 130227]
00194     vector<UInt4> putSlicedT0IndexEvent( UInt4 start_posi, string path_to_file, UInt4 *count_to_last );
00195     vector<UInt4> putSlicedT0IndexEventPy( UInt4 start_posi, string path_to_file );
00197 
00204 };
00205 
00206 #endif
 All Classes Functions