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 14 of file CSCComparatorDigi.cc.

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

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

Default construction.

Definition at line 19 of file CSCComparatorDigi.cc.

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

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 55 of file CSCComparatorDigi.cc.

References i, and timeBinWord_.

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

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

References i, and timeBinWord_.

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

69  {
70  std::vector<int> tbins;
71  uint16_t tbit = timeBinWord_;
72  const uint16_t one=1;
73  for(int i=0;i<16;++i) {
74  if(tbit & one) tbins.push_back(i);
75  tbit=tbit>>1;
76  if(tbit==0) break; // end already if no more bits set
77  }
78  return tbins;
79 }
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 44 of file CSCComparatorDigi.cc.

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

44  {
45  bool result = false;
46  if(getTimeBin() == digi.getTimeBin()) {
47  result = (getStrip() < digi.getStrip());
48  }
49  return result;
50 }
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: query.py:137
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 27 of file CSCComparatorDigi.cc.

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

27  {
28  if ( getStrip() != digi.getStrip() ) return false;
29  if ( getComparator() != digi.getComparator() ) return false;
30  if ( getTimeBinWord() != digi.getTimeBinWord() ) return false;
31  return true;
32 }
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 94 of file CSCComparatorDigi.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, getComparator(), getStrip(), getTimeBin(), and getTimeBinsOn().

94  {
95  std::cout << "CSCComparatorDigi strip: " << getStrip()
96  << " comparator: " << getComparator()
97  << " first time bin: "<< getTimeBin()
98  << " time bins on: ";
99  std::vector<int> tbins=getTimeBinsOn();
100  std::copy( tbins.begin(), tbins.end(),
101  std::ostream_iterator<int>( std::cout, " "));
102  std::cout << std::endl;
103 }
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
tuple cout
Definition: gather_cfg.py:121
void CSCComparatorDigi::setComparator ( int  comparator)

Set Comparator data.

Definition at line 87 of file CSCComparatorDigi.cc.

References comparator_.

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

Set the strip number.

Definition at line 84 of file CSCComparatorDigi.cc.

References strip_.

84  {
85  strip_ = strip;
86 }

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().