CMS 3D CMS Logo

SiPixelFrameReverter.cc
Go to the documentation of this file.
6 // DataFormats
12 // Geometry
16 
17 using namespace std;
18 using namespace sipixelobjects;
19 
20 SiPixelFrameReverter::SiPixelFrameReverter(const SiPixelFedCabling* map) : map_(map), DetToFedMap(map->det2PathMap()) {}
21 
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
33 
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 }
58 
59 int SiPixelFrameReverter::findFedId(uint32_t detId) {
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 }
66 
67 short SiPixelFrameReverter::findLinkInFed(uint32_t detId, GlobalPixel global) {
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 }
86 
87 short SiPixelFrameReverter::findRocInLink(uint32_t detId, GlobalPixel global) {
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 }
106 
107 short SiPixelFrameReverter::findRocInDet(uint32_t detId, GlobalPixel global) {
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 }
126 
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 }
FEDNumbering.h
PixelSubdetector.h
PixelBarrelName.h
TrackerGeometry.h
PixelTopology.h
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
SiPixelFrameReverter::SiPixelFrameReverter
SiPixelFrameReverter(const SiPixelFedCabling *map)
Definition: SiPixelFrameReverter.cc:20
SiPixelFedCabling::findItem
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
muonClassificationByHits_cfi.pixel
pixel
Definition: muonClassificationByHits_cfi.py:9
SiPixelFedCabling::pathToDetUnit
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
SiPixelFedCabling
Definition: SiPixelFedCabling.h:10
sipixelobjects::LocalPixel
identify pixel inside single ROC
Definition: LocalPixel.h:7
SiPixelFrameReverter::DetToFedMap
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
Definition: SiPixelFrameReverter.h:50
DetId
Definition: DetId.h:17
sipixelobjects::GlobalPixel
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
sipixelobjects
Definition: CablingPathToDetUnit.h:4
sipixelobjects::ElectronicIndex
Definition: ElectronicIndex.h:5
SiPixelFrameReverter::toCabling
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
Definition: SiPixelFrameReverter.cc:34
PixelROC.h
CablingPathToDetUnit.h
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelFrameReverter::findFedId
int findFedId(uint32_t detId)
Definition: SiPixelFrameReverter.cc:59
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
IT
std::vector< LinkConnSpec >::const_iterator IT
Definition: TriggerBoardSpec.cc:5
SiPixelFrameReverter::hasDetUnit
bool hasDetUnit(uint32_t detId) const
Definition: SiPixelFrameReverter.h:24
SiPixelFrameReverter::findRocInDet
short findRocInDet(uint32_t detId, sipixelobjects::GlobalPixel global)
Definition: SiPixelFrameReverter.cc:107
SiPixelFrameReverter::findLinkInFed
short findLinkInFed(uint32_t detId, sipixelobjects::GlobalPixel global)
Definition: SiPixelFrameReverter.cc:67
SiPixelFrameReverter::findRocInLink
short findRocInLink(uint32_t detId, sipixelobjects::GlobalPixel global)
Definition: SiPixelFrameReverter.cc:87
sipixelobjects::PixelROC
Definition: PixelROC.h:23
std
Definition: JetResolutionObject.h:76
sipixelobjects::LocalPixel::RocRowCol
row and collumn in ROC representation
Definition: LocalPixel.h:13
DetId.h
PixelGeomDetUnit.h
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
Skims_PA_cff.paths
paths
Definition: Skims_PA_cff.py:18
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
SiPixelFrameReverter::findPixelInRoc
sipixelobjects::LocalPixel findPixelInRoc(uint32_t detId, sipixelobjects::GlobalPixel global)
Definition: SiPixelFrameReverter.cc:127
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
genParticles_cff.map
map
Definition: genParticles_cff.py:11
SiPixelFrameReverter::map_
const SiPixelFedCabling * map_
Definition: SiPixelFrameReverter.h:48
SiPixelFrameReverter::buildStructure
void buildStructure(const TrackerGeometry *)
Definition: SiPixelFrameReverter.cc:22
PixelFEDCabling.h
sipixelobjects::DetectorIndex
Definition: DetectorIndex.h:6
PixelEndcapName.h
TrackerGeometry
Definition: TrackerGeometry.h:14
SiPixelFrameReverter.h