CMS 3D CMS Logo

CSCComparatorDigi Class Reference

Digi for CSC Comparators. More...

#include <DataFormats/CSCDigi/interface/CSCComparatorDigi.h>

List of all members.

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< intgetTimeBinsOn () 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_


Detailed Description

Digi for CSC Comparators.

Date
2007/07/23 12:08:19
Revision
1.11

Author:
M. Schmitt, Northwestern

Definition at line 17 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.

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 }


Member Function Documentation

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 }

void CSCComparatorDigi::print ( void   )  const

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 }

void CSCComparatorDigi::setComparator ( int  comparator  ) 

Set Comparator data.

Definition at line 89 of file CSCComparatorDigi.cc.

References comparator_.

00089                                                     {
00090   comparator_ = comparator;
00091 }

void CSCComparatorDigi::setStrip ( int  strip  ) 

Set the strip number.

Definition at line 86 of file CSCComparatorDigi.cc.

References strip_.

00086                                           {
00087   strip_ = strip;
00088 }


Member Data Documentation

uint16_t CSCComparatorDigi::comparator_ [private]

Definition at line 65 of file CSCComparatorDigi.h.

Referenced by getComparator(), and setComparator().

uint16_t CSCComparatorDigi::strip_ [private]

Definition at line 64 of file CSCComparatorDigi.h.

Referenced by getStrip(), and setStrip().

uint16_t CSCComparatorDigi::timeBinWord_ [private]

Definition at line 66 of file CSCComparatorDigi.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:09 2009 for CMSSW by  doxygen 1.5.4