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

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

Definition at line 41 of file CSCRPCData.cc.

References ntbins_, size_, and theData.

42  : size_(length)
43 {
44  //size_ = ntbins_*2*4+2;
45  // header & trailer word, + 4 RPCs per time bin, 2 lines per RPC
46  ntbins_ = (size_-2)/8;
47  memcpy(theData, buf, size_*2);
48 }
unsigned short theData[2 *4 *32+2]
Definition: CSCRPCData.h:37
int ntbins_
Definition: CSCRPCData.h:35

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

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

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

Definition at line 25 of file CSCRPCData.h.

References size_, and theData.

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

Definition at line 95 of file CSCRPCData.cc.

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

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

Definition at line 23 of file CSCRPCData.h.

References ntbins_, and Print().

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

Definition at line 50 of file CSCRPCData.cc.

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

Referenced by nTbins().

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

Definition at line 27 of file CSCRPCData.h.

References debug.

Referenced by CSCDCCUnpacker::CSCDCCUnpacker().

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

Definition at line 22 of file CSCRPCData.h.

References size_.

Referenced by CSCTMBData::UnpackTMB().

22 {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 33 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 35 of file CSCRPCData.h.

Referenced by CSCRPCData(), and nTbins().

int CSCRPCData::size_
private

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

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