CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
sipixelobjects::PixelFEDLink Class Reference

#include <PixelFEDLink.h>

Public Types

typedef std::vector< PixelROCROCs
 ROCs served be this link. More...
 

Public Member Functions

void add (const ROCs &rocs)
 add connection (defined by connection spec and ROCs) More...
 
void addItem (const PixelROC &roc)
 
bool checkRocNumbering () const
 
unsigned int id () const
 link id More...
 
unsigned int numberOfROCs () const
 number of ROCs in fed More...
 
 PixelFEDLink (unsigned int id=0)
 ctor with id of link and parent FED More...
 
std::string print (int depth=0) const
 
const PixelROCroc (unsigned int id) const
 return ROC identified by id. ROC ids are ranged [1,numberOfROCs] More...
 

Private Member Functions

std::string printForMap () const
 

Private Attributes

unsigned int theId
 
ROCs theROCs
 

Detailed Description

Definition at line 17 of file PixelFEDLink.h.

Member Typedef Documentation

ROCs served be this link.

Definition at line 20 of file PixelFEDLink.h.

Constructor & Destructor Documentation

sipixelobjects::PixelFEDLink::PixelFEDLink ( unsigned int  id = 0)
inline

ctor with id of link and parent FED

Definition at line 23 of file PixelFEDLink.h.

23 : theId(id) {}

Member Function Documentation

void PixelFEDLink::add ( const ROCs rocs)

add connection (defined by connection spec and ROCs)

Definition at line 32 of file PixelFEDLink.cc.

Referenced by PixelEndcapLinkMaker::links(), PixelBarrelLinkMaker::links(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

32 { theROCs.insert(theROCs.end(), rocs.begin(), rocs.end()); }
void PixelFEDLink::addItem ( const PixelROC roc)

Definition at line 11 of file PixelFEDLink.cc.

References sipixelobjects::PixelROC::idInLink(), and PixelMapPlotter::roc.

11  {
12  // INFO roc numbering vs vector has offset=1
13  if (roc.idInLink() > theROCs.size())
14  theROCs.resize(roc.idInLink());
15  theROCs[roc.idInLink() - 1] = roc;
16 }
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:40
bool PixelFEDLink::checkRocNumbering ( ) const

check ROC in link numbering consistency, ie. that ROC position in vector is the same as its id. To be called by owner

Definition at line 18 of file PixelFEDLink.cc.

References gather_cfg::cout, and mps_fire::result.

18  {
19  bool result = true;
20  unsigned int idx_expected = 0;
21  typedef ROCs::const_iterator CIR;
22  for (CIR it = theROCs.begin(); it != theROCs.end(); it++) {
23  idx_expected++;
24  if (idx_expected != (*it).idInLink()) {
25  result = false;
26  cout << "** PixelFEDLink, idInLink in ROC, expected: " << idx_expected << " has: " << (*it).idInLink() << endl;
27  }
28  }
29  return result;
30 }
tuple result
Definition: mps_fire.py:311
tuple cout
Definition: gather_cfg.py:144
unsigned int sipixelobjects::PixelFEDLink::id ( ) const
inline

link id

Definition at line 29 of file PixelFEDLink.h.

References theId.

Referenced by sipixelobjects::PixelFEDCabling::addLink(), and SiPixelFedCablingTree::pathToDetUnit().

29 { return theId; }
unsigned int sipixelobjects::PixelFEDLink::numberOfROCs ( ) const
inline
string PixelFEDLink::print ( int  depth = 0) const

Definition at line 34 of file PixelFEDLink.cc.

References gpuClustering::id, and submitPVResolutionJobs::out.

34  {
35  ostringstream out;
36  // if (id() < 0) return out.str(); // id() >= 0, since it returns an unsigned
37 
38  if (depth-- >= 0) {
39  if (id() < 10)
40  out << " LNK: " << id();
41  else
42  out << " LNK: " << id();
43  if (depth == 0)
44  out << printForMap();
45  else {
46  out << endl;
47  typedef ROCs::const_iterator CIR;
48  for (CIR ir = theROCs.begin(); ir != theROCs.end(); ir++)
49  out << (ir)->print(depth);
50  out << "# total number of ROCs: " << numberOfROCs() << endl;
51  }
52  }
53  return out.str();
54 }
string PixelFEDLink::printForMap ( ) const
private

Definition at line 56 of file PixelFEDLink.cc.

References Reference_intrackfit_cff::barrel, PixelEndcapName::bladeName(), PixelEndcapName::diskName(), first, PixelEndcapName::halfCylinder(), PixelModuleName::isBarrel(), SiStripPI::max, min(), PixelBarrelName::name(), PixelEndcapName::name(), submitPVResolutionJobs::out, PixelEndcapName::pannelName(), DetId::rawId(), and createJobs::tmp.

56  {
57  typedef ROCs::const_iterator CIR;
58  ostringstream out;
59 
60  // barrel
61  {
62  int minroc = 9999;
63  int maxroc = -1;
64  bool first = true;
65  PixelBarrelName prev;
66  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
67  DetId detid = DetId(ir->rawId());
68  bool barrel = PixelModuleName::isBarrel(detid.rawId());
69  if (!barrel)
70  continue;
71  PixelBarrelName curr(detid);
72  if (first)
73  prev = curr;
74 
75  int idRoc = ir->idInDetUnit();
76  if (curr == prev) {
77  minroc = min(idRoc, minroc);
78  maxroc = max(idRoc, maxroc);
79  }
80 
81  if (!(curr == prev)) {
82  out << " MOD: " << prev.name() << " ROC: " << minroc << ", " << maxroc << std::endl;
83  prev = curr;
84  maxroc = minroc = idRoc;
85  // minroc = idRoc;
86  // maxroc = idRoc;
87  }
88 
89  if (ir == theROCs.end() - 1) {
90  out << " MOD: " << curr.name() << " ROC: " << minroc << ", " << maxroc << std::endl;
91  }
92  }
93  }
94 
95  // same for endcpap
96  {
97  bool first = true;
98  PixelEndcapName prev;
99  for (CIR ir = theROCs.begin(); ir < theROCs.end(); ir++) {
100  DetId detid = DetId(ir->rawId());
101  bool barrel = PixelModuleName::isBarrel(detid.rawId());
102  if (barrel)
103  continue;
104  PixelEndcapName tmp(detid);
105  PixelEndcapName curr(tmp.halfCylinder(), tmp.diskName(), tmp.bladeName(), tmp.pannelName());
106  if (first)
107  prev = curr;
108  if (!(curr == prev))
109  out << " MOD: " << prev.name() << std::endl;
110  if (ir == theROCs.end() - 1)
111  out << " MOD: " << curr.name() << std::endl;
112  }
113  }
114  return out.str();
115 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::string name() const override
from base class
T min(T a, T b)
Definition: MathUtil.h:58
virtual bool isBarrel() const
true for barrel modules
Definition: DetId.h:17
std::string name() const override
from base class
tmp
align.sh
Definition: createJobs.py:716
const PixelROC* sipixelobjects::PixelFEDLink::roc ( unsigned int  id) const
inline

return ROC identified by id. ROC ids are ranged [1,numberOfROCs]

Definition at line 35 of file PixelFEDLink.h.

References theROCs.

Referenced by SiPixelFedCablingTree::findItem(), SiPixelFedCablingTree::findItemInFed(), SiPixelFedCablingTree::pathToDetUnit(), SiPixelFedCablingTree::pathToDetUnitHasDetUnit(), and SiPixelFedCablingMap::SiPixelFedCablingMap().

35 { return (id > 0 && id <= theROCs.size()) ? &theROCs[id - 1] : nullptr; }

Member Data Documentation

unsigned int sipixelobjects::PixelFEDLink::theId
private

Definition at line 46 of file PixelFEDLink.h.

Referenced by id().

ROCs sipixelobjects::PixelFEDLink::theROCs
private

Definition at line 47 of file PixelFEDLink.h.

Referenced by numberOfROCs(), and roc().