CMS 3D CMS Logo

HBHELinearMap.h
Go to the documentation of this file.
1 #ifndef CondFormats_HcalObjects_HBHELinearMap_h_
2 #define CondFormats_HcalObjects_HBHELinearMap_h_
3 
4 //
5 // Linearize the channel id in the HBHE
6 //
7 // I. Volobouev
8 // September 2014
9 //
10 
11 #include <vector>
12 #include <utility>
13 
15 
17 public:
18  enum { ChannelCount = 5184U };
19 
20  HBHELinearMap();
21 
22  // Mapping from the depth/ieta/iphi triple which uniquely
23  // identifies an HBHE channel into a linear index, currently
24  // from 0 to 5183 (inclusive). This linear index should not
25  // be treated as anything meaningful -- consider it to be
26  // just a convenient unique key in a database table.
27  unsigned linearIndex(unsigned depth, int ieta, unsigned iphi) const;
28 
29  // Check whether the given triple is a valid depth/ieta/iphi combination
30  bool isValidTriple(unsigned depth, int ieta, unsigned iphi) const;
31 
32  // Inverse mapping, from a linear index into depth/ieta/iphi triple.
33  // Any of the argument pointers is allowed to be NULL in which case
34  // the corresponding variable is simply not filled out.
35  void getChannelTriple(unsigned index, unsigned* depth, int* ieta, unsigned* iphi) const;
36 
37  // The following assumes a valid HBHE depth/ieta combination
38  static HcalSubdetector getSubdetector(unsigned depth, int ieta);
39 
40 private:
41  class HBHEChannelId {
42  public:
43  inline HBHEChannelId() : depth_(1000U), ieta_(1000), iphi_(1000U) {}
44 
45  inline HBHEChannelId(const unsigned i_depth, const int i_ieta, const unsigned i_iphi)
46  : depth_(i_depth), ieta_(i_ieta), iphi_(i_iphi) {}
47 
48  // Inspectors
49  inline unsigned depth() const { return depth_; }
50  inline int ieta() const { return ieta_; }
51  inline unsigned iphi() const { return iphi_; }
52 
53  inline bool operator<(const HBHEChannelId& r) const {
54  if (depth_ < r.depth_)
55  return true;
56  if (r.depth_ < depth_)
57  return false;
58  if (ieta_ < r.ieta_)
59  return true;
60  if (r.ieta_ < ieta_)
61  return false;
62  return iphi_ < r.iphi_;
63  }
64 
65  inline bool operator==(const HBHEChannelId& r) const {
66  return depth_ == r.depth_ && ieta_ == r.ieta_ && iphi_ == r.iphi_;
67  }
68 
69  inline bool operator!=(const HBHEChannelId& r) const { return !(*this == r); }
70 
71  private:
72  unsigned depth_;
73  int ieta_;
74  unsigned iphi_;
75  };
76 
77  typedef std::pair<HBHEChannelId, unsigned> MapPair;
78  typedef std::vector<MapPair> ChannelMap;
79 
80  unsigned find(unsigned depth, int ieta, unsigned iphi) const;
81 
84 };
85 
86 // Standard map
88 
89 #endif // CondFormats_HcalObjects_HBHELinearMap_h_
HBHELinearMap::getChannelTriple
void getChannelTriple(unsigned index, unsigned *depth, int *ieta, unsigned *iphi) const
Definition: HBHELinearMap.cc:7
HBHELinearMap::HBHEChannelId::ieta
int ieta() const
Definition: HBHELinearMap.h:50
HBHELinearMap::HBHEChannelId::operator!=
bool operator!=(const HBHEChannelId &r) const
Definition: HBHELinearMap.h:69
HBHELinearMap::ChannelCount
Definition: HBHELinearMap.h:18
HBHELinearMap::getSubdetector
static HcalSubdetector getSubdetector(unsigned depth, int ieta)
Definition: HBHELinearMap.cc:113
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HBHELinearMap::HBHEChannelId::HBHEChannelId
HBHEChannelId()
Definition: HBHELinearMap.h:43
HBHELinearMap::HBHEChannelId::HBHEChannelId
HBHEChannelId(const unsigned i_depth, const int i_ieta, const unsigned i_iphi)
Definition: HBHELinearMap.h:45
HBHELinearMap::HBHEChannelId::iphi_
unsigned iphi_
Definition: HBHELinearMap.h:74
HBHELinearMap::MapPair
std::pair< HBHEChannelId, unsigned > MapPair
Definition: HBHELinearMap.h:77
HBHELinearMap::HBHELinearMap
HBHELinearMap()
Definition: HBHELinearMap.cc:44
HBHELinearMap::find
unsigned find(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:21
HBHELinearMap::HBHEChannelId::ieta_
int ieta_
Definition: HBHELinearMap.h:73
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HBHELinearMap::isValidTriple
bool isValidTriple(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:30
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HBHELinearMap::HBHEChannelId::operator<
bool operator<(const HBHEChannelId &r) const
Definition: HBHELinearMap.h:53
HBHELinearMap::linearIndex
unsigned linearIndex(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:35
HBHELinearMap::HBHEChannelId::operator==
bool operator==(const HBHEChannelId &r) const
Definition: HBHELinearMap.h:65
HBHELinearMap::HBHEChannelId
Definition: HBHELinearMap.h:41
HBHELinearMap::lookup_
HBHEChannelId lookup_[ChannelCount]
Definition: HBHELinearMap.h:82
HBHELinearMap::inverse_
ChannelMap inverse_
Definition: HBHELinearMap.h:83
HcalSubdetector.h
HBHELinearMap
Definition: HBHELinearMap.h:16
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
hbheChannelMap
const HBHELinearMap & hbheChannelMap()
Definition: HBHELinearMap.cc:139
HBHELinearMap::HBHEChannelId::depth
unsigned depth() const
Definition: HBHELinearMap.h:49
HBHELinearMap::ChannelMap
std::vector< MapPair > ChannelMap
Definition: HBHELinearMap.h:78
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HBHELinearMap::HBHEChannelId::iphi
unsigned iphi() const
Definition: HBHELinearMap.h:51
HBHELinearMap::HBHEChannelId::depth_
unsigned depth_
Definition: HBHELinearMap.h:72