CMS 3D CMS Logo

GEMChMap.cc
Go to the documentation of this file.
4 
5 GEMChMap::GEMChMap() : theVersion("") {}
6 
7 GEMChMap::GEMChMap(const std::string& version) : theVersion(version) {}
8 
10 
11 const std::string& GEMChMap::version() const { return theVersion; }
12 
14  // 12 bits for vfat, 5 bits for geb, 8 bit long GLIB serial number
15  amcVec_.clear();
16 
17  chamberMap_.clear();
18 
19  chamVfats_.clear();
20  chamIEtas_.clear();
21 
22  chStMap_.clear();
23  stChMap_.clear();
24 
25  unsigned int fedId = 0;
26 
27  for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
28  int maxVFat = 0;
29  int maxLayerId = GEMDetId::maxLayerId;
30  int maxiEtaId = 0;
31  if (st == 0) {
32  maxVFat = maxVFatGE0_;
33  maxLayerId = GEMDetId::maxLayerId0;
34  maxiEtaId = maxiEtaIdGE0_;
35  } else if (st == 1) {
36  maxVFat = maxVFatGE11_;
37  maxiEtaId = maxiEtaIdGE11_;
38  } else if (st == 2) {
39  maxVFat = maxVFatGE21_;
40  maxiEtaId = maxiEtaIdGE21_;
41  }
42 
43  uint16_t chipPos = 0;
44  for (int lphi = 0; lphi < maxVFat; ++lphi) {
45  for (int ieta = 1; ieta <= maxiEtaId; ++ieta) {
46  if (st == 2 and ieta % 2 == 0)
47  continue;
48  for (int i = 0; i < maxChan_; ++i) {
49  // only 1 vfat type for dummy map
51  cMap.chamberType = st;
52  cMap.vfatAdd = chipPos;
53  cMap.chNum = i;
54 
55  GEMChMap::stripNum sMap;
56  sMap.chamberType = st;
57  if (st != 2) {
58  sMap.iEta = ieta;
59  sMap.stNum = i + lphi * maxChan_;
60  } else {
61  sMap.iEta = ieta + i % 2;
62  sMap.stNum = i / 2 + lphi * maxChan_ / 2;
63  }
64 
65  add(cMap, sMap);
66  add(sMap, cMap);
67 
69  ec.vfatAdd = cMap.vfatAdd;
70  ec.chamberType = st;
71 
72  add(cMap.chamberType, cMap.vfatAdd);
73  add(ec, sMap.iEta);
74  }
75  chipPos++;
76  }
77  }
78 
79  for (int re = -1; re <= 1; re = re + 2) {
80  uint8_t amcNum = 1; //amc
81  uint8_t gebId = 0;
82  if (st == 0)
84  else if (st == 1)
86  else if (st == 2)
88 
89  for (int ch = 1; ch <= GEMDetId::maxChamberId; ++ch) {
90  for (int ly = 1; ly <= maxLayerId; ++ly) {
91  GEMDetId gemId(re, 1, st, ly, ch, 0);
92 
94  ec.fedId = fedId;
95  ec.gebId = gebId;
96  ec.amcNum = amcNum;
97 
99  dc.detId = gemId;
100  dc.chamberType = st;
101  add(ec, dc);
102 
103  GEMChMap::sectorEC amcEC = {fedId, amcNum};
104  if (!isValidAMC(fedId, amcNum))
105  add(amcEC);
106 
107  // 5 bits for gebId
108  if (st > 0 && gebId == maxGEB1_) {
109  gebId = 0;
110  amcNum += 2; // only odd amc No. is used for GE11
111  } else if (st == 0 && gebId == maxGEBs_) {
112  gebId = 0;
113  amcNum++;
114  } else {
115  // 1 geb per chamber
116  gebId++;
117  }
118  }
119  }
120  }
121  }
122 }
unsigned int fedId
Definition: GEMChMap.h:28
GEMChMap()
Definition: GEMChMap.cc:5
uint32_t detId
Definition: GEMChMap.h:47
const std::string & version() const
Definition: GEMChMap.cc:11
std::map< chamEC, chamDC > chamberMap_
Definition: GEMChMap.h:176
std::map< stripNum, channelNum > stChMap_
Definition: GEMChMap.h:182
std::string theVersion
Definition: GEMChMap.h:171
static const int maxiEtaIdGE0_
Definition: GEMChMap.h:196
static constexpr int32_t maxLayerId0
Definition: GEMDetId.h:31
std::map< int, std::vector< uint16_t > > chamVfats_
Definition: GEMChMap.h:178
static const int maxiEtaIdGE21_
Definition: GEMChMap.h:198
static const int maxGEB1_
Definition: GEMChMap.h:190
bool isValidAMC(unsigned int fedId, uint8_t amcNum) const
Definition: GEMChMap.h:123
~GEMChMap()
Definition: GEMChMap.cc:9
uint16_t gebId
Definition: GEMChMap.h:30
static constexpr int32_t minStationId0
Definition: GEMDetId.h:24
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
std::map< channelNum, stripNum > chStMap_
Definition: GEMChMap.h:181
static const int maxGEBs_
Definition: GEMChMap.h:189
std::map< vfatEC, std::vector< int > > chamIEtas_
Definition: GEMChMap.h:179
uint8_t amcNum
Definition: GEMChMap.h:29
void add(sectorEC e)
Definition: GEMChMap.h:139
static const int maxVFatGE0_
Definition: GEMChMap.h:193
static const int maxChan_
Definition: GEMChMap.h:199
static const int maxVFatGE11_
Definition: GEMChMap.h:194
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
static constexpr int32_t maxChamberId
Definition: GEMDetId.h:29
static const int maxiEtaIdGE11_
Definition: GEMChMap.h:197
std::vector< sectorEC > amcVec_
Definition: GEMChMap.h:173
uint16_t vfatAdd
Definition: GEMChMap.h:62
static const int maxVFatGE21_
Definition: GEMChMap.h:195
void setDummy()
Definition: GEMChMap.cc:13