CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelFrameReverter.cc
Go to the documentation of this file.
7 // DataFormats
13 // Geometry
18 
20 
21 #include <sstream>
22 
23 using namespace std;
24 using namespace sipixelobjects;
25 
27  : map_(map)
28 {
29  // Build map
30  buildStructure(iSetup);
31 }
32 
33 
35 {
36 
37  // Create map connecting each detId to appropriate SiPixelFrameConverter
38 
40  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
41 
42  for(TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++){
43 
44  if(dynamic_cast<PixelGeomDetUnit*>((*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
54 
55 
57 {
58  std::vector<CablingPathToDetUnit> path = DetToFedMap[detId];
59  int fedId = (int) path[0].fed;
60  return fedId;
61 }
62 
63 
64 short SiPixelFrameReverter::findLinkInFed(uint32_t detId, GlobalPixel global)
65 {
66  std::vector<CablingPathToDetUnit> path = map_->pathToDetUnit(detId);
67  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
68  for (IT it = path.begin(); it != path.end(); ++it) {
69  const PixelROC * roc = map_->findItem(*it);
70  if (!roc) continue;
71 
72  LocalPixel local = roc->toLocal(global);
73 
74  if(!local.valid()) continue;
75  short link = (short) it->link;
76  return link;
77  }
78  return -1;
79 }
80 
81 
82 short SiPixelFrameReverter::findRocInLink(uint32_t detId, GlobalPixel global)
83 {
84  std::vector<CablingPathToDetUnit> path = map_->pathToDetUnit(detId);
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) continue;
89 
90  LocalPixel local = roc->toLocal(global);
91 
92  if(!local.valid()) continue;
93  short rocInLink = (short) roc->idInLink();
94  return rocInLink;
95  }
96  return -1;
97 }
98 
99 
100 short SiPixelFrameReverter::findRocInDet(uint32_t detId, GlobalPixel global)
101 {
102  std::vector<CablingPathToDetUnit> path = map_->pathToDetUnit(detId);
103  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
104  for (IT it = path.begin(); it != path.end(); ++it) {
105  const PixelROC * roc = map_->findItem(*it);
106  if (!roc) continue;
107 
108  LocalPixel local = roc->toLocal(global);
109 
110  if(!local.valid()) continue;
111  short rocInDet = (short) roc->idInDetUnit();
112  return rocInDet;
113  }
114  return -1;
115 }
116 
117 
119 {
120  std::vector<CablingPathToDetUnit> path = map_->pathToDetUnit(detId);
121  typedef std::vector<CablingPathToDetUnit>::const_iterator IT;
122  for (IT it = path.begin(); it != path.end(); ++it) {
123  const PixelROC * roc = map_->findItem(*it);
124  if (!roc) continue;
125 
126  LocalPixel local = roc->toLocal(global);
127 
128  if(!local.valid()) continue;
129  return local;
130  }
131  LocalPixel::RocRowCol pixel = {-1,-1};
132  LocalPixel local(pixel);
133  return local;
134 }
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
virtual std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const =0
unsigned int idInLink() const
id of this ROC in parent Link.
Definition: PixelROC.h:46
void buildStructure(edm::EventSetup const &)
identify pixel inside single ROC
Definition: LocalPixel.h:7
dictionary map
Definition: Association.py:160
int path() const
Definition: HLTadd.h:3
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
SiPixelFrameReverter(const edm::EventSetup &, const SiPixelFedCabling *map)
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
int findFedId(uint32_t detId)
LocalPixel toLocal(const GlobalPixel &gp) const
Definition: PixelROC.cc:54
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:43
std::vector< LinkConnSpec >::const_iterator IT
short findRocInLink(uint32_t detId, sipixelobjects::GlobalPixel global)
short findRocInDet(uint32_t detId, sipixelobjects::GlobalPixel global)
Definition: DetId.h:20
const SiPixelFedCabling * map_
const T & get() const
Definition: EventSetup.h:55
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > DetToFedMap
row and collumn in ROC representation
Definition: LocalPixel.h:15
sipixelobjects::LocalPixel findPixelInRoc(uint32_t detId, sipixelobjects::GlobalPixel global)
short findLinkInFed(uint32_t detId, sipixelobjects::GlobalPixel global)