Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-07 00:40:59

0001 #include "CondFormats/GEMObjects/interface/GEMChMap.h"
0002 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0003 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0004 
0005 GEMChMap::GEMChMap() : theVersion("") {}
0006 
0007 GEMChMap::GEMChMap(const std::string& version) : theVersion(version) {}
0008 
0009 GEMChMap::~GEMChMap() {}
0010 
0011 const std::string& GEMChMap::version() const { return theVersion; }
0012 
0013 void GEMChMap::setDummy() {
0014   // 12 bits for vfat, 5 bits for geb, 8 bit long GLIB serial number
0015   amcVec_.clear();
0016 
0017   chamberMap_.clear();
0018 
0019   chamVfats_.clear();
0020   chamIEtas_.clear();
0021 
0022   chStMap_.clear();
0023   stChMap_.clear();
0024 
0025   unsigned int fedId = 0;
0026 
0027   for (int st = GEMDetId::minStationId0; st <= GEMDetId::maxStationId; ++st) {
0028     int maxVFat = 0;
0029     int maxLayerId = GEMDetId::maxLayerId;
0030     int maxiEtaId = 0;
0031     if (st == 0) {
0032       maxVFat = maxVFatGE0_;
0033       maxLayerId = GEMDetId::maxLayerId0;
0034       maxiEtaId = maxiEtaIdGE0_;
0035     } else if (st == 1) {
0036       maxVFat = maxVFatGE11_;
0037       maxiEtaId = maxiEtaIdGE11_;
0038     } else if (st == 2) {
0039       maxVFat = maxVFatGE21_;
0040       maxiEtaId = maxiEtaIdGE21_;
0041     }
0042 
0043     uint16_t chipPos = 0;
0044     for (int lphi = 0; lphi < maxVFat; ++lphi) {
0045       for (int ieta = 1; ieta <= maxiEtaId; ++ieta) {
0046         if (st == 2 and ieta % 2 == 0)
0047           continue;
0048         for (int i = 0; i < maxChan_; ++i) {
0049           // only 1 vfat type for dummy map
0050           GEMChMap::channelNum cMap;
0051           cMap.chamberType = st;
0052           cMap.vfatAdd = chipPos;
0053           cMap.chNum = i;
0054 
0055           GEMChMap::stripNum sMap;
0056           sMap.chamberType = st;
0057           if (st != 2) {
0058             sMap.iEta = ieta;
0059             sMap.stNum = i + lphi * maxChan_;
0060           } else {
0061             sMap.iEta = ieta + i % 2;
0062             sMap.stNum = i / 2 + lphi * maxChan_ / 2;
0063           }
0064 
0065           add(cMap, sMap);
0066           add(sMap, cMap);
0067 
0068           GEMChMap::vfatEC ec;
0069           ec.vfatAdd = cMap.vfatAdd;
0070           ec.chamberType = st;
0071 
0072           add(cMap.chamberType, cMap.vfatAdd);
0073           add(ec, sMap.iEta);
0074         }
0075         chipPos++;
0076       }
0077     }
0078 
0079     for (int re = -1; re <= 1; re = re + 2) {
0080       uint8_t amcNum = 1;  //amc
0081       uint8_t gebId = 0;
0082       if (st == 0)
0083         fedId = (re == 1 ? FEDNumbering::MINGE0FEDID + 1 : FEDNumbering::MINGE0FEDID);
0084       else if (st == 1)
0085         fedId = (re == 1 ? FEDNumbering::MINGEMFEDID + 1 : FEDNumbering::MINGEMFEDID);
0086       else if (st == 2)
0087         fedId = (re == 1 ? FEDNumbering::MINGE21FEDID + 1 : FEDNumbering::MINGE21FEDID);
0088 
0089       for (int ch = 1; ch <= GEMDetId::maxChamberId; ++ch) {
0090         for (int ly = 1; ly <= maxLayerId; ++ly) {
0091           GEMDetId gemId(re, 1, st, ly, ch, 0);
0092 
0093           GEMChMap::chamEC ec;
0094           ec.fedId = fedId;
0095           ec.gebId = gebId;
0096           ec.amcNum = amcNum;
0097 
0098           GEMChMap::chamDC dc;
0099           dc.detId = gemId;
0100           dc.chamberType = st;
0101           add(ec, dc);
0102 
0103           GEMChMap::sectorEC amcEC = {fedId, amcNum};
0104           if (!isValidAMC(fedId, amcNum))
0105             add(amcEC);
0106 
0107           // 5 bits for gebId
0108           if (st > 0 && gebId == maxGEB1_) {
0109             gebId = 0;
0110             amcNum += 2;  // only odd amc No. is used for GE11
0111           } else if (st == 0 && gebId == maxGEBs_) {
0112             gebId = 0;
0113             amcNum++;
0114           } else {
0115             // 1 geb per chamber
0116             gebId++;
0117           }
0118         }
0119       }
0120     }
0121   }
0122 }