CMS 3D CMS Logo

SiPixelTopoFinder.cc
Go to the documentation of this file.
1 
3 
10 
12 
14 
15 void SiPixelTopoFinder::init(const TrackerGeometry* trackerGeometry,
16  const TrackerTopology* trackerTopology,
17  const SiPixelFedCablingMap* siPixelFedCablingMap) {
18  phase_ = -1;
19 
20  tkGeom_ = trackerGeometry;
21  tkTopo_ = trackerTopology;
22  cablingMap_ = siPixelFedCablingMap;
23  // from cabling map to FedIds
25 
26  // clear data
27  fDetIds_.clear();
28  fSensors_.clear();
29  fSensorLayout_.clear();
30  fRocIds_.clear();
31 
32  // loop over tracker geometry
33  for (TrackerGeometry::DetContainer::const_iterator it = tkGeom_->dets().begin(); it != tkGeom_->dets().end();
34  it++) { // tracker geo
35 
36  const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>((*it));
37  if (pgdu == nullptr)
38  continue;
39  // get detId for a module
40  DetId detId = (*it)->geographicalId();
41  int detid = detId.rawId();
42  fDetIds_.push_back(detid);
43 
44  // don't want to use magic number row 80 column 52 for Phase-1
45  const PixelTopology* topo = static_cast<const PixelTopology*>(&pgdu->specificTopology());
46  int rowsperroc = topo->rowsperroc();
47  int colsperroc = topo->colsperroc();
48 
49  int nROCrows = pgdu->specificTopology().nrows() / rowsperroc;
50  int nROCcolumns = pgdu->specificTopology().ncolumns() / colsperroc;
51 
52  fSensors_[detid] = std::make_pair(rowsperroc, colsperroc);
53  fSensorLayout_[detid] = std::make_pair(nROCrows, nROCcolumns);
54 
55  std::map<int, int> rocIdMap;
56  for (int irow = 0; irow < nROCrows; irow++) { // row
57  for (int icol = 0; icol < nROCcolumns; icol++) { // column
58  int dummyOfflineRow = (rowsperroc / 2 - 1) + irow * rowsperroc;
59  int dummeOfflineColumn = (colsperroc / 2 - 1) + icol * colsperroc;
60  int fedId = fFedIds_[detId.rawId()];
61 
62  int roc(-1), rocR(-1), rocC(-1);
64  detId, cablingMap_, fedId, dummyOfflineRow, dummeOfflineColumn, roc, rocR, rocC);
65 
66  // encode irow, icol
67  int key = SiPixelTopoFinder::indexROC(irow, icol, nROCcolumns);
68  int value = roc;
69  rocIdMap[key] = value;
70  } // column
71  } // row
72 
73  fRocIds_[detid] = rocIdMap;
74 
75  } // tracker geo
76 }
77 
79  const SiPixelFedCablingMap* cablingMap,
80  int fedId,
81  int offlineRow,
82  int offlineCol,
83  int& roc,
84  int& row,
85  int& col) {
86  // from detector to cabling
88  sipixelobjects::DetectorIndex detector; //{detId.rawId(), offlineRow, offlineCol};
89  detector.rawId = detId.rawId();
90  detector.row = offlineRow;
91  detector.col = offlineCol;
92 
94  converter.toCabling(cabling, detector);
95 
96  // then one can construct local pixel
98  loc.dcol = cabling.dcol;
99  loc.pxid = cabling.pxid;
100  // and get local(online) row/column
101  sipixelobjects::LocalPixel locpixel(loc);
102  col = locpixel.rocCol();
103  row = locpixel.rocRow();
104  //sipixelobjects::CablingPathToDetUnit path = {(unsigned int) fedId, (unsigned int)cabling.link, (unsigned int)cabling.roc};
105  //const sipixelobjects::PixelROC *theRoc = fCablingMap_->findItem(path);
106  const sipixelobjects::PixelROC* theRoc = converter.toRoc(cabling.link, cabling.roc);
107  roc = theRoc->idInDetUnit();
108 
109  // has to be BPIX; has to be minus side; has to be half module
110  // for phase-I, there is no half module
111  if (detId.subdetId() == PixelSubdetector::PixelBarrel && SiPixelTopoFinder::side(detId) == 1 &&
112  SiPixelTopoFinder::half(detId)) {
113  roc += 8;
114  }
115 }
116 
117 int SiPixelTopoFinder::indexROC(int irow, int icol, int nROCcolumns) {
118  return int(icol + irow * nROCcolumns);
119 
120  /*generate the folling roc index that is going to map with ROC id as
121  8 9 10 11 12 13 14 15
122  0 1 2 3 4 5 6 7 */
123 }
124 
125 // The following three functions copied from DQM/SiPixelPhase1Common/src/SiPixelCoordinates.cc
128  return PixelBarrelName(detid, tkTopo_, phase_).shell();
129  else if (detid.subdetId() == PixelSubdetector::PixelEndcap)
130  return PixelEndcapName(detid, tkTopo_, phase_).halfCylinder();
131  else
132  return -9999;
133 }
134 
135 int SiPixelTopoFinder::side(const DetId& detid) {
137  return 1 + (SiPixelTopoFinder::quadrant(detid) > 2);
138  else if (detid.subdetId() == PixelSubdetector::PixelEndcap)
139  return tkTopo_->pxfSide(detid);
140  else
141  return -9999;
142 }
143 
144 int SiPixelTopoFinder::half(const DetId& detid) {
146  return PixelBarrelName(detid, tkTopo_, phase_).isHalfModule();
147  else
148  return -9999;
149 }
FEDNumbering.h
SiPixelTopoFinder.h
PixelBarrelName.h
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
PixelTopology.h
TrackerTopology::pxfSide
unsigned int pxfSide(const DetId &id) const
Definition: TrackerTopology.h:192
SiPixelTopoFinder::quadrant
int quadrant(const DetId &detid)
Definition: SiPixelTopoFinder.cc:126
converter
Definition: CandidateProducer.h:25
PixelTopology::colsperroc
virtual int colsperroc() const =0
TrackerTopology
Definition: TrackerTopology.h:16
cuy.col
col
Definition: cuy.py:1010
SiPixelTopoFinder::tkGeom_
const TrackerGeometry * tkGeom_
Definition: SiPixelTopoFinder.h:40
PixelBarrelName
Definition: PixelBarrelName.h:16
SiPixelTopoFinder::half
int half(const DetId &detid)
Definition: SiPixelTopoFinder.cc:144
PixelEndcapName::halfCylinder
HalfCylinder halfCylinder() const
Definition: PixelEndcapName.h:42
sipixelobjects::ElectronicIndex::dcol
int dcol
Definition: ElectronicIndex.h:8
SiPixelTopoFinder::cablingMap_
const SiPixelFedCablingMap * cablingMap_
Definition: SiPixelTopoFinder.h:41
SiPixelTopoFinder::side
int side(const DetId &detid)
Definition: SiPixelTopoFinder.cc:135
SiPixelTopoFinder::fSensors_
std::map< int, std::pair< int, int > > fSensors_
Definition: SiPixelTopoFinder.h:46
SiPixelTopoFinder::phase_
int phase_
Definition: SiPixelTopoFinder.h:37
sipixelobjects::LocalPixel::rocCol
int rocCol() const
Definition: LocalPixel.h:35
SiPixelTopoFinder::SiPixelTopoFinder
SiPixelTopoFinder()
Definition: SiPixelTopoFinder.cc:11
sipixelobjects::LocalPixel
identify pixel inside single ROC
Definition: LocalPixel.h:7
DetId
Definition: DetId.h:17
SiPixelTopoFinder::onlineRocColRow
void onlineRocColRow(const DetId &detId, const SiPixelFedCablingMap *cablingMap, int fedId, int offlineRow, int offlineCol, int &roc, int &row, int &col)
Definition: SiPixelTopoFinder.cc:78
PixelEndcapName
Definition: PixelEndcapName.h:16
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
SiPixelTopoFinder::fSensorLayout_
std::map< int, std::pair< int, int > > fSensorLayout_
Definition: SiPixelTopoFinder.h:48
PixelTopology::ncolumns
virtual int ncolumns() const =0
sipixelobjects::ElectronicIndex::pxid
int pxid
Definition: ElectronicIndex.h:9
PixelTopology
Definition: PixelTopology.h:10
sipixelobjects::ElectronicIndex
Definition: ElectronicIndex.h:5
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
sipixelobjects::ElectronicIndex::link
int link
Definition: ElectronicIndex.h:6
SiPixelFrameConverter.h
SiPixelTopoFinder::fRocIds_
std::map< int, std::map< int, int > > fRocIds_
Definition: SiPixelTopoFinder.h:52
SiPixelTopoFinder::tkTopo_
const TrackerTopology * tkTopo_
Definition: SiPixelTopoFinder.h:39
SiPixelFedCablingMap::det2fedMap
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
Definition: SiPixelFedCablingMap.cc:133
sipixelobjects::LocalPixel::DcolPxid::pxid
int pxid
Definition: LocalPixel.h:20
PixelBarrelName::shell
Shell shell() const
Definition: PixelBarrelName.h:40
sipixelobjects::LocalPixel::DcolPxid
double collumn and pixel ID in double collumn representation
Definition: LocalPixel.h:19
sipixelobjects::LocalPixel::rocRow
int rocRow() const
Definition: LocalPixel.h:34
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
SiPixelTopoFinder::indexROC
int indexROC(int irow, int icol, int nROCcolumns)
Definition: SiPixelTopoFinder.cc:117
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
SiPixelTopoFinder::fDetIds_
std::vector< int > fDetIds_
Definition: SiPixelTopoFinder.h:44
SiPixelFrameConverter
Definition: SiPixelFrameConverter.h:15
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
PixelTopology::rowsperroc
virtual int rowsperroc() const =0
SiPixelFedCablingMap
Definition: SiPixelFedCablingMap.h:19
sipixelobjects::PixelROC
Definition: PixelROC.h:23
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
relativeConstraints.value
value
Definition: relativeConstraints.py:53
PixelGeomDetUnit.h
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
SiPixelTopoFinder::init
void init(const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const SiPixelFedCablingMap *siPixelFedCablingMap)
Definition: SiPixelTopoFinder.cc:15
SiPixelTopoFinder::fFedIds_
std::unordered_map< uint32_t, unsigned int > fFedIds_
Definition: SiPixelTopoFinder.h:50
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
SiPixelTopoFinder::~SiPixelTopoFinder
~SiPixelTopoFinder()
Definition: SiPixelTopoFinder.cc:13
PixelTopology::nrows
virtual int nrows() const =0
crabWrapper.key
key
Definition: crabWrapper.py:19
PixelBarrelName::isHalfModule
bool isHalfModule() const
full or half module
Definition: PixelBarrelName.cc:702
sipixelobjects::PixelROC::idInDetUnit
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37
sipixelobjects::LocalPixel::DcolPxid::dcol
int dcol
Definition: LocalPixel.h:20
sipixelobjects::DetectorIndex
Definition: DetectorIndex.h:6
sipixelobjects::ElectronicIndex::roc
int roc
Definition: ElectronicIndex.h:7
PixelEndcapName.h
TrackerGeometry
Definition: TrackerGeometry.h:14