test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CSCComparatorDigi Class Reference

#include <CSCComparatorDigi.h>

Public Member Functions

 CSCComparatorDigi (int strip, int comparator, int timeBinWord)
 Construct from the strip number and the ADC readings. More...
 
 CSCComparatorDigi ()
 comparator here can be either 0 or 1 for left or right halfstrip of given strip More...
 
int getComparator () const
 Get Comparator readings. More...
 
int getStrip () const
 Get the strip number. More...
 
int getTimeBin () const
 Return bin number of first time bin which is ON. Counts from 0. More...
 
std::vector< int > getTimeBinsOn () const
 
int getTimeBinWord () const
 Return the word with each bit corresponding to a time bin. More...
 
bool operator< (const CSCComparatorDigi &digi) const
 sort by time first, then by strip More...
 
bool operator== (const CSCComparatorDigi &digi) const
 Digis are equal if they are on the same strip and have same Comparator data. More...
 
void print () const
 Print content of digi. More...
 
void setComparator (int comparator)
 Set Comparator data. More...
 
void setStrip (int strip)
 Set the strip number. More...
 

Private Attributes

uint16_t comparator_
 
uint16_t strip_
 
uint16_t timeBinWord_
 

Detailed Description

Digi for CSC Comparators.

Author
M. Schmitt, Northwestern

Definition at line 16 of file CSCComparatorDigi.h.

Constructor & Destructor Documentation

CSCComparatorDigi::CSCComparatorDigi ( int  strip,
int  comparator,
int  timeBinWord 
)

Construct from the strip number and the ADC readings.

Definition at line 15 of file CSCComparatorDigi.cc.

16  : strip_( strip ), comparator_( comparator ), timeBinWord_( timeBinWord ) {
17 }
CSCComparatorDigi::CSCComparatorDigi ( )

comparator here can be either 0 or 1 for left or right halfstrip of given strip

Default construction.

Definition at line 20 of file CSCComparatorDigi.cc.

21  : strip_( 0 ), comparator_( 0 ), timeBinWord_( 0 ) {
22 }

Member Function Documentation

int CSCComparatorDigi::getComparator ( ) const
inline
int CSCComparatorDigi::getStrip ( ) const
inline

Get the strip number.

Definition at line 35 of file CSCComparatorDigi.h.

References strip_.

Referenced by CSCCLCTData::add(), CSCDigiToRaw::add(), operator<(), operator<<(), operator==(), print(), and CSCCathodeLCTProcessor::readComparatorDigis().

35 { return strip_; }
int CSCComparatorDigi::getTimeBin ( ) const

Return bin number of first time bin which is ON. Counts from 0.

Definition at line 56 of file CSCComparatorDigi.cc.

References i, and timeBinWord_.

Referenced by operator<(), operator<<(), print(), and CSCCathodeLCTProcessor::readComparatorDigis().

56  {
57  // Find first bin which fired, counting from 0
58  uint16_t tbit=1;
59  int tbin=-1;
60  for(int i=0;i<16;++i) {
61  if(tbit & timeBinWord_) {
62  tbin=i;
63  break;
64  }
65  tbit=tbit<<1;
66  }
67  return tbin;
68 }
int i
Definition: DBlmapReader.cc:9
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 70 of file CSCComparatorDigi.cc.

References i, and timeBinWord_.

Referenced by CSCCLCTData::add(), and print().

70  {
71  std::vector<int> tbins;
72  uint16_t tbit = timeBinWord_;
73  const uint16_t one=1;
74  for(int i=0;i<16;++i) {
75  if(tbit & one) tbins.push_back(i);
76  tbit=tbit>>1;
77  if(tbit==0) break; // end already if no more bits set
78  }
79  return tbins;
80 }
int i
Definition: DBlmapReader.cc:9
int CSCComparatorDigi::getTimeBinWord ( ) const
inline

Return the word with each bit corresponding to a time bin.

Definition at line 41 of file CSCComparatorDigi.h.

References timeBinWord_.

Referenced by CSCDigiToRaw::add(), and operator==().

41 { return timeBinWord_; }
bool CSCComparatorDigi::operator< ( const CSCComparatorDigi digi) const

sort by time first, then by strip

Definition at line 45 of file CSCComparatorDigi.cc.

References getStrip(), getTimeBin(), and mps_fire::result.

45  {
46  bool result = false;
47  if(getTimeBin() == digi.getTimeBin()) {
48  result = (getStrip() < digi.getStrip());
49  }
50  return result;
51 }
int getStrip() const
Get the strip number.
int getTimeBin() const
Return bin number of first time bin which is ON. Counts from 0.
tuple result
Definition: mps_fire.py:83
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 28 of file CSCComparatorDigi.cc.

References getComparator(), getStrip(), and getTimeBinWord().

28  {
29  if ( getStrip() != digi.getStrip() ) return false;
30  if ( getComparator() != digi.getComparator() ) return false;
31  if ( getTimeBinWord() != digi.getTimeBinWord() ) return false;
32  return true;
33 }
int getStrip() const
Get the strip number.
int getComparator() const
Get Comparator readings.
int getTimeBinWord() const
Return the word with each bit corresponding to a time bin.
void CSCComparatorDigi::print ( void  ) const

Print content of digi.

Definition at line 95 of file CSCComparatorDigi.cc.

References getComparator(), getStrip(), getTimeBin(), getTimeBinsOn(), and i.

95  {
96  std::ostringstream ost;
97  ost << "CSCComparatorDigi | strip " << getStrip()
98  << " | comparator " << getComparator()
99  << " | first time bin " << getTimeBin() << " | time bins on ";
100  std::vector<int> tbins=getTimeBinsOn();
101  for(unsigned int i=0; i<tbins.size();i++) {ost << tbins[i] << " ";}
102  edm::LogVerbatim("CSCDigi") << ost.str();
103 }
int i
Definition: DBlmapReader.cc:9
int getStrip() const
Get the strip number.
int getComparator() const
Get Comparator readings.
int getTimeBin() const
Return bin number of first time bin which is ON. Counts from 0.
std::vector< int > getTimeBinsOn() const
void CSCComparatorDigi::setComparator ( int  comparator)

Set Comparator data.

Definition at line 88 of file CSCComparatorDigi.cc.

References comparator_.

88  {
89  comparator_ = comparator;
90 }
void CSCComparatorDigi::setStrip ( int  strip)

Set the strip number.

Definition at line 85 of file CSCComparatorDigi.cc.

References strip_.

85  {
86  strip_ = strip;
87 }

Member Data Documentation

uint16_t CSCComparatorDigi::comparator_
private

Definition at line 64 of file CSCComparatorDigi.h.

Referenced by getComparator(), and setComparator().

uint16_t CSCComparatorDigi::strip_
private

Definition at line 63 of file CSCComparatorDigi.h.

Referenced by getStrip(), and setStrip().

uint16_t CSCComparatorDigi::timeBinWord_
private

Definition at line 65 of file CSCComparatorDigi.h.

Referenced by getTimeBin(), getTimeBinsOn(), and getTimeBinWord().