CMS 3D CMS Logo

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.

References add().

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(), PixelBarrelLinkMaker::links(), PixelFEDLink(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

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().

Referenced by roc().

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:43
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 mps_fire::result.

Referenced by roc().

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 }
unsigned int sipixelobjects::PixelFEDLink::id ( ) const
inline

link id

Definition at line 31 of file PixelFEDLink.h.

References theId.

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

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

Definition at line 40 of file PixelFEDLink.cc.

References triggerObjects_cff::id, and MillePedeFileConverter_cfg::out.

Referenced by roc().

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 }
string PixelFEDLink::printForMap ( ) const
private

Definition at line 59 of file PixelFEDLink.cc.

References Reference_intrackfit_cff::barrel, PixelEndcapName::bladeName(), PixelEndcapName::diskName(), plotBeamSpotDB::first, PixelEndcapName::halfCylinder(), PixelModuleName::isBarrel(), SiStripPI::max, min(), PixelEndcapName::name(), PixelBarrelName::name(), MillePedeFileConverter_cfg::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 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::string name() const override
from base class
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:18
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const PixelROC* sipixelobjects::PixelFEDLink::roc ( unsigned int  id) const
inline

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().