Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:36

0001 #ifndef SiPixelTopoFinder_H
0002 #define SiPixelTopoFinder_H
0003 // -*- C++ -*-
0004 //
0005 // Class:      SiPixelTopoFinder
0006 //
0007 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0008 #include "DataFormats/DetId/interface/DetId.h"
0009 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0010 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
0011 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0012 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0013 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0014 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
0015 
0016 class SiPixelTopoFinder {
0017 public:
0018   SiPixelTopoFinder();
0019   ~SiPixelTopoFinder();
0020 
0021   void init(const TrackerGeometry* trackerGeometry,
0022             const TrackerTopology* trackerTopology,
0023             const SiPixelFedCablingMap* siPixelFedCablingMap);
0024 
0025   std::vector<int> getDetIds() const { return fDetIds_; }
0026 
0027   std::map<int, std::pair<int, int>> getSensors() const { return fSensors_; }
0028 
0029   std::map<int, std::pair<int, int>> getSensorLayout() const { return fSensorLayout_; }
0030 
0031   std::unordered_map<uint32_t, unsigned int> getFedIds() const { return fFedIds_; }
0032 
0033   std::map<int, std::map<int, int>> getRocIds() const { return fRocIds_; }
0034 
0035 private:
0036   // initialize with nullptr
0037   int phase_ = -1;
0038 
0039   const TrackerTopology* tkTopo_ = nullptr;
0040   const TrackerGeometry* tkGeom_ = nullptr;
0041   const SiPixelFedCablingMap* cablingMap_ = nullptr;
0042 
0043   // List of <int> DetIds
0044   std::vector<int> fDetIds_;
0045   // ROC size (number of row, number of columns for each det id)
0046   std::map<int, std::pair<int, int>> fSensors_;
0047   // the roc layout on a module
0048   std::map<int, std::pair<int, int>> fSensorLayout_;
0049   // fedId as a function of detId
0050   std::unordered_map<uint32_t, unsigned int> fFedIds_;
0051   // map the index ROC to rocId
0052   std::map<int, std::map<int, int>> fRocIds_;
0053 
0054   // conversion between online(local, per-ROC) row/column and offline(global, per-Module) row/column
0055   void onlineRocColRow(const DetId& detId,
0056                        const SiPixelFedCablingMap* cablingMap,
0057                        int fedId,
0058                        int offlineRow,
0059                        int offlineCol,
0060                        int& roc,
0061                        int& row,
0062                        int& col);
0063 
0064   int indexROC(int irow, int icol, int nROCcolumns);
0065 
0066   // some helper function for pixel naming
0067   int quadrant(const DetId& detid);
0068   int side(const DetId& detid);
0069   int half(const DetId& detid);
0070 };
0071 
0072 #endif