1 #ifndef CTPPS_PIXELINDICES_H
2 #define CTPPS_PIXELINDICES_H
58 constexpr
int maxROCsInX = 2;
60 constexpr
int maxROCsInY = 3;
62 constexpr
int DColsPerROC = 26;
64 constexpr
int ROCSizeInX = 80;
65 constexpr
int ROCSizeInY = 52;
67 constexpr
int defaultDetSizeInX = 160;
68 constexpr
int defaultDetSizeInY = 156;
71 constexpr
bool CTPPS_CHECK_LIMITS =
true;
83 if (CTPPS_CHECK_LIMITS) {
84 if (theChipsInX < 1 || theChipsInX > maxROCsInX)
87 if (theChipsInY < 1 || theChipsInY > maxROCsInY)
97 if (CTPPS_CHECK_LIMITS) {
98 if (theChipsInX < 1 || theChipsInX > maxROCsInX)
101 if (theChipsInY < 1 || theChipsInY > maxROCsInY)
115 edm::LogInfo(
"RPix") <<
" Rows in one chip " << ROCSizeInX <<
" and columns " << ROCSizeInY;
116 edm::LogInfo(
"RPix") <<
" Double columns per ROC " << DColsPerROC;
126 inline static int convertDcolToCol(
const int dcol,
const int pix,
int& colROC,
int& rowROC) {
127 if (CTPPS_CHECK_LIMITS) {
128 if (dcol < 0 || dcol >= DColsPerROC || pix < 2 || pix > 161) {
129 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong dcol or pix " << dcol <<
" " << pix;
137 int colEvenOdd = pix % 2;
139 colROC = dcol * 2 + colEvenOdd;
140 rowROC =
abs(
int(pix / 2) - 80);
142 if (CTPPS_CHECK_LIMITS) {
143 if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
144 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong col or row " << colROC <<
" " << rowROC <<
" " << dcol <<
" "
161 if (CTPPS_CHECK_LIMITS) {
162 if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
163 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong index " << colROC <<
" " << rowROC;
169 if (rocId >= 0 && rocId < 3) {
172 col = (rocId + 1) * ROCSizeInY - colROC - 1;
173 }
else if (rocId >= 3 && rocId < 6) {
176 col = (5 - rocId) * ROCSizeInY + colROC;
178 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong ROC ID " << rocId;
181 if (CTPPS_CHECK_LIMITS) {
183 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong index " << col <<
" " << row;
196 if (CTPPS_CHECK_LIMITS) {
198 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong index 3 ";
204 int chipX = row / ROCSizeInX;
205 int chipY = col / ROCSizeInY;
209 if (CTPPS_CHECK_LIMITS && (rocId < 0 || rocId >= 6)) {
210 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong roc index " << rocId;
214 rowROC = (row % ROCSizeInX);
215 colROC = (col % ROCSizeInY);
218 colROC = 51 - colROC;
219 rowROC = 79 - rowROC;
222 if (CTPPS_CHECK_LIMITS) {
223 if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
224 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong index " << colROC <<
" " << rowROC;
237 if (CTPPS_CHECK_LIMITS) {
245 int chipX = row / ROCSizeInX;
246 int chipY = col / ROCSizeInY;
250 if (CTPPS_CHECK_LIMITS && (rocId < 0 || rocId >= 6)) {
251 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong roc index " << rocId;
260 if (col == 0 || row == 0 || col == (defaultDetSizeInY - 1) || row == (defaultDetSizeInX - 1))
269 inline static int rocIndex(
const int chipX,
const int chipY) {
271 if (CTPPS_CHECK_LIMITS) {
272 if (chipX < 0 || chipX >= 2 || chipY < 0 || chipY >= 3) {
273 edm::LogError(
"RPix") <<
"PixelChipIndices: wrong index " << chipX <<
" " << chipY;
282 if (CTPPS_CHECK_LIMITS) {
283 if (rocId < 0 || rocId >= (maxROCsInX * maxROCsInY)) {
284 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: Error in ROC index " << rocId;
294 int dColumnId = (colROC) / 2;
295 if (CTPPS_CHECK_LIMITS) {
296 if (dColumnId < 0 || dColumnId >= 26) {
297 edm::LogError(
"RPix") <<
"CTPPSPixelIndices: wrong dcol index " << dColumnId <<
" " << colROC;
307 int dcolInMod = dcol + chipIndex * 26;
314 return (rowROC << 6) | colROC;
317 int rowROC = (chan >> 6) & 0x7F;
318 int colROC = chan & 0x3F;
319 return std::pair<int, int>(rowROC, colROC);
static int convertDcolToCol(const int dcol, const int pix, int &colROC, int &rowROC)
int numberOfROCsInY(void)
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int getDefaultRowDetSize() const
CTPPSPixelIndices(const int colsInDet, const int rowsInDet)
Log< level::Error, false > LogError
static int pixelToChannelROC(const int rowROC, const int colROC)
static int rocIndex(const int chipX, const int chipY)
int getDefaultColDetSize() const
int getROCId(const int col, const int row) const
static std::pair< int, int > channelToPixelROC(const int chan)
Abs< T >::type abs(const T &t)
Log< level::Info, false > LogInfo
int transformToModule(const int colROC, const int rowROC, const int rocId, int &col, int &row) const
static int DColumnInModule(const int dcol, const int chipIndex)
int transformToROC(const int col, const int row, int &rocId, int &colROC, int &rowROC) const
bool isOnEdge(const int col, const int row) const
int numberOfROCsInX(void)
static int DColumn(const int colROC)