ATLAS Offline Software
Loading...
Searching...
No Matches
ITkPixLayout.h
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4/*
5* Author: Ondra Kovanda, ondrej.kovanda at cern.ch
6* Date: 04/2024
7* Description: ITkPix* chip layout template. This aims for a contiguously stored
8* array of arbitrary type, representing the individual pixels in
9* ITkPix* chips with a 'physically' motivated (col, row) access
10*/
11
12#ifndef ITKPIXLAYOUT_H
13#define ITKPIXLAYOUT_H
14
15#include <array>
16#include <cstdint>
17
18template<class T> class ITkPixLayout{
19
20 public:
21
23
24 T& operator()(const uint16_t col, const uint16_t row){
25
26 //Columns are stored after one another
27 return m_pixels[ col * 384 + row ];
28
29 }
30
31 T operator()(const uint16_t col, const uint16_t row) const {
32
33 //Columns are stored after one another
34 return m_pixels[ col * 384 + row ];
35
36 }
37
38 int nHits() const {
39
40 //count hits
41 int hits = 0;
42 for (const auto& pixel : m_pixels) if (pixel) hits++;
43 return hits;
44
45 }
46
47 private:
48
49 //All chips will always have 400*384 pixels
50 std::array<T, 153600> m_pixels = {};
51
52};
53
54#endif
T operator()(const uint16_t col, const uint16_t row) const
T & operator()(const uint16_t col, const uint16_t row)
int nHits() const
std::array< uint16_t, 153600 > m_pixels