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()) {}

Member Function Documentation

◆ buildStructure()

void SiPixelFrameReverter::buildStructure ( const TrackerGeometry trackerGeometry)

Definition at line 22 of file SiPixelFrameReverter.cc.

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

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

◆ findFedId()

int SiPixelFrameReverter::findFedId ( uint32_t  detId)

Definition at line 59 of file SiPixelFrameReverter.cc.

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 }

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

◆ findLinkInFed()

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

Definition at line 67 of file SiPixelFrameReverter.cc.

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 }

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

◆ findPixelInRoc()

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

Definition at line 127 of file SiPixelFrameReverter.cc.

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 }

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

◆ findRocInDet()

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

Definition at line 107 of file SiPixelFrameReverter.cc.

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 }

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

◆ findRocInLink()

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

Definition at line 87 of file SiPixelFrameReverter.cc.

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 }

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

◆ hasDetUnit()

bool SiPixelFrameReverter::hasDetUnit ( uint32_t  detId) const
inline

Definition at line 24 of file SiPixelFrameReverter.h.

24 { return (DetToFedMap.find(detId) != DetToFedMap.end()); }

References DetToFedMap.

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

◆ toCabling()

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

Definition at line 34 of file SiPixelFrameReverter.cc.

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 }

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().

Member Data Documentation

◆ DetToFedMap

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

◆ map_

const SiPixelFedCabling* SiPixelFrameReverter::map_
private
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
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
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::ElectronicIndex
Definition: ElectronicIndex.h:5
createfilelist.int
int
Definition: createfilelist.py:10
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
sipixelobjects::PixelROC
Definition: PixelROC.h:23
sipixelobjects::LocalPixel::RocRowCol
row and collumn in ROC representation
Definition: LocalPixel.h:13
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
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