CMS 3D CMS Logo

PixelFEDCabling.cc
Go to the documentation of this file.
2 
4 
5 #include <sstream>
6 using namespace std;
7 using namespace sipixelobjects;
8 
9 void PixelFEDCabling::setLinks(Links& links) { theLinks = links; }
10 
11 void PixelFEDCabling::addLink(const PixelFEDLink& link) {
12  if (link.id() < 1)
13  return;
14  if (theLinks.size() < link.id())
15  theLinks.resize(link.id());
16  theLinks[link.id() - 1] = link;
17 }
18 
19 void PixelFEDCabling::addItem(unsigned int linkId, const PixelROC& roc) {
20  if (linkId < 1)
21  return;
22  if (theLinks.size() < linkId)
23  theLinks.resize(linkId);
24  if (theLinks[linkId - 1].id() != linkId)
25  theLinks[linkId - 1] = PixelFEDLink(linkId);
26  theLinks[linkId - 1].addItem(roc);
27 }
28 
29 bool PixelFEDCabling::checkLinkNumbering() const {
30  bool result = true;
31  typedef Links::const_iterator IL;
32  unsigned int idx_expected = 0;
33  for (IL il = theLinks.begin(); il != theLinks.end(); il++) {
34  idx_expected++;
35  if ((*il).id() != 0 && idx_expected != (*il).id()) {
36  result = false;
37  cout << " ** PixelFEDCabling ** link numbering inconsistency, expected id: " << idx_expected
38  << " has: " << (*il).id() << endl;
39  }
40  if (!(*il).checkRocNumbering()) {
41  result = false;
42  cout << "** PixelFEDCabling ** inconsistent ROC numbering in link id: " << (*il).id() << endl;
43  }
44  }
45  return result;
46 }
47 
48 string PixelFEDCabling::print(int depth) const {
49  ostringstream out;
50  typedef vector<PixelFEDLink>::const_iterator IT;
51  if (depth-- >= 0) {
52  out << "FED: " << id() << endl;
53  for (IT it = theLinks.begin(); it != theLinks.end(); it++)
54  out << (*it).print(depth);
55  out << "# total number of Links: " << numberOfLinks() << endl;
56  }
57  out << endl;
58  return out.str();
59 }
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
gather_cfg.cout
cout
Definition: gather_cfg.py:144
sipixelobjects
Definition: CablingPathToDetUnit.h:4
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
PixelROC.h
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
sipixelobjects::PixelFEDCabling::Links
std::vector< PixelFEDLink > Links
Definition: PixelFEDCabling.h:18
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
sipixelobjects::PixelROC
Definition: PixelROC.h:23
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
electronStore.links
links
Definition: electronStore.py:149
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
PixelFEDCabling.h