CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
SiPixelFedCablingTree Class Referencefinal

#include <SiPixelFedCablingTree.h>

Inheritance diagram for SiPixelFedCablingTree:
SiPixelFedCabling

Public Types

typedef sipixelobjects::PixelFEDCabling PixelFEDCabling
 

Public Member Functions

void addFed (const PixelFEDCabling &f)
 add cabling for one fed More...
 
void addItem (unsigned int fedId, unsigned int linkId, const sipixelobjects::PixelROC &roc)
 
int checkNumbering () const
 
std::unordered_map< uint32_t, unsigned int > det2fedMap () const override
 
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap () const override
 
const PixelFEDCablingfed (unsigned int idFed) const
 get fed identified by its id More...
 
std::vector< const PixelFEDCabling * > fedList () const
 
const sipixelobjects::PixelROCfindItem (const sipixelobjects::CablingPathToDetUnit &path) const override
 
const sipixelobjects::PixelROCfindItemInFed (const sipixelobjects::CablingPathToDetUnit &path, const PixelFEDCabling *aFed) const
 
std::vector< sipixelobjects::CablingPathToDetUnitpathToDetUnit (uint32_t rawDetId) const override
 
std::string print (int depth=0) const
 
 SiPixelFedCablingTree (const std::string &version="")
 
std::string version () const override
 map version More...
 
 ~SiPixelFedCablingTree () override
 
- Public Member Functions inherited from SiPixelFedCabling
virtual ~SiPixelFedCabling ()
 

Private Attributes

std::unordered_map< int, PixelFEDCablingtheFedCablings
 
std::string theVersion
 

Detailed Description

Definition at line 11 of file SiPixelFedCablingTree.h.

Member Typedef Documentation

Definition at line 14 of file SiPixelFedCablingTree.h.

Constructor & Destructor Documentation

SiPixelFedCablingTree::SiPixelFedCablingTree ( const std::string &  version = "")
inline

Definition at line 16 of file SiPixelFedCablingTree.h.

16 : theVersion(version) {}
std::string version() const override
map version
SiPixelFedCablingTree::~SiPixelFedCablingTree ( )
inlineoverride

Definition at line 18 of file SiPixelFedCablingTree.h.

References addFed(), f, fed(), and fedList().

18 {}

Member Function Documentation

void SiPixelFedCablingTree::addFed ( const PixelFEDCabling f)

add cabling for one fed

Definition at line 68 of file SiPixelFedCablingTree.cc.

References f, triggerObjects_cff::id, and sipixelobjects::PixelFEDCabling::id().

Referenced by ~SiPixelFedCablingTree().

69 {
70  int id = f.id();
71  theFedCablings[id] = f;
72 }
double f[11][100]
std::unordered_map< int, PixelFEDCabling > theFedCablings
void SiPixelFedCablingTree::addItem ( unsigned int  fedId,
unsigned int  linkId,
const sipixelobjects::PixelROC roc 
)

Definition at line 104 of file SiPixelFedCablingTree.cc.

References sipixelobjects::PixelFEDCabling::addItem(), l1t::stage2::layer2::fedId, and sipixelobjects::PixelFEDCabling::id().

Referenced by SiPixelFedCablingMapBuilder::produce(), and version().

105 {
106  PixelFEDCabling & cabling = theFedCablings[fedId];
107  if (cabling.id() != fedId) cabling=PixelFEDCabling(fedId);
108  cabling.addItem(linkId,roc);
109 }
void addItem(unsigned int linkId, const PixelROC &roc)
sipixelobjects::PixelFEDCabling PixelFEDCabling
std::unordered_map< int, PixelFEDCabling > theFedCablings
int SiPixelFedCablingTree::checkNumbering ( ) const

Definition at line 135 of file SiPixelFedCablingTree.cc.

References gather_cfg::cout, and mps_update::status.

Referenced by version().

136 {
137  int status = 0;
138  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
139  if (im->first != static_cast<int>( im->second.id())) {
140  status = 1;
141  std::cout << "PROBLEM WITH FED ID!!" << im->first <<" vs: "<< im->second.id() << std::endl;
142  }
143  im->second.checkLinkNumbering();
144  }
145  return status;
146 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::unordered_map< uint32_t, unsigned int > SiPixelFedCablingTree::det2fedMap ( ) const
overridevirtual

Implements SiPixelFedCabling.

Definition at line 33 of file SiPixelFedCablingTree.cc.

References mps_fire::result.

Referenced by version().

33  {
34  std::unordered_map<uint32_t, unsigned int> result;
35  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
36  auto const & aFed = im->second;
37  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
38  auto link = aFed.link(idxLink);
39  if (!link) continue;
40  unsigned int numberOfRocs = link->numberOfROCs();
41  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
42  auto roc = link->roc(idxRoc);
43  result[roc->rawId()]=aFed.id(); // we know that a det is in one fed only...
44  }
45  }
46  }
47  return result;
48 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > SiPixelFedCablingTree::det2PathMap ( ) const
overridevirtual

Implements SiPixelFedCabling.

Definition at line 50 of file SiPixelFedCablingTree.cc.

References callgraph::path, and mps_fire::result.

Referenced by version().

50  {
51  std::map< uint32_t,std::vector<sipixelobjects::CablingPathToDetUnit> > result;
52  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
53  auto const & aFed = im->second;
54  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
55  auto link = aFed.link(idxLink);
56  if (!link) continue;
57  unsigned int numberOfRocs = link->numberOfROCs();
58  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
59  auto roc = link->roc(idxRoc);
60  CablingPathToDetUnit path = {aFed.id(), link->id(), roc->idInLink()};
61  result[roc->rawId()].push_back(path);
62  }
63  }
64  }
65  return result;
66 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
const PixelFEDCabling * SiPixelFedCablingTree::fed ( unsigned int  idFed) const

get fed identified by its id

Definition at line 74 of file SiPixelFedCablingTree.cc.

Referenced by ~SiPixelFedCablingTree().

75 {
76  auto it = theFedCablings.find(id);
77  return ( it == theFedCablings.end() ) ? nullptr : & (*it).second;
78 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::vector< const PixelFEDCabling * > SiPixelFedCablingTree::fedList ( ) const

Definition at line 93 of file SiPixelFedCablingTree.cc.

References a, b, sipixelobjects::PixelFEDCabling::id(), and mps_fire::result.

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

94 {
95  std::vector<const PixelFEDCabling *> result;
96  for (IMAP im = theFedCablings.begin(); im != theFedCablings.end(); im++) {
97  result.push_back( &(im->second) );
98  }
99  std::sort(result.begin(),result.end(),[](const PixelFEDCabling * a,const PixelFEDCabling * b){return a->id()<b->id();});
100  return result;
101 
102 }
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::unordered_map< int, PixelFEDCabling > theFedCablings
const sipixelobjects::PixelROC * SiPixelFedCablingTree::findItem ( const sipixelobjects::CablingPathToDetUnit path) const
overridevirtual

Implements SiPixelFedCabling.

Definition at line 111 of file SiPixelFedCablingTree.cc.

References sipixelobjects::CablingPathToDetUnit::fed, sipixelobjects::CablingPathToDetUnit::link, sipixelobjects::PixelFEDCabling::link(), sipixelobjects::CablingPathToDetUnit::roc, and sipixelobjects::PixelFEDLink::roc().

Referenced by version().

113 {
114  const PixelROC* roc = nullptr;
115  const PixelFEDCabling * aFed = fed(path.fed);
116  if (aFed) {
117  const PixelFEDLink * aLink = aFed->link(path.link);
118  if (aLink) roc = aLink->roc(path.roc);
119  }
120  return roc;
121 }
const PixelFEDCabling * fed(unsigned int idFed) const
get fed identified by its id
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id&#39;s are ranged [1, numberOfLinks]
const sipixelobjects::PixelROC * SiPixelFedCablingTree::findItemInFed ( const sipixelobjects::CablingPathToDetUnit path,
const PixelFEDCabling aFed 
) const

Definition at line 124 of file SiPixelFedCablingTree.cc.

References sipixelobjects::CablingPathToDetUnit::link, sipixelobjects::PixelFEDCabling::link(), sipixelobjects::CablingPathToDetUnit::roc, and sipixelobjects::PixelFEDLink::roc().

Referenced by SiPixelFrameConverter::toRoc(), and version().

127 {
128  const PixelROC* roc = nullptr;
129  const PixelFEDLink * aLink = aFed->link(path.link);
130  if (aLink) roc = aLink->roc(path.roc);
131  return roc;
132 }
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id&#39;s are ranged [1, numberOfLinks]
std::vector< sipixelobjects::CablingPathToDetUnit > SiPixelFedCablingTree::pathToDetUnit ( uint32_t  rawDetId) const
overridevirtual

Implements SiPixelFedCabling.

Definition at line 11 of file SiPixelFedCablingTree.cc.

References sipixelobjects::PixelFEDLink::id(), sipixelobjects::PixelFEDCabling::id(), sipixelobjects::PixelROC::idInLink(), sipixelobjects::PixelFEDCabling::link(), sipixelobjects::PixelFEDCabling::numberOfLinks(), sipixelobjects::PixelFEDLink::numberOfROCs(), callgraph::path, sipixelobjects::PixelROC::rawId(), mps_fire::result, and sipixelobjects::PixelFEDLink::roc().

Referenced by version().

13 {
14  std::vector<sipixelobjects::CablingPathToDetUnit> result;
15  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
16  const PixelFEDCabling & aFed = im->second;
17  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
18  const PixelFEDLink * link = aFed.link(idxLink);
19  if (!link) continue;
20  unsigned int numberOfRocs = link->numberOfROCs();
21  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
22  const PixelROC * roc = link->roc(idxRoc);
23  if (rawDetId == roc->rawId() ) {
24  CablingPathToDetUnit path = {aFed.id(), link->id(), roc->idInLink()};
25  result.push_back(path);
26  }
27  }
28  }
29  }
30  return result;
31 }
unsigned int numberOfLinks() const
number of links in FED
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:43
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:37
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id&#39;s are ranged [1, numberOfLinks]
std::unordered_map< int, PixelFEDCabling > theFedCablings
string SiPixelFedCablingTree::print ( int  depth = 0) const

Definition at line 80 of file SiPixelFedCablingTree.cc.

References MillePedeFileConverter_cfg::out.

Referenced by version().

81 {
82  ostringstream out;
83  if ( depth-- >=0 ) {
84  out << theVersion << endl;
85  for(IMAP it=theFedCablings.begin(); it != theFedCablings.end(); it++) {
86  out << (*it).second.print(depth);
87  }
88  }
89  out << endl;
90  return out.str();
91 }
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::string SiPixelFedCablingTree::version ( ) const
inlineoverridevirtual

Member Data Documentation

std::unordered_map<int, PixelFEDCabling> SiPixelFedCablingTree::theFedCablings
private

Definition at line 51 of file SiPixelFedCablingTree.h.

std::string SiPixelFedCablingTree::theVersion
private

Definition at line 50 of file SiPixelFedCablingTree.h.

Referenced by version().