File indexing completed on 2024-04-06 12:02:28
0001 #ifndef PPSObjects_PixelROC_H
0002 #define PPSObjects_PixelROC_H
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include "CondFormats/PPSObjects/interface/CTPPSPixelIndices.h"
0007
0008 #include <cstdint>
0009 #include <string>
0010
0011
0012
0013
0014
0015
0016
0017
0018 class CTPPSPixelROC {
0019 public:
0020 CTPPSPixelROC() : theDetUnit(0), theIdDU(0), theIdLk(0) {}
0021
0022 ~CTPPSPixelROC() {}
0023
0024
0025
0026
0027 CTPPSPixelROC(uint32_t du, int idInDU, int idLk);
0028
0029 void setParameters(uint32_t du, int idInDU, int idLk) {
0030 theDetUnit = du;
0031 theIdDU = idInDU;
0032 theIdLk = idLk;
0033 }
0034
0035
0036 uint32_t rawId() const { return theDetUnit; }
0037
0038
0039 unsigned int idInDetUnit() const { return theIdDU; }
0040
0041
0042 unsigned int idInLink() const { return theIdLk; }
0043
0044 std::pair<int, int> toLocal(const std::pair<int, int> &modulePixel) const {
0045 int rocPixelRow, rocPixelColumn, idDU;
0046 int modulePixelRow = modulePixel.first;
0047 int modulePixelColumn = modulePixel.second;
0048
0049 theIndices.transformToROC(modulePixelColumn, modulePixelRow, idDU, rocPixelColumn, rocPixelRow);
0050
0051 std::pair<int, int> rocPixel;
0052 rocPixel = std::make_pair(rocPixelRow, rocPixelColumn);
0053
0054 return rocPixel;
0055 }
0056
0057 std::pair<int, int> toGlobal(const std::pair<int, int> &rocPixel) const {
0058 int modulePixelRow = -1;
0059 int modulePixelColumn = -1;
0060 int rocPixelRow = rocPixel.first;
0061 int rocPixelColumn = rocPixel.second;
0062
0063 theIndices.transformToModule(rocPixelColumn, rocPixelRow, theIdDU, modulePixelColumn, modulePixelRow);
0064
0065 std::pair<int, int> modulePixel;
0066 modulePixel = std::make_pair(modulePixelRow, modulePixelColumn);
0067
0068 return modulePixel;
0069 }
0070
0071 std::pair<int, int> toGlobalfromDcol(const std::pair<int, int> &rocPixel) const {
0072 int modulePixelRow = -1;
0073 int modulePixelColumn = -1;
0074 int rocDcol = rocPixel.first;
0075 int rocPxl = rocPixel.second;
0076
0077 int rocPixelRow;
0078 int rocPixelColumn;
0079
0080 theIndices.convertDcolToCol(rocDcol, rocPxl, rocPixelColumn, rocPixelRow);
0081
0082 theIndices.transformToModule(rocPixelColumn, rocPixelRow, theIdDU, modulePixelColumn, modulePixelRow);
0083
0084 std::pair<int, int> modulePixel;
0085 modulePixel = std::make_pair(modulePixelRow, modulePixelColumn);
0086
0087 return modulePixel;
0088 }
0089
0090
0091 std::string print(int depth = 0) const;
0092
0093 private:
0094 uint32_t theDetUnit;
0095 unsigned int theIdDU, theIdLk;
0096
0097 CTPPSPixelIndices theIndices;
0098
0099 COND_SERIALIZABLE;
0100 };
0101
0102 #endif