CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecordCD.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 
5 using namespace rpcrawtodigi;
6 using namespace std;
7 
8 RecordCD::RecordCD(int lbInLink, int partitionNumber, int eod, int halfP,
9  const std::vector<int> & packedStrips) : DataRecord(0)
10 {
11  theData = 0;
12 
13  theData |= (lbInLink <<CHAMBER_SHIFT);
14 
15  theData |= (partitionNumber<<PARTITION_NUMBER_SHIFT);
16 
17  theData |= (eod<<EOD_SHIFT );
18 
19  theData |= (halfP<<HALFP_SHIFT);
20 
21  int partitionData = 0;
22  for (vector<int>::const_iterator iv = packedStrips.begin(); iv != packedStrips.end(); iv++ ) {
23  int ibit = (partitionNumber) ? (*iv)%(partitionNumber*BITS_PER_PARTITION) : (*iv);
24  partitionData |= (1<<ibit);
25  }
26  theData |= (partitionData<<PARTITION_DATA_SHIFT);
27 }
28 
29 int RecordCD::lbInLink() const
30 {
31  return (theData >> CHAMBER_SHIFT ) & CHAMBER_MASK ;
32 }
33 
35 {
37 }
38 
39 int RecordCD::eod() const
40 {
41  return (theData >> EOD_SHIFT ) & EOD_MASK;
42 }
43 
44 int RecordCD::halfP() const
45 {
46  return (theData >> HALFP_SHIFT ) & HALFP_MASK;
47 }
48 
50 {
52 }
53 
54 std::vector<int> RecordCD::packedStrips() const
55 {
56  int partitionNumber = this->partitionNumber();
57  int partitionData = this->partitionData();
58  std::vector<int> strips;
59  for (int ib=0; ib <8; ++ib) {
60  if ((partitionData>>ib)& 1) strips.push_back( partitionNumber* BITS_PER_PARTITION + ib);
61  }
62  return strips;
63 }
64 
65 std::string RecordCD::print() const
66 {
67  std::ostringstream str;
68  str <<" DATA";
69  return str.str();
70 }
int eod() const
Definition: RecordCD.cc:39
int lbInLink() const
Definition: RecordCD.cc:29
static const int HALFP_SHIFT
Definition: RecordCD.h:21
static const int HALFP_MASK
Definition: RecordCD.h:20
static const int CHAMBER_SHIFT
Definition: RecordCD.h:27
static const int EOD_MASK
Definition: RecordCD.h:23
int partitionData() const
Definition: RecordCD.cc:49
std::string print() const
Definition: RecordCD.cc:65
static const int PARTITION_DATA_MASK
Definition: RecordCD.h:14
int halfP() const
Definition: RecordCD.cc:44
static const int CHAMBER_MASK
Definition: RecordCD.h:26
int partitionNumber() const
Definition: RecordCD.cc:34
static const int PARTITION_DATA_SHIFT
Definition: RecordCD.h:15
std::vector< int > packedStrips() const
Definition: RecordCD.cc:54
static const int PARTITION_NUMBER_SHIFT
Definition: RecordCD.h:18
static const int PARTITION_NUMBER_MASK
Definition: RecordCD.h:17
static const int EOD_SHIFT
Definition: RecordCD.h:24
static const int BITS_PER_PARTITION
Definition: RecordCD.h:29