CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
18  idx += (lay & kHcalBeamLayerMask) << kHcalBeamLayerOffset;
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) {
32  det = (idx >> kHcalBeamTypeOffset) & kHcalBeamTypeMask;
36  if (((idx >> kHcalBeamYSignOffset) & kHcalBeamYSignMask) == 1)
37  y = -y;
38  if (((idx >> kHcalBeamXSignOffset) & kHcalBeamXSignMask) == 1)
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
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
static const int kHcalBeamTypeMask
static const int kHcalBeamYSignOffset
static const int kHcalBeamXSignOffset
static const int kHcalBeamXValueOffset
tuple cout
Definition: gather_cfg.py:144
static void unpackIndex(const uint32_t &idx, int &det, int &lay, int &x, int &y)
static const int kHcalBeamTypeOffset