CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 18 of file PixelFEDLink.h.

Member Typedef Documentation

ROCs served be this link.

Definition at line 22 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 25 of file PixelFEDLink.h.

25 : theId(id) { }

Member Function Documentation

void PixelFEDLink::add ( const ROCs rocs)

add connection (defined by connection spec and ROCs)

Definition at line 35 of file PixelFEDLink.cc.

Referenced by PixelEndcapLinkMaker::links(), and PixelBarrelLinkMaker::links().

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

Definition at line 12 of file PixelFEDLink.cc.

References sipixelobjects::PixelROC::idInLink().

13 {
14  // INFO roc numbering vs vector has offset=1
15  if(roc.idInLink() > theROCs.size() ) theROCs.resize(roc.idInLink());
16  theROCs[roc.idInLink()-1] = roc;
17 }
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:46
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 19 of file PixelFEDLink.cc.

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

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

number of ROCs in fed

Definition at line 34 of file PixelFEDLink.h.

References theROCs.

Referenced by SiPixelFedCablingTree::pathToDetUnit(), and SiPixelFedCablingMap::SiPixelFedCablingMap().

34 { return theROCs.size(); }
string PixelFEDLink::print ( int  depth = 0) const

Definition at line 40 of file PixelFEDLink.cc.

References dbtoconf::out.

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

Definition at line 59 of file PixelFEDLink.cc.

References Reference_intrackfit_cff::barrel, PixelEndcapName::bladeName(), cond::rpcobgas::detid, PixelEndcapName::diskName(), first, PixelEndcapName::halfCylinder(), PixelModuleName::isBarrel(), max(), min, PixelBarrelName::name(), PixelEndcapName::name(), dbtoconf::out, PixelEndcapName::pannelName(), DetId::rawId(), and tmp.

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

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

Definition at line 37 of file PixelFEDLink.h.

References theROCs.

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

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

Member Data Documentation

unsigned int sipixelobjects::PixelFEDLink::theId
private

Definition at line 49 of file PixelFEDLink.h.

Referenced by id().

ROCs sipixelobjects::PixelFEDLink::theROCs
private

Definition at line 50 of file PixelFEDLink.h.

Referenced by numberOfROCs(), and roc().