00001 #ifndef DTDigi_DTDigi_h 00002 #define DTDigi_DTDigi_h 00003 00017 #include <boost/cstdint.hpp> 00018 00019 class DTDigi{ 00020 00021 public: 00022 typedef uint32_t ChannelType; 00023 00026 explicit DTDigi (int wire, int nTDC, int number=0); 00027 00031 explicit DTDigi (int wire, double tdrift, int number=0); 00032 00034 explicit DTDigi (ChannelType channel, int nTDC); 00035 00037 DTDigi (); 00038 00040 bool operator==(const DTDigi& digi) const; 00041 00043 ChannelType channel() const ; 00044 00046 // DTEnum::ViewCode viewCode() const ; 00047 00049 int wire() const; 00050 00052 int number() const; 00053 00055 double time() const; 00056 00058 uint32_t countsTDC() const; 00059 00061 void setTime(double time); 00062 00064 void setCountsTDC (int nTDC); 00065 00067 void print() const; 00068 00069 private: 00070 friend class testDTDigis; 00071 00072 // The value of one TDC count in ns 00073 static const double reso; 00074 00075 // Used to repack the channel number to an int 00076 struct ChannelPacking { 00077 uint16_t wire; 00078 uint16_t number; 00079 }; 00080 00081 00082 private: 00083 uint16_t theWire; // channel number 00084 uint32_t theCounts; // TDC count, up to 20 bits actually used 00085 uint16_t theNumber; // counter for digis in the same cell 00086 }; 00087 00088 #include<iostream> 00089 inline std::ostream & operator<<(std::ostream & o, const DTDigi& digi) { 00090 return o << " " << digi.wire() 00091 << " " << digi.time() 00092 << " " << digi.number(); 00093 } 00094 #endif 00095