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.

Date:
2007/07/23 12:08:19
Revision:
1.11
Author
M. Schmitt, Northwestern

Definition at line 18 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 16 of file CSCComparatorDigi.cc.

17  : strip_( strip ), comparator_( comparator ), timeBinWord_( timeBinWord ) {
18 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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.

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

Member Function Documentation

int CSCComparatorDigi::getComparator ( ) const
inline
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().

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

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

References i, and timeBinWord_.

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

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

References timeBinWord_.

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

43 { 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.

46  {
47  bool result = false;
48  if(getTimeBin() == digi.getTimeBin()) {
49  result = (getStrip() < digi.getStrip());
50  }
51  return result;
52 }
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 29 of file CSCComparatorDigi.cc.

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

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

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

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

Set Comparator data.

Definition at line 89 of file CSCComparatorDigi.cc.

References comparator_.

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

Set the strip number.

Definition at line 86 of file CSCComparatorDigi.cc.

References strip(), and strip_.

86  {
87  strip_ = strip;
88 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16

Member Data Documentation

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