CMS 3D CMS Logo

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

#include <UCTCTP7RawData.h>

Public Types

enum  CaloType { EBEE =0, HBHE, HF }
 

Public Member Functions

uint32_t caloLinkBXID ()
 
const uint32_t * dataPtr () const
 
uint32_t getET (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool getFB (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
uint32_t getFeatureIndex (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
uint32_t getHFFeatureBits (bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
uint32_t getIndex (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
uint32_t getLinkStatus (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool isLinkDown (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool isLinkInError (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool isLinkMasked (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool isLinkMisaligned (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
bool isTowerMasked (CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
 
uint32_t nBXPerL1A ()
 
void print ()
 
uint32_t sof ()
 
 UCTCTP7RawData (const uint32_t *d)
 
virtual ~UCTCTP7RawData ()
 

Private Member Functions

const UCTCTP7RawDataoperator= (const UCTCTP7RawData &i)
 
 UCTCTP7RawData (const UCTCTP7RawData &)
 

Private Attributes

const uint32_t * myDataPtr
 

Detailed Description

Definition at line 9 of file UCTCTP7RawData.h.

Member Enumeration Documentation

Enumerator
EBEE 
HBHE 
HF 

Definition at line 12 of file UCTCTP7RawData.h.

Constructor & Destructor Documentation

UCTCTP7RawData::UCTCTP7RawData ( const uint32_t *  d)
inline

Definition at line 14 of file UCTCTP7RawData.h.

14  : myDataPtr(d) {
15  if(myDataPtr != 0) {
16  if(sof() != 0xA110CA7E) {
17  LogError("UCTCTP7RawData") << "Failed to see 0xA110CA7E at start - but continuing" << std::endl;
18  }
19  }
20  }
uint32_t sof()
const uint32_t * myDataPtr
tuple d
Definition: ztail.py:151
virtual UCTCTP7RawData::~UCTCTP7RawData ( )
inlinevirtual

Definition at line 22 of file UCTCTP7RawData.h.

22 {;}
UCTCTP7RawData::UCTCTP7RawData ( const UCTCTP7RawData )
private

Member Function Documentation

uint32_t UCTCTP7RawData::caloLinkBXID ( )
inline

Definition at line 30 of file UCTCTP7RawData.h.

30 {return (myDataPtr[1] & 0x00000FFF);}
const uint32_t * myDataPtr
const uint32_t* UCTCTP7RawData::dataPtr ( ) const
inline

Definition at line 26 of file UCTCTP7RawData.h.

26 {return myDataPtr;}
const uint32_t * myDataPtr
uint32_t UCTCTP7RawData::getET ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 144 of file UCTCTP7RawData.h.

References data, hcaldqm::constants::HF, and cmsHarvester::index.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

144  {
145  uint32_t index = getIndex(cType, negativeEta, cEta, iPhi);
146  const uint32_t data = myDataPtr[index];
147  uint32_t et = 0xDEADBEEF;
148  if(cType == HF) {
149  // Pick out the correct 8-bits for the iEta chosen
150  // Note that cEta = 41 is special, it only occurs for iPhi == 1 and shares cEta = 40 position
151  if(cEta == 41) et = ((data >> 16) & 0xFF);
152  else et = ((data >> ((cEta - 30) % 4) * 8) & 0xFF);
153  }
154  else {
155  // Pick out the correct 8-bits for the iPhi chosen
156  et = ((data >> (iPhi * 8)) & 0xFF);
157  }
158  return et;
159  }
const uint32_t * myDataPtr
uint32_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool UCTCTP7RawData::getFB ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 161 of file UCTCTP7RawData.h.

References data, benchmark_cfg::fb, hcaldqm::constants::HF, and cmsHarvester::index.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

161  {
162  uint32_t index = getFeatureIndex(cType, negativeEta, cEta, iPhi);
163  const uint32_t data = myDataPtr[index];
164  bool fb = false;
165  if(cType == HF) {
166  // Two bits are expected from HF - this is interface to get one compressed bit!
167  fb = (getHFFeatureBits(negativeEta, cEta, iPhi) != 0);
168  }
169  else {
170  // Pick out the correct bit for the tower chosen
171  uint32_t tower = iPhi;
172  if(((cEta - 1) % 2) == 1) {
173  tower += 4;
174  }
175  fb = ((data & (0x1 << tower)) != 0);
176  }
177  return fb;
178  }
uint32_t getHFFeatureBits(bool negativeEta, uint32_t cEta, uint32_t iPhi)
const uint32_t * myDataPtr
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
uint32_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t UCTCTP7RawData::getFeatureIndex ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 109 of file UCTCTP7RawData.h.

References hcaldqm::constants::HF, and cmsHarvester::index.

109  {
110  // Get index into the data words for the tower
111  uint32_t index = getIndex(cType, negativeEta, cEta, iPhi);
112  if(cType == EBEE || cType == HBHE) {
113  // Two 32-bit words contain ET, so we should offset the index to
114  // to the feature and link status bits
115  if(((cEta - 1) % 2) == 0) {
116  // [index] is offset to ET of first four towers (0 - 3)
117  // [index + 2] is where the feature and link status bits are
118  index += 2;
119  }
120  else {
121  // In this case [index] is offset to ET of second four towers (4 - 7)
122  // [index + 1] is where the feature and link status bits are
123  index += 1;
124  }
125  }
126  else if(cType == HF) {
127  // HF Fragment has different structure than EBEE and HBHE fragments
128  // First three 32-bit words have ETs for 11 objects (yes, 11 not 12)
129  // cEta = 40 / 41 are double in eta and flop bettween a and b HF fragments
130  // Further the remaining upper byte of the third word actually has feature
131  // bits. This feature index will point to the 4th 32-bit word. It is
132  // expected that the top byte from 3rd 32-bit word will be patched in within
133  // the feature bit access function.
134  // Since there are three instead of if block as above for EBEE, HBHE
135  // I wrote here a more compact implementation of index computation.
136  index += (3 - ((cEta - 30) / 4));
137  }
138  else {
139  return 0xDEADBEEF;
140  }
141  return index;
142  }
uint32_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t UCTCTP7RawData::getHFFeatureBits ( bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 180 of file UCTCTP7RawData.h.

References data, hcaldqm::constants::HF, cmsHarvester::index, and edm::shift.

180  {
181  uint32_t index = getFeatureIndex(HF, negativeEta, cEta, iPhi);
182  // Stitch together the top 8 bits from previous 32-bit word and bottom 14 bits from this word
183  const uint32_t data = ((myDataPtr[index] & 0x3FFF) << 8) + (myDataPtr[index - 1] >> 24);
184  uint32_t shift = (cEta - 30) * 2;
185  if(cEta == 41) shift = 20; // 41 occurs on b-fiber but shares the position of 40
186  return ((data >> shift) & 0x3);
187  }
const uint32_t * myDataPtr
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static unsigned int const shift
uint32_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t UCTCTP7RawData::getIndex ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 34 of file UCTCTP7RawData.h.

References hcaldqm::constants::HF, and cmsHarvester::index.

34  {
35  uint32_t index = 0xDEADBEEF;
36  if(cType == EBEE || cType == HBHE) {
37  if(iPhi > 3) {
38  LogError("UCTCTP7RawData") << "Incorrect iPhi; iPhi = " << iPhi << "; should be in [0,3]" << std::endl;
39  return 0xDEADBEEF;
40  }
41  if(cEta < 1 || cEta > 28) {
42  LogError("UCTCTP7RawData") << "Incorrect caloEta; cEta = " << cEta << "; should be in [1-28]" << std::endl;
43  return 0xDEADBEEF;
44  }
45  // ECAL/HB+HE fragment size is 3 32-bit words
46  // Each fragment covers 2 eta and 4 phi towers
47  // All four phi towers are in one 32-bit word
48  // Even and odd eta are in neighboring 32-bit words
49  index = 2 + ( ((cEta - 1) / 2) * (3 + 3) + ((cEta - 1) % 2) );
50  // But, towers are arranged in a peculiar order for firmware
51  // convenience - the index needs to be computing with these
52  // if statements. This is brittle code that one should be
53  // very careful with.
54  if(negativeEta) {
55  // Add offset for 6 ECAL and 6 HCAL fragments
56  index += (6 * (3 + 3));
57  }
58  else {
59  if(cEta > 12) {
60  // Add offset for 14 ECAL, 14 HB+HE and 2 HF fragments
61  // Note that first six are included in the definition of
62  // the variable - index
63  // Note also that HF fragments are larger at 4 32-bit words
64  index += ((14 * (3 + 3) + (2 * 4)));
65  }
66  }
67  // Data starts with ECAL towers so offset by 3 additional 32-bit words
68  if(cType == HBHE) index += 3;
69  }
70  else if(cType == HF) {
71  if(iPhi > 1) {
72  LogError("UCTCTP7RawData") << "HF iPhi should be 0 or 1 (for a , b) - invalid iPhi = " << iPhi << std::endl;
73  return 0xDEADBEEF;
74  }
75  if(cEta < 30 || cEta > 41) {
76  LogError("UCTCTP7RawData") << "HF cEta should be between 30 and 41 - invalid cEta = " << cEta << std::endl;
77  return 0xDEADBEEF;
78  }
79  if(negativeEta) {
80  if(iPhi == 0) {
81  // Offset by 6 positive eta and 14 negative eta EBEE/HBHE fragments (each 3 32-bit words)
82  // There are four HF cEta towers packed in each 32-bit word
83  // Add additional offset of 1 for (34-37) and 2 for (38-41)
84  index = 2 + 20 * (3 + 3) + ((cEta - 30) / 4);
85  }
86  else {
87  // Additional HF a fragment offset for HF b channel
88  index = 2 + 20 * (3 + 3) + 1 * 4 + ((cEta - 30) / 4);
89  }
90  }
91  else {
92  if(iPhi == 0) {
93  // Offset by all EBEE/HBHE and two HF fragments (4 32-bit words)
94  index = 2 + 2 * 14 * (3 + 3) + 2 * 4 + ((cEta - 30) / 4);
95  }
96  else {
97  // Additional HF a fragment offset for HF b channel
98  index = 2 + 2 * 14 * (3 + 3) + 3 * 4 + ((cEta - 30) / 4);
99  }
100  }
101  }
102  else {
103  LogError("UCTCTP7RawData") << "Unknown CaloType " << cType << std::endl;
104  return 0xDEADBEEF;
105  }
106  return index;
107  }
uint32_t UCTCTP7RawData::getLinkStatus ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 189 of file UCTCTP7RawData.h.

References data, and cmsHarvester::index.

189  {
190  uint32_t index = getFeatureIndex(cType, negativeEta, cEta, iPhi);
191  const uint32_t data = myDataPtr[index];
192  return (data >> 16);
193  }
const uint32_t * myDataPtr
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
uint32_t getFeatureIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool UCTCTP7RawData::isLinkDown ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 216 of file UCTCTP7RawData.h.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

216  {
217  uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
218  return ((linkStatus & 0x00004000) != 0);
219  }
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool UCTCTP7RawData::isLinkInError ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 211 of file UCTCTP7RawData.h.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

211  {
212  uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
213  return ((linkStatus & 0x00002000) != 0);
214  }
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool UCTCTP7RawData::isLinkMasked ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 221 of file UCTCTP7RawData.h.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

221  {
222  uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
223  return ((linkStatus & 0x00008000) != 0);
224  }
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool UCTCTP7RawData::isLinkMisaligned ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 206 of file UCTCTP7RawData.h.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

206  {
207  uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
208  return ((linkStatus & 0x00001000) != 0);
209  }
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool UCTCTP7RawData::isTowerMasked ( CaloType  cType,
bool  negativeEta,
uint32_t  cEta,
uint32_t  iPhi 
)
inline

Definition at line 195 of file UCTCTP7RawData.h.

References hcaldqm::constants::HF.

Referenced by L1TCaloLayer1RawToDigi::makeECalTPGs(), L1TCaloLayer1RawToDigi::makeHCalTPGs(), and L1TCaloLayer1RawToDigi::makeHFTPGs().

195  {
196  uint32_t linkStatus = getLinkStatus(cType, negativeEta, cEta, iPhi);
197  uint32_t tower = iPhi;
198  if(((cEta - 1) % 2) == 1) tower += 4;
199  if(cType == HF) {
200  tower = (cEta - 30);
201  if(cEta == 41) tower = 10;
202  }
203  return ((linkStatus & (0x1 << tower)) != 0);
204  }
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t UCTCTP7RawData::nBXPerL1A ( )
inline

Definition at line 32 of file UCTCTP7RawData.h.

32 {return ((myDataPtr[1] & 0x000F0000) >> 16);}
const uint32_t * myDataPtr
const UCTCTP7RawData& UCTCTP7RawData::operator= ( const UCTCTP7RawData i)
private
void UCTCTP7RawData::print ( void  )
inline

Definition at line 226 of file UCTCTP7RawData.h.

References gather_cfg::cout, TauDecayModes::dec, edm::first(), hcaldqm::constants::HF, and i.

Referenced by L1TCaloLayer1RawToDigi::produce().

226  {
227  using namespace std;
228  cout << "CTP7 Payload Header:" << endl;
229  cout << "No BX per L1A = " << dec << nBXPerL1A() << endl;
230  cout << "Calo BX ID = " << dec << caloLinkBXID() << endl;
231  CaloType cType = EBEE;
232  bool negativeEta = false;
233  bool first = true;
234  for(uint32_t i = 0; i < 2; i++) {
235  if(i != 0) negativeEta = true;
236  first = true;
237  cType = EBEE;
238  for(uint32_t cEta = 1; cEta <= 28; cEta++) {
239  for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
240  if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
241  getET(cType, negativeEta, cEta, iPhi) != 0) {
242  if(first) cout << "EcalET FG LinkStatus" << endl;
243  first = false;
244  cout << dec << setfill(' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) << " "
245  << getFB(cType, negativeEta, cEta, iPhi) << " "
246  << showbase << internal << setfill('0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
247  << " (" << dec << getIndex(cType, negativeEta, cEta, iPhi) << ", " << negativeEta << ", " << cEta << ", " << iPhi << ")"
248  << endl;
249  }
250  }
251  }
252  first = true;
253  cType = HBHE;
254  for(uint32_t cEta = 1; cEta <= 28; cEta++) {
255  for(uint32_t iPhi = 0; iPhi < 4; iPhi++) {
256  if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
257  getET(cType, negativeEta, cEta, iPhi) != 0) {
258  if(first) cout << "HcalET Feature LinkStatus" << endl;
259  first = false;
260  cout << dec << setfill(' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) << " "
261  << getFB(cType, negativeEta, cEta, iPhi) << " "
262  << showbase << internal << setfill('0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
263  << " (" << dec << getIndex(cType, negativeEta, cEta, iPhi) << ", " << negativeEta << ", " << cEta << ", " << iPhi << ")"
264  << endl;
265  }
266  }
267  }
268  first = true;
269  cType = HF;
270  for(uint32_t cEta = 30; cEta <= 40; cEta++) {
271  for(uint32_t iPhi = 0; iPhi < 2; iPhi++) {
272  if(iPhi == 1 && cEta == 40) cEta = 41;
273  if(getLinkStatus(cType, negativeEta, cEta, iPhi) != 0 ||
274  getET(cType, negativeEta, cEta, iPhi) != 0) {
275  if(first) cout << "HF-ET Feature LinkStatus" << endl;
276  first = false;
277  cout << dec << setfill(' ') << setw(6) << getET(cType, negativeEta, cEta, iPhi) << " "
278  << dec << setfill(' ') << setw(2) << getHFFeatureBits(negativeEta, cEta, iPhi) << " "
279  << showbase << internal << setfill('0') << setw(10) << hex << getLinkStatus(cType, negativeEta, cEta, iPhi)
280  << " (" << dec << getIndex(cType, negativeEta, cEta, iPhi) << ", " << negativeEta << ", " << cEta << ", " << iPhi << ")"
281  << endl;
282  }
283  }
284  }
285  }
286  }
int i
Definition: DBlmapReader.cc:9
uint32_t getHFFeatureBits(bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t caloLinkBXID()
uint32_t nBXPerL1A()
uint32_t getLinkStatus(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t getIndex(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
uint32_t getET(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
bool getFB(CaloType cType, bool negativeEta, uint32_t cEta, uint32_t iPhi)
tuple cout
Definition: gather_cfg.py:145
uint32_t UCTCTP7RawData::sof ( )
inline

Definition at line 28 of file UCTCTP7RawData.h.

28 {return myDataPtr[0];}
const uint32_t * myDataPtr

Member Data Documentation

const uint32_t* UCTCTP7RawData::myDataPtr
private

Definition at line 297 of file UCTCTP7RawData.h.