Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-21 02:52:56

0001 #ifndef DataFormats_CSCDigi_CSCComparatorDigi_h
0002 #define DataFormats_CSCDigi_CSCComparatorDigi_h
0003 
0004 /** \class CSCComparatorDigi
0005  *
0006  * Digi for CSC Comparators.
0007  *
0008  *
0009  * \author M. Schmitt, Northwestern
0010  *
0011  */
0012 #include <iosfwd>
0013 #include <vector>
0014 #include <cstdint>
0015 
0016 class CSCComparatorDigi {
0017 public:
0018   /// Construct from the strip number and the ADC readings.
0019   CSCComparatorDigi(int strip, int comparator, int timeBinWord);
0020   ///comparator here can be either 0 or 1 for left or right halfstrip of given strip
0021 
0022   /// Default construction.
0023   CSCComparatorDigi();
0024 
0025   /// Digis are equal if they are on the same strip and have same Comparator data
0026   bool operator==(const CSCComparatorDigi& digi) const;
0027 
0028   /// sort by time first, then by strip
0029   bool operator<(const CSCComparatorDigi& digi) const;
0030 
0031   /// Get the distrip number. Counts from 0.
0032   int getDiStrip() const;
0033 
0034   /// Get the strip number. Counts from 1.
0035   int getStrip() const { return strip_; }
0036 
0037   /// Get the CFEB number. Counts from 0.
0038   int getCFEB() const;
0039 
0040   /// Get Comparator readings. Can be 0 or 1.
0041   int getComparator() const { return comparator_; }
0042 
0043   /// Return the word with each bit corresponding to a time bin
0044   int getTimeBinWord() const { return timeBinWord_; }
0045 
0046   /// Return bin number of first time bin which is ON. Counts from 0.
0047   int getTimeBin() const;
0048 
0049   /// Get the associated halfstrip number for this comparator digi. Counts from 0.
0050   int getHalfStrip() const;
0051 
0052   /// Return the fractional half-strip. Counts from 0.25
0053   float getFractionalStrip() const;
0054 
0055   /** Return vector of the bin numbers for which time bins are ON.
0056    * e.g. if bits 0 and 13 fired, then this vector will contain the values 0 and 13
0057    */
0058   std::vector<int> getTimeBinsOn() const;
0059 
0060   /// Set the strip number
0061   void setStrip(int strip);
0062 
0063   /// Set Comparator data
0064   void setComparator(int comparator);
0065 
0066   /// Print content of digi
0067   void print() const;
0068 
0069 private:
0070   uint16_t strip_;
0071   uint16_t comparator_;
0072   uint16_t timeBinWord_;
0073 };
0074 
0075 /// Output operator
0076 std::ostream& operator<<(std::ostream& o, const CSCComparatorDigi& digi);
0077 
0078 #endif