Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:54

0001 #include "EventFilter/L1TRawToDigi/interface/OmtfMuonUnpacker.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include "EventFilter/L1TRawToDigi/interface/OmtfMuonDataWord64.h"
0006 
0007 namespace omtf {
0008 
0009   void MuonUnpacker::unpack(unsigned int fed,
0010                             unsigned int amc,
0011                             const MuonDataWord64 &data,
0012                             l1t::RegionalMuonCandBxCollection *producedMuonDigis) {
0013     LogTrace("") << "OMTF->MUON " << std::endl;
0014     LogTrace("") << data << std::endl;
0015     l1t::tftype overlap = (fed == 1380) ? l1t::tftype::omtf_neg : l1t::tftype::omtf_pos;
0016     unsigned int iProcessor = amc - 1;  //0-5
0017     l1t::RegionalMuonCand digi;
0018     digi.setHwPt(data.pT());
0019     digi.setHwEta(data.eta());
0020     digi.setHwPhi(data.phi());
0021     digi.setHwSign(data.ch());
0022     digi.setHwSignValid(data.vch());
0023     digi.setHwQual(data.quality());
0024     std::map<int, int> trackAddr;
0025     trackAddr[0] = data.layers();
0026     trackAddr[1] = 0;
0027     trackAddr[2] = data.weight_lowBits();
0028     digi.setTrackAddress(trackAddr);
0029     digi.setTFIdentifiers(iProcessor, overlap);
0030     int bx = data.bxNum() - 3;
0031     LogTrace("") << "OMTF Muon, BX=" << bx << ", hwPt=" << digi.hwPt() << ", link: " << digi.link() << std::endl;
0032 
0033     // add digi to collection, keep fixed ascending link orderi (insert in proper place)
0034     l1t::RegionalMuonCandBxCollection::const_iterator itb = producedMuonDigis->begin(bx);
0035     l1t::RegionalMuonCandBxCollection::const_iterator ite = producedMuonDigis->end(bx);
0036     unsigned int indeks = 0;
0037     while (indeks < ite - itb) {
0038       if (digi.link() < (itb + indeks)->link())
0039         break;
0040       indeks++;
0041     }
0042     producedMuonDigis->insert(bx, indeks, digi);
0043   }
0044 
0045 }  // namespace omtf