CMS 3D CMS Logo

RPCReadOutMapping.cc
Go to the documentation of this file.
2 
9 
11 
12 #include <iostream>
13 
14 using namespace edm;
15 
17 
19  IMAP im = theFeds.find(dccId);
20  const DccSpec &ddc = (*im).second;
21  return (im != theFeds.end()) ? &ddc : nullptr;
22 }
23 
24 void RPCReadOutMapping::add(const DccSpec &dcc) { theFeds[dcc.id()] = dcc; }
25 
26 std::vector<const DccSpec *> RPCReadOutMapping::dccList() const {
27  std::vector<const DccSpec *> result;
28  result.reserve(theFeds.size());
29  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
30  result.push_back(&(im->second));
31  }
32  return result;
33 }
34 
35 std::pair<int, int> RPCReadOutMapping::dccNumberRange() const {
36  if (theFeds.empty())
37  return std::make_pair(0, -1);
38  else {
39  IMAP first = theFeds.begin();
40  IMAP last = theFeds.end();
41  last--;
42  return std::make_pair(first->first, last->first);
43  }
44 }
45 
46 std::vector<std::pair<LinkBoardElectronicIndex, LinkBoardPackedStrip> > RPCReadOutMapping::rawDataFrame(
47  const StripInDetUnit &stripInDetUnit) const {
48  std::vector<std::pair<LinkBoardElectronicIndex, LinkBoardPackedStrip> > result;
49  LinkBoardElectronicIndex eleIndex = {0, 0, 0, 0};
50 
51  const uint32_t &rawDetId = stripInDetUnit.first;
52  const int &stripInDU = stripInDetUnit.second;
53 
54  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
55  const DccSpec &dccSpec = (*im).second;
56  const std::vector<TriggerBoardSpec> &triggerBoards = dccSpec.triggerBoards();
57  for (std::vector<TriggerBoardSpec>::const_iterator it = triggerBoards.begin(); it != triggerBoards.end(); it++) {
58  const TriggerBoardSpec &triggerBoard = (*it);
59  typedef std::vector<const LinkConnSpec *> LINKS;
60  LINKS linkConns = triggerBoard.enabledLinkConns();
61  for (LINKS::const_iterator ic = linkConns.begin(); ic != linkConns.end(); ic++) {
62  const LinkConnSpec &link = **ic;
63  const std::vector<LinkBoardSpec> &boards = link.linkBoards();
64  for (std::vector<LinkBoardSpec>::const_iterator ib = boards.begin(); ib != boards.end(); ib++) {
65  const LinkBoardSpec &board = (*ib);
66 
67  eleIndex.dccId = dccSpec.id();
68  eleIndex.dccInputChannelNum = triggerBoard.dccInputChannelNum();
69  eleIndex.tbLinkInputNum = link.triggerBoardInputNumber();
70  eleIndex.lbNumInLink = board.linkBoardNumInLink();
71 
72  const std::vector<FebConnectorSpec> &febs = board.febs();
73  int febCheck = 0;
74  for (std::vector<FebConnectorSpec>::const_iterator ifc = febs.begin(); ifc != febs.end(); ifc++) {
75  const FebConnectorSpec &febConnector = (*ifc);
76  febCheck++;
77  if (febConnector.rawId() != rawDetId)
78  continue;
79  int febInLB = febConnector.linkBoardInputNum();
80  /* if (febInLB != febCheck) {
81  edm::LogError("rawDataFrame") << " problem with febInLB: " <<febInLB<<" "<<febCheck;
82  } */
83  for (int istrip = 0; istrip < febConnector.nstrips(); istrip++) {
84  int stripPinInFeb = febConnector.cablePinNum(istrip);
85  if (febConnector.chamberStripNum(istrip) == stripInDU) {
86  result.push_back(std::make_pair(eleIndex, LinkBoardPackedStrip(febInLB, stripPinInFeb)));
87  }
88  }
89  }
90  }
91  }
92  }
93  }
94  return result;
95 }
96 
98  //FIXME after debugging change to dcc(ele.dccId)->triggerBoard(ele.dccInputChannelNum)->...
100  if (dcc) {
102  if (tb) {
103  const LinkConnSpec *lc = tb->linkConn(ele.tbLinkInputNum);
104  if (lc) {
105  const LinkBoardSpec *lb = lc->linkBoard(ele.lbNumInLink);
106  return lb;
107  }
108  }
109  }
110  return nullptr;
111 }
112 
114  const LinkBoardPackedStrip &lbstrip) const {
115  uint32_t detUnit = 0;
116  int stripInDU = 0;
117  int febInLB = lbstrip.febInLB();
118  int stripPinInFeb = lbstrip.stripPinInFeb();
119 
120  const FebConnectorSpec *feb = location.feb(febInLB);
121  if (feb) {
122  detUnit = feb->rawId();
123  const ChamberStripSpec strip = feb->strip(stripPinInFeb);
124  if (strip.chamberStripNumber > -1) {
125  stripInDU = strip.chamberStripNumber;
126  } else {
127  // LogWarning("detUnitFrame")<<"problem with stip for febInLB: "<<febInLB
128  // <<" strip pin: "<< stripPinInFeb
129  // <<" strip pin: "<< stripPinInFeb;
130  LogDebug("") << "problem with stip for febInLB: " << febInLB << " strip pin: " << stripPinInFeb
131  << " strip pin: " << stripPinInFeb << " for linkBoard: " << location.print(3);
132  }
133  } else {
134  // LogWarning("detUnitFrame")<<"problem with detUnit for febInLB: ";
135  LogDebug("") << "problem with detUnit for febInLB: " << febInLB << " for linkBoard: " << location.print(1);
136  }
137  return std::make_pair(detUnit, stripInDU);
138 }
139 
140 //
141 // ALL BELOW IS TEMPORARY, TO BE REMOVED !!!!
142 //
143 
144 std::pair<LinkBoardElectronicIndex, int> RPCReadOutMapping::getRAWSpecForCMSChamberSrip(uint32_t detId,
145  int strip,
146  int dccInputChannel) const {
147  LinkBoardElectronicIndex linkboard;
148  linkboard.dccId = 790;
149  linkboard.dccInputChannelNum = dccInputChannel;
150 
151  for (int k = 0; k < 18; k++) {
152  linkboard.tbLinkInputNum = k;
153  for (int j = 0; j < 3; j++) {
154  linkboard.lbNumInLink = j;
155  const LinkBoardSpec *location = this->location(linkboard);
156  if (location) {
157  for (int i = 1; i < 7; i++) {
158  const FebConnectorSpec *feb = location->feb(i);
159  if (feb && feb->rawId() == detId) {
160  for (int l = 1; l < 17; l++) {
161  int pin = l;
162  const ChamberStripSpec aStrip = feb->strip(pin);
163  if (aStrip.cmsStripNumber == strip) {
164  int bitInLink = (i - 1) * 16 + l - 1;
165  std::pair<LinkBoardElectronicIndex, int> stripInfo(linkboard, bitInLink);
166  return stripInfo;
167  }
168  }
169  }
170  }
171  }
172  }
173  }
174  RPCDetId aDet(detId);
175  std::cout << "Strip: " << strip << " not found for detector: " << aDet << std::endl;
176  std::pair<LinkBoardElectronicIndex, int> dummyStripInfo(linkboard, -99);
177  return dummyStripInfo;
178 }
179 
180 std::vector<const LinkBoardSpec *> RPCReadOutMapping::getLBforChamber(const std::string &name) const {
181  std::vector<const LinkBoardSpec *> vLBforChamber;
182 
183  LinkBoardElectronicIndex linkboard;
184  linkboard.dccId = 790;
185  linkboard.dccInputChannelNum = 1;
186  linkboard.tbLinkInputNum = 1;
187  linkboard.lbNumInLink = 0;
188  const LinkBoardSpec *location = this->location(linkboard);
189 
190  for (int k = 0; k < 18; k++) {
191  linkboard.dccInputChannelNum = 1;
192  linkboard.tbLinkInputNum = k;
193  for (int j = 0; j < 3; j++) {
194  linkboard.lbNumInLink = j;
195  int febInputNum = 1;
196  location = this->location(linkboard);
197  if (location) {
198  //location->print();
199  for (int j = 0; j < 6; j++) {
200  const FebConnectorSpec *feb = location->feb(febInputNum + j);
201  if (feb) {
202  //feb->print();
203  std::string chName = feb->chamber().chamberLocationName();
204  if (chName == name) {
205  vLBforChamber.push_back(location);
206  //feb->chamber().print();
207  break;
208  }
209  }
210  }
211  }
212  }
213  }
214  return vLBforChamber;
215 }
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
RPCReadOutMapping::IMAP
std::map< int, DccSpec >::const_iterator IMAP
Definition: RPCReadOutMapping.h:62
ChamberStripSpec.h
RPCReadOutMapping.h
TriggerBoardSpec::enabledLinkConns
std::vector< const LinkConnSpec * > enabledLinkConns() const
not masked links belonging to this TB
Definition: TriggerBoardSpec.cc:18
ChamberLocationSpec::chamberLocationName
std::string chamberLocationName() const
Definition: ChamberLocationSpec.cc:20
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
FebConnectorSpec::strip
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
Definition: FebConnectorSpec.cc:9
LinkConnSpec
Definition: LinkConnSpec.h:14
edm
HLT enums.
Definition: AlignableModifier.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
RPCReadOutMapping::RPCReadOutMapping
RPCReadOutMapping(const std::string &version="")
Definition: RPCReadOutMapping.cc:16
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
LinkBoardElectronicIndex::dccId
int dccId
Definition: LinkBoardElectronicIndex.h:11
ChamberStripSpec
Definition: ChamberStripSpec.h:11
LinkBoardPackedStrip::febInLB
int febInLB() const
Definition: LinkBoardPackedStrip.h:10
RPCReadOutMapping::getLBforChamber
std::vector< const LinkBoardSpec * > getLBforChamber(const std::string &name) const
Definition: RPCReadOutMapping.cc:180
FebConnectorSpec::cablePinNum
const int cablePinNum(int istrip) const
Definition: FebConnectorSpec.cc:52
LinkBoardPackedStrip::stripPinInFeb
int stripPinInFeb() const
Definition: LinkBoardPackedStrip.h:11
RPCReadOutMapping::location
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
Definition: RPCReadOutMapping.cc:97
ChamberStripSpec::cmsStripNumber
int cmsStripNumber
Definition: ChamberStripSpec.h:14
FebConnectorSpec::chamberStripNum
const int chamberStripNum(int istrip) const
Definition: FebConnectorSpec.cc:40
RPCReadOutMapping::add
void add(const DccSpec &dcc)
attach FED to map
Definition: RPCReadOutMapping.cc:24
LinkBoardElectronicIndex::dccInputChannelNum
int dccInputChannelNum
Definition: LinkBoardElectronicIndex.h:12
dqmdumpme.last
last
Definition: dqmdumpme.py:56
RPCReadOutMapping::dcc
const DccSpec * dcc(int dccId) const
FED identified by ID.
Definition: RPCReadOutMapping.cc:18
DccSpec::triggerBoards
const std::vector< TriggerBoardSpec > & triggerBoards() const
Definition: DccSpec.h:26
RPCReadOutMapping::getRAWSpecForCMSChamberSrip
std::pair< LinkBoardElectronicIndex, int > getRAWSpecForCMSChamberSrip(uint32_t detId, int strip, int dccInputChannel) const
Definition: RPCReadOutMapping.cc:144
DccSpec::id
int id() const
id of FED
Definition: DccSpec.h:22
dqmdumpme.k
k
Definition: dqmdumpme.py:60
FebConnectorSpec::rawId
const uint32_t & rawId() const
DetUnit to which data belongs.
Definition: FebConnectorSpec.cc:64
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LinkBoardElectronicIndex::tbLinkInputNum
int tbLinkInputNum
Definition: LinkBoardElectronicIndex.h:13
RPCDetId.h
RPCReadOutMapping::detUnitFrame
virtual StripInDetUnit detUnitFrame(const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
convert strip location as in raw data (LB and LBchannel) to detUnit frame
Definition: RPCReadOutMapping.cc:113
FebConnectorSpec.h
LinkBoardSpec
Definition: LinkBoardSpec.h:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
LinkBoardSpec.h
LinkBoardSpec::linkBoardNumInLink
int linkBoardNumInLink() const
this LB number in link
Definition: LinkBoardSpec.h:26
RPCReadOutMapping::theFeds
std::map< int, DccSpec > theFeds
Definition: RPCReadOutMapping.h:63
cuy.ib
ib
Definition: cuy.py:662
RPCReadOutMapping::rawDataFrame
std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > rawDataFrame(const StripInDetUnit &duFrame) const
connection "paths" that lead from one digi to one strip
Definition: RPCReadOutMapping.cc:46
RPCReadOutMapping::dccList
std::vector< const DccSpec * > dccList() const
all FEDs in map
Definition: RPCReadOutMapping.cc:26
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
TriggerBoardSpec.h
LinkBoardElectronicIndex
Definition: LinkBoardElectronicIndex.h:10
LinkBoardSpec::febs
const std::vector< FebConnectorSpec > & febs() const
Definition: LinkBoardSpec.h:36
TriggerBoardSpec::dccInputChannelNum
int dccInputChannelNum() const
input channel number to DCC
Definition: TriggerBoardSpec.h:20
DccSpec
Definition: DccSpec.h:16
TriggerBoardSpec
Definition: TriggerBoardSpec.h:14
DccSpec::triggerBoard
const TriggerBoardSpec * triggerBoard(int channelNumber) const
TB attached to channel.
Definition: DccSpec.cc:19
LinkConnSpec::linkBoard
const LinkBoardSpec * linkBoard(int linkBoardNumInLink) const
LB served by this link, identified by its position in link.
Definition: LinkConnSpec.cc:18
FebConnectorSpec::linkBoardInputNum
int linkBoardInputNum() const
this FEB channel in LinkBoard
Definition: FebConnectorSpec.h:29
FebConnectorSpec::nstrips
const int nstrips() const
Definition: FebConnectorSpec.h:43
TriggerBoardSpec::linkConn
const LinkConnSpec * linkConn(int tbInputNumber) const
link attached to this TB with given input number
Definition: TriggerBoardSpec.cc:9
LinkBoardPackedStrip
Definition: LinkBoardPackedStrip.h:4
RPCReadOutMapping::StripInDetUnit
std::pair< uint32_t, int > StripInDetUnit
first member is DetUnit ID, second strip in DetUnit frame
Definition: RPCReadOutMapping.h:25
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FebConnectorSpec::chamber
const ChamberLocationSpec & chamber() const
Definition: FebConnectorSpec.h:40
EcalCondDBWriter_cfi.location
location
Definition: EcalCondDBWriter_cfi.py:63
LinkBoardSpec::feb
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
Definition: LinkBoardSpec.cc:9
RPCReadOutMapping::dccNumberRange
std::pair< int, int > dccNumberRange() const
Range of FED IDs in map (min and max id)
Definition: RPCReadOutMapping.cc:35
mps_fire.result
result
Definition: mps_fire.py:311
FebConnectorSpec
Definition: FebConnectorSpec.h:23
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
LinkBoardSpec::print
std::string print(int depth=0) const
debud printout
Definition: LinkBoardSpec.cc:40
LinkBoardElectronicIndex::lbNumInLink
int lbNumInLink
Definition: LinkBoardElectronicIndex.h:14
LinkConnSpec.h