CMS 3D CMS Logo

GEMROMapping.h
Go to the documentation of this file.
1 #ifndef CondFormats_GEMObjects_GEMROMapping_h
2 #define CondFormats_GEMObjects_GEMROMapping_h
4 #include <map>
5 #include <vector>
6 
7 class GEMROMapping {
8 public:
9  struct chamEC {
10  unsigned int fedId;
11  uint8_t amcNum;
12  uint8_t gebId;
13  bool operator<(const chamEC& r) const {
14  if (fedId == r.fedId) {
15  if (amcNum == r.amcNum) {
16  return gebId < r.gebId;
17  } else {
18  return amcNum < r.amcNum;
19  }
20  } else {
21  return fedId < r.fedId;
22  }
23  }
24  };
25 
26  struct chamDC {
28  int vfatVer;
29  bool operator<(const chamDC& r) const { return detId < r.detId; }
30  };
31 
32  struct vfatEC {
33  uint16_t vfatAdd;
35  bool operator<(const vfatEC& r) const {
36  if (vfatAdd == r.vfatAdd) {
37  return detId < r.detId;
38  } else {
39  return vfatAdd < r.vfatAdd;
40  }
41  }
42  };
43 
44  struct vfatDC {
45  int vfatType;
47  int localPhi;
48  bool operator<(const vfatDC& r) const {
49  if (vfatType == r.vfatType) {
50  if (detId == r.detId) {
51  return localPhi < r.localPhi;
52  } else {
53  return detId < r.detId;
54  }
55  } else {
56  return vfatType < r.vfatType;
57  }
58  }
59  };
60 
61  struct channelNum {
62  int vfatType;
63  int chNum;
64  bool operator<(const channelNum& c) const {
65  if (vfatType == c.vfatType)
66  return chNum < c.chNum;
67  else
68  return vfatType < c.vfatType;
69  }
70  };
71 
72  struct stripNum {
73  int vfatType;
74  int stNum;
75  bool operator<(const stripNum& s) const {
76  if (vfatType == s.vfatType)
77  return stNum < s.stNum;
78  else
79  return vfatType < s.vfatType;
80  }
81  };
82 
84 
85  bool isValidChipID(const vfatEC& r) const { return vMapED_.find(r) != vMapED_.end(); }
86  bool isValidChamber(const chamEC& r) const { return chamED_.find(r) != chamED_.end(); }
87 
88  const chamDC& chamberPos(const chamEC& r) const { return chamED_.at(r); }
89  void add(chamEC e, chamDC d) { chamED_[e] = d; }
90 
91  const std::vector<vfatEC> getVfats(const GEMDetId& r) const { return chamVfats_.at(r); }
92  void add(GEMDetId e, vfatEC d) { chamVfats_[e].push_back(d); }
93 
94  const vfatDC& vfatPos(const vfatEC& r) const { return vMapED_.at(r); }
95  void add(vfatEC e, vfatDC d) { vMapED_[e] = d; }
96 
97  const channelNum& hitPos(const stripNum& s) const { return stChMap_.at(s); }
98  const stripNum& hitPos(const channelNum& c) const { return chStMap_.at(c); }
99 
100  void add(channelNum c, stripNum s) { chStMap_[c] = s; }
101  void add(stripNum s, channelNum c) { stChMap_[s] = c; }
102 
103 private:
104  std::map<chamEC, chamDC> chamED_;
105 
106  std::map<GEMDetId, std::vector<vfatEC>> chamVfats_;
107 
108  std::map<vfatEC, vfatDC> vMapED_;
109 
110  std::map<channelNum, stripNum> chStMap_;
111  std::map<stripNum, channelNum> stChMap_;
112 };
113 #endif
void add(channelNum c, stripNum s)
Definition: GEMROMapping.h:100
void add(stripNum s, channelNum c)
Definition: GEMROMapping.h:101
bool operator<(const vfatDC &r) const
Definition: GEMROMapping.h:48
std::map< stripNum, channelNum > stChMap_
Definition: GEMROMapping.h:111
const channelNum & hitPos(const stripNum &s) const
Definition: GEMROMapping.h:97
void add(chamEC e, chamDC d)
Definition: GEMROMapping.h:89
std::map< vfatEC, vfatDC > vMapED_
Definition: GEMROMapping.h:108
unsigned int fedId
Definition: GEMROMapping.h:10
bool operator<(const stripNum &s) const
Definition: GEMROMapping.h:75
bool operator<(const chamDC &r) const
Definition: GEMROMapping.h:29
bool operator<(const channelNum &c) const
Definition: GEMROMapping.h:64
std::map< chamEC, chamDC > chamED_
Definition: GEMROMapping.h:104
const vfatDC & vfatPos(const vfatEC &r) const
Definition: GEMROMapping.h:94
d
Definition: ztail.py:151
void add(GEMDetId e, vfatEC d)
Definition: GEMROMapping.h:92
bool operator<(const vfatEC &r) const
Definition: GEMROMapping.h:35
const chamDC & chamberPos(const chamEC &r) const
Definition: GEMROMapping.h:88
std::map< GEMDetId, std::vector< vfatEC > > chamVfats_
Definition: GEMROMapping.h:106
bool isValidChamber(const chamEC &r) const
Definition: GEMROMapping.h:86
bool isValidChipID(const vfatEC &r) const
Definition: GEMROMapping.h:85
const std::vector< vfatEC > getVfats(const GEMDetId &r) const
Definition: GEMROMapping.h:91
const stripNum & hitPos(const channelNum &c) const
Definition: GEMROMapping.h:98
std::map< channelNum, stripNum > chStMap_
Definition: GEMROMapping.h:110
bool operator<(const chamEC &r) const
Definition: GEMROMapping.h:13
void add(vfatEC e, vfatDC d)
Definition: GEMROMapping.h:95