CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 18 of file SiPixelFrameReverter.h.

Constructor & Destructor Documentation

SiPixelFrameReverter::SiPixelFrameReverter ( const edm::EventSetup iSetup,
const SiPixelFedCabling map 
)

Definition at line 26 of file SiPixelFrameReverter.cc.

References buildStructure().

27  : map_(map)
28 {
29  // Build map
30  buildStructure(iSetup);
31 }
void buildStructure(edm::EventSetup const &)
const SiPixelFedCabling * map_

Member Function Documentation

void SiPixelFrameReverter::buildStructure ( edm::EventSetup const &  iSetup)

Definition at line 34 of file SiPixelFrameReverter.cc.

References DetToFedMap, edm::EventSetup::get(), map_, mergeAndRegister::paths, and SiPixelFedCabling::pathToDetUnit().

Referenced by SiPixelFrameReverter().

35 {
36 
37  // Create map connecting each detId to appropriate SiPixelFrameConverter
38 
40  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
41 
42  for(auto it = pDD->dets().begin(); it != pDD->dets().end(); it++){
43 
44  if(dynamic_cast<PixelGeomDetUnit const *>((*it))!=0){
45 
46  DetId detId = (*it)->geographicalId();
47  uint32_t id = detId();
48  std::vector<CablingPathToDetUnit> paths = map_->pathToDetUnit(id);
49  DetToFedMap.insert(pair< uint32_t,std::vector<CablingPathToDetUnit> > (id,paths));
50 
51  }
52  } // for(TrackerGeometry::DetContainer::const_iterator
53 } // end buildStructure
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
Definition: DetId.h:18
const SiPixelFedCabling * map_
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
int SiPixelFrameReverter::findFedId ( uint32_t  detId)

Definition at line 79 of file SiPixelFrameReverter.cc.

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

80 {
81  if(!hasDetUnit(detId)) return -1;
82  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
83  int fedId = (int) path[0].fed;
84  return fedId;
85 }
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 88 of file SiPixelFrameReverter.cc.

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

89 {
90  if(!hasDetUnit(detId)) return -1;
91  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
92  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
93  for (IT it = path.begin(); it != path.end(); ++it) {
94  const PixelROC * roc = map_->findItem(*it);
95  if (!roc) continue;
96 
97  LocalPixel local = roc->toLocal(global);
98 
99  if(!local.valid()) continue;
100  short link = (short) it->link;
101  return link;
102  }
103  return -1;
104 }
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:47
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * map_
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
LocalPixel SiPixelFrameReverter::findPixelInRoc ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 145 of file SiPixelFrameReverter.cc.

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

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

Definition at line 126 of file SiPixelFrameReverter.cc.

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

Referenced by SiPixelQuality::IsAreaBad().

127 {
128  if(!hasDetUnit(detId)) return -1;
129  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detId)->second;
130  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
131  for (IT it = path.begin(); it != path.end(); ++it) {
132  const PixelROC * roc = map_->findItem(*it);
133  if (!roc) continue;
134 
135  LocalPixel local = roc->toLocal(global);
136 
137  if(!local.valid()) continue;
138  short rocInDet = (short) roc->idInDetUnit();
139  return rocInDet;
140  }
141  return -1;
142 }
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:47
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:39
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * map_
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
short SiPixelFrameReverter::findRocInLink ( uint32_t  detId,
sipixelobjects::GlobalPixel  global 
)

Definition at line 107 of file SiPixelFrameReverter.cc.

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

108 {
109  if(!hasDetUnit(detId)) 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) continue;
115 
116  LocalPixel local = roc->toLocal(global);
117 
118  if(!local.valid()) continue;
119  short rocInLink = (short) roc->idInLink();
120  return rocInLink;
121  }
122  return -1;
123 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:42
bool hasDetUnit(uint32_t detId) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
LocalPixel toLocal(const GlobalPixel &glo) const
Definition: PixelROC.h:47
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * map_
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
bool SiPixelFrameReverter::hasDetUnit ( uint32_t  detId) const
inline

Definition at line 26 of file SiPixelFrameReverter.h.

References DetToFedMap.

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

26 { 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 56 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(), sipixelobjects::DetectorIndex::row, sipixelobjects::PixelROC::toLocal(), and sipixelobjects::LocalPixel::valid().

Referenced by PixelDataFormatter::digi2word().

58 {
59  if(!hasDetUnit(detector.rawId)) return -1;
60  std::vector<CablingPathToDetUnit> path = DetToFedMap.find(detector.rawId)->second;
61  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
62  for (IT it = path.begin(); it != path.end(); ++it) {
63  const PixelROC * roc = map_->findItem(*it);
64  if (!roc) return -3;
65  if (! roc->rawId() == detector.rawId) return -4;
66 
67  GlobalPixel global = {detector.row, detector.col};
68  LocalPixel local = roc->toLocal(global);
69  if(!local.valid()) continue;
70  ElectronicIndex cabIdx = {static_cast<int>(it->link), static_cast<int>(it->roc), local.dcol(), local.pxid()};
71  cabling = cabIdx;
72 
73  return it->fed;
74  }
75  return -2;
76 }
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:47
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:36
std::vector< LinkConnSpec >::const_iterator IT
const SiPixelFedCabling * map_
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap

Member Data Documentation

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