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  int ix(0), ixx(x);
8  if (x < 0) {
9  ix = 1;
10  ixx = -x;
11  }
12  int iy(0), iyy(y);
13  if (y < 0) {
14  iy = 1;
15  iyy = -y;
16  }
17  uint32_t idx = (det & kHcalBeamTypeMask) << kHcalBeamTypeOffset;
23 
24 #ifdef EDM_ML_DEBUG
25  std::cout << "HcalTestBeamNumbering: Detector " << det << " Layer " << lay << " x " << x << " " << ix << " " << ixx
26  << " y " << y << " " << iy << " " << iyy << " ID " << std::hex << idx << std::dec << std::endl;
27 #endif
28  return idx;
29 }
30 
31 void HcalTestBeamNumbering::unpackIndex(const uint32_t& idx, int& det, int& lay, int& x, int& y) {
37  y = -y;
39  x = -x;
40 
41 #ifdef EDM_ML_DEBUG
42  std::cout << "HcalTestBeamNumbering: ID " << std::hex << idx << std::dec << " Detector " << det << " Layer " << lay
43  << " x " << x << " y " << y << std::endl;
44 #endif
45 }
static const int kHcalBeamYValueOffset
static const int kHcalBeamYSignMask
static const int kHcalBeamLayerMask
static const int kHcalBeamYValueMask
static const int kHcalBeamXSignMask
static uint32_t packIndex(int det, int lay, int x, int y)
const int iyy[18][41][3]
const int ixx[18][41][3]
static const int kHcalBeamXValueMask
static const int kHcalBeamLayerOffset
static const int kHcalBeamTypeMask
static const int kHcalBeamYSignOffset
static const int kHcalBeamXSignOffset
static const int kHcalBeamXValueOffset
float x
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
static const int kHcalBeamTypeOffset