CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
CSCRPCData Class Reference

#include <CSCRPCData.h>

Public Member Functions

void add (const CSCRPCDigi &)
 
std::vector< int > BXN () const
 
bool check () const
 
 CSCRPCData (int ntbins=7)
 default constructor More...
 
 CSCRPCData (const unsigned short *b04buf, int length)
 
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+2]
 

Static Private Attributes

static bool debug = false
 

Detailed Description

Definition at line 9 of file CSCRPCData.h.

Constructor & Destructor Documentation

CSCRPCData::CSCRPCData ( int  ntbins = 7)

default constructor

Definition at line 21 of file CSCRPCData.cc.

References i, and theData.

22  :ntbins_(ntbins)
23 {
24  theData[0] = 0x6b04;
25  for(int i = 1; i < 257; ++i) {
26  // data format is bits 12-14 are RPC number, 0 to 3
27  int rpc = (i-1)/14;
28  theData[i] = rpc << 12;
29 
30  // bits 8-11 of the first word of the pair is time bin
31  int tbin = ((i-1)%14)/2;
32  theData[i] |= tbin << 8;
33  }
34  theData[257] = 0x6e04;
35 }
int i
Definition: DBlmapReader.cc:9
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
int ntbins_
Definition: CSCRPCData.h:28
CSCRPCData::CSCRPCData ( const unsigned short *  b04buf,
int  length 
)

Definition at line 37 of file CSCRPCData.cc.

References ntbins_, size_, and theData.

38  : size_(length)
39 {
40  //size_ = ntbins_*2*4+2;
41  // header & trailer word, + 4 RPCs per time bin, 2 lines per RPC
42  ntbins_ = (size_-2)/8;
43  memcpy(theData, buf, size_*2);
44 }
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
int ntbins_
Definition: CSCRPCData.h:28

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 69 of file CSCRPCData.cc.

References pos, query::result, size_, and theData.

69  {
70  std::vector<int> result;
71  for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
72  // skip header word
73  int pos = linePair*2 + 1;
75  //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8);
76 
77  int bxnnew = ((theData[pos+1] >> 8) & 0x7 ) ;
78  //int bxnnew = (((theData[pos+1] >> 8) & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ;
79 
80  int rpc = (theData[pos] >> 12) & 0x7;
81  //int tbin = (theData[pos] >> 8) & 0xf;
82  //int bxn = bxnnew;
83  result.push_back(bxnnew);
84  result.push_back(rpc);
85 
86 
87  }
88  return result;
89 }
tuple result
Definition: query.py:137
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
bool CSCRPCData::check ( ) const
inline

Definition at line 22 of file CSCRPCData.h.

References size_, and theData.

22 {return theData[0]==0x6b04 && theData[size_-1] == 0x6e04;}
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
std::vector< CSCRPCDigi > CSCRPCData::digis ( ) const

Definition at line 91 of file CSCRPCData.cc.

References debug, i, LogTrace, pos, query::result, size_, and theData.

91  {
92  std::vector<CSCRPCDigi> result;
93  int bxnold =0 ;
94  int bxnnew =0 ;
95  //int bxnewGreg;
96  for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
97  // skip header word
98  int pos = linePair*2 + 1;
99  // LogTrace("RPC") << "+++ CSCRPCData " << std::hex << theData[pos]
100  // << " " << theData[pos+1];
101  if (debug)
102  LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData " << std::hex << theData[pos]
103  << " " << theData[pos+1];
104  // make the two pad words into one and see if it's empty
105  int pad = (theData[pos] & 0xff) + ((theData[pos+1] & 0xff) << 8);
106 
107  //bxnnew = (((theData[pos+1] >> 8) & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ;
108  bxnnew = ((theData[pos+1] >> 8) & 0x7 ) ;
109  //LogTrace("RPC") << " " << "bxnnew" << " " << bxnnew;
110  //LogTrace("RPC") << " " << "bxnnewGreg" << " " << bxnewGreg;
111  if ( linePair == 0 ) bxnold = bxnnew;
112  if ( bxnnew - bxnold > 1 )
113  LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData warning: RPC BXN is incrementing by more than 1 clock cycle";
114  bxnold = bxnnew;
115 
116  if(pad != 0) {
117  if (debug) LogTrace("CSCRPCData|CSCRawToDigi") << "+++ CSCRPCData Found a PAD ="
118  << std::hex << pad << " " << theData[pos]
119  << " + " << theData[pos+1];
120  int rpc = (theData[pos] >> 12) & 0x7;
121  int tbin = (theData[pos] >> 8) & 0xf;
122  int bxn = bxnnew;
123  //LogTrace("RPC") << " rpc: " << rpc << " bxn: " << bxn << " tbin: " << tbin;
124  for(int i = 0; i < 16; ++i) {
125  // if the bit is set, make a digi
126  if((pad>>i)&1) {
127  result.push_back(CSCRPCDigi(rpc, i, bxn, tbin));
128  //LogTrace("RPC") << "digi-->" << " rpc: " << rpc << " i: " << i << " bxn: " << bxn << " tbin: " << tbin;
129  }
130  }
131  }
132  }
133  return result;
134 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
#define LogTrace(id)
static bool debug
Definition: CSCRPCData.h:27
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
int CSCRPCData::nTbins ( )
inline

Definition at line 20 of file CSCRPCData.h.

References ntbins_.

20 {return ntbins_;}
int ntbins_
Definition: CSCRPCData.h:28
void CSCRPCData::Print ( void  ) const

Definition at line 46 of file CSCRPCData.cc.

References geometryCSVtoXML::line, LogTrace, pos, size_, and theData.

46  {
47  LogTrace ("CSCRPCData|CSCRawToDigi") << "CSCRPCData.Print";
48  for(int line = 0; line < ((size_)); ++line) {
49  LogTrace("CSCRPCData|CSCRawToDigi") <<std::hex << theData[line];
50  }
51 
52  for(int linePair = 0; linePair < ((size_-2)/2); ++linePair) {
53  // skip header word
54  int pos = linePair*2 + 1;
55  // make the two pad words into one and see if it's empty
56  //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8);
57 
58  int bxnnew = ((theData[pos+1] >> 8) & 0x7 );
59 
60  int rpc = (theData[pos] >> 12) & 0x7;
61  int tbin = (theData[pos] >> 8) & 0xf;
62  int bxn = bxnnew;
63 
64  LogTrace ("CSCRPCData|CSCRawToDigi") << " RPC=" << rpc << " Tbin=" <<tbin <<" BXN=" << bxn;
65 
66  }
67 }
#define LogTrace(id)
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:30
static void CSCRPCData::setDebug ( bool  debugValue)
inlinestatic

Definition at line 24 of file CSCRPCData.h.

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

24 {debug = debugValue;}
static bool debug
Definition: CSCRPCData.h:27
int CSCRPCData::sizeInWords ( )
inline

Definition at line 19 of file CSCRPCData.h.

References size_.

Referenced by CSCTMBData::UnpackTMB().

19 {return size_;}

Member Data Documentation

bool CSCRPCData::debug = false
staticprivate
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().