CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiPixelTopoFinder Class Reference

#include <SiPixelTopoFinder.h>

Public Member Functions

std::vector< int > getDetIds () const
 
std::unordered_map< uint32_t, unsigned int > getFedIds () const
 
std::map< int, std::map< int, int > > getRocIds () const
 
std::map< int, std::pair< int, int > > getSensorLayout () const
 
std::map< int, std::pair< int, int > > getSensors () const
 
void init (const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const SiPixelFedCablingMap *siPixelFedCablingMap)
 
 SiPixelTopoFinder ()
 
 ~SiPixelTopoFinder ()
 

Private Member Functions

int half (const DetId &detid)
 
int indexROC (int irow, int icol, int nROCcolumns)
 
void onlineRocColRow (const DetId &detId, const SiPixelFedCablingMap *cablingMap, int fedId, int offlineRow, int offlineCol, int &roc, int &row, int &col)
 
int quadrant (const DetId &detid)
 
int side (const DetId &detid)
 

Private Attributes

const SiPixelFedCablingMapcablingMap_ = nullptr
 
std::vector< int > fDetIds_
 
std::unordered_map< uint32_t, unsigned int > fFedIds_
 
std::map< int, std::map< int, int > > fRocIds_
 
std::map< int, std::pair< int, int > > fSensorLayout_
 
std::map< int, std::pair< int, int > > fSensors_
 
int phase_ = -1
 
const TrackerGeometrytkGeom_ = nullptr
 
const TrackerTopologytkTopo_ = nullptr
 

Detailed Description

Definition at line 16 of file SiPixelTopoFinder.h.

Constructor & Destructor Documentation

◆ SiPixelTopoFinder()

SiPixelTopoFinder::SiPixelTopoFinder ( )

Definition at line 11 of file SiPixelTopoFinder.cc.

11 {}

◆ ~SiPixelTopoFinder()

SiPixelTopoFinder::~SiPixelTopoFinder ( )

Definition at line 13 of file SiPixelTopoFinder.cc.

13 {}

Member Function Documentation

◆ getDetIds()

std::vector<int> SiPixelTopoFinder::getDetIds ( ) const
inline

Definition at line 25 of file SiPixelTopoFinder.h.

References fDetIds_.

25 { return fDetIds_; }
std::vector< int > fDetIds_

◆ getFedIds()

std::unordered_map<uint32_t, unsigned int> SiPixelTopoFinder::getFedIds ( ) const
inline

Definition at line 31 of file SiPixelTopoFinder.h.

References fFedIds_.

31 { return fFedIds_; }
std::unordered_map< uint32_t, unsigned int > fFedIds_

◆ getRocIds()

std::map<int, std::map<int, int> > SiPixelTopoFinder::getRocIds ( ) const
inline

Definition at line 33 of file SiPixelTopoFinder.h.

References fRocIds_.

33 { return fRocIds_; }
std::map< int, std::map< int, int > > fRocIds_

◆ getSensorLayout()

std::map<int, std::pair<int, int> > SiPixelTopoFinder::getSensorLayout ( ) const
inline

Definition at line 29 of file SiPixelTopoFinder.h.

References fSensorLayout_.

29 { return fSensorLayout_; }
std::map< int, std::pair< int, int > > fSensorLayout_

◆ getSensors()

std::map<int, std::pair<int, int> > SiPixelTopoFinder::getSensors ( ) const
inline

Definition at line 27 of file SiPixelTopoFinder.h.

References fSensors_.

27 { return fSensors_; }
std::map< int, std::pair< int, int > > fSensors_

◆ half()

int SiPixelTopoFinder::half ( const DetId detid)
private

Definition at line 144 of file SiPixelTopoFinder.cc.

References PixelBarrelName::isHalfModule(), phase_, PixelSubdetector::PixelBarrel, DetId::subdetId(), and tkTopo_.

Referenced by onlineRocColRow().

144  {
146  return PixelBarrelName(detid, tkTopo_, phase_).isHalfModule();
147  else
148  return -9999;
149 }
bool isHalfModule() const
full or half module
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const TrackerTopology * tkTopo_

◆ indexROC()

int SiPixelTopoFinder::indexROC ( int  irow,
int  icol,
int  nROCcolumns 
)
private

Definition at line 117 of file SiPixelTopoFinder.cc.

References createfilelist::int.

Referenced by init().

117  {
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 }

◆ init()

void SiPixelTopoFinder::init ( const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology,
const SiPixelFedCablingMap siPixelFedCablingMap 
)

Definition at line 15 of file SiPixelTopoFinder.cc.

References cablingMap_, PixelTopology::colsperroc(), SiPixelFedCablingMap::det2fedMap(), hcalRecHitTable_cff::detId, TrackerGeometry::dets(), fDetIds_, l1tstage2_dqm_sourceclient-live_cfg::fedId, fFedIds_, fRocIds_, fSensorLayout_, fSensors_, indexROC(), submitPVResolutionJobs::key, PixelTopology::ncolumns(), PixelTopology::nrows(), onlineRocColRow(), phase_, PixelMapPlotter::roc, PixelTopology::rowsperroc(), PixelGeomDetUnit::specificTopology(), tkGeom_, tkTopo_, and relativeConstraints::value.

17  {
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 }
const TrackerGeometry * tkGeom_
virtual int ncolumns() const =0
virtual int rowsperroc() const =0
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)
const SiPixelFedCablingMap * cablingMap_
void onlineRocColRow(const DetId &detId, const SiPixelFedCablingMap *cablingMap, int fedId, int offlineRow, int offlineCol, int &roc, int &row, int &col)
std::map< int, std::pair< int, int > > fSensorLayout_
virtual int colsperroc() const =0
std::map< int, std::map< int, int > > fRocIds_
key
prepare the HTCondor submission files and eventually submit them
Definition: value.py:1
const TrackerTopology * tkTopo_
std::vector< int > fDetIds_
int indexROC(int irow, int icol, int nROCcolumns)
Definition: DetId.h:17
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
std::unordered_map< uint32_t, unsigned int > fFedIds_

◆ onlineRocColRow()

void SiPixelTopoFinder::onlineRocColRow ( const DetId detId,
const SiPixelFedCablingMap cablingMap,
int  fedId,
int  offlineRow,
int  offlineCol,
int &  roc,
int &  row,
int &  col 
)
private

Definition at line 78 of file SiPixelTopoFinder.cc.

References cuy::col, sipixelobjects::ElectronicIndex::dcol, sipixelobjects::LocalPixel::DcolPxid::dcol, hgcalTestNeighbor_cfi::detector, hcalRecHitTable_cff::detId, l1tstage2_dqm_sourceclient-live_cfg::fedId, half(), sipixelobjects::PixelROC::idInDetUnit(), sipixelobjects::ElectronicIndex::link, PixelSubdetector::PixelBarrel, sipixelobjects::ElectronicIndex::pxid, sipixelobjects::LocalPixel::DcolPxid::pxid, sipixelobjects::ElectronicIndex::roc, PixelMapPlotter::roc, sipixelobjects::LocalPixel::rocCol(), sipixelobjects::LocalPixel::rocRow(), and side().

Referenced by init().

85  {
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 }
int side(const DetId &detid)
int half(const DetId &detid)
identify pixel inside single ROC
Definition: LocalPixel.h:7
double collumn and pixel ID in double collumn representation
Definition: LocalPixel.h:19
col
Definition: cuy.py:1009
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:37

◆ quadrant()

int SiPixelTopoFinder::quadrant ( const DetId detid)
private

Definition at line 126 of file SiPixelTopoFinder.cc.

References PixelEndcapName::halfCylinder(), phase_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, PixelBarrelName::shell(), DetId::subdetId(), and tkTopo_.

Referenced by side().

126  {
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 }
HalfCylinder halfCylinder() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const TrackerTopology * tkTopo_
Shell shell() const

◆ side()

int SiPixelTopoFinder::side ( const DetId detid)
private

Definition at line 135 of file SiPixelTopoFinder.cc.

References PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxfSide(), quadrant(), DetId::subdetId(), and tkTopo_.

Referenced by onlineRocColRow().

135  {
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 }
int quadrant(const DetId &detid)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const TrackerTopology * tkTopo_
unsigned int pxfSide(const DetId &id) const

Member Data Documentation

◆ cablingMap_

const SiPixelFedCablingMap* SiPixelTopoFinder::cablingMap_ = nullptr
private

Definition at line 41 of file SiPixelTopoFinder.h.

Referenced by init().

◆ fDetIds_

std::vector<int> SiPixelTopoFinder::fDetIds_
private

Definition at line 44 of file SiPixelTopoFinder.h.

Referenced by getDetIds(), and init().

◆ fFedIds_

std::unordered_map<uint32_t, unsigned int> SiPixelTopoFinder::fFedIds_
private

Definition at line 50 of file SiPixelTopoFinder.h.

Referenced by getFedIds(), and init().

◆ fRocIds_

std::map<int, std::map<int, int> > SiPixelTopoFinder::fRocIds_
private

Definition at line 52 of file SiPixelTopoFinder.h.

Referenced by getRocIds(), and init().

◆ fSensorLayout_

std::map<int, std::pair<int, int> > SiPixelTopoFinder::fSensorLayout_
private

Definition at line 48 of file SiPixelTopoFinder.h.

Referenced by getSensorLayout(), and init().

◆ fSensors_

std::map<int, std::pair<int, int> > SiPixelTopoFinder::fSensors_
private

Definition at line 46 of file SiPixelTopoFinder.h.

Referenced by getSensors(), and init().

◆ phase_

int SiPixelTopoFinder::phase_ = -1
private

Definition at line 37 of file SiPixelTopoFinder.h.

Referenced by half(), init(), and quadrant().

◆ tkGeom_

const TrackerGeometry* SiPixelTopoFinder::tkGeom_ = nullptr
private

Definition at line 40 of file SiPixelTopoFinder.h.

Referenced by init().

◆ tkTopo_

const TrackerTopology* SiPixelTopoFinder::tkTopo_ = nullptr
private

Definition at line 39 of file SiPixelTopoFinder.h.

Referenced by half(), init(), quadrant(), and side().