Newer
Older
TB_Chris / TbUT / src / mamba / .svn / text-base / mamba_decoder.h.svn-base
  1. #ifndef MAMBA_DECODER
  2. #define MAMBA_DECODER
  3.  
  4. #include <stdint.h>
  5. #include <vector>
  6. #include <fstream>
  7.  
  8. class mamba_decoder
  9. {
  10.  
  11. private:
  12. bool& m_isAType;
  13.  
  14. int nBeetles;
  15. int nSubsets;
  16. int nCH;
  17. int startADC;
  18. int stopADC;
  19. int nADCs;
  20. uint64_t _pack_id;
  21. uint64_t _trig_id;
  22. uint64_t _timestamp;
  23. uint64_t _ts_timestamp;
  24. uint64_t _coincidence_id;
  25. uint64_t _padding;
  26. std::vector<int> _ADC;
  27. std::vector<int> _bHeader0;
  28. std::vector<int> _bHeader1;
  29. std::vector<int> _bHeader2;
  30. std::vector<int> _bHeader3;
  31. std::vector<int> _bHeader3P1;
  32. std::vector<int> _bHeader3P2;
  33. unsigned int _TDC;
  34. double _baseline;
  35. public:
  36.  
  37. mamba_decoder( bool& isAType);
  38.  
  39. virtual ~mamba_decoder();
  40. bool eof(){ return ifile->eof(); }
  41.  
  42. bool open(const char * filename);
  43. void close();
  44. void rewind(){ ifile->clear(); ifile->seekg(0, std::ios::beg); }
  45.  
  46. std::ifstream * ifile;
  47. bool find_mamba_header();
  48. bool check_mamba_footer();
  49. int find_beetle_header( int * subsADCs, int thr) ;
  50.  
  51. bool read_event();
  52. uint64_t PackID(){ return _pack_id; }
  53. uint64_t TrigID(){ return _trig_id; }
  54. uint64_t Timestamp(){ return _timestamp; }
  55. uint64_t TsTimestamp(){ return _ts_timestamp; }
  56. uint64_t CoincidenceID(){ return _coincidence_id; }
  57. uint64_t Padding(){ return _padding; }
  58. std::vector<int> ADC(){
  59. return _ADC;
  60. }
  61. std::vector<int> BHeader0() {
  62. return _bHeader0;
  63. }
  64. std::vector<int> BHeader1() {
  65. return _bHeader1;
  66. }
  67. std::vector<int> BHeader2() {
  68. return _bHeader2;
  69. }
  70. std::vector<int> BHeader3() {
  71. return _bHeader3;
  72. }
  73. std::vector<int> BHeader3P1() {
  74. return _bHeader3P1;
  75. }
  76. std::vector<int> BHeader3P2() {
  77. return _bHeader3P2;
  78. }
  79. unsigned int TDC(){ return _TDC; }
  80.  
  81. };
  82.  
  83.  
  84. #endif