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 #include <algorithm>
7 
8 class GEMROMapping {
9  // EC electronics corrdinate
10  // DC GEMDetId corrdinate
11  // geb = GEM electronics board == OptoHybrid
12 public:
13  struct sectorEC {
14  unsigned int fedId;
15  uint8_t amcNum;
16  bool operator==(const sectorEC& r) const {
17  if (fedId == r.fedId) {
18  return amcNum == r.amcNum;
19  } else {
20  return false;
21  }
22  }
23  };
24 
25  struct chamEC {
26  unsigned int fedId;
27  uint8_t amcNum;
28  uint8_t gebId;
29  bool operator<(const chamEC& r) const {
30  if (fedId == r.fedId) {
31  if (amcNum == r.amcNum) {
32  return gebId < r.gebId;
33  } else {
34  return amcNum < r.amcNum;
35  }
36  } else {
37  return fedId < r.fedId;
38  }
39  }
40  };
41 
42  struct chamDC {
44  int vfatVer;
45  bool operator<(const chamDC& r) const { return detId < r.detId; }
46  };
47 
48  struct vfatEC {
49  uint16_t vfatAdd;
51  bool operator<(const vfatEC& r) const {
52  if (vfatAdd == r.vfatAdd) {
53  return detId < r.detId;
54  } else {
55  return vfatAdd < r.vfatAdd;
56  }
57  }
58  };
59 
60  struct vfatDC {
61  int vfatType;
63  int localPhi;
64  bool operator<(const vfatDC& r) const {
65  if (vfatType == r.vfatType) {
66  if (detId == r.detId) {
67  return localPhi < r.localPhi;
68  } else {
69  return detId < r.detId;
70  }
71  } else {
72  return vfatType < r.vfatType;
73  }
74  }
75  };
76 
77  struct channelNum {
78  int vfatType;
79  int chNum;
80  bool operator<(const channelNum& c) const {
81  if (vfatType == c.vfatType)
82  return chNum < c.chNum;
83  else
84  return vfatType < c.vfatType;
85  }
86  };
87 
88  struct stripNum {
89  int vfatType;
90  int stNum;
91  bool operator<(const stripNum& s) const {
92  if (vfatType == s.vfatType)
93  return stNum < s.stNum;
94  else
95  return vfatType < s.vfatType;
96  }
97  };
98 
100 
101  bool isValidChipID(const vfatEC& r) const { return vfatMap_.find(r) != vfatMap_.end(); }
102  bool isValidChamber(const chamEC& r) const { return chamberMap_.find(r) != chamberMap_.end(); }
103 
104  bool isValidAMC(const sectorEC& r) const { return std::find(amcVec_.begin(), amcVec_.end(), r) != amcVec_.end(); }
105 
106  void add(sectorEC e) { amcVec_.push_back(e); }
107 
108  const chamDC& chamberPos(const chamEC& r) const { return chamberMap_.at(r); }
109  void add(chamEC e, chamDC d) { chamberMap_[e] = d; }
110 
111  const std::vector<vfatEC> getVfats(const GEMDetId& r) const { return chamVfats_.at(r); }
112  void add(GEMDetId e, vfatEC d) { chamVfats_[e].push_back(d); }
113 
114  const vfatDC& vfatPos(const vfatEC& r) const { return vfatMap_.at(r); }
115  void add(vfatEC e, vfatDC d) { vfatMap_[e] = d; }
116 
117  const channelNum& hitPos(const stripNum& s) const { return stChMap_.at(s); }
118  const stripNum& hitPos(const channelNum& c) const { return chStMap_.at(c); }
119 
120  void add(channelNum c, stripNum s) { chStMap_[c] = s; }
121  void add(stripNum s, channelNum c) { stChMap_[s] = c; }
122 
123 private:
124  std::vector<sectorEC> amcVec_;
125 
126  // electronics map to GEMDetId chamber
127  std::map<chamEC, chamDC> chamberMap_;
128 
129  std::map<GEMDetId, std::vector<vfatEC>> chamVfats_;
130 
131  std::map<vfatEC, vfatDC> vfatMap_;
132 
133  std::map<channelNum, stripNum> chStMap_;
134  std::map<stripNum, channelNum> stChMap_;
135 };
136 #endif
GEMROMapping::vfatEC::detId
GEMDetId detId
Definition: GEMROMapping.h:50
GEMROMapping::chamberPos
const chamDC & chamberPos(const chamEC &r) const
Definition: GEMROMapping.h:108
GEMROMapping::channelNum::vfatType
int vfatType
Definition: GEMROMapping.h:78
GEMROMapping::add
void add(sectorEC e)
Definition: GEMROMapping.h:106
GEMROMapping::vfatDC::vfatType
int vfatType
Definition: GEMROMapping.h:61
GEMROMapping::chStMap_
std::map< channelNum, stripNum > chStMap_
Definition: GEMROMapping.h:133
GEMROMapping::chamEC::fedId
unsigned int fedId
Definition: GEMROMapping.h:26
GEMROMapping::chamDC::operator<
bool operator<(const chamDC &r) const
Definition: GEMROMapping.h:45
GEMROMapping::chamEC::gebId
uint8_t gebId
Definition: GEMROMapping.h:28
GEMROMapping::stripNum::operator<
bool operator<(const stripNum &s) const
Definition: GEMROMapping.h:91
GEMROMapping::isValidChamber
bool isValidChamber(const chamEC &r) const
Definition: GEMROMapping.h:102
GEMROMapping::amcVec_
std::vector< sectorEC > amcVec_
Definition: GEMROMapping.h:124
GEMROMapping::chamDC
Definition: GEMROMapping.h:42
GEMROMapping::getVfats
const std::vector< vfatEC > getVfats(const GEMDetId &r) const
Definition: GEMROMapping.h:111
GEMROMapping::chamEC::operator<
bool operator<(const chamEC &r) const
Definition: GEMROMapping.h:29
GEMROMapping::sectorEC::operator==
bool operator==(const sectorEC &r) const
Definition: GEMROMapping.h:16
GEMROMapping
Definition: GEMROMapping.h:8
GEMROMapping::sectorEC
Definition: GEMROMapping.h:13
GEMROMapping::stripNum
Definition: GEMROMapping.h:88
GEMROMapping::vfatPos
const vfatDC & vfatPos(const vfatEC &r) const
Definition: GEMROMapping.h:114
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GEMROMapping::chamDC::vfatVer
int vfatVer
Definition: GEMROMapping.h:44
GEMROMapping::isValidChipID
bool isValidChipID(const vfatEC &r) const
Definition: GEMROMapping.h:101
GEMROMapping::vfatDC::detId
GEMDetId detId
Definition: GEMROMapping.h:62
GEMROMapping::vfatDC::localPhi
int localPhi
Definition: GEMROMapping.h:63
alignCSCRings.s
s
Definition: alignCSCRings.py:92
GEMROMapping::add
void add(GEMDetId e, vfatEC d)
Definition: GEMROMapping.h:112
GEMROMapping::isValidAMC
bool isValidAMC(const sectorEC &r) const
Definition: GEMROMapping.h:104
GEMROMapping::GEMROMapping
GEMROMapping()
Definition: GEMROMapping.h:99
GEMROMapping::vfatMap_
std::map< vfatEC, vfatDC > vfatMap_
Definition: GEMROMapping.h:131
GEMROMapping::sectorEC::fedId
unsigned int fedId
Definition: GEMROMapping.h:14
GEMROMapping::stripNum::vfatType
int vfatType
Definition: GEMROMapping.h:89
GEMROMapping::vfatDC
Definition: GEMROMapping.h:60
GEMROMapping::channelNum::chNum
int chNum
Definition: GEMROMapping.h:79
GEMROMapping::add
void add(stripNum s, channelNum c)
Definition: GEMROMapping.h:121
GEMROMapping::add
void add(channelNum c, stripNum s)
Definition: GEMROMapping.h:120
GEMDetId
Definition: GEMDetId.h:18
GEMROMapping::vfatEC::vfatAdd
uint16_t vfatAdd
Definition: GEMROMapping.h:49
GEMROMapping::chamEC
Definition: GEMROMapping.h:25
GEMROMapping::stChMap_
std::map< stripNum, channelNum > stChMap_
Definition: GEMROMapping.h:134
GEMROMapping::stripNum::stNum
int stNum
Definition: GEMROMapping.h:90
alignCSCRings.r
r
Definition: alignCSCRings.py:93
GEMROMapping::channelNum::operator<
bool operator<(const channelNum &c) const
Definition: GEMROMapping.h:80
GEMDetId.h
GEMROMapping::chamEC::amcNum
uint8_t amcNum
Definition: GEMROMapping.h:27
GEMROMapping::add
void add(vfatEC e, vfatDC d)
Definition: GEMROMapping.h:115
GEMROMapping::add
void add(chamEC e, chamDC d)
Definition: GEMROMapping.h:109
GEMROMapping::channelNum
Definition: GEMROMapping.h:77
GEMROMapping::hitPos
const channelNum & hitPos(const stripNum &s) const
Definition: GEMROMapping.h:117
GEMROMapping::chamberMap_
std::map< chamEC, chamDC > chamberMap_
Definition: GEMROMapping.h:127
GEMROMapping::sectorEC::amcNum
uint8_t amcNum
Definition: GEMROMapping.h:15
GEMROMapping::chamVfats_
std::map< GEMDetId, std::vector< vfatEC > > chamVfats_
Definition: GEMROMapping.h:129
ztail.d
d
Definition: ztail.py:151
GEMROMapping::vfatEC::operator<
bool operator<(const vfatEC &r) const
Definition: GEMROMapping.h:51
GEMROMapping::chamDC::detId
GEMDetId detId
Definition: GEMROMapping.h:43
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
GEMROMapping::vfatEC
Definition: GEMROMapping.h:48
GEMROMapping::vfatDC::operator<
bool operator<(const vfatDC &r) const
Definition: GEMROMapping.h:64
GEMROMapping::hitPos
const stripNum & hitPos(const channelNum &c) const
Definition: GEMROMapping.h:118
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37