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)
10 {
11  theLinks = links;
12 }
13 
14 void PixelFEDCabling::addLink(const PixelFEDLink & link)
15 {
16  if ( link.id() < 1) return;
17  if ( theLinks.size() < link.id() ) theLinks.resize(link.id());
18  theLinks[link.id()-1] = link;
19 }
20 
21 void PixelFEDCabling::addItem(unsigned int linkId, const PixelROC & roc)
22 {
23  if ( linkId < 1) return;
24  if ( theLinks.size() < linkId ) theLinks.resize(linkId);
25  if ( theLinks[linkId-1].id() != linkId) theLinks[linkId-1] = PixelFEDLink(linkId);
26  theLinks[linkId-1].addItem(roc);
27 }
28 
29 bool PixelFEDCabling::checkLinkNumbering() const
30 {
31  bool result = true;
32  typedef Links::const_iterator IL;
33  unsigned int idx_expected = 0;
34  for (IL il = theLinks.begin(); il != theLinks.end(); il++) {
35  idx_expected++;
36  if ((*il).id() != 0 && idx_expected != (*il).id() ) {
37  result = false;
38  cout << " ** PixelFEDCabling ** link numbering inconsistency, expected id: "
39  << idx_expected <<" has: " << (*il).id() << endl;
40  }
41  if (! (*il).checkRocNumbering() ) {
42  result = false;
43  cout << "** PixelFEDCabling ** inconsistent ROC numbering in link id: "
44  << (*il).id() << endl;
45  }
46  }
47  return result;
48 }
49 
50 string PixelFEDCabling::print(int depth) const
51 {
52  ostringstream out;
53  typedef vector<PixelFEDLink>::const_iterator IT;
54  if (depth-- >=0 ) {
55  out <<"FED: "<<id()<< endl;
56  for (IT it=theLinks.begin(); it != theLinks.end(); it++)
57  out << (*it).print(depth);
58  out <<"# total number of Links: "<< numberOfLinks() << endl;
59  }
60  out << endl;
61  return out.str();
62 }
63 
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:10
std::vector< LinkConnSpec >::const_iterator IT
std::vector< PixelFEDLink > Links