mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
added slsDetectorData class to readout (analog) detectors
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@2 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
parent
7ca31b2a62
commit
6a1ffaeda0
@ -1,6 +0,0 @@
|
||||
|
||||
# DO NOT DELETE
|
||||
|
||||
./energyCalibration_cpp.so: energyCalibration.h
|
||||
./energyCalibration_cpp.so: /afs/psi.ch/project/sls_det_software/root_v5.32.01_sl5_32bit/include/cintdictversion.h /afs/psi.ch/project/sls_det_software/root_v5.32.01_sl5_32bit/include/RVersion.h
|
||||
energyCalibration_cpp__ROOTBUILDVERSION= 5.32/01
|
91
slsDetectorCalibration/slsDetectorData.h
Normal file
91
slsDetectorCalibration/slsDetectorData.h
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef SLSDETECTORDATA_H
|
||||
#define SLSDETECTORDATA_H
|
||||
|
||||
class slsDetectorData {
|
||||
|
||||
/**
|
||||
|
||||
Constructor (no error checking if datasize and offsets are compatible!)
|
||||
\param npx number of pixels in the x direction
|
||||
\param npy number of pixels in the y direction
|
||||
\param ds size of the dataset
|
||||
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset)
|
||||
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||
|
||||
|
||||
*/
|
||||
slsDetectorData(int npx, int npy=1, int ds=-1, int **dMap=NULL, int **dMask=NULL) {
|
||||
nx=npx;
|
||||
ny=npy;
|
||||
|
||||
if (ds<=0)
|
||||
dataSize=nx*ny;
|
||||
else
|
||||
dataSize=ds;
|
||||
|
||||
dataMap=new int[nx][ny];
|
||||
dataMask=new int[nx][ny];
|
||||
|
||||
if (dMap==NULL) {
|
||||
for (int iy=0; iy<ny; iy++)
|
||||
for (int ix=0; ix<nx; ix++)
|
||||
dataMap[ix][iy]=iy*nx+ix;
|
||||
} else {
|
||||
for (int iy=0; iy<ny; iy++)
|
||||
for (int ix=0; ix<nx; ix++)
|
||||
dataMap[ix][iy]=dMap[ix][iy];
|
||||
}
|
||||
if (dMap!=NULL) {
|
||||
|
||||
for (int iy=0; iy<ny; iy++)
|
||||
for (int ix=0; ix<nx; ix++)
|
||||
dataMask[ix][iy]=dMask[ix][iy];
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
|
||||
Returns the value of the selected channel for the given dataset (no error checking if number of pixels are compatible!)
|
||||
\param data pointer to the dataset (including headers etc)
|
||||
\param ix pixel numb er in the x direction
|
||||
\param iy pixel number in the y direction
|
||||
|
||||
\returns data for the selected channel, with inversion if required
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int getChannel(int *data, int ix, int iy=1) {
|
||||
return *(data+dataMap[ix][iy])^dataMask[ix][iy];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Returns the value of the selected channel for the given dataset (no error checking if number of pixels are compatible!)
|
||||
\param data pointer to the dataset (including headers etc)
|
||||
\param ix pixel numb er in the x direction
|
||||
\param iy pixel number in the y direction
|
||||
|
||||
\returns data for the selected channel, with inversion if required
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int getChannel(u_int16_t *data, int ix, int iy=1) {
|
||||
return *(data+dataMap[ix][iy])^((u_int16_t)dataMask[ix][iy]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int nx; /**< Number of pixels in the x direction */
|
||||
int ny; /**< Number of pixels in the y direction */
|
||||
int dataSize; /**< Size of a dataset */
|
||||
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in the dataset (as offset)*/
|
||||
int **dataMask; /**< Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user