CMS 3D CMS Logo

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