Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-21 02:53:05

0001 #include "EventFilter/L1TRawToDigi/interface/OmtfCscPacker.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include "DataFormats/L1TMuon/interface/OMTF/OmtfCscDataWord64.h"
0005 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0006 
0007 namespace omtf {
0008 
0009   void CscPacker::init() { theCsc2Omtf = mapCscDet2EleIndex(); }
0010 
0011   void CscPacker::pack(const CSCCorrelatedLCTDigiCollection* prod, FedAmcRawsMap& raws) {
0012     const CSCCorrelatedLCTDigiCollection& cscDigis = *prod;
0013     for (const auto& chDigis : cscDigis) {
0014       CSCDetId chamberId = CSCDetId(chDigis.first).chamberId();
0015       for (auto digi = chDigis.second.first; digi != chDigis.second.second; digi++) {
0016         CscDataWord64 data;
0017         data.hitNum_ = digi->getTrknmb();
0018         data.vp_ = digi->isValid();
0019         data.bxNum_ = digi->getBX() - (CSCConstants::LCT_CENTRAL_BX - 3);
0020         data.halfStrip_ = digi->getStrip();
0021         data.clctPattern_ = digi->getPattern();
0022         data.keyWG_ = digi->getKeyWG();
0023         data.lr_ = digi->getBend();
0024         data.quality_ = digi->getQuality();
0025         auto im = theCsc2Omtf.find(chamberId);
0026         if (im != theCsc2Omtf.end()) {
0027           std::vector<EleIndex> links = {im->second.first, im->second.second};
0028           for (const auto& link : links) {
0029             unsigned int fed = link.fed();
0030             if (fed == 0)
0031               continue;
0032             data.station_ = chamberId.station() - 1;
0033             data.linkNum_ = link.link();
0034             data.cscID_ = chamberId.chamber() - (link.amc() - 1) * 6;
0035             unsigned int amc = link.amc() * 2 - 1;
0036             raws[std::make_pair(fed, amc)].push_back(data.rawData);
0037             LogTrace("") << "ADDED RAW: fed: " << fed << " amc: " << amc << " CSC DATA: " << data << std::endl;
0038           }
0039         }
0040       }
0041     }
0042   }
0043 
0044 }  // namespace omtf