qupid 0.2
Quasi-Signal Generation Model for Pixelized Detector
Loading...
Searching...
No Matches
QPDigitizerSquare.cpp
1#include "QPPixel.hpp"
2#include "QPDigitizerSquare.hpp"
3
4QPDigitizerSquare::QPDigitizerSquare(double sizex, double sizey, int npixx, int npixy): QPDigitizerBase(npixx*npixy){
5 fSize[0] = sizex;
6 fSize[1] = sizey;
7
8 fNpix[0] = npixx;
9 fNpix[1] = npixy;
10
11 return;
12}
13
15 if(i > fNpix[0]*fNpix[1]) return nullptr;
16
17 return GetPixel(i/fNpix[0], i%fNpix[0]);
18}
19
20QPPixel* QPDigitizerSquare::GetPixel(const int i, const int j){
21 if(i < 0|| fNpix[0] < i) return nullptr;
22 if(j < 0|| fNpix[1] < j) return nullptr;
23
24 double xoff = -fSize[0]/2;
25 double yoff = -fSize[1]/2;
26
27 return new QPPixel(
28 (fSize[0])/(fNpix[0])*i + xoff,
29 (fSize[1])/(fNpix[1])*j + yoff,
30 (fSize[0])/(fNpix[0])*(i+1) + xoff,
31 (fSize[1])/(fNpix[1])*(j+1) + yoff,
32 this, i, j
33 );
34}
Abstract pixel-matrix digitizer: owns the injected signals and the matrix geometry; concrete classes ...
int fNpix[2]
number of pixels {x, y}
double fSize[2]
matrix extent {x, y}, µm
QPDigitizerSquare(double sizex=1, double sizey=1, int npixx=1, int npixy=1)
virtual QPPixel * GetPixel(const int index)
Pixel by linear index, decomposed as (index / npixx, index % npixx) and forwarded to GetPixel(int,...
Rectangular pixel cell (µm) with grid indices (i, j).
Definition QPPixel.hpp:11