#include <CSCRPCData.h>
Public Member Functions | |
void | add (const CSCRPCDigi &) |
std::vector< int > | BXN () const |
bool | check () const |
CSCRPCData (const unsigned short *b04buf, int length) | |
CSCRPCData (int ntbins=7) | |
default constructor | |
std::vector< CSCRPCDigi > | digis () 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+2] |
Static Private Attributes | |
static bool | debug = false |
Definition at line 9 of file CSCRPCData.h.
CSCRPCData::CSCRPCData | ( | int | ntbins = 7 | ) |
default constructor
Definition at line 21 of file CSCRPCData.cc.
: ntbins_(ntbins), size_( 0 ) { theData[0] = 0x6b04; for(int i = 1; i < 257; ++i) { // data format is bits 12-14 are RPC number, 0 to 3 int rpc = (i-1)/14; theData[i] = rpc << 12; // bits 8-11 of the first word of the pair is time bin int tbin = ((i-1)%14)/2; theData[i] |= tbin << 8; } theData[257] = 0x6e04; }
CSCRPCData::CSCRPCData | ( | const unsigned short * | b04buf, |
int | length | ||
) |
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 69 of file CSCRPCData.cc.
References pos, query::result, size_, and theData.
{ std::vector<int> result; for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) { // skip header word int pos = linePair*2 + 1; //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8); int bxnnew = ((theData[pos+1] >> 8) & 0x7 ) ; //int bxnnew = (((theData[pos+1] >> 8) & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ; int rpc = (theData[pos] >> 12) & 0x7; //int tbin = (theData[pos] >> 8) & 0xf; //int bxn = bxnnew; result.push_back(bxnnew); result.push_back(rpc); } return result; }
bool CSCRPCData::check | ( | ) | const [inline] |
std::vector< CSCRPCDigi > CSCRPCData::digis | ( | ) | const |
Definition at line 91 of file CSCRPCData.cc.
References debug, i, LogTrace, pos, query::result, size_, and theData.
{ std::vector<CSCRPCDigi> result; int bxnold =0 ; int bxnnew =0 ; //int bxnewGreg; for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) { // skip header word int pos = linePair*2 + 1; // LogTrace("RPC") << "+++ CSCRPCData " << std::hex << theData[pos] // << " " << theData[pos+1]; if (debug) LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData " << std::hex << theData[pos] << " " << theData[pos+1]; // make the two pad words into one and see if it's empty int pad = (theData[pos] & 0xff) + ((theData[pos+1] & 0xff) << 8); //bxnnew = (((theData[pos+1] >> 8) & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ; bxnnew = ((theData[pos+1] >> 8) & 0x7 ) ; //LogTrace("RPC") << " " << "bxnnew" << " " << bxnnew; //LogTrace("RPC") << " " << "bxnnewGreg" << " " << bxnewGreg; if ( linePair == 0 ) bxnold = bxnnew; if ( bxnnew - bxnold > 1 ) LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData warning: RPC BXN is incrementing by more than 1 clock cycle"; bxnold = bxnnew; if(pad != 0) { if (debug) LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData Found a PAD =" << std::hex << pad << " " << theData[pos] << " + " << theData[pos+1]; int rpc = (theData[pos] >> 12) & 0x7; int tbin = (theData[pos] >> 8) & 0xf; int bxn = bxnnew; //LogTrace("RPC") << " rpc: " << rpc << " bxn: " << bxn << " tbin: " << tbin; for(int i = 0; i < 16; ++i) { // if the bit is set, make a digi if((pad>>i)&1) { result.push_back(CSCRPCDigi(rpc, i, bxn, tbin)); //LogTrace("RPC") << "digi-->" << " rpc: " << rpc << " i: " << i << " bxn: " << bxn << " tbin: " << tbin; } } } } return result; }
int CSCRPCData::nTbins | ( | ) | [inline] |
void CSCRPCData::Print | ( | void | ) | const |
Definition at line 46 of file CSCRPCData.cc.
References geometryCSVtoXML::line, LogTrace, pos, size_, and theData.
{ LogTrace ("CSCRPCData|CSCRawToDigi") << "CSCRPCData.Print"; for(int line = 0; line < ((size_)); ++line) { LogTrace("CSCRPCData|CSCRawToDigi") <<std::hex << theData[line]; } for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) { // skip header word int pos = linePair*2 + 1; // make the two pad words into one and see if it's empty //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8); int bxnnew = ((theData[pos+1] >> 8) & 0x7 ); int rpc = (theData[pos] >> 12) & 0x7; int tbin = (theData[pos] >> 8) & 0xf; int bxn = bxnnew; LogTrace ("CSCRPCData|CSCRawToDigi") << " RPC=" << rpc << " Tbin=" <<tbin <<" BXN=" << bxn; } }
static void CSCRPCData::setDebug | ( | bool | debugValue | ) | [inline, static] |
Definition at line 24 of file CSCRPCData.h.
References debug.
Referenced by CSCDCCUnpacker::CSCDCCUnpacker().
{debug = debugValue;}
int CSCRPCData::sizeInWords | ( | ) | [inline] |
Definition at line 19 of file CSCRPCData.h.
References size_.
Referenced by CSCTMBData::UnpackTMB().
{return size_;}
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+2] [private] |
Definition at line 30 of file CSCRPCData.h.
Referenced by BXN(), check(), CSCRPCData(), digis(), and Print().