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
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 }
const TrackerGeometry * tkGeom_
virtual int ncolumns() const =0
int quadrant(const DetId &detid)
virtual int rowsperroc() const =0
int side(const DetId &detid)
std::map< int, std::pair< int, int > > fSensors_
virtual int nrows() const =0
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
int half(const DetId &detid)
const SiPixelFedCablingMap * cablingMap_
void onlineRocColRow(const DetId &detId, const SiPixelFedCablingMap *cablingMap, int fedId, int offlineRow, int offlineCol, int &roc, int &row, int &col)
identify pixel inside single ROC
Definition: LocalPixel.h:7
std::map< int, std::pair< int, int > > fSensorLayout_
bool isHalfModule() const
full or half module
virtual int colsperroc() const =0
HalfCylinder halfCylinder() const
std::map< int, std::map< int, int > > fRocIds_
key
prepare the HTCondor submission files and eventually submit them
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: value.py:1
const TrackerTopology * tkTopo_
std::vector< int > fDetIds_
double collumn and pixel ID in double collumn representation
Definition: LocalPixel.h:19
Shell shell() const
int indexROC(int irow, int icol, int nROCcolumns)
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
void init(const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const SiPixelFedCablingMap *siPixelFedCablingMap)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
col
Definition: cuy.py:1009
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
std::unordered_map< uint32_t, unsigned int > fFedIds_
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37