mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
some changes in slsCalibration for moench
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#ifndef SINGLE_PHOTON_HIT_H
|
||||
#define SINGLE_PHOTON_HIT_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
@ -26,7 +28,7 @@ class single_photon_hit {
|
||||
\param nx cluster size in x direction
|
||||
\param ny cluster size in y direction (defaults to 1 for 1D detectors)
|
||||
*/
|
||||
single_photon_hit(int nx=3, int ny=3): dx(nx), dy(ny) {data=new double[dx*dy];};
|
||||
single_photon_hit(int nx=3, int ny=3): dx(nx), dy(ny) {data=new int[dx*dy];};
|
||||
|
||||
~single_photon_hit(){delete [] data;}; /**< destructor, deletes the data array */
|
||||
|
||||
@ -35,8 +37,9 @@ class single_photon_hit {
|
||||
*/
|
||||
size_t write(FILE *myFile) {
|
||||
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
if (fwrite((void*)this, 1, 3*sizeof(int), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
|
||||
if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -47,8 +50,8 @@ class single_photon_hit {
|
||||
size_t read(FILE *myFile) {
|
||||
//fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
|
||||
if (fread((void*)this, 1, 3*sizeof(int), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
if (fread((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -60,7 +63,7 @@ class single_photon_hit {
|
||||
*/
|
||||
void set_data(double v, int ix, int iy=0){data[(iy+dy/2)*dx+ix+dx/2]=v;};
|
||||
|
||||
void set_cluster_size(int nx, int ny) {if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new double[dx*dy];};
|
||||
void set_cluster_size(int nx, int ny) {if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new int[dx*dy];};
|
||||
void get_cluster_size(int &nx, int &ny) {nx=dx; ny=dy;};
|
||||
void get_pixel(int &x1, int &y1) {x1=x; y1=y;};
|
||||
|
||||
@ -71,11 +74,11 @@ class single_photon_hit {
|
||||
\returns value of the cluster element
|
||||
*/
|
||||
double get_data(int ix, int iy=0){return data[(iy+dy/2)*dx+ix+dx/2];};
|
||||
double *get_cluster() {return data;};
|
||||
int *get_cluster() {return data;};
|
||||
|
||||
int iframe; /**< frame number */
|
||||
int x; /**< x-coordinate of the center of hit */
|
||||
int y; /**< x-coordinate of the center of hit */
|
||||
int16_t x; /**< x-coordinate of the center of hit */
|
||||
int16_t y; /**< x-coordinate of the center of hit */
|
||||
double rms; /**< noise of central pixel l -- at some point it can be removed*/
|
||||
double ped; /**< pedestal of the central pixel -- at some point it can be removed*/
|
||||
double tot; /**< sum of the 3x3 cluster */
|
||||
@ -83,7 +86,7 @@ class single_photon_hit {
|
||||
double quadTot; /**< sum of the maximum 2x2cluster */
|
||||
int dx; /**< size of data cluster in x */
|
||||
int dy; /**< size of data cluster in y */
|
||||
double *data; /**< pointer to data */
|
||||
int *data; /**< pointer to data */
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user