#include <DataFormats/CSCDigi/interface/CSCComparatorDigi.h>
Public Member Functions | |
CSCComparatorDigi () | |
comparator here can be either 0 or 1 for left or right halfstrip of given strip | |
CSCComparatorDigi (int strip, int comparator, int timeBinWord) | |
Construct from the strip number and the ADC readings. | |
int | getComparator () const |
Get Comparator readings. | |
int | getStrip () const |
Get the strip number. | |
int | getTimeBin () const |
Return bin number of first time bin which is ON. Counts from 0. | |
std::vector< int > | getTimeBinsOn () const |
Return vector of the bin numbers for which time bins are ON. | |
int | getTimeBinWord () const |
Return the word with each bit corresponding to a time bin. | |
bool | operator< (const CSCComparatorDigi &digi) const |
sort by time first, then by strip | |
bool | operator== (const CSCComparatorDigi &digi) const |
Digis are equal if they are on the same strip and have same Comparator data. | |
void | print () const |
Print content of digi. | |
void | setComparator (int comparator) |
Set Comparator data. | |
void | setStrip (int strip) |
Set the strip number. | |
Private Attributes | |
uint16_t | comparator_ |
uint16_t | strip_ |
uint16_t | timeBinWord_ |
Definition at line 17 of file CSCComparatorDigi.h.
Construct from the strip number and the ADC readings.
Definition at line 16 of file CSCComparatorDigi.cc.
00017 : strip_( strip ), comparator_( comparator ), timeBinWord_( timeBinWord ) { 00018 }
CSCComparatorDigi::CSCComparatorDigi | ( | ) |
comparator here can be either 0 or 1 for left or right halfstrip of given strip
Default construction.
Definition at line 21 of file CSCComparatorDigi.cc.
00022 : strip_( 0 ), comparator_( 0 ), timeBinWord_( 0 ) { 00023 }
int CSCComparatorDigi::getComparator | ( | ) | const [inline] |
Get Comparator readings.
Definition at line 39 of file CSCComparatorDigi.h.
References comparator_.
Referenced by CSCCLCTData::add(), CSCDigiToRaw::add(), operator<<(), operator==(), print(), and CSCCathodeLCTProcessor::run().
00039 { return comparator_; }
int CSCComparatorDigi::getStrip | ( | ) | const [inline] |
Get the strip number.
Definition at line 36 of file CSCComparatorDigi.h.
References strip_.
Referenced by CSCCLCTData::add(), CSCDigiToRaw::add(), operator<(), operator<<(), operator==(), print(), and CSCCathodeLCTProcessor::run().
00036 { return strip_; }
int CSCComparatorDigi::getTimeBin | ( | ) | const |
Return bin number of first time bin which is ON. Counts from 0.
Definition at line 57 of file CSCComparatorDigi.cc.
References i, and timeBinWord_.
Referenced by operator<(), operator<<(), print(), and CSCCathodeLCTProcessor::run().
00057 { 00058 // Find first bin which fired, counting from 0 00059 uint16_t tbit=1; 00060 int tbin=-1; 00061 for(int i=0;i<16;++i) { 00062 if(tbit & timeBinWord_) { 00063 tbin=i; 00064 break; 00065 } 00066 tbit=tbit<<1; 00067 } 00068 return tbin; 00069 }
std::vector< int > CSCComparatorDigi::getTimeBinsOn | ( | ) | const |
Return vector of the bin numbers for which time bins are ON.
e.g. if bits 0 and 13 fired, then this vector will contain the values 0 and 13
Definition at line 71 of file CSCComparatorDigi.cc.
References i, and timeBinWord_.
Referenced by CSCCLCTData::add(), and print().
00071 { 00072 std::vector<int> tbins; 00073 uint16_t tbit = timeBinWord_; 00074 const uint16_t one=1; 00075 for(int i=0;i<16;++i) { 00076 if(tbit & one) tbins.push_back(i); 00077 tbit=tbit>>1; 00078 if(tbit==0) break; // end already if no more bits set 00079 } 00080 return tbins; 00081 }
int CSCComparatorDigi::getTimeBinWord | ( | ) | const [inline] |
Return the word with each bit corresponding to a time bin.
Definition at line 42 of file CSCComparatorDigi.h.
References timeBinWord_.
Referenced by CSCDigiToRaw::add(), and operator==().
00042 { return timeBinWord_; }
bool CSCComparatorDigi::operator< | ( | const CSCComparatorDigi & | digi | ) | const |
sort by time first, then by strip
Definition at line 46 of file CSCComparatorDigi.cc.
References getStrip(), getTimeBin(), and HLT_VtxMuL3::result.
00046 { 00047 bool result = false; 00048 if(getTimeBin() == digi.getTimeBin()) { 00049 result = (getStrip() < digi.getStrip()); 00050 } 00051 return result; 00052 }
bool CSCComparatorDigi::operator== | ( | const CSCComparatorDigi & | digi | ) | const |
Digis are equal if they are on the same strip and have same Comparator data.
Definition at line 29 of file CSCComparatorDigi.cc.
References getComparator(), getStrip(), and getTimeBinWord().
00029 { 00030 if ( getStrip() != digi.getStrip() ) return false; 00031 if ( getComparator() != digi.getComparator() ) return false; 00032 if ( getTimeBinWord() != digi.getTimeBinWord() ) return false; 00033 return true; 00034 }
Print content of digi.
Definition at line 96 of file CSCComparatorDigi.cc.
References edmNew::copy(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getComparator(), getStrip(), getTimeBin(), and getTimeBinsOn().
00096 { 00097 std::cout << "CSCComparatorDigi strip: " << getStrip() 00098 << " comparator: " << getComparator() 00099 << " first time bin: "<< getTimeBin() << std::endl; 00100 std::cout << " time bins on:"; 00101 std::vector<int> tbins=getTimeBinsOn(); 00102 std::copy( tbins.begin(), tbins.end(), 00103 std::ostream_iterator<int>( std::cout, " ")); 00104 std::cout << std::endl; 00105 }
Set Comparator data.
Definition at line 89 of file CSCComparatorDigi.cc.
References comparator_.
00089 { 00090 comparator_ = comparator; 00091 }
uint16_t CSCComparatorDigi::comparator_ [private] |
Definition at line 65 of file CSCComparatorDigi.h.
Referenced by getComparator(), and setComparator().
uint16_t CSCComparatorDigi::strip_ [private] |
uint16_t CSCComparatorDigi::timeBinWord_ [private] |
Definition at line 66 of file CSCComparatorDigi.h.
Referenced by getTimeBin(), getTimeBinsOn(), and getTimeBinWord().