TV1190Data.hxx

Go to the documentation of this file.
00001 #ifndef TV1190Data_hxx_seen
00002 #define TV1190Data_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 V1190 manual.
00010 class TDCMeasurement {
00011 
00012   friend class TV1190Data;
00013 
00014 public:
00015   
00016   /// Is this the leading edge measurement?
00017   bool IsLeading() const {return ((tdc_measurement_word & 0x4000000) == 0x0000000);}
00018   /// Is this the trailing edge measurement?
00019   bool IsTrailing() const {return ((tdc_measurement_word & 0x4000000) == 0x4000000);}
00020   /// Get the TDC measurement
00021   uint32_t GetMeasurement() const {return (tdc_measurement_word & 0x7ffff);}
00022 
00023 /// Get the TDC number
00024   uint32_t GetTDCNumber() const;
00025   /// Get the channel number
00026   uint32_t GetChannel() const {return ((tdc_measurement_word & 0x3f80000) >> 19 );}
00027 
00028   /// Get Event ID; this is event number defined by V1190 module
00029   uint32_t GetEventID() const;
00030 
00031   /// Get Bunch ID
00032   uint32_t GetBunchID() const;
00033 
00034   /// Get Event Index; this is which event number within the bank.
00035   uint32_t GetEventIndex() const{return event_index;};
00036 
00037   /// Check if measurement has a TDC header
00038   bool HasTDCHeader() const {return (tdc_header_word != 0);}
00039   /// Check if measurement has a TDC trailer
00040   bool HasTDCTrailer() const {return (tdc_trailer_word != 0);}
00041   /// Check if measurement has a TDC error word
00042   bool HasTDCErrorWord() const {return (tdc_error_error != 0);}
00043 
00044   /// Get Errors
00045   uint32_t GetErrors() const;
00046 
00047 private:
00048 
00049   /// Found fields to hold the header, measurement, trailer and error words.
00050   uint32_t tdc_header_word;
00051   uint32_t tdc_measurement_word;
00052   uint32_t tdc_trailer_word;
00053   uint32_t tdc_error_error;
00054   int event_index;
00055   
00056   /// Constructor; need to pass in header and measurement.
00057   TDCMeasurement(uint32_t header, uint32_t measurement, int index):
00058     tdc_header_word(header),
00059     tdc_measurement_word(measurement),
00060     tdc_trailer_word(0),tdc_error_error(0),event_index(index){};
00061 
00062   /// Set the trailer word.
00063   void SetTrailer(uint32_t trailer);
00064 
00065   /// Set the error word.
00066   void SetErrors(uint32_t error){tdc_error_error = error;}  
00067 
00068 
00069   TDCMeasurement();    
00070 };
00071 
00072 
00073 /// Class to store data from CAEN V1190.
00074 /// We store the information as a vector of TDCMeasurement's
00075 /// Question: do we need a way of retrieving information about TDCs that
00076 /// have no measurements?  Currently this information is not exposed.
00077 /// For the definition of obscure variables see the CAEN V1190 manual.
00078 class TV1190Data: public TGenericData {
00079 
00080 public:
00081 
00082   /// Constructor
00083   TV1190Data(int bklen, int bktype, const char* name, void *pdata);
00084 
00085 
00086   /// Get Event Counter
00087   uint32_t GetEventCounter(int index = 0) const {return (fGlobalHeader[index] & 0x07ffffe0) >> 5;};
00088 
00089   /// Get Geographical Address
00090   uint32_t GetGeoAddress(int index = 0) const {return (fGlobalHeader[index] & 0x1f) ;};
00091 
00092   /// Get the extended trigger time tag
00093   int GetExtendedTriggerTimeTag(int index = 0) const {return fExtendedTriggerTimeTag[index];};
00094 
00095   /// Get the word count
00096   int GetWordCount() const {return fWordCountTotal;};
00097 
00098   // Methods to check the status flags in trailer.
00099   bool IsTriggerLost(int index = 0) const {
00100     if(fStatus[index] & 0x4)
00101       return true;
00102     else
00103       return false;
00104   }  
00105   bool HasBufferOverflow(int index = 0) const {
00106     if(fStatus[index] & 0x2)
00107       return true;
00108     else
00109       return false;
00110   }
00111   bool HasTDCError(int index = 0) const {
00112     if(fStatus[index] & 0x1)
00113       return true;
00114     else
00115       return false;
00116   }
00117 
00118   /// Get the number of events in this bank
00119   int GetEventsInBank(){return fGlobalHeader.size();};
00120 
00121   void Print();
00122 
00123   /// Get the Vector of TDC Measurements.
00124   std::vector<TDCMeasurement>& GetMeasurements() {return fMeasurements;}
00125 
00126 
00127 private:
00128   
00129   // We have vectors of the headers/trailers/etc, since there can be 
00130   // multiple events in a bank.
00131 
00132   /// The overall global header
00133   std::vector<uint32_t> fGlobalHeader;
00134   
00135     
00136   std::vector<int> fExtendedTriggerTimeTag; // Extended trigger time
00137   int fWordCountTotal; // Word count
00138 
00139   std::vector<uint32_t> fStatus;
00140 
00141 
00142   /// Vector of TDC Measurements.
00143   std::vector<TDCMeasurement> fMeasurements;
00144 
00145 };
00146 
00147 #endif

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1