CMS 3D CMS Logo

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::SiPixelFrameReverter ( const SiPixelFedCabling map)

Definition at line 20 of file SiPixelFrameReverter.cc.

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

Member Function Documentation

◆ buildStructure()

void SiPixelFrameReverter::buildStructure ( const TrackerGeometry trackerGeometry)

Definition at line 22 of file SiPixelFrameReverter.cc.

References TrackerGeometry::dets(), DetToFedMap, map_, Skims_PA_cff::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_

◆ findFedId()

int SiPixelFrameReverter::findFedId ( uint32_t  detId)

Definition at line 59 of file SiPixelFrameReverter.cc.

References DetToFedMap, l1tstage2_dqm_sourceclient-live_cfg::fedId, hasDetUnit(), createfilelist::int, and castor_dqm_sourceclient_file_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 }
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
bool hasDetUnit(uint32_t detId) const

◆ findLinkInFed()

short SiPixelFrameReverter::findLinkInFed ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 67 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), MainPageGenerator::link, DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, and PixelMapPlotter::roc.

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
identify pixel inside single ROC
Definition: LocalPixel.h:7
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
bool hasDetUnit(uint32_t detId) const

◆ findPixelInRoc()

LocalPixel SiPixelFrameReverter::findPixelInRoc ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 127 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, muonClassificationByHits_cfi::pixel, and PixelMapPlotter::roc.

127  {
128  if (!hasDetUnit(detId)) {
129  LocalPixel::RocRowCol pixel = {-1, -1};
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};
148  return local;
149 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
identify pixel inside single ROC
Definition: LocalPixel.h:7
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
bool hasDetUnit(uint32_t detId) const

◆ findRocInDet()

short SiPixelFrameReverter::findRocInDet ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 107 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, and PixelMapPlotter::roc.

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
identify pixel inside single ROC
Definition: LocalPixel.h:7
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
bool hasDetUnit(uint32_t detId) const

◆ findRocInLink()

short SiPixelFrameReverter::findRocInLink ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 87 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, and PixelMapPlotter::roc.

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
identify pixel inside single ROC
Definition: LocalPixel.h:7
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
bool hasDetUnit(uint32_t detId) const

◆ hasDetUnit()

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

◆ toCabling()

int SiPixelFrameReverter::toCabling ( sipixelobjects::ElectronicIndex cabling,
const sipixelobjects::DetectorIndex detector 
) const

Definition at line 34 of file SiPixelFrameReverter.cc.

References hgcalTestNeighbor_cfi::detector, DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, and PixelMapPlotter::roc.

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
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
std::vector< LinkConnSpec >::const_iterator IT
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
const SiPixelFedCabling * map_
bool hasDetUnit(uint32_t detId) const

Member Data Documentation

◆ DetToFedMap

std::map<uint32_t, std::vector<sipixelobjects::CablingPathToDetUnit> > SiPixelFrameReverter::DetToFedMap
private

◆ map_

const SiPixelFedCabling* SiPixelFrameReverter::map_
private