CMS 3D CMS Logo

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 (const unsigned short *b04buf, int length)
 
 CSCRPCData (int ntbins=7)
 default constructor More...
 
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 std::atomic< bool > debug {false}
 

Detailed Description

Definition at line 11 of file CSCRPCData.h.

Constructor & Destructor Documentation

◆ CSCRPCData() [1/2]

CSCRPCData::CSCRPCData ( int  ntbins = 7)

default constructor

Definition at line 25 of file CSCRPCData.cc.

25  : ntbins_(ntbins), size_(0) {
26  theData[0] = 0x6b04;
27  for (int i = 1; i < 257; ++i) {
28  // data format is bits 12-14 are RPC number, 0 to 3
29  int rpc = (i - 1) / 14;
30  theData[i] = rpc << 12;
31 
32  // bits 8-11 of the first word of the pair is time bin
33  int tbin = ((i - 1) % 14) / 2;
34  theData[i] |= tbin << 8;
35  }
36  theData[257] = 0x6e04;
37 }

References mps_fire::i, omtf::DataWord64::rpc, and theData.

◆ CSCRPCData() [2/2]

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

Definition at line 39 of file CSCRPCData.cc.

39  : size_(length) {
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 }

References visDQMUpload::buf, ntbins_, size_, and theData.

Member Function Documentation

◆ add()

void CSCRPCData::add ( const CSCRPCDigi )

◆ BXN()

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.

68  {
69  std::vector<int> result;
70  for (int linePair = 0; linePair < ((size_ - 2) / 2); ++linePair) {
71  // skip header word
72  int pos = linePair * 2 + 1;
74  //int pad = theData[pos] & 0xff + ((theData[pos+1] & 0x3f) << 8);
75 
76  int bxnnew = ((theData[pos + 1] >> 8) & 0x7);
77  //int bxnnew = (((theData[pos+1] >> 8) & 0x3 )<<2) | ((theData[pos+1]>>6)&0x3) ;
78 
79  int rpc = (theData[pos] >> 12) & 0x7;
80  //int tbin = (theData[pos] >> 8) & 0xf;
81  //int bxn = bxnnew;
82  result.push_back(bxnnew);
83  result.push_back(rpc);
84  }
85  return result;
86 }

References mps_fire::result, omtf::DataWord64::rpc, size_, and theData.

◆ check()

bool CSCRPCData::check ( ) const
inline

Definition at line 24 of file CSCRPCData.h.

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

References size_, and theData.

◆ digis()

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

Definition at line 88 of file CSCRPCData.cc.

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

References debug, mps_fire::i, LogTrace, mps_fire::result, omtf::DataWord64::rpc, size_, and theData.

◆ nTbins()

int CSCRPCData::nTbins ( )
inline

Definition at line 22 of file CSCRPCData.h.

22 { return ntbins_; }

References ntbins_.

◆ Print()

void CSCRPCData::Print ( void  ) const

Definition at line 46 of file CSCRPCData.cc.

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 }

References mps_splice::line, LogTrace, omtf::DataWord64::rpc, size_, and theData.

◆ setDebug()

static void CSCRPCData::setDebug ( bool  debugValue)
inlinestatic

Definition at line 26 of file CSCRPCData.h.

26 { debug = debugValue; }

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

◆ sizeInWords()

int CSCRPCData::sizeInWords ( )
inline

Definition at line 21 of file CSCRPCData.h.

21 { return size_; }

References size_.

Referenced by CSCTMBData::UnpackTMB().

Member Data Documentation

◆ debug

std::atomic< 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 32 of file CSCRPCData.h.

Referenced by digis(), rrapi.RRApi::dprint(), util.rrapi.RRApi::dprint(), pkg.AbstractPkg::generate(), util.rrapi.RRApi::get(), rrapi.RRApi::get(), pkg.AbstractPkg::get_kwds(), runTauIdMVA.TauIDEmbedder::loadMVA_WPs_run2_2017(), runTauIdMVA.TauIDEmbedder::runTauID(), setDebug(), and pkg.AbstractPkg::write().

◆ ntbins_

int CSCRPCData::ntbins_
private

Definition at line 34 of file CSCRPCData.h.

Referenced by CSCRPCData(), and nTbins().

◆ size_

int CSCRPCData::size_
private

Definition at line 35 of file CSCRPCData.h.

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

◆ theData

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

Definition at line 36 of file CSCRPCData.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
CSCRPCData::debug
static std::atomic< bool > debug
Definition: CSCRPCData.h:32
pos
Definition: PixelAliasList.h:18
CSCRPCDigi
Definition: CSCRPCDigi.h:15
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCRPCData::theData
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
CSCRPCData::ntbins_
int ntbins_
Definition: CSCRPCData.h:34
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
mps_splice.line
line
Definition: mps_splice.py:76
omtf::DataWord64::rpc
Definition: OmtfDataWord64.h:16
CSCRPCData::size_
int size_
Definition: CSCRPCData.h:35