CMS 3D CMS Logo

RPCReadOutMappingWithFastSearch.cc
Go to the documentation of this file.
2 #include <vector>
3 #include <iostream>
4 
5 using namespace std;
6 
8  const LinkBoardElectronicIndex& lb2) const {
9  if (lb1.dccId < lb2.dccId)
10  return true;
11  if (lb1.dccId > lb2.dccId)
12  return false;
14  return true;
16  return false;
17  if (lb1.tbLinkInputNum < lb2.tbLinkInputNum)
18  return true;
19  if (lb1.tbLinkInputNum > lb2.tbLinkInputNum)
20  return false;
21  if (lb1.lbNumInLink < lb2.lbNumInLink)
22  return true;
23  if (lb1.lbNumInLink > lb2.lbNumInLink)
24  return false;
25  return false;
26 }
27 
29 
31  if (theVersion == arm->version())
32  return;
33 
34  theVersion = arm->version();
35  theLBMap.clear();
36  theMapping = arm;
37 
38  typedef vector<const DccSpec*> DCCLIST;
39  DCCLIST dccList = arm->dccList();
40  for (DCCLIST::const_iterator idcc = dccList.begin(), idccEnd = dccList.end(); idcc < idccEnd; ++idcc) {
41  const DccSpec& dccSpec = **idcc;
42  const std::vector<TriggerBoardSpec>& triggerBoards = dccSpec.triggerBoards();
43  for (std::vector<TriggerBoardSpec>::const_iterator it = triggerBoards.begin(); it != triggerBoards.end(); it++) {
44  const TriggerBoardSpec& triggerBoard = (*it);
45  typedef std::vector<const LinkConnSpec*> LINKS;
46  LINKS linkConns = triggerBoard.enabledLinkConns();
47  for (LINKS::const_iterator ic = linkConns.begin(); ic != linkConns.end(); ic++) {
48  const LinkConnSpec& link = **ic;
49  const std::vector<LinkBoardSpec>& boards = link.linkBoards();
50  for (std::vector<LinkBoardSpec>::const_iterator ib = boards.begin(); ib != boards.end(); ib++) {
51  const LinkBoardSpec& board = (*ib);
52 
53  LinkBoardElectronicIndex eleIndex;
54  eleIndex.dccId = dccSpec.id();
55  eleIndex.dccInputChannelNum = triggerBoard.dccInputChannelNum();
56  eleIndex.tbLinkInputNum = link.triggerBoardInputNumber();
57  eleIndex.lbNumInLink = board.linkBoardNumInLink();
58  LBMap::iterator inMap = theLBMap.find(eleIndex);
59  if (inMap != theLBMap.end()) {
60  cout << "The element in map already exists!" << endl;
61  } else {
62  theLBMap[eleIndex] = &board;
63  }
64  }
65  }
66  }
67  }
68 }
69 
71  const LinkBoardSpec& location, const LinkBoardPackedStrip& lbstrip) const {
72  return theMapping->detUnitFrame(location, lbstrip);
73 }
74 
76  LBMap::const_iterator inMap = theLBMap.find(ele);
77  return (inMap != theLBMap.end()) ? inMap->second : nullptr;
78  // return theMapping->location(ele);
79 }
const std::vector< LinkBoardSpec > & linkBoards() const
Definition: LinkConnSpec.h:25
int dccInputChannelNum() const
input channel number to DCC
const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const override
conversion between electronic and detector indexing
void init(const RPCReadOutMapping *arm)
takes ownership of map
int triggerBoardInputNumber() const
this link input number in TriggerBoard
Definition: LinkConnSpec.h:20
int linkBoardNumInLink() const
this LB number in link
Definition: LinkBoardSpec.h:26
std::vector< const DccSpec * > dccList() const
all FEDs in map
virtual StripInDetUnit detUnitFrame(const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
convert strip location as in raw data (LB and LBchannel) to detUnit frame
std::vector< const LinkConnSpec * > enabledLinkConns() const
not masked links belonging to this TB
RPCReadOutMapping::StripInDetUnit detUnitFrame(const LinkBoardSpec &location, const LinkBoardPackedStrip &lbstrip) const override
convert strip location as in raw data (LB and LBchannel) to detUnit frame
bool operator()(const LinkBoardElectronicIndex &lb1, const LinkBoardElectronicIndex &lb2) const
const std::vector< TriggerBoardSpec > & triggerBoards() const
Definition: DccSpec.h:26
int id() const
id of FED
Definition: DccSpec.h:22
std::pair< uint32_t, int > StripInDetUnit
first member is DetUnit ID, second strip in DetUnit frame
ib
Definition: cuy.py:661