00001 #ifndef TV1730DppData_hxx_seen 00002 #define TV1730DppData_hxx_seen 00003 00004 #include <vector> 00005 00006 #include "TGenericData.hxx" 00007 00008 /// Class for each channel measurement 00009 /// For the definition of obscure variables see the CAEN V1730 manual (for DPP readout). 00010 class ChannelMeasurement { 00011 00012 friend class TV1730DppData; 00013 00014 public: 00015 00016 /// See CAEN DPP manual for definition of all these variables 00017 bool GetDualTraceEnabled(){return (header1 & 0x80000000) >> 31;} 00018 bool GetChargeEnabled(){return (header1 & 0x40000000) >> 30;} 00019 bool GetTimeEnabled(){return (header1 & 0x20000000) >> 29;} 00020 bool GetBaselineEnabled(){return (header1 & 0x10000000) >> 28;} 00021 bool GetSamplesEnabled(){return (header1 & 0x08000000) >> 27;} 00022 int GetNSamples(){ 00023 int header_size = (header1 & 0xfff)*8; 00024 if(header_size != fSamples.size()) 00025 std::cerr << "v17390::ChannelMeasurement N samples doesn't match!!" 00026 << header_size << " " << fSamples.size() <<std::endl; 00027 return header_size; 00028 } 00029 00030 int GetChannel(){ return fChan;} 00031 00032 /// Get Errors 00033 uint32_t GetSample(int i){ 00034 if(i >= 0 && i < fSamples.size()) 00035 return fSamples[i]; 00036 return 9999999; 00037 } 00038 00039 void AddSamples(std::vector<uint32_t> Samples){ 00040 fSamples = Samples; 00041 } 00042 00043 private: 00044 00045 int fChan; // channel number 00046 uint32_t header0; 00047 uint32_t header1; 00048 00049 /// Constructor; need to pass in header and measurement. 00050 ChannelMeasurement(int chan, uint32_t iheader0, uint32_t iheader1){ 00051 fChan = chan; 00052 header0 = iheader0; 00053 header1 = iheader1; 00054 } 00055 00056 std::vector<uint32_t> fSamples; 00057 00058 00059 }; 00060 00061 00062 /// Class to store DPP data from CAEN V1730. 00063 class TV1730DppData: public TGenericData { 00064 00065 public: 00066 00067 /// Constructor 00068 TV1730DppData(int bklen, int bktype, const char* name, void *pdata); 00069 00070 00071 /// Get Event Counter 00072 uint32_t GetEventCounter() const {return (fGlobalHeader[2]);}; 00073 00074 /// Get Geographical Address 00075 uint32_t GetGeoAddress() const {return (fGlobalHeader[1] & 0xf8000000) >> 27 ;}; 00076 00077 /// Get the extended trigger time tag 00078 uint32_t GetTriggerTimeTag() const {return fGlobalHeader[3];}; 00079 00080 /// Get channel mask 00081 uint32_t GetChMask(){return (fGlobalHeader[1] & 0xff);}; 00082 00083 void Print(); 00084 00085 /// Get the Vector of TDC Measurements. 00086 std::vector<ChannelMeasurement>& GetMeasurements() {return fMeasurements;} 00087 00088 00089 00090 private: 00091 00092 // We have vectors of the headers/trailers/etc, since there can be 00093 // multiple events in a bank. 00094 00095 /// The overall global header 00096 std::vector<uint32_t> fGlobalHeader; 00097 00098 /// Vector of V1730 Measurements. 00099 std::vector<ChannelMeasurement> fMeasurements; 00100 00101 }; 00102 00103 #endif