Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InttDeadMap.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InttDeadMap.cc
1 #include "InttDeadMap.h"
2 
4 
5 #include <cassert>
6 #include <iostream>
7 #include <limits>
8 
10 
11 const InttDeadMap::Map&
13 {
14  static Map tmp_map;
15  return tmp_map;
16 }
17 
20 {
21  static Map tmp_map;
22  return tmp_map;
23 }
24 
26  const int ladder_phi, const int ladder_z,
27  const int strip_z, const int strip_phi)
28 {
30  ladder_phi, ladder_z,
31  strip_z, strip_phi));
32 }
33 
35  const int ladder_phi, const int ladder_z,
36  const int strip_z, const int strip_phi) const
37 {
38  if (isDeadChannel(getInttKey(layer,
39  ladder_phi, ladder_z,
40  strip_z, strip_phi)))
41  {
42  return true;
43  }
44  else if (isDeadChannel(getInttKey(layer,
45  ladder_phi, ladder_z,
46  strip_z, s_wildCardID)))
47  {
48  return true;
49  }
50  else if (isDeadChannel(getInttKey(layer,
51  ladder_phi, ladder_z,
53  {
54  return true;
55  }
56  else if (isDeadChannel(getInttKey(layer,
57  ladder_phi, s_wildCardID,
59  {
60  return true;
61  }
62  else if (isDeadChannel(getInttKey(layer,
65  {
66  return true;
67  }
68  return false;
69 }
70 
72 {
73  return size() > 0;
74 }
75 
76 void InttDeadMap::identify(std::ostream& os) const
77 {
78  os << "InttDeadMap base class" << std::endl;
79 }
80 
82  int ladder_phi, int ladder_z,
83  int strip_z, int strip_phi)
84 {
85  static const int layer_bit = 8;
86  static const int ladder_phi_bit = 16;
87  static const int ladder_z_bit = 8;
88  static const int strip_z_bit = 16;
89  static const int strip_phi_bit = 16;
90 
91  bool wildcard = false;
92 
93  if (layer == s_wildCardID) wildcard = true;
94  if (wildcard) layer = (1 << layer_bit) - 1;
95 
96  if (ladder_phi == s_wildCardID) wildcard = true;
97  if (wildcard) ladder_phi = (1 << ladder_phi_bit) - 1;
98 
99  if (ladder_z == s_wildCardID) wildcard = true;
100  if (wildcard) ladder_z = (1 << ladder_z_bit) - 1;
101 
102  if (strip_z == s_wildCardID) wildcard = true;
103  if (wildcard) strip_z = (1 << strip_z_bit) - 1;
104 
105  if (strip_phi == s_wildCardID) wildcard = true;
106  if (wildcard) strip_phi = (1 << strip_phi_bit) - 1;
107 
108  // bit sum check
109  assert(layer_bit + ladder_phi_bit + ladder_z_bit + strip_z_bit + strip_phi_bit == std::numeric_limits<PHG4CellDefs::keytype>::digits);
110 
111  //max range check
112  assert(layer < (1 << layer_bit));
113  assert(ladder_phi < (1 << ladder_phi_bit));
114  assert(ladder_z < (1 << ladder_z_bit));
115  assert(strip_z < (1 << strip_z_bit));
116  assert(strip_phi < (1 << strip_phi_bit));
117 
118  //min range check
119  assert(layer >= 0);
120  assert(ladder_phi >= 0);
121  assert(ladder_z >= 0);
122  assert(strip_z >= 0);
123  assert(strip_phi >= 0);
124 
125  PHG4CellDefs::keytype key = 0;
126 
127  key += layer;
128 
129  key <<= ladder_phi_bit;
130  key += ladder_phi;
131 
132  key <<= ladder_z_bit;
133  key += ladder_z;
134 
135  key <<= strip_z_bit;
136  key += strip_z;
137 
138  key <<= strip_phi_bit;
139  key += strip_phi;
140 
141  return key;
142 }