CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
SiPixelFrameReverter Class Reference

#include <SiPixelFrameReverter.h>

Public Member Functions

void buildStructure (const TrackerGeometry *)
 
int findFedId (uint32_t detId)
 
short findLinkInFed (uint32_t detId, sipixelobjects::GlobalPixel global)
 
sipixelobjects::LocalPixel findPixelInRoc (uint32_t detId, sipixelobjects::GlobalPixel global)
 
short findRocInDet (uint32_t detId, sipixelobjects::GlobalPixel global)
 
short findRocInLink (uint32_t detId, sipixelobjects::GlobalPixel global)
 
bool hasDetUnit (uint32_t detId) const
 
 SiPixelFrameReverter (const SiPixelFedCabling *map)
 
int toCabling (sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
 

Private Attributes

std::map< uint32_t,
std::vector
< sipixelobjects::CablingPathToDetUnit > > 
DetToFedMap
 
const SiPixelFedCablingmap_
 

Detailed Description

Definition at line 17 of file SiPixelFrameReverter.h.

Constructor & Destructor Documentation

SiPixelFrameReverter::SiPixelFrameReverter ( const SiPixelFedCabling map)

Definition at line 20 of file SiPixelFrameReverter.cc.

20 : map_(map), DetToFedMap(map->det2PathMap()) {}
virtual std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap() const =0
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_

Member Function Documentation

void SiPixelFrameReverter::buildStructure ( const TrackerGeometry trackerGeometry)

Definition at line 22 of file SiPixelFrameReverter.cc.

References TrackerGeometry::dets(), DetToFedMap, map_, mergeAndRegister::paths, and SiPixelFedCabling::pathToDetUnit().

22  {
23  // Create map connecting each detId to appropriate SiPixelFrameConverter
24  for (auto it = trackerGeometry->dets().begin(); it != trackerGeometry->dets().end(); it++) {
25  if (dynamic_cast<PixelGeomDetUnit const*>((*it)) != nullptr) {
26  DetId detId = (*it)->geographicalId();
27  uint32_t id = detId();
28  std::vector<CablingPathToDetUnit> paths = map_->pathToDetUnit(id);
29  DetToFedMap.insert(pair<uint32_t, std::vector<CablingPathToDetUnit> >(id, paths));
30  }
31  } // for(TrackerGeometry::DetContainer::const_iterator
32 } // end buildStructure
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DetId.h:17
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
int SiPixelFrameReverter::findFedId ( uint32_t  detId)

Definition at line 59 of file SiPixelFrameReverter.cc.

References DetToFedMap, l1tstage2_dqm_sourceclient-live_cfg::fedId, hasDetUnit(), and fed_dqm_sourceclient-live_cfg::path.

59  {
60  if (!hasDetUnit(detId))
61  return -1;
62  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
63  int fedId = (int)path[0].fed;
64  return fedId;
65 }
bool hasDetUnit(uint32_t detId) const
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
short SiPixelFrameReverter::findLinkInFed ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 67 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), MainPageGenerator::link, map_, fed_dqm_sourceclient-live_cfg::path, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

67  {
68  if (!hasDetUnit(detId))
69  return -1;
70  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
71  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
72  for (IT it = path.begin(); it != path.end(); ++it) {
73  const PixelROC* roc = map_->findItem(*it);
74  if (!roc)
75  continue;
76 
77  LocalPixel local = roc->toLocal(global);
78 
79  if (!local.valid())
80  continue;
81  short link = (short)it->link;
82  return link;
83  }
84  return -1;
85 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
LocalPixel SiPixelFrameReverter::findPixelInRoc ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 127 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), map_, fed_dqm_sourceclient-live_cfg::path, digitizers_cfi::pixel, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

127  {
128  if (!hasDetUnit(detId)) {
129  LocalPixel::RocRowCol pixel = {-1, -1};
130  LocalPixel local(pixel);
131  return local;
132  }
133  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
134  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
135  for (IT it = path.begin(); it != path.end(); ++it) {
136  const PixelROC* roc = map_->findItem(*it);
137  if (!roc)
138  continue;
139 
140  LocalPixel local = roc->toLocal(global);
141 
142  if (!local.valid())
143  continue;
144  return local;
145  }
146  LocalPixel::RocRowCol pixel = {-1, -1};
147  LocalPixel local(pixel);
148  return local;
149 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
row and collumn in ROC representation
Definition: LocalPixel.h:13
short SiPixelFrameReverter::findRocInDet ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 107 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInDetUnit(), map_, fed_dqm_sourceclient-live_cfg::path, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

107  {
108  if (!hasDetUnit(detId))
109  return -1;
110  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
111  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
112  for (IT it = path.begin(); it != path.end(); ++it) {
113  const PixelROC* roc = map_->findItem(*it);
114  if (!roc)
115  continue;
116 
117  LocalPixel local = roc->toLocal(global);
118 
119  if (!local.valid())
120  continue;
121  short rocInDet = (short)roc->idInDetUnit();
122  return rocInDet;
123  }
124  return -1;
125 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
short SiPixelFrameReverter::findRocInLink ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 87 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInLink(), map_, fed_dqm_sourceclient-live_cfg::path, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

87  {
88  if (!hasDetUnit(detId))
89  return -1;
90  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
91  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
92  for (IT it = path.begin(); it != path.end(); ++it) {
93  const PixelROC* roc = map_->findItem(*it);
94  if (!roc)
95  continue;
96 
97  LocalPixel local = roc->toLocal(global);
98 
99  if (!local.valid())
100  continue;
101  short rocInLink = (short)roc->idInLink();
102  return rocInLink;
103  }
104  return -1;
105 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:40
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
bool SiPixelFrameReverter::hasDetUnit ( uint32_t  detId) const
inline

Definition at line 24 of file SiPixelFrameReverter.h.

References DetToFedMap.

Referenced by findFedId(), findLinkInFed(), findPixelInRoc(), findRocInDet(), findRocInLink(), and toCabling().

24 { return (DetToFedMap.find(detId) != DetToFedMap.end()); }
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
int SiPixelFrameReverter::toCabling ( sipixelobjects::ElectronicIndex cabling,
const sipixelobjects::DetectorIndex detector 
) const

Definition at line 34 of file SiPixelFrameReverter.cc.

References sipixelobjects::DetectorIndex::col, sipixelobjects::LocalPixel::dcol(), DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), map_, fed_dqm_sourceclient-live_cfg::path, sipixelobjects::LocalPixel::pxid(), sipixelobjects::DetectorIndex::rawId, sipixelobjects::PixelROC::rawId(), PixelMapPlotter::roc, sipixelobjects::DetectorIndex::row, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by PixelDataFormatter::digi2word(), and PixelDataFormatter::digi2wordPhase1Layer1().

35  {
36  if (!hasDetUnit(detector.rawId))
37  return -1;
38  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detector.rawId)->second;
39  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
40  for (IT it = path.begin(); it != path.end(); ++it) {
41  const PixelROC* roc = map_->findItem(*it);
42  if (!roc)
43  return -3;
44  if (roc->rawId() != detector.rawId)
45  return -4;
46 
47  GlobalPixel global = {detector.row, detector.col};
48  LocalPixel local = roc->toLocal(global);
49  if (!local.valid())
50  continue;
51  ElectronicIndex cabIdx = {static_cast<int>(it->link), static_cast<int>(it->roc), local.dcol(), local.pxid()};
52  cabling = cabIdx;
53 
54  return it->fed;
55  }
56  return -2;
57 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:45
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:34
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_

Member Data Documentation

std::map<uint32_t, std::vector<sipixelobjects::CablingPathToDetUnit> > SiPixelFrameReverter::DetToFedMap
private
const SiPixelFedCabling* SiPixelFrameReverter::map_
private