CMS 3D CMS Logo

CSCRPCData Class Reference

#include <EventFilter/CSCRawToDigi/interface/CSCRPCData.h>

List of all members.

Public Member Functions

void add (const CSCRPCDigi &)
std::vector< intBXN () const
bool check () const
 CSCRPCData (const unsigned short *b04buf, int length)
 CSCRPCData (int ntbins=7)
 default constructor
std::vector< CSCRPCDigidigis () const
int nTbins ()
void Print () const
int sizeInWords ()

Static Public Member Functions

static void setDebug (bool debugValue)

Private Attributes

int ntbins_
int size_
unsigned short theData [2 *4 *32]

Static Private Attributes

static bool debug = false
 data format is RPC0 Tbin 0 Pads[7:0] RPC0 BXN Pads[15:8] RPC0 Tbin 1 Pads[7:0]


Detailed Description

Definition at line 9 of file CSCRPCData.h.


Constructor & Destructor Documentation

CSCRPCData::CSCRPCData ( int  ntbins = 7  ) 

default constructor

Definition at line 19 of file CSCRPCData.cc.

References i, and theData.

00020   :ntbins_(ntbins)
00021 {
00022   bzero(theData, 516);
00023   theData[0] = 0x6b04;
00024   for(int i = 1; i < 257; ++i) {
00025     // data format is bits 12-14 are RPC number, 0 to 3
00026     int rpc = (i-1)/14;
00027     theData[i] |= rpc << 12;
00028 
00029     // bits 8-11 of the first word of the pair is time bin
00030     int tbin = ((i-1)%14)/2;
00031     theData[i] |= tbin << 8;
00032   }
00033   theData[257] = 0x6e04;  
00034 }

CSCRPCData::CSCRPCData ( const unsigned short *  b04buf,
int  length 
)

Definition at line 36 of file CSCRPCData.cc.

References ntbins_, size_, and theData.

00037   : size_(length)
00038 {
00039   //size_ = ntbins_*2*4+2;
00040   // header & trailer word, + 4 RPCs per time bin, 2 lines per RPC
00041   ntbins_ = (size_-2)/8;
00042   memcpy(theData, buf, size_*2);
00043 }


Member Function Documentation

void CSCRPCData::add ( const CSCRPCDigi  ) 

std::vector< int > CSCRPCData::BXN ( void   )  const

make the two pad words into one and see if it's empty

Definition at line 68 of file CSCRPCData.cc.

References HLT_VtxMuL3::result, size_, and theData.

00068                                      {
00069   std::vector<int> result;
00070   for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
00071     // skip header word
00072     int pos = linePair*2 + 1;
00074     //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8);
00075    
00076     int bxnnew = (((theData[pos+1] >> 8)  & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ;
00077    
00078     int rpc  = (theData[pos]   >> 12) & 0x7;
00079     //int tbin = (theData[pos]   >> 8)  & 0xf;
00080     //int bxn  = bxnnew;
00081     result.push_back(bxnnew);
00082     result.push_back(rpc);
00083 
00084    
00085   }
00086   return result;
00087 }

bool CSCRPCData::check (  )  const [inline]

Definition at line 22 of file CSCRPCData.h.

References size_, and theData.

00022 {return theData[0]==0x6b04 && theData[size_-1] == 0x6e04;}

std::vector< CSCRPCDigi > CSCRPCData::digis (  )  const

Definition at line 89 of file CSCRPCData.cc.

References debug, i, LogTrace, HLT_VtxMuL3::result, size_, and theData.

00089                                               {
00090   std::vector<CSCRPCDigi> result;
00091   int bxnold =0 ;
00092   int bxnnew =0 ;
00093   for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
00094     // skip header word
00095     int pos = linePair*2 + 1;
00096     if (debug) 
00097       LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData " << std::hex << theData[pos] 
00098                                  << " " << theData[pos+1];
00099     // make the two pad words into one and see if it's empty
00100     int pad = theData[pos] & 0xff + ((theData[pos+1] & 0xff) << 8);
00101 
00102     bxnnew = (((theData[pos+1] >> 8)  & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ;
00103     if ( linePair == 0 ) bxnold = bxnnew;
00104     if ( bxnnew - bxnold > 1 ) 
00105       LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData warning: RPC BXN is incrementing by more than 1 clock cycle";
00106     bxnold = bxnnew;
00107 
00108     if(pad != 0) {
00109       if (debug) LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData Found a PAD =" 
00110                                             << std::hex << pad << " " << theData[pos] 
00111                                             << " + " << theData[pos+1];
00112       int rpc  = (theData[pos]   >> 12) & 0x7;
00113       int tbin = (theData[pos]   >> 8)  & 0xf;
00114       int bxn  = bxnnew;
00115       for(int i = 0; i < 16; ++i) {
00116         // if the bit is set, make a digi
00117         if((pad>>i)&1) {
00118           result.push_back(CSCRPCDigi(rpc, i, bxn, tbin));
00119         }
00120       }
00121     } 
00122   }
00123   return result;
00124 }

int CSCRPCData::nTbins (  )  [inline]

Definition at line 20 of file CSCRPCData.h.

References ntbins_.

00020 {return ntbins_;}

void CSCRPCData::Print (  )  const

Definition at line 45 of file CSCRPCData.cc.

References parsecf::pyparsing::line(), LogTrace, size_, and theData.

00045                              {
00046   LogTrace ("CSCRPCData|CSCRawToDigi") << "CSCRPCData.Print";
00047   for(int line = 0; line < ((size_)); ++line) {
00048     LogTrace("CSCRPCData|CSCRawToDigi") <<std::hex << theData[line];
00049   }
00050   
00051   for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
00052     // skip header word
00053     int pos = linePair*2 + 1;
00054     // make the two pad words into one and see if it's empty
00055     //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8);
00056   
00057     int bxnnew = ((theData[pos+1] >> 8)  & 0x7 );
00058   
00059     int rpc  = (theData[pos]   >> 12) & 0x7;
00060     int tbin = (theData[pos]   >> 8)  & 0xf;
00061     int bxn  = bxnnew;
00062   
00063     LogTrace ("CSCRPCData|CSCRawToDigi") << " RPC=" << rpc << " Tbin=" <<tbin <<" BXN=" << bxn;
00064   
00065   }
00066 }

static void CSCRPCData::setDebug ( bool  debugValue  )  [inline, static]

Definition at line 24 of file CSCRPCData.h.

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

00024 {debug = debugValue;}

int CSCRPCData::sizeInWords (  )  [inline]

Definition at line 19 of file CSCRPCData.h.

References size_.

Referenced by CSCTMBData::UnpackTMB().

00019 {return size_;}


Member Data Documentation

bool CSCRPCData::debug = false [static, private]

data format is RPC0 Tbin 0 Pads[7:0] RPC0 BXN Pads[15:8] RPC0 Tbin 1 Pads[7:0]

.. RPC0 Tbin 6 Pads[7:0] RPC3 BXN Pads[15:8]

Definition at line 27 of file CSCRPCData.h.

Referenced by digis(), and setDebug().

int CSCRPCData::ntbins_ [private]

Definition at line 28 of file CSCRPCData.h.

Referenced by CSCRPCData(), and nTbins().

int CSCRPCData::size_ [private]

Definition at line 29 of file CSCRPCData.h.

Referenced by BXN(), check(), CSCRPCData(), digis(), Print(), and sizeInWords().

unsigned short CSCRPCData::theData[2 *4 *32] [private]

Definition at line 30 of file CSCRPCData.h.

Referenced by BXN(), check(), CSCRPCData(), digis(), and Print().


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