#include <CSCComparatorDigi.h>
Public Member Functions | |
CSCComparatorDigi (int strip, int comparator, int timeBinWord) | |
Construct from the strip number and the ADC readings. | |
CSCComparatorDigi () | |
comparator here can be either 0 or 1 for left or right halfstrip of given strip | |
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 |
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_ |
Digi for CSC Comparators.
Definition at line 18 of file CSCComparatorDigi.h.
CSCComparatorDigi::CSCComparatorDigi | ( | int | strip, |
int | comparator, | ||
int | timeBinWord | ||
) |
Construct from the strip number and the ADC readings.
Definition at line 16 of file CSCComparatorDigi.cc.
: strip_( strip ), comparator_( comparator ), timeBinWord_( timeBinWord ) { }
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.
: strip_( 0 ), comparator_( 0 ), timeBinWord_( 0 ) { }
int CSCComparatorDigi::getComparator | ( | ) | const [inline] |
Get Comparator readings.
Definition at line 40 of file CSCComparatorDigi.h.
References comparator_.
Referenced by CSCCLCTData::add(), CSCDigiToRaw::add(), operator<<(), operator==(), print(), and CSCCathodeLCTProcessor::readComparatorDigis().
{ return comparator_; }
int CSCComparatorDigi::getStrip | ( | ) | const [inline] |
Get the strip number.
Definition at line 37 of file CSCComparatorDigi.h.
References strip_.
Referenced by CSCCLCTData::add(), CSCDigiToRaw::add(), operator<(), operator<<(), operator==(), print(), and CSCCathodeLCTProcessor::readComparatorDigis().
{ 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::readComparatorDigis().
{ // Find first bin which fired, counting from 0 uint16_t tbit=1; int tbin=-1; for(int i=0;i<16;++i) { if(tbit & timeBinWord_) { tbin=i; break; } tbit=tbit<<1; } return tbin; }
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().
{ std::vector<int> tbins; uint16_t tbit = timeBinWord_; const uint16_t one=1; for(int i=0;i<16;++i) { if(tbit & one) tbins.push_back(i); tbit=tbit>>1; if(tbit==0) break; // end already if no more bits set } return tbins; }
int CSCComparatorDigi::getTimeBinWord | ( | ) | const [inline] |
Return the word with each bit corresponding to a time bin.
Definition at line 43 of file CSCComparatorDigi.h.
References timeBinWord_.
Referenced by CSCDigiToRaw::add(), and operator==().
{ 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 query::result.
{ bool result = false; if(getTimeBin() == digi.getTimeBin()) { result = (getStrip() < digi.getStrip()); } return result; }
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().
{ if ( getStrip() != digi.getStrip() ) return false; if ( getComparator() != digi.getComparator() ) return false; if ( getTimeBinWord() != digi.getTimeBinWord() ) return false; return true; }
void CSCComparatorDigi::print | ( | void | ) | const |
Print content of digi.
Definition at line 96 of file CSCComparatorDigi.cc.
References filterCSVwithJSON::copy, gather_cfg::cout, getComparator(), getStrip(), getTimeBin(), and getTimeBinsOn().
{ std::cout << "CSCComparatorDigi strip: " << getStrip() << " comparator: " << getComparator() << " first time bin: "<< getTimeBin() << " time bins on: "; std::vector<int> tbins=getTimeBinsOn(); std::copy( tbins.begin(), tbins.end(), std::ostream_iterator<int>( std::cout, " ")); std::cout << std::endl; }
void CSCComparatorDigi::setComparator | ( | int | comparator | ) |
Set Comparator data.
Definition at line 89 of file CSCComparatorDigi.cc.
References comparator_.
{ comparator_ = comparator; }
void CSCComparatorDigi::setStrip | ( | int | strip | ) |
uint16_t CSCComparatorDigi::comparator_ [private] |
Definition at line 66 of file CSCComparatorDigi.h.
Referenced by getComparator(), and setComparator().
uint16_t CSCComparatorDigi::strip_ [private] |
Definition at line 65 of file CSCComparatorDigi.h.
Referenced by getStrip(), and setStrip().
uint16_t CSCComparatorDigi::timeBinWord_ [private] |
Definition at line 67 of file CSCComparatorDigi.h.
Referenced by getTimeBin(), getTimeBinsOn(), and getTimeBinWord().