CMS 3D CMS Logo

HGCalWaferIndex.cc
Go to the documentation of this file.
2 
3 const int kHGCalWaferUOffset = 0;
4 const int kHGCalWaferUMask = 0x1F;
5 const int kHGCalWaferUSignOffset = 5;
6 const int kHGCalWaferUSignMask = 0x1;
7 const int kHGCalWaferVOffset = 6;
8 const int kHGCalWaferVMask = 0x1F;
9 const int kHGCalWaferVSignOffset = 11;
10 const int kHGCalWaferVSignMask = 0x1;
11 const int kHGCalLayerOffset = 18;
12 const int kHGCalLayerMask = 0x1F;
13 const int kHGCalWaferCopyOffset = 0;
14 const int kHGCalWaferCopyMask = 0x7FFFF;
15 const int kHGCalLayerOldMask = 0x1000000;
16 
17 int32_t HGCalWaferIndex::waferIndex(int32_t layer, int32_t waferU,
18  int32_t waferV, bool old) {
19  int32_t id(0);
20  if (old) {
21  id |=
24  } else {
25  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
26  int waferUsign = (waferU >= 0) ? 0 : 1;
27  int waferVsign = (waferV >= 0) ? 0 : 1;
28  id |= (((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) |
29  ((waferUsign & kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) |
30  ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) |
31  ((waferVsign & kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) |
32  ((layer & kHGCalLayerMask) << kHGCalLayerOffset));
33  }
34  return id;
35 }
36 
37 int HGCalWaferIndex::waferLayer(const int32_t id) {
38  return (id >> kHGCalLayerOffset) & kHGCalLayerMask;
39 }
40 
41 int HGCalWaferIndex::waferU(const int32_t id) {
42  int32_t iu = (id >> kHGCalWaferUOffset) & kHGCalWaferUMask;
43  return (((id >> kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -iu : iu);
44 }
45 
46 int HGCalWaferIndex::waferV(const int32_t id) {
47  int32_t iv = (id >> kHGCalWaferVOffset) & kHGCalWaferVMask;
48  return (((id >> kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -iv : iv);
49 }
50 
51 int HGCalWaferIndex::waferCopy(const int32_t id) {
53 }
54 
55 bool HGCalWaferIndex::waferFormat(const int32_t id) {
56  return ((id & kHGCalLayerOldMask) == 0);
57 }
const int kHGCalWaferVMask
const int kHGCalWaferUSignMask
const int kHGCalWaferVSignOffset
static int32_t waferV(const int32_t index)
const int kHGCalWaferUMask
static int32_t waferCopy(const int32_t index)
const int kHGCalLayerMask
const int kHGCalLayerOldMask
const int kHGCalWaferCopyOffset
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int32_t waferU(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
const int kHGCalWaferVSignMask
static int32_t waferLayer(const int32_t index)
const int kHGCalWaferCopyMask
const int kHGCalLayerOffset
const int kHGCalWaferUOffset
static bool waferFormat(const int32_t index)
const int kHGCalWaferUSignOffset
const int kHGCalWaferVOffset