00001 #ifndef TV792Data_hxx_seen 00002 #define TV792Data_hxx_seen 00003 00004 #include <vector> 00005 00006 #include "TGenericData.hxx" 00007 00008 /// Class for each TDC measurement 00009 /// For the definition of obscure variables see the CAEN V792 manual. 00010 class VADCMeasurement { 00011 00012 friend class TV792Data; 00013 00014 public: 00015 00016 /// Get the ADC measurement 00017 uint32_t GetMeasurement() const {return (adc_measurement_word & 0xfff);} 00018 00019 /// Get GEO address 00020 uint32_t GetGeoAddress() const {return ((adc_measurement_word & 0xf8000000) >> 27);} 00021 00022 /// Get the crate number 00023 uint32_t GetCrate() 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 Under Threshold? 00029 bool IsUnderThreshold() const {return ((adc_measurement_word & 0x2000) == 0x2000);} 00030 00031 /// Is OverFlow? 00032 bool IsOverFlow() const {return ((adc_measurement_word & 0x1000) == 0x1000);} 00033 00034 private: 00035 00036 /// Fields to hold the header, measurement, trailer and error words. 00037 uint32_t adc_header_word; 00038 uint32_t adc_measurement_word; 00039 00040 /// Constructor; need to pass in header and measurement. 00041 VADCMeasurement(uint32_t header, uint32_t measurement): 00042 adc_header_word(header), 00043 adc_measurement_word(measurement){ 00044 00045 } 00046 00047 00048 VADCMeasurement(); 00049 }; 00050 00051 00052 /// Class for storing data from CAEN V792 module 00053 class TV792Data: public TGenericData { 00054 00055 00056 public: 00057 00058 /// Constructor 00059 TV792Data(int bklen, int bktype, const char* name, void *pdata); 00060 00061 00062 void Print(); 00063 00064 /// Get GEO address 00065 uint32_t GetGeoAddress() const {return ((fAdc_header_word & 0xf8000000) >> 27);} 00066 00067 /// Get the crate number 00068 uint32_t GetCrate() const {return ((fAdc_header_word & 0xff0000) >> 16);} 00069 00070 /// Get the number of converted channels. 00071 uint32_t GetNumberChannels() const {return ((fAdc_header_word & 0x3f00) >> 8); }; 00072 00073 /// Get the event counter 00074 uint32_t GetEventCounter() const {return (fAdc_trailer_word & 0xffffff); }; 00075 00076 /// Get the Vector of TDC Measurements. 00077 std::vector<VADCMeasurement>& GetMeasurements() {return fMeasurements;} 00078 00079 00080 private: 00081 00082 /// Vector of TDC Measurements. 00083 std::vector<VADCMeasurement> fMeasurements; 00084 00085 00086 /// Fields to hold the header, measurement, trailer and error words. 00087 uint32_t fAdc_header_word; 00088 uint32_t fAdc_trailer_word; 00089 00090 }; 00091 00092 #endif