File indexing completed on 2024-04-06 12:02:12
0001 #include "CondFormats/GEMObjects/interface/GEMELMap.h"
0002 #include "CondFormats/GEMObjects/interface/GEMROmap.h"
0003 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0004
0005 GEMELMap::GEMELMap() : theVersion("") {}
0006
0007 GEMELMap::GEMELMap(const std::string& version) : theVersion(version) {}
0008
0009 GEMELMap::~GEMELMap() {}
0010
0011 const std::string& GEMELMap::version() const { return theVersion; }
0012
0013 void GEMELMap::convert(GEMROmap& romap) {
0014 for (auto imap : theVFatMap_) {
0015 for (unsigned int ix = 0; ix < imap.vfatId.size(); ix++) {
0016 GEMROmap::eCoord ec;
0017 ec.vfatId = imap.vfatId[ix] & chipIdMask_;
0018 ec.gebId = imap.gebId[ix];
0019 ec.amcId = imap.amcId[ix];
0020
0021 int st = std::abs(imap.z_direction[ix]);
0022 GEMROmap::dCoord dc;
0023 dc.gemDetId = GEMDetId(imap.z_direction[ix], 1, st, imap.depth[ix], imap.sec[ix], imap.iEta[ix]);
0024 dc.vfatType = imap.vfatType[ix];
0025 dc.iPhi = imap.iPhi[ix];
0026
0027 romap.add(ec, dc);
0028 romap.add(dc, ec);
0029 }
0030 }
0031
0032 for (auto imap : theStripMap_) {
0033 for (unsigned int ix = 0; ix < imap.vfatType.size(); ix++) {
0034 GEMROmap::channelNum cMap;
0035 cMap.vfatType = imap.vfatType[ix];
0036 cMap.chNum = imap.vfatCh[ix];
0037
0038 GEMROmap::stripNum sMap;
0039 sMap.vfatType = imap.vfatType[ix];
0040 sMap.stNum = imap.vfatStrip[ix];
0041
0042 romap.add(cMap, sMap);
0043 romap.add(sMap, cMap);
0044 }
0045 }
0046 }
0047
0048 void GEMELMap::convertDummy(GEMROmap& romap) {
0049
0050 uint16_t amcId = 1;
0051 uint16_t gebId = 0;
0052
0053 for (int re = -1; re <= 1; re = re + 2) {
0054 for (int st = GEMDetId::minStationId; st <= GEMDetId::maxStationId; ++st) {
0055 int maxVFat = maxVFatGE11_;
0056 if (st == 2)
0057 maxVFat = maxVFatGE21_;
0058 if (st == 0)
0059 maxVFat = maxVFatGE0_;
0060
0061 for (int ch = 1; ch <= GEMDetId::maxChamberId; ++ch) {
0062 for (int ly = 1; ly <= GEMDetId::maxLayerId; ++ly) {
0063
0064 gebId++;
0065 uint16_t chipId = 0;
0066 for (int roll = 1; roll <= GEMDetId::maxRollId; ++roll) {
0067 GEMDetId gemId(re, 1, st, ly, ch, roll);
0068
0069 for (int nphi = 1; nphi <= maxVFat; ++nphi) {
0070 chipId++;
0071
0072 GEMROmap::eCoord ec;
0073 ec.vfatId = chipId;
0074 ec.gebId = gebId;
0075 ec.amcId = amcId;
0076
0077 GEMROmap::dCoord dc;
0078 dc.gemDetId = gemId;
0079 dc.vfatType = 1;
0080 dc.iPhi = nphi;
0081
0082 romap.add(ec, dc);
0083 romap.add(dc, ec);
0084 }
0085 }
0086
0087 if (gebId == maxGEBs_) {
0088
0089 gebId = 0;
0090 amcId++;
0091 }
0092 }
0093 }
0094 }
0095 }
0096
0097 for (int i = 0; i < maxChan_; ++i) {
0098
0099 GEMROmap::channelNum cMap;
0100 cMap.vfatType = 1;
0101 cMap.chNum = i;
0102
0103 GEMROmap::stripNum sMap;
0104 sMap.vfatType = 1;
0105 sMap.stNum = i + 1;
0106
0107 romap.add(cMap, sMap);
0108 romap.add(sMap, cMap);
0109 }
0110 }