CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiPixelFrameReverter Class Reference

#include <SiPixelFrameReverter.h>

Public Member Functions

void buildStructure (edm::EventSetup const &)
 
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 edm::EventSetup &, 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 edm::EventSetup iSetup,
const SiPixelFedCabling map 
)

Definition at line 26 of file SiPixelFrameReverter.cc.

27  : map_(map), DetToFedMap(map->det2PathMap()) {
28  // Build map
29  // buildStructure(iSetup);
30 }
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 ( edm::EventSetup const &  )

Definition at line 32 of file SiPixelFrameReverter.cc.

References TrackerGeometry::dets(), DetToFedMap, edm::EventSetup::get(), map_, Skims_PA_cff::paths, and SiPixelFedCabling::pathToDetUnit().

32  {
33  // Create map connecting each detId to appropriate SiPixelFrameConverter
34 
36  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
37 
38  for (auto it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
39  if (dynamic_cast<PixelGeomDetUnit const*>((*it)) != nullptr) {
40  DetId detId = (*it)->geographicalId();
41  uint32_t id = detId();
42  std::vector<CablingPathToDetUnit> paths = map_->pathToDetUnit(id);
43  DetToFedMap.insert(pair<uint32_t, std::vector<CablingPathToDetUnit> >(id, paths));
44  }
45  } // for(TrackerGeometry::DetContainer::const_iterator
46 } // 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 73 of file SiPixelFrameReverter.cc.

References DetToFedMap, l1tstage2_dqm_sourceclient-live_cfg::fedId, hasDetUnit(), createfilelist::int, and castor_dqm_sourceclient_file_cfg::path.

Referenced by hasDetUnit().

73  {
74  if (!hasDetUnit(detId))
75  return -1;
76  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
77  int fedId = (int)path[0].fed;
78  return fedId;
79 }
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 81 of file SiPixelFrameReverter.cc.

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

Referenced by hasDetUnit().

81  {
82  if (!hasDetUnit(detId))
83  return -1;
84  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
85  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
86  for (IT it = path.begin(); it != path.end(); ++it) {
87  const PixelROC* roc = map_->findItem(*it);
88  if (!roc)
89  continue;
90 
91  LocalPixel local = roc->toLocal(global);
92 
93  if (!local.valid())
94  continue;
95  short link = (short)it->link;
96  return link;
97  }
98  return -1;
99 }
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_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
LocalPixel SiPixelFrameReverter::findPixelInRoc ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 141 of file SiPixelFrameReverter.cc.

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

Referenced by hasDetUnit().

141  {
142  if (!hasDetUnit(detId)) {
143  LocalPixel::RocRowCol pixel = {-1, -1};
144  LocalPixel local(pixel);
145  return local;
146  }
147  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
148  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
149  for (IT it = path.begin(); it != path.end(); ++it) {
150  const PixelROC* roc = map_->findItem(*it);
151  if (!roc)
152  continue;
153 
154  LocalPixel local = roc->toLocal(global);
155 
156  if (!local.valid())
157  continue;
158  return local;
159  }
160  LocalPixel::RocRowCol pixel = {-1, -1};
161  LocalPixel local(pixel);
162  return local;
163 }
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_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
row and collumn in ROC representation
Definition: LocalPixel.h:13
short SiPixelFrameReverter::findRocInDet ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 121 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by hasDetUnit(), and SiPixelQuality::IsAreaBad().

121  {
122  if (!hasDetUnit(detId))
123  return -1;
124  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
125  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
126  for (IT it = path.begin(); it != path.end(); ++it) {
127  const PixelROC* roc = map_->findItem(*it);
128  if (!roc)
129  continue;
130 
131  LocalPixel local = roc->toLocal(global);
132 
133  if (!local.valid())
134  continue;
135  short rocInDet = (short)roc->idInDetUnit();
136  return rocInDet;
137  }
138  return -1;
139 }
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_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
short SiPixelFrameReverter::findRocInLink ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 101 of file SiPixelFrameReverter.cc.

References DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), sipixelobjects::PixelROC::idInLink(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_cfg::path, PixelMapPlotter::roc, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by hasDetUnit().

101  {
102  if (!hasDetUnit(detId))
103  return -1;
104  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
105  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
106  for (IT it = path.begin(); it != path.end(); ++it) {
107  const PixelROC* roc = map_->findItem(*it);
108  if (!roc)
109  continue;
110 
111  LocalPixel local = roc->toLocal(global);
112 
113  if (!local.valid())
114  continue;
115  short rocInLink = (short)roc->idInLink();
116  return rocInLink;
117  }
118  return -1;
119 }
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_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
bool SiPixelFrameReverter::hasDetUnit ( uint32_t  detId) const
inline

Definition at line 24 of file SiPixelFrameReverter.h.

References hgcalTestNeighbor_cfi::detector, DetToFedMap, findFedId(), findLinkInFed(), findPixelInRoc(), findRocInDet(), findRocInLink(), and toCabling().

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 48 of file SiPixelFrameReverter.cc.

References sipixelobjects::DetectorIndex::col, sipixelobjects::LocalPixel::dcol(), DetToFedMap, SiPixelFedCabling::findItem(), hasDetUnit(), DTRecHitClients_cfi::local, map_, castor_dqm_sourceclient_file_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(), PixelDataFormatter::digi2wordPhase1Layer1(), and hasDetUnit().

49  {
50  if (!hasDetUnit(detector.rawId))
51  return -1;
52  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detector.rawId)->second;
53  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
54  for (IT it = path.begin(); it != path.end(); ++it) {
55  const PixelROC* roc = map_->findItem(*it);
56  if (!roc)
57  return -3;
58  if (roc->rawId() != detector.rawId)
59  return -4;
60 
61  GlobalPixel global = {detector.row, detector.col};
62  LocalPixel local = roc->toLocal(global);
63  if (!local.valid())
64  continue;
65  ElectronicIndex cabIdx = {static_cast<int>(it->link), static_cast<int>(it->roc), local.dcol(), local.pxid()};
66  cabling = cabIdx;
67 
68  return it->fed;
69  }
70  return -2;
71 }
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_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0

Member Data Documentation

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