CMS 3D CMS Logo

HcalTestBeamNumbering.cc
Go to the documentation of this file.
2 #include <iostream>
3 
4 //#define EDM_ML_DEBUG
5 
6 uint32_t HcalTestBeamNumbering::packIndex(int det, int lay, int x, int y) {
7 
8  int ix(0), ixx(x);
9  if (x < 0) { ix = 1; ixx =-x;}
10  int iy(0), iyy(y);
11  if (y < 0) { iy = 1; iyy =-y;}
12  uint32_t idx = (det&kHcalBeamTypeMask)<<kHcalBeamTypeOffset;
18 
19 #ifdef EDM_ML_DEBUG
20  std::cout << "HcalTestBeamNumbering: Detector " << det << " Layer " << lay
21  << " x " << x << " " << ix << " " << ixx << " y " << y << " "
22  << iy << " " << iyy << " ID " << std::hex << idx << std::dec
23  << std::endl;
24 #endif
25  return idx;
26 }
27 
28 void HcalTestBeamNumbering::unpackIndex(const uint32_t& idx, int& det, int& lay,
29  int& x, int& y) {
30 
35  if (((idx>>kHcalBeamYSignOffset)&kHcalBeamYSignMask) == 1) y = -y;
36  if (((idx>>kHcalBeamXSignOffset)&kHcalBeamXSignMask) == 1) x = -x;
37 
38 #ifdef EDM_ML_DEBUG
39  std::cout << "HcalTestBeamNumbering: ID " << std::hex << idx << std::dec
40  << " Detector " << det << " Layer " << lay << " x " << x << " y "
41  << y << std::endl;
42 #endif
43 }
static const int kHcalBeamYValueOffset
int iyy[18][41][3]
static const int kHcalBeamYSignMask
static const int kHcalBeamLayerMask
int ixx[18][41][3]
static const int kHcalBeamYValueMask
static const int kHcalBeamXSignMask
static uint32_t packIndex(int det, int lay, int x, int y)
static const int kHcalBeamXValueMask
T x() const
Cartesian x coordinate.
static const int kHcalBeamLayerOffset
static const int kHcalBeamTypeMask
static const int kHcalBeamYSignOffset
static const int kHcalBeamXSignOffset
static const int kHcalBeamXValueOffset
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
static const int kHcalBeamTypeOffset