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 13 of file SiPixelFedCablingTree.h.

Member Typedef Documentation

◆ PixelFEDCabling

Definition at line 15 of file SiPixelFedCablingTree.h.

Constructor & Destructor Documentation

◆ SiPixelFedCablingTree()

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

Definition at line 17 of file SiPixelFedCablingTree.h.

17 : theVersion(version) {}

◆ ~SiPixelFedCablingTree()

SiPixelFedCablingTree::~SiPixelFedCablingTree ( )
inlineoverride

Definition at line 19 of file SiPixelFedCablingTree.h.

19 {}

Member Function Documentation

◆ addFed()

void SiPixelFedCablingTree::addFed ( const PixelFEDCabling f)

add cabling for one fed

Definition at line 90 of file SiPixelFedCablingTree.cc.

90  {
91  int id = f.id();
92  theFedCablings[id] = f;
93 }

References f, and triggerObjects_cff::id.

◆ addItem()

void SiPixelFedCablingTree::addItem ( unsigned int  fedId,
unsigned int  linkId,
const sipixelobjects::PixelROC roc 
)

Definition at line 123 of file SiPixelFedCablingTree.cc.

123  {
125  if (cabling.id() != fedId)
126  cabling = PixelFEDCabling(fedId);
127  cabling.addItem(linkId, roc);
128 }

References sipixelobjects::PixelFEDCabling::addItem(), l1tstage2_dqm_sourceclient-live_cfg::fedId, sipixelobjects::PixelFEDCabling::id(), and PixelMapPlotter::roc.

◆ checkNumbering()

int SiPixelFedCablingTree::checkNumbering ( ) const

Definition at line 150 of file SiPixelFedCablingTree.cc.

150  {
151  int status = 0;
152  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
153  if (im->first != static_cast<int>(im->second.id())) {
154  status = 1;
155  std::cout << "PROBLEM WITH FED ID!!" << im->first << " vs: " << im->second.id() << std::endl;
156  }
157  im->second.checkLinkNumbering();
158  }
159  return status;
160 }

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

◆ det2fedMap()

std::unordered_map< uint32_t, unsigned int > SiPixelFedCablingTree::det2fedMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 53 of file SiPixelFedCablingTree.cc.

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)
60  continue;
61  unsigned int numberOfRocs = link->numberOfROCs();
62  for (unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
63  auto roc = link->roc(idxRoc);
64  result[roc->rawId()] = aFed.id(); // we know that a det is in one fed only...
65  }
66  }
67  }
68  return result;
69 }

References MainPageGenerator::link, mps_fire::result, and PixelMapPlotter::roc.

◆ det2PathMap()

std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > SiPixelFedCablingTree::det2PathMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 71 of file SiPixelFedCablingTree.cc.

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

References MainPageGenerator::link, castor_dqm_sourceclient_file_cfg::path, mps_fire::result, and PixelMapPlotter::roc.

◆ fed()

const PixelFEDCabling * SiPixelFedCablingTree::fed ( unsigned int  idFed) const

get fed identified by its id

Definition at line 95 of file SiPixelFedCablingTree.cc.

95  {
96  auto it = theFedCablings.find(id);
97  return (it == theFedCablings.end()) ? nullptr : &(*it).second;
98 }

◆ fedList()

std::vector< const PixelFEDCabling * > SiPixelFedCablingTree::fedList ( ) const

Definition at line 112 of file SiPixelFedCablingTree.cc.

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

References a, b, mps_fire::result, and jetUpdater_cfi::sort.

Referenced by SiPixelFedCablingMap::SiPixelFedCablingMap().

◆ findItem()

const sipixelobjects::PixelROC * SiPixelFedCablingTree::findItem ( const sipixelobjects::CablingPathToDetUnit path) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 130 of file SiPixelFedCablingTree.cc.

130  {
131  const PixelROC* roc = nullptr;
132  const PixelFEDCabling* aFed = fed(path.fed);
133  if (aFed) {
134  const PixelFEDLink* aLink = aFed->link(path.link);
135  if (aLink)
136  roc = aLink->roc(path.roc);
137  }
138  return roc;
139 }

References sipixelobjects::PixelFEDCabling::link(), castor_dqm_sourceclient_file_cfg::path, sipixelobjects::PixelFEDLink::roc(), and PixelMapPlotter::roc.

◆ findItemInFed()

const sipixelobjects::PixelROC * SiPixelFedCablingTree::findItemInFed ( const sipixelobjects::CablingPathToDetUnit path,
const PixelFEDCabling aFed 
) const

Definition at line 141 of file SiPixelFedCablingTree.cc.

142  {
143  const PixelROC* roc = nullptr;
144  const PixelFEDLink* aLink = aFed->link(path.link);
145  if (aLink)
146  roc = aLink->roc(path.roc);
147  return roc;
148 }

References sipixelobjects::PixelFEDCabling::link(), castor_dqm_sourceclient_file_cfg::path, sipixelobjects::PixelFEDLink::roc(), and PixelMapPlotter::roc.

Referenced by SiPixelFrameConverter::toRoc().

◆ pathToDetUnit()

std::vector< sipixelobjects::CablingPathToDetUnit > SiPixelFedCablingTree::pathToDetUnit ( uint32_t  rawDetId) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 11 of file SiPixelFedCablingTree.cc.

11  {
12  std::vector<sipixelobjects::CablingPathToDetUnit> result;
13  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
14  const PixelFEDCabling& aFed = im->second;
15  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
16  const PixelFEDLink* link = aFed.link(idxLink);
17  if (!link)
18  continue;
19  unsigned int numberOfRocs = link->numberOfROCs();
20  for (unsigned int idxRoc = 1; idxRoc <= numberOfRocs; idxRoc++) {
21  const PixelROC* roc = link->roc(idxRoc);
22  if (rawDetId == roc->rawId()) {
23  CablingPathToDetUnit path = {aFed.id(), link->id(), roc->idInLink()};
24  result.push_back(path);
25  }
26  }
27  }
28  }
29  return result;
30 }

References sipixelobjects::PixelFEDCabling::id(), sipixelobjects::PixelFEDCabling::link(), MainPageGenerator::link, sipixelobjects::PixelFEDCabling::numberOfLinks(), castor_dqm_sourceclient_file_cfg::path, mps_fire::result, and PixelMapPlotter::roc.

◆ pathToDetUnitHasDetUnit()

bool SiPixelFedCablingTree::pathToDetUnitHasDetUnit ( uint32_t  rawDetId,
unsigned int  fedId 
) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 32 of file SiPixelFedCablingTree.cc.

32  {
33  for (auto im = theFedCablings.begin(); im != theFedCablings.end(); ++im) {
34  const PixelFEDCabling& aFed = im->second;
35  if (aFed.id() == fedId) {
36  for (unsigned int idxLink = 1; idxLink <= aFed.numberOfLinks(); idxLink++) {
37  const PixelFEDLink* link = aFed.link(idxLink);
38  if (!link)
39  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 }

References l1tstage2_dqm_sourceclient-live_cfg::fedId, sipixelobjects::PixelFEDCabling::id(), sipixelobjects::PixelFEDCabling::link(), MainPageGenerator::link, sipixelobjects::PixelFEDCabling::numberOfLinks(), and PixelMapPlotter::roc.

◆ print()

string SiPixelFedCablingTree::print ( int  depth = 0) const

Definition at line 100 of file SiPixelFedCablingTree.cc.

100  {
101  ostringstream out;
102  if (depth-- >= 0) {
103  out << theVersion << endl;
104  for (IMAP it = theFedCablings.begin(); it != theFedCablings.end(); it++) {
105  out << (*it).second.print(depth);
106  }
107  }
108  out << endl;
109  return out.str();
110 }

References LEDCalibrationChannels::depth, and MillePedeFileConverter_cfg::out.

◆ version()

std::string SiPixelFedCablingTree::version ( ) const
inlineoverridevirtual

map version

Implements SiPixelFedCabling.

Definition at line 30 of file SiPixelFedCablingTree.h.

30 { return theVersion; }

References theVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

Member Data Documentation

◆ theFedCablings

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

Definition at line 51 of file SiPixelFedCablingTree.h.

◆ theVersion

std::string SiPixelFedCablingTree::theVersion
private

Definition at line 50 of file SiPixelFedCablingTree.h.

Referenced by version().

sipixelobjects::PixelFEDCabling::id
unsigned int id() const
Definition: PixelFEDCabling.h:34
sipixelobjects::PixelFEDCabling::link
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id's are ranged [1, numberOfLinks]
Definition: PixelFEDCabling.h:27
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
mps_update.status
status
Definition: mps_update.py:69
gather_cfg.cout
cout
Definition: gather_cfg.py:144
sipixelobjects::PixelFEDCabling
Definition: PixelFEDCabling.h:16
SiPixelFedCablingTree::PixelFEDCabling
sipixelobjects::PixelFEDCabling PixelFEDCabling
Definition: SiPixelFedCablingTree.h:15
SiPixelFedCablingTree::fed
const PixelFEDCabling * fed(unsigned int idFed) const
get fed identified by its id
Definition: SiPixelFedCablingTree.cc:95
SiPixelFedCablingTree::theVersion
std::string theVersion
Definition: SiPixelFedCablingTree.h:50
sipixelobjects::PixelFEDCabling::numberOfLinks
unsigned int numberOfLinks() const
number of links in FED
Definition: PixelFEDCabling.h:32
sipixelobjects::CablingPathToDetUnit
Definition: CablingPathToDetUnit.h:5
sipixelobjects::PixelFEDCabling::addItem
void addItem(unsigned int linkId, const PixelROC &roc)
Definition: PixelFEDCabling.cc:19
SiPixelFedCablingTree::theFedCablings
std::unordered_map< int, PixelFEDCabling > theFedCablings
Definition: SiPixelFedCablingTree.h:51
IMAP
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
Definition: SiPixelFedCablingTree.cc:9
b
double b
Definition: hdecay.h:118
SiPixelFedCablingTree::version
std::string version() const override
map version
Definition: SiPixelFedCablingTree.h:30
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
a
double a
Definition: hdecay.h:119
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
sipixelobjects::PixelROC
Definition: PixelROC.h:23
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37