00001 #ifndef TMesytecData_hxx_seen 00002 #define TMesytecData_hxx_seen 00003 00004 #include <vector> 00005 00006 #include "TGenericData.hxx" 00007 00008 00009 /// Class for each TDC measurement 00010 /// For the definition of obscure variables see the CAEN V1190 manual. 00011 /// Currently doesn't support reading out extended timestamp! 00012 /// 00013 class ADCMeasMesy { 00014 00015 friend class TMesytecData; 00016 00017 public: 00018 00019 /// Get the ADC measurement 00020 uint32_t GetMeasurement() const; 00021 00022 /// Get Module ID 00023 uint32_t GetModuleID() const {return (adc_header_word & 0xff0000) >> 16;}; 00024 00025 /// Get the channel number 00026 uint32_t GetChannel() const {return ((adc_measurement_word & 0x1f0000) >> 16);} 00027 00028 /// Is Out Of Range? 00029 bool IsOutOfRange() const {return ((adc_measurement_word & 0x4000) == 0x4000);} 00030 00031 private: 00032 00033 /// Fields to hold the header, measurement, extendedtimestamp words. 00034 uint32_t adc_header_word; 00035 uint32_t adc_measurement_word; 00036 uint32_t adc_extendedtimestamp_word; 00037 00038 /// Constructor; need to pass in header and measurement. 00039 ADCMeasMesy(uint32_t header, uint32_t measurement): 00040 adc_header_word(header), 00041 adc_measurement_word(measurement), 00042 adc_extendedtimestamp_word(0){}; 00043 00044 00045 ADCMeasMesy(); 00046 }; 00047 00048 00049 00050 00051 /// Class to store data from Mesytec MADC32 module. 00052 /// For details on this module see: 00053 /// http://daq-plone.triumf.ca/HR/VME/mesytec-modules/MADC-32_V14_fw0126.pdf/at_download/file 00054 class TMesytecData: public TGenericData { 00055 00056 public: 00057 00058 /// Constructor 00059 TMesytecData(int bklen, int bktype, const char* name, void *pdata); 00060 00061 void Print(); 00062 00063 /// Get the Vector of ADC Measurements. 00064 std::vector<ADCMeasMesy>& GetMeasurements() {return fMeasurements;} 00065 00066 /// Get ADC resolution (11, 12 or 13 bit); 00067 /// Return values: 1 -> 11 bit, 2 -> 12 bit, 3 -> 13 bit (??) 00068 uint32_t GetADCResolution() const {return (fGlobalHeader & 0x7000) >> 12;}; 00069 00070 /// Get Module ID 00071 uint32_t GetModuleID() const {return (fGlobalHeader & 0xff0000) >> 16;}; 00072 00073 /// Get Output format (???) 00074 uint32_t GetOutputFormat() const {return (fGlobalHeader & 0x8000) >> 15;}; 00075 00076 // Get overall timestamp 00077 uint32_t GetTimeStamp() const {return (fGlobalTrailer & 0x3fffffff);}; 00078 00079 private: 00080 00081 /// The overall global header 00082 uint32_t fGlobalHeader; 00083 00084 /// The overall global trailer 00085 uint32_t fGlobalTrailer; 00086 00087 /// Vector of ADC Measurements. 00088 std::vector<ADCMeasMesy> fMeasurements; 00089 00090 }; 00091 00092 00093 00094 00095 #endif