Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "EventFilter/RPCRawToDigi/interface/RPCTwinMuxPacker.h"
0002 
0003 #include "CondFormats/RPCObjects/interface/RPCInverseAMCLinkMap.h"
0004 #include "EventFilter/RPCRawToDigi/interface/RPCLBPacker.h"
0005 
0006 void RPCTwinMuxPacker::getRPCTwinMuxRecords(
0007     RPCInverseLBLinkMap const& lb_map,
0008     RPCInverseAMCLinkMap const& amc_map,
0009     int min_bx,
0010     int max_bx,
0011     unsigned int bcn,
0012     RPCDigiCollection const& digis,
0013     std::map<RPCAMCLink, std::vector<std::pair<int, rpctwinmux::RPCRecord> > >& amc_bx_tmrecord,
0014     bool ignore_eod) {
0015   std::map<RPCLBLink, std::vector<std::pair<int, RPCLBRecord> > > mlb_bx_lbrecord;
0016   RPCLBPacker::getRPCLBRecords(lb_map, min_bx, max_bx, bcn, digis, mlb_bx_lbrecord, ignore_eod);
0017 
0018   for (std::map<RPCLBLink, std::vector<std::pair<int, RPCLBRecord> > >::const_iterator mlb_bx_lbrecord_it =
0019            mlb_bx_lbrecord.begin();
0020        mlb_bx_lbrecord_it != mlb_bx_lbrecord.end();
0021        ++mlb_bx_lbrecord_it) {
0022     // multimap, but no splitting for TwinMux inputs
0023     RPCInverseAMCLinkMap::map_type::const_iterator amc_it(amc_map.getMap().find(mlb_bx_lbrecord_it->first));
0024     if (amc_it == amc_map.getMap().end()) {
0025       continue;
0026     }
0027 
0028     RPCAMCLink amc_id(amc_it->second);
0029     int amc_input(amc_id.getAMCInput());
0030     amc_id.setAMCInput();
0031     std::vector<std::pair<int, rpctwinmux::RPCRecord> >& bx_tmrecord(amc_bx_tmrecord[amc_id]);
0032     std::vector<std::pair<int, rpctwinmux::RPCRecord> >::iterator tmrecord_it(bx_tmrecord.begin());
0033     for (std::vector<std::pair<int, RPCLBRecord> >::const_iterator bx_lbrecord = mlb_bx_lbrecord_it->second.begin();
0034          bx_lbrecord != mlb_bx_lbrecord_it->second.end();
0035          ++bx_lbrecord) {
0036       // find the first record at this bx for this amc without this input
0037       for (; tmrecord_it != bx_tmrecord.end() && tmrecord_it->first < bx_lbrecord->first; ++tmrecord_it)
0038         ;
0039       if (tmrecord_it == bx_tmrecord.end() || tmrecord_it->first != bx_lbrecord->first) {
0040         tmrecord_it = bx_tmrecord.insert(
0041             tmrecord_it, std::pair<int, rpctwinmux::RPCRecord>(bx_lbrecord->first, rpctwinmux::RPCRecord()));
0042         tmrecord_it->second.setBXOffset(bx_lbrecord->first);
0043       }
0044       rpctwinmux::RPCLinkRecord tm_link_record;
0045       tm_link_record.setAcknowledge(true);
0046       tm_link_record.setEOD(bx_lbrecord->second.isEOD());
0047       tm_link_record.setDelay(bx_lbrecord->second.getDelay());
0048       tm_link_record.setLinkBoard(bx_lbrecord->second.getLinkBoard());
0049       tm_link_record.setConnector(bx_lbrecord->second.getConnector());
0050       tm_link_record.setPartition(bx_lbrecord->second.getPartition());
0051       tm_link_record.setPartitionData(bx_lbrecord->second.getPartitionData());
0052 
0053       tmrecord_it->second.setRPCLinkRecord(amc_input, tm_link_record);
0054       // make sure we don't fill this input twice if ignore_eod == true
0055       ++tmrecord_it;
0056     }
0057   }
0058 }