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 final
 
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap () const final
 
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 final
 
const sipixelobjects::PixelROCfindItemInFed (const sipixelobjects::CablingPathToDetUnit &path, const PixelFEDCabling *aFed) const
 
std::vector< sipixelobjects::CablingPathToDetUnitpathToDetUnit (uint32_t rawDetId) const final
 
bool pathToDetUnitHasDetUnit (uint32_t rawDetId, unsigned int fedId) const final
 
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 88 of file SiPixelFedCablingTree.cc.

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

Referenced by ~SiPixelFedCablingTree().

89 {
90  int id = f.id();
91  theFedCablings[id] = f;
92 }
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 124 of file SiPixelFedCablingTree.cc.

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

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

125 {
126  PixelFEDCabling & cabling = theFedCablings[fedId];
127  if (cabling.id() != fedId) cabling=PixelFEDCabling(fedId);
128  cabling.addItem(linkId,roc);
129 }
void addItem(unsigned int linkId, const PixelROC &roc)
sipixelobjects::PixelFEDCabling PixelFEDCabling
std::unordered_map< int, PixelFEDCabling > theFedCablings
int SiPixelFedCablingTree::checkNumbering ( ) const

Definition at line 155 of file SiPixelFedCablingTree.cc.

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

Referenced by version().

156 {
157  int status = 0;
158  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
159  if (im->first != static_cast<int>( im->second.id())) {
160  status = 1;
161  std::cout << "PROBLEM WITH FED ID!!" << im->first <<" vs: "<< im->second.id() << std::endl;
162  }
163  im->second.checkLinkNumbering();
164  }
165  return status;
166 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::unordered_map< uint32_t, unsigned int > SiPixelFedCablingTree::det2fedMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 53 of file SiPixelFedCablingTree.cc.

References mps_fire::result.

Referenced by version().

53  {
54  std::unordered_map<uint32_t, unsigned int> result;
55  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
56  auto const & aFed = im->second;
57  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
58  auto link = aFed.link(idxLink);
59  if (!link) continue;
60  unsigned int numberOfRocs = link->numberOfROCs();
61  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
62  auto roc = link->roc(idxRoc);
63  result[roc->rawId()]=aFed.id(); // we know that a det is in one fed only...
64  }
65  }
66  }
67  return result;
68 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > SiPixelFedCablingTree::det2PathMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 70 of file SiPixelFedCablingTree.cc.

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

Referenced by version().

70  {
71  std::map< uint32_t,std::vector<sipixelobjects::CablingPathToDetUnit> > result;
72  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
73  auto const & aFed = im->second;
74  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
75  auto link = aFed.link(idxLink);
76  if (!link) continue;
77  unsigned int numberOfRocs = link->numberOfROCs();
78  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
79  auto roc = link->roc(idxRoc);
80  CablingPathToDetUnit path = {aFed.id(), link->id(), roc->idInLink()};
81  result[roc->rawId()].push_back(path);
82  }
83  }
84  }
85  return result;
86 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
const PixelFEDCabling * SiPixelFedCablingTree::fed ( unsigned int  idFed) const

get fed identified by its id

Definition at line 94 of file SiPixelFedCablingTree.cc.

Referenced by ~SiPixelFedCablingTree().

95 {
96  auto it = theFedCablings.find(id);
97  return ( it == theFedCablings.end() ) ? nullptr : & (*it).second;
98 }
std::unordered_map< int, PixelFEDCabling > theFedCablings
std::vector< const PixelFEDCabling * > SiPixelFedCablingTree::fedList ( ) const

Definition at line 113 of file SiPixelFedCablingTree.cc.

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

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

114 {
115  std::vector<const PixelFEDCabling *> result;
116  for (IMAP im = theFedCablings.begin(); im != theFedCablings.end(); im++) {
117  result.push_back( &(im->second) );
118  }
119  std::sort(result.begin(),result.end(),[](const PixelFEDCabling * a,const PixelFEDCabling * b){return a->id()<b->id();});
120  return result;
121 
122 }
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
finalvirtual

Implements SiPixelFedCabling.

Definition at line 131 of file SiPixelFedCablingTree.cc.

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

Referenced by version().

133 {
134  const PixelROC* roc = nullptr;
135  const PixelFEDCabling * aFed = fed(path.fed);
136  if (aFed) {
137  const PixelFEDLink * aLink = aFed->link(path.link);
138  if (aLink) roc = aLink->roc(path.roc);
139  }
140  return roc;
141 }
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 144 of file SiPixelFedCablingTree.cc.

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

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

147 {
148  const PixelROC* roc = nullptr;
149  const PixelFEDLink * aLink = aFed->link(path.link);
150  if (aLink) roc = aLink->roc(path.roc);
151  return roc;
152 }
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
finalvirtual

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
bool SiPixelFedCablingTree::pathToDetUnitHasDetUnit ( uint32_t  rawDetId,
unsigned int  fedId 
) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 33 of file SiPixelFedCablingTree.cc.

References l1t::stage2::layer2::fedId, sipixelobjects::PixelFEDCabling::id(), sipixelobjects::PixelFEDCabling::link(), sipixelobjects::PixelFEDCabling::numberOfLinks(), sipixelobjects::PixelFEDLink::numberOfROCs(), sipixelobjects::PixelROC::rawId(), and sipixelobjects::PixelFEDLink::roc().

Referenced by version().

33  {
34  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
35  const PixelFEDCabling & aFed = im->second;
36  if(aFed.id() == fedId) {
37  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
38  const PixelFEDLink * link = aFed.link(idxLink);
39  if (!link) continue;
40  unsigned int numberOfRocs = link->numberOfROCs();
41  for(unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
42  const PixelROC * roc = link->roc(idxRoc);
43  if (rawDetId == roc->rawId() ) {
44  return true;
45  }
46  }
47  }
48  }
49  }
50  return false;
51 }
unsigned int numberOfLinks() const
number of links in FED
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 100 of file SiPixelFedCablingTree.cc.

References MillePedeFileConverter_cfg::out.

Referenced by version().

101 {
102  ostringstream out;
103  if ( depth-- >=0 ) {
104  out << theVersion << endl;
105  for(IMAP it=theFedCablings.begin(); it != theFedCablings.end(); it++) {
106  out << (*it).second.print(depth);
107  }
108  }
109  out << endl;
110  return out.str();
111 }
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 52 of file SiPixelFedCablingTree.h.

std::string SiPixelFedCablingTree::theVersion
private

Definition at line 51 of file SiPixelFedCablingTree.h.

Referenced by version().