CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 std::atomic< bool > debug {false}
 

Detailed Description

Definition at line 11 of file CSCRPCData.h.

Constructor & Destructor Documentation

CSCRPCData::CSCRPCData ( int  ntbins = 7)

default constructor

Definition at line 25 of file CSCRPCData.cc.

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

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 }
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
int ntbins_
Definition: CSCRPCData.h:34
CSCRPCData::CSCRPCData ( const unsigned short *  b04buf,
int  length 
)

Definition at line 39 of file CSCRPCData.cc.

References ntbins_, size_, and theData.

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 }
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
int ntbins_
Definition: CSCRPCData.h:34

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 mps_fire::result, omtf::DataWord64::rpc, size_, and theData.

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 }
tuple result
Definition: mps_fire.py:311
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
bool CSCRPCData::check ( ) const
inline

Definition at line 24 of file CSCRPCData.h.

References size_, and theData.

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

Definition at line 88 of file CSCRPCData.cc.

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

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 }
static std::atomic< bool > debug
Definition: CSCRPCData.h:32
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
int CSCRPCData::nTbins ( )
inline

Definition at line 22 of file CSCRPCData.h.

References ntbins_.

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

Definition at line 46 of file CSCRPCData.cc.

References geometryCSVtoXML::line, LogTrace, omtf::DataWord64::rpc, 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 }
#define LogTrace(id)
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:36
static void CSCRPCData::setDebug ( bool  debugValue)
inlinestatic

Definition at line 26 of file CSCRPCData.h.

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

26 { debug = debugValue; }
static std::atomic< bool > debug
Definition: CSCRPCData.h:32
int CSCRPCData::sizeInWords ( )
inline

Definition at line 21 of file CSCRPCData.h.

References size_.

Referenced by CSCTMBData::UnpackTMB().

21 { return size_; }

Member Data Documentation

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().

int CSCRPCData::ntbins_
private

Definition at line 34 of file CSCRPCData.h.

Referenced by CSCRPCData(), and nTbins().

int CSCRPCData::size_
private

Definition at line 35 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 36 of file CSCRPCData.h.

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