CMS 3D CMS Logo

RPCTwinMuxPacker.cc
Go to the documentation of this file.
2 
5 
7  RPCInverseLBLinkMap const& lb_map,
8  RPCInverseAMCLinkMap const& amc_map,
9  int min_bx,
10  int max_bx,
11  unsigned int bcn,
12  RPCDigiCollection const& digis,
13  std::map<RPCAMCLink, std::vector<std::pair<int, rpctwinmux::RPCRecord> > >& amc_bx_tmrecord,
14  bool ignore_eod) {
15  std::map<RPCLBLink, std::vector<std::pair<int, RPCLBRecord> > > mlb_bx_lbrecord;
16  RPCLBPacker::getRPCLBRecords(lb_map, min_bx, max_bx, bcn, digis, mlb_bx_lbrecord, ignore_eod);
17 
18  for (std::map<RPCLBLink, std::vector<std::pair<int, RPCLBRecord> > >::const_iterator mlb_bx_lbrecord_it =
19  mlb_bx_lbrecord.begin();
20  mlb_bx_lbrecord_it != mlb_bx_lbrecord.end();
21  ++mlb_bx_lbrecord_it) {
22  // multimap, but no splitting for TwinMux inputs
23  RPCInverseAMCLinkMap::map_type::const_iterator amc_it(amc_map.getMap().find(mlb_bx_lbrecord_it->first));
24  if (amc_it == amc_map.getMap().end()) {
25  continue;
26  }
27 
28  RPCAMCLink amc_id(amc_it->second);
29  int amc_input(amc_id.getAMCInput());
30  amc_id.setAMCInput();
31  std::vector<std::pair<int, rpctwinmux::RPCRecord> >& bx_tmrecord(amc_bx_tmrecord[amc_id]);
32  std::vector<std::pair<int, rpctwinmux::RPCRecord> >::iterator tmrecord_it(bx_tmrecord.begin());
33  for (std::vector<std::pair<int, RPCLBRecord> >::const_iterator bx_lbrecord = mlb_bx_lbrecord_it->second.begin();
34  bx_lbrecord != mlb_bx_lbrecord_it->second.end();
35  ++bx_lbrecord) {
36  // find the first record at this bx for this amc without this input
37  for (; tmrecord_it != bx_tmrecord.end() && tmrecord_it->first < bx_lbrecord->first; ++tmrecord_it)
38  ;
39  if (tmrecord_it == bx_tmrecord.end() || tmrecord_it->first != bx_lbrecord->first) {
40  tmrecord_it = bx_tmrecord.insert(
41  tmrecord_it, std::pair<int, rpctwinmux::RPCRecord>(bx_lbrecord->first, rpctwinmux::RPCRecord()));
42  tmrecord_it->second.setBXOffset(bx_lbrecord->first);
43  }
44  rpctwinmux::RPCLinkRecord tm_link_record;
45  tm_link_record.setAcknowledge(true);
46  tm_link_record.setEOD(bx_lbrecord->second.isEOD());
47  tm_link_record.setDelay(bx_lbrecord->second.getDelay());
48  tm_link_record.setLinkBoard(bx_lbrecord->second.getLinkBoard());
49  tm_link_record.setConnector(bx_lbrecord->second.getConnector());
50  tm_link_record.setPartition(bx_lbrecord->second.getPartition());
51  tm_link_record.setPartitionData(bx_lbrecord->second.getPartitionData());
52 
53  tmrecord_it->second.setRPCLinkRecord(amc_input, tm_link_record);
54  // make sure we don't fill this input twice if ignore_eod == true
55  ++tmrecord_it;
56  }
57  }
58 }
void setAcknowledge(bool da)
void setLinkBoard(unsigned int link_board)
void setDelay(unsigned int delay)
static void getRPCLBRecords(RPCInverseLBLinkMap const &lb_map, int min_bx, int max_bx, unsigned int bcn, RPCDigiCollection const &digis, std::map< RPCLBLink, std::vector< std::pair< int, RPCLBRecord > > > &mlb_bx_lbrecord, bool ignore_eod=false)
Definition: RPCLBPacker.cc:8
void setPartition(unsigned int partition)
static void getRPCTwinMuxRecords(RPCInverseLBLinkMap const &lb_map, RPCInverseAMCLinkMap const &amc_map, int min_bx, int max_bx, unsigned int bcn, RPCDigiCollection const &digis, std::map< RPCAMCLink, std::vector< std::pair< int, rpctwinmux::RPCRecord > > > &amc_bx_tmrecord, bool ignore_eod=false)
void setConnector(unsigned int connector)
void setPartitionData(std::uint8_t data)