Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:13

0001 #ifndef DTDigi_DTDigi_h
0002 #define DTDigi_DTDigi_h
0003 
0004 /** \class DTDigi
0005  *
0006  * Digi for Drift Tubes.
0007  * It can be initialized/set with a time in ns or a TDC count in
0008  * the specified base (ie number of counts/BX).
0009  *  
0010  *
0011  * \author N. Amapane, G. Cerminara, M. Pelliccioni - INFN Torino
0012  *
0013  */
0014 
0015 #include <cstdint>
0016 
0017 class DTDigi {
0018 public:
0019   //  typedef uint32_t ChannelType;
0020 
0021   /// Construct from the wire#, the TDC counts and the digi number.
0022   /// number should identify uniquely multiple digis in the same cell.
0023   explicit DTDigi(int wire, int nTDC, int number = 0, int base = 32);
0024 
0025   // Construct from the wire#, the time (ns) and the digi number.
0026   // time is converted in TDC counts (1 TDC = 25./base ns)
0027   // number should identify uniquely multiple digis in the same cell.
0028   explicit DTDigi(int wire, double tdrift, int number = 0, int base = 32);
0029 
0030   // Construct from channel and counts.
0031   //  explicit DTDigi (ChannelType channel, int nTDC);
0032 
0033   /// Default construction.
0034   DTDigi();
0035 
0036   /// Digis are equal if they are on the same cell and have same TDC count
0037   bool operator==(const DTDigi& digi) const;
0038 
0039   // The channel identifier and the digi number packed together
0040   //  ChannelType channel() const ;
0041 
0042   /// Return wire number
0043   int wire() const;
0044 
0045   /// Identifies different digis within the same cell
0046   int number() const;
0047 
0048   /// Get time in ns
0049   double time() const;
0050 
0051   /// Get raw TDC count
0052   int32_t countsTDC() const;
0053 
0054   /// Get the TDC unit value in ns
0055   double tdcUnit() const;
0056 
0057   /// Get the TDC base (counts per BX)
0058   int tdcBase() const;
0059 
0060   /// Print content of digi
0061   void print() const;
0062 
0063 private:
0064   friend class testDTDigis;
0065 
0066   // The value of one TDC count in ns
0067   static const double reso;
0068 
0069   int32_t theCounts;   // TDC count, in units given by 1/theTDCBase
0070   uint16_t theWire;    // channel number
0071   uint8_t theNumber;   // counter for digis in the same cell
0072   uint8_t theTDCBase;  // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2)
0073 };
0074 
0075 #include <iostream>
0076 #include <cstdint>
0077 inline std::ostream& operator<<(std::ostream& o, const DTDigi& digi) {
0078   return o << " " << digi.wire() << " " << digi.time() << " " << digi.number();
0079 }
0080 #endif