mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Compare commits
5 Commits
kp_highZ
...
moench-war
Author | SHA1 | Date | |
---|---|---|---|
7d7a4e79d0 | |||
3b8c612103 | |||
08c0c59a28 | |||
7e01095684 | |||
500442fd6b |
38
.github/workflows/cmake.yml
vendored
Normal file
38
.github/workflows/cmake.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: CMake
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Debug
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
name: Configure and build using cmake
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: libzmq3-dev libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev
|
||||
version: 1.0
|
||||
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSLS_USE_TESTS=ON -DSLS_USE_HDF5=ON -DSLS_USE_GUI=ON -DSLS_USE_MOENCH=ON
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build -j2 --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C ${{env.BUILD_TYPE}} -j1
|
||||
|
||||
|
@ -220,7 +220,7 @@ template <class dataType> class analogDetector {
|
||||
clone. Must be virtual!
|
||||
\returns a clone of the original analog detector
|
||||
*/
|
||||
virtual analogDetector *Clone() { return new analogDetector(this); }
|
||||
virtual analogDetector *Clone() = 0;
|
||||
|
||||
/**
|
||||
Gives an id to the structure. For debugging purposes in case of
|
||||
@ -298,8 +298,8 @@ template <class dataType> class analogDetector {
|
||||
if (gmap)
|
||||
delete[] gmap;
|
||||
gmap = new double[nnx * nny];
|
||||
for (iy = 0; iy < nny; ++iy) {
|
||||
for (ix = 0; ix < nnx; ++ix) {
|
||||
for (iy = 0; iy < static_cast<int>(nny); ++iy) {
|
||||
for (ix = 0; ix < static_cast<int>(nnx); ++ix) {
|
||||
gmap[iy * nnx + ix] = gm[iy * nnx + ix];
|
||||
// cout << gmap[iy*nnx+ix] << " " ;
|
||||
}
|
||||
@ -866,7 +866,7 @@ template <class dataType> class analogDetector {
|
||||
for (ix = xmin; ix < xmax; ++ix) {
|
||||
if (det->isGood(ix, iy)) {
|
||||
// addToPedestal(data,ix,iy,1);
|
||||
addToPedestal(data, ix, iy, 0);
|
||||
addToPedestal(data, ix, iy, cm);
|
||||
/* if (ix==50 && iy==50) */
|
||||
/* cout<< "*ped* " << id << " " << ix << " " << iy << " "
|
||||
* << det->getChannel(data,ix,iy) << " " <<
|
||||
@ -1097,7 +1097,7 @@ template <class dataType> class analogDetector {
|
||||
return thr;
|
||||
};
|
||||
|
||||
virtual int setClusterSize(int n = -1) { return 0; };
|
||||
virtual int setClusterSize(int n = -1) = 0;
|
||||
|
||||
/**
|
||||
gets threshold value for conversion into number of photons
|
||||
|
@ -100,10 +100,7 @@ class commonModeSubtraction {
|
||||
if (iroi >= 0 && iroi < nROI) {
|
||||
if (nCm[iroi] > 0)
|
||||
return mean[iroi] / nCm[iroi];
|
||||
else
|
||||
std::cout << ix << " " << iy << " no data in cm " << iroi << std::endl;
|
||||
} else
|
||||
std::cout << ix << " " << iy << " bad roi " << iroi << std::endl;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -120,8 +117,6 @@ class commonModeSubtraction {
|
||||
return sqrt(mean2[iroi] / nCm[iroi] -
|
||||
(mean[iroi] / nCm[iroi]) *
|
||||
(mean[iroi] / nCm[iroi]));
|
||||
else
|
||||
std::cout << ix << " " << iy << " no data in cm " << iroi << std::endl;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
@ -57,21 +57,33 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
|
||||
int groupmap[512*5][1024/5];
|
||||
|
||||
|
||||
jungfrauLGADStrixelsData()
|
||||
: slsDetectorData<uint16_t>(1024/5, 512*5,
|
||||
512 * 1024 * 2 + sizeof(header)) {
|
||||
cout << "aaa" << endl;
|
||||
// cout << "aaa" << endl;
|
||||
#ifdef ALDO //VH
|
||||
cout<< "using reduced jf_header" << endl; //VH
|
||||
#endif //VH
|
||||
for (int ix = 0; ix < 1024/5; ix++) {
|
||||
for (int iy = 0; iy < 512*5; iy++) {
|
||||
dataMap[iy][ix] = sizeof(header);//+ ( 1024 * 5 + 300) * 2; //somewhere on the guardring of the LGAD
|
||||
groupmap[iy][ix]=-1;
|
||||
#ifdef HIGHZ
|
||||
dataMask[iy][ix] = 0x3fff;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int x0=256+10, x1=256+246;
|
||||
int y0=10, y1=256-10;
|
||||
int ix,iy;
|
||||
int ox=0, oy=0, ooy=0;
|
||||
ox=2;//0; //original value is 0
|
||||
cout << "G0" << endl;
|
||||
|
||||
//chip1
|
||||
/*
|
||||
@ -90,10 +102,11 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
ox=0;
|
||||
for (int ipx=x0; ipx<x1; ipx++) {
|
||||
for (int ipy=y0; ipy<y0+54; ipy++) { //y0+54 excludes the last row (in chip coordinates), should be y0+55 to include all rows
|
||||
ix=(ipx-x0+ox)/3;
|
||||
iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy;
|
||||
ix=(ipx-x0+ox)/3;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
// cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
|
||||
groupmap[iy][ix]=0;
|
||||
// cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,12 +114,13 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
//3 square pixels in x on the left
|
||||
oy=-54;
|
||||
ooy=54*3;
|
||||
ox=3;
|
||||
ox=2;//; //original value is 3
|
||||
for (int ipx=x0; ipx<x1; ipx++) {
|
||||
for (int ipy=y0+54; ipy<y0+64+54; ipy++) { //I think y0+54 catches the last row of group1! Should be y0+55 if we want to include all rows? And y0+55+64
|
||||
ix=(ipx-x0+ox)/5;
|
||||
iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
groupmap[iy][ix]=1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,6 +134,7 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
ix=(ipx-x0+ox)/4;
|
||||
iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
groupmap[iy][ix]=2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +158,8 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
ix=(ipx-x0+ox)/4;
|
||||
iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
//if (ipx==x0)
|
||||
// cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
|
||||
//if (ipx==x0) cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
|
||||
groupmap[iy][ix]=2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,6 +173,7 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
ix=(ipx-x0+ox)/5;
|
||||
iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
groupmap[iy][ix]=1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +187,7 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
ix=(ipx-x0+ox)/3;
|
||||
iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy;
|
||||
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
|
||||
groupmap[iy][ix]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,336 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#ifndef JUNGFRAULGADSTRIXELSDATA_H
|
||||
#define JUNGFRAULGADSTRIXELSDATA_H
|
||||
#ifdef CINT
|
||||
#include "sls/sls_detector_defs_CINT.h"
|
||||
#else
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#endif
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
//#define VERSION_V2
|
||||
/**
|
||||
@short structure for a Detector Packet or Image Header
|
||||
@li frameNumber is the frame number
|
||||
@li expLength is the subframe number (32 bit eiger) or real time exposure
|
||||
time in 100ns (others)
|
||||
@li packetNumber is the packet number
|
||||
@li bunchId is the bunch id from beamline
|
||||
@li timestamp is the time stamp with 10 MHz clock
|
||||
@li modId is the unique module id (unique even for left, right, top, bottom)
|
||||
@li xCoord is the x coordinate in the complete detector system
|
||||
@li yCoord is the y coordinate in the complete detector system
|
||||
@li zCoord is the z coordinate in the complete detector system
|
||||
@li debug is for debugging purposes
|
||||
@li roundRNumber is the round robin set number
|
||||
@li detType is the detector type see :: detectorType
|
||||
@li version is the version number of this structure format
|
||||
*/
|
||||
|
||||
namespace strixelSingleChip {
|
||||
constexpr int nc_rawimg = 1024; //for full images //256;
|
||||
constexpr int nr_rawimg = 512;
|
||||
constexpr int nr_chip = 256;
|
||||
constexpr int gr = 9;
|
||||
|
||||
//Group 1: 25um pitch, groups of 3, 1 column of square pixels
|
||||
constexpr int g1_ncols{ (nc_rawimg-(2*gr)-1)/3 }; //79
|
||||
constexpr int g1_nrows{ ( (nr_chip/4)-gr )*3 }; //165
|
||||
|
||||
//Group 2: 15um pitch, groups of 5, 3 columns of square pixels
|
||||
constexpr int g2_ncols{ (nc_rawimg-(2*gr)-3)/5 }; //47
|
||||
constexpr int g2_nrows{ (nr_chip/4)*5 }; //320
|
||||
|
||||
//Group 3: 18.75um pitch, groups of 4, 2 columns of square pixels (double the size of the other groups)
|
||||
constexpr int g3_ncols{ (nc_rawimg-(2*gr)-2)/4 }; //59
|
||||
constexpr int g3_nrows{ ( ((nr_chip/4)*2)-gr )*4 }; //476
|
||||
|
||||
constexpr int nc_strixel = 2*gr + 1 + g1_ncols; //group 1 is the "longest" group in x and has one extra square pixel
|
||||
constexpr int nr_strixel = 2*gr + g1_nrows + g2_nrows + g3_nrows;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint64_t bunchNumber; /**< is the frame number */
|
||||
uint64_t pre; /**< something */
|
||||
|
||||
} jf_header; //Aldo's header
|
||||
|
||||
|
||||
using namespace strixelSingleChip;
|
||||
|
||||
class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
int iframe;
|
||||
int mchip;
|
||||
int chip_x0;
|
||||
int chip_y0;
|
||||
|
||||
void remapGroup( const int group ) {
|
||||
int ix, iy=0;
|
||||
int x0, y0, x1, y1, shifty;
|
||||
int multiplicator;
|
||||
int shiftx;
|
||||
switch (group) {
|
||||
default:
|
||||
case 1:
|
||||
multiplicator = 3;
|
||||
break;
|
||||
case 2:
|
||||
multiplicator = 5;
|
||||
break;
|
||||
case 3:
|
||||
multiplicator = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( mchip == 1 ) {
|
||||
|
||||
chip_x0=256;
|
||||
chip_y0=1; //because of bump bonding issues(+1 row) on M408
|
||||
|
||||
switch (group) {
|
||||
default:
|
||||
case 1:
|
||||
x0 = 10+chip_x0; //9 gr + 1 sq pixel
|
||||
x1 = 246+chip_x0;
|
||||
y0 = 9+chip_y0;
|
||||
y1 = 64+chip_y0;
|
||||
shifty = 0;
|
||||
break;
|
||||
case 2:
|
||||
x0 = 12+chip_x0;
|
||||
x1 = 247+chip_x0;
|
||||
y0 = 64+chip_y0;
|
||||
y1 = 128+chip_y0;
|
||||
shifty = g1_nrows;
|
||||
break;
|
||||
case 3:
|
||||
x0 = 11+chip_x0;
|
||||
x1 = 247+chip_x0;
|
||||
y0 = 128+chip_y0;
|
||||
y1 = 247+chip_y0;
|
||||
shifty = g2_nrows+g1_nrows;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mchip == 6 ) {
|
||||
|
||||
chip_x0=512;
|
||||
chip_y0=255; //should be 256 but is 255 because of bump bonding issues (+1 row) on M408
|
||||
|
||||
switch (group) {
|
||||
default:
|
||||
case 1:
|
||||
|
||||
x0 = 9+chip_x0; //9 gr sq pixel
|
||||
x1 = 246+chip_x0;
|
||||
y0 = 192+chip_y0;
|
||||
y1 = 244+chip_y0;
|
||||
|
||||
shifty = g1_nrows+2*g2_nrows+2*g3_nrows;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
x0 = 9+chip_x0;
|
||||
x1 = 244+chip_x0;
|
||||
y0 = 128+chip_y0;
|
||||
y1 = 191+chip_y0;
|
||||
|
||||
|
||||
shifty = g1_nrows+g2_nrows+2*g3_nrows;;
|
||||
break;
|
||||
case 3:
|
||||
|
||||
x0 = 9+chip_x0;
|
||||
x1 = 244+chip_x0;
|
||||
y0 = 9+chip_y0;
|
||||
y1 = 127+chip_y0;
|
||||
shifty =g1_nrows+g2_nrows+g3_nrows;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//remapping loop
|
||||
for ( int ipy=y0; ipy<=y1;ipy++) {
|
||||
for ( int ipx=x0; ipx<=x1; ipx++ ) {
|
||||
|
||||
ix = int ((ipx-x0)/multiplicator);
|
||||
for ( int m=0; m<multiplicator;m++ ) {
|
||||
if ( (ipx-x0)%multiplicator==m ) iy=(ipy-y0)*multiplicator +m + shifty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// if (iy< 40) cout << iy << " " << ix <<endl;
|
||||
dataMap[iy][ix] = sizeof(header) + (nc_rawimg * ipy + ipx) * 2;
|
||||
groupmap[iy][ix]=group-1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
int groupmap[512*5][1024/3];
|
||||
|
||||
using header = sls::defs::sls_receiver_header;
|
||||
|
||||
|
||||
jungfrauLGADStrixelsData()
|
||||
: slsDetectorData<uint16_t>( /*nc_strixel*/g1_ncols, /*nr_strixel*/ 2*g1_nrows+2*g2_nrows+2*g3_nrows,
|
||||
g1_ncols* (2*g1_nrows+2*g2_nrows+2*g3_nrows) * 2 + sizeof(header) ) {
|
||||
std::cout << "Jungfrau strixels 2X single chip with full module data " << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
//Fill all strixels with dummy values
|
||||
for (int ix = 0; ix != g1_ncols; ++ix) {
|
||||
for (int iy = 0; iy != 2*g1_nrows+2*g2_nrows+2*g3_nrows; ++iy) {
|
||||
dataMap[iy][ix] = sizeof(header);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
cout << "sizeofheader = "<<sizeof(header)<<endl;
|
||||
std::cout << "Jungfrau strixels 2X single chip with full module data " << std::endl;
|
||||
|
||||
mchip = 1;
|
||||
remapGroup(1);
|
||||
|
||||
|
||||
remapGroup(2);
|
||||
remapGroup(3);
|
||||
|
||||
mchip = 6;
|
||||
remapGroup(1);
|
||||
remapGroup(2);
|
||||
remapGroup(3);
|
||||
|
||||
iframe = 0;
|
||||
std::cout << "data struct created" << std::endl;
|
||||
};
|
||||
|
||||
/**
|
||||
Returns the value of the selected channel for the given dataset as
|
||||
double. \param data pointer to the dataset (including headers etc) \param
|
||||
ix pixel number in the x direction \param iy pixel number in the y
|
||||
direction \returns data for the selected channel, with inversion if
|
||||
required as double
|
||||
|
||||
*/
|
||||
virtual double getValue(char *data, int ix, int iy = 0) {
|
||||
|
||||
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
\param buff pointer to the dataset
|
||||
\returns frame number
|
||||
|
||||
*/
|
||||
|
||||
|
||||
int getFrameNumber(char *buff) {
|
||||
#ifdef ALDO //VH
|
||||
return ((header *)buff)->bunchNumber; //VH
|
||||
#else //VH
|
||||
return ((header *)buff)->detHeader.frameNumber;
|
||||
#endif //VH
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Returns the packet number for the given dataset. purely virtual func
|
||||
\param buff pointer to the dataset
|
||||
\returns packet number number
|
||||
|
||||
|
||||
|
||||
*/
|
||||
int getPacketNumber(char *buff) {
|
||||
#ifdef ALDO //VH
|
||||
//uint32_t fakePacketNumber = 1000;
|
||||
//return fakePacketNumber; //VH //TODO: Keep in mind in case of bugs! //This is definitely bad!
|
||||
return 1000;
|
||||
#else //VH
|
||||
return ((header *)buff)->detHeader.packetNumber;
|
||||
#endif //VH
|
||||
};
|
||||
|
||||
|
||||
|
||||
char *readNextFrame(std::ifstream &filebin) {
|
||||
int ff = -1, np = -1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
char *readNextFrame(std::ifstream &filebin, int &ff) {
|
||||
int np = -1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
|
||||
char *data = new char[dataSize];
|
||||
char *d = readNextFrame(filebin, ff, np, data);
|
||||
if (d == NULL) {
|
||||
delete[] data;
|
||||
data = NULL;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
char *readNextFrame(std::ifstream &filebin, int &ff, int &np,char *data) {
|
||||
char *retval = 0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
np = 0;
|
||||
int pn;
|
||||
|
||||
// cout << dataSize << endl;
|
||||
if (ff >= 0)
|
||||
fnum = ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, dataSize)) {
|
||||
ff = getFrameNumber(data);
|
||||
np = getPacketNumber(data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
/* Loops over a memory slot until a complete frame is found (i.e. all */
|
||||
/* packets 0 to nPackets, same frame number). purely virtual func \param */
|
||||
/* data pointer to the memory to be analyzed \param ndata reference to the */
|
||||
/* amount of data found for the frame, in case the frame is incomplete at */
|
||||
/* the end of the memory slot \param dsize size of the memory slot to be */
|
||||
/* analyzed \returns pointer to the beginning of the last good frame (might */
|
||||
/* be incomplete if ndata smaller than dataSize), or NULL if no frame is */
|
||||
/* found */
|
||||
|
||||
/* *\/ */
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
||||
if (dsize < dataSize)
|
||||
ndata = dsize;
|
||||
else
|
||||
ndata = dataSize;
|
||||
return data;
|
||||
};
|
||||
|
||||
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
};
|
||||
|
||||
#endif
|
@ -3,7 +3,6 @@
|
||||
#ifndef JUNGFRAUMODULEDATA_H
|
||||
#define JUNGFRAUMODULEDATA_H
|
||||
#include "slsDetectorData.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
//#define VERSION_V2
|
||||
/**
|
||||
@ -42,15 +41,8 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
|
||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
|
||||
#ifdef ALDO //VH
|
||||
using header = jf_header; //VH
|
||||
#else //VH
|
||||
using header = sls::defs::sls_receiver_header;
|
||||
#endif //VH
|
||||
|
||||
#ifndef ZMQ
|
||||
#define off sizeof(header)
|
||||
#define off sizeof(jf_header)
|
||||
#endif
|
||||
#ifdef ZMQ
|
||||
#define off 0
|
||||
@ -110,13 +102,9 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
|
||||
/* unsigned char frameNumber[3]; */
|
||||
/* unsigned char bunchid[8]; */
|
||||
/* }; */
|
||||
|
||||
|
||||
int getFrameNumber(char *buff) {
|
||||
#ifdef ALDO
|
||||
return ((header *)buff)->bunchNumber;
|
||||
#else
|
||||
return ((header *)buff)->detHeader.frameNumber;
|
||||
#endif
|
||||
return ((jf_header *)buff)->bunchNumber;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -54,28 +54,28 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
cout << "off is " << off << endl;
|
||||
cout << "off is " << off << endl;
|
||||
|
||||
if (off>0)
|
||||
if (off>0)
|
||||
cout << "M04 RAW DATA NEW " << endl;
|
||||
else
|
||||
else
|
||||
cout << "M04 ZMQ DATA NEW " << endl;
|
||||
|
||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
||||
|
||||
|
||||
|
||||
|
||||
int row, col;
|
||||
int row, col;
|
||||
|
||||
// int isample;
|
||||
int iadc;
|
||||
// int ix, iy;
|
||||
// int isample;
|
||||
int iadc;
|
||||
// int ix, iy;
|
||||
|
||||
// int npackets=40;
|
||||
int i;
|
||||
// int adc4(0);
|
||||
// int npackets=40;
|
||||
int i;
|
||||
// int adc4(0);
|
||||
|
||||
for (int is = 0; is < aSamples; is++) {
|
||||
|
||||
|
@ -12,8 +12,7 @@ template <class dataType> class slsDetectorData {
|
||||
const int nx; /**< Number of pixels in the x direction */
|
||||
const int ny; /**< Number of pixels in the y direction */
|
||||
int dataSize; /**<size of the data constituting one frame */
|
||||
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in
|
||||
the dataset (as offset)*/
|
||||
|
||||
dataType **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) */
|
||||
@ -25,6 +24,9 @@ template <class dataType> class slsDetectorData {
|
||||
int isOrdered;
|
||||
|
||||
public:
|
||||
|
||||
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in
|
||||
the dataset (as offset)*/
|
||||
/**
|
||||
General slsDetectors data structure. Works for data acquired using the
|
||||
slsDetectorReceiver. Can be generalized to other detectors (many virtual
|
||||
@ -196,19 +198,18 @@ template <typename dataType> slsDetectorData<dataType>::~slsDetectorData() {
|
||||
template <typename dataType>
|
||||
void slsDetectorData<dataType>::setDataMap(int **dMap) {
|
||||
|
||||
int ip = 0;
|
||||
int ix, iy;
|
||||
// int ip = 0;
|
||||
if (dMap == NULL) {
|
||||
for (iy = 0; iy < ny; iy++) {
|
||||
for (ix = 0; ix < nx; ix++) {
|
||||
for (int iy = 0; iy < ny; iy++) {
|
||||
for (int ix = 0; ix < nx; ix++) {
|
||||
dataMap[iy][ix] = (iy * nx + ix) * sizeof(dataType);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// cout << "set dmap "<< dataMap << " " << dMap << endl;
|
||||
for (iy = 0; iy < ny; iy++) {
|
||||
for (int iy = 0; iy < ny; iy++) {
|
||||
// cout << iy << endl;
|
||||
for (ix = 0; ix < nx; ix++) {
|
||||
for (int ix = 0; ix < nx; ix++) {
|
||||
dataMap[iy][ix] = dMap[iy][ix];
|
||||
// cout << ix << " " << iy << endl;
|
||||
/*ip=dataMap[ix][iy]/sizeof(dataType);
|
||||
@ -218,8 +219,8 @@ void slsDetectorData<dataType>::setDataMap(int **dMap) {
|
||||
}
|
||||
}
|
||||
/* //commented this part because it causes out-of-bound issues if nx or ny are larger than dataMap bounds (single-chip readout of strixel with groups of different pitches) VH 2023-02-24
|
||||
for (iy = 0; iy < ny; iy++) {
|
||||
for (ix = 0; ix < nx; ix++) {
|
||||
for (int iy = 0; iy < ny; iy++) {
|
||||
for (int ix = 0; ix < nx; ix++) {
|
||||
ip = dataMap[iy][ix] / sizeof(dataType);
|
||||
xmap[ip] = ix;
|
||||
ymap[ip] = iy;
|
||||
@ -291,7 +292,6 @@ template <typename dataType>
|
||||
dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
|
||||
int el = dsize / sizeof(dataType);
|
||||
// dataType **data;
|
||||
int ix, iy;
|
||||
// data=new dataType*[ny];
|
||||
// for(int i = 0; i < ny; i++) {
|
||||
// data[i]=new dataType[nx];
|
||||
@ -301,6 +301,7 @@ dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
|
||||
dsize = dataSize;
|
||||
|
||||
for (int ip = 0; ip < (el); ip++) {
|
||||
int ix, iy;
|
||||
getPixel(ip, ix, iy);
|
||||
if (ix >= 0 && ix < nx && iy >= 0 && iy < ny) {
|
||||
// data[iy][ix]=getChannel(ptr,ix,iy);
|
||||
|
@ -23,7 +23,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
/* if (etamin>=etamax) { */
|
||||
/* etamin=-1; */
|
||||
/* etamax=2; */
|
||||
/* // cout << ":" <<endl; */
|
||||
/* // std::cout << ":" <<endl; */
|
||||
/* } */
|
||||
/* etastep=(etamax-etamin)/nbeta; */
|
||||
|
||||
@ -164,7 +164,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
dY = -1.;
|
||||
break;
|
||||
default:
|
||||
cout << "bad quadrant" << endl;
|
||||
std::cout << "bad quadrant" << std::endl;
|
||||
dX = 0.;
|
||||
dY = 0.;
|
||||
}
|
||||
@ -174,19 +174,19 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
ex = (etax - etamin) / etastepX;
|
||||
ey = (etay - etamin) / etastepY;
|
||||
if (ex < 0) {
|
||||
cout << "x*" << ex << endl;
|
||||
std::cout << "x*" << ex << std::endl;
|
||||
ex = 0;
|
||||
}
|
||||
if (ex >= nbetaX) {
|
||||
cout << "x?" << ex << endl;
|
||||
std::cout << "x?" << ex << std::endl;
|
||||
ex = nbetaX - 1;
|
||||
}
|
||||
if (ey < 0) {
|
||||
cout << "y*" << ey << " " << nbetaY << endl;
|
||||
std::cout << "y*" << ey << " " << nbetaY << std::endl;
|
||||
ey = 0;
|
||||
}
|
||||
if (ey >= nbetaY) {
|
||||
cout << "y?" << ey << " " << nbetaY << endl;
|
||||
std::cout << "y?" << ey << " " << nbetaY << std::endl;
|
||||
ey = nbetaY - 1;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
// calcMyEta(totquad,quad,cl,etax, etay);
|
||||
calcEta(totquad, cc, etax, etay);
|
||||
|
||||
// cout <<"******"<< etax << " " << etay << endl;
|
||||
// std::cout <<"******"<< etax << " " << etay << std::endl;
|
||||
|
||||
return addToFlatFieldDistribution(etax, etay);
|
||||
}
|
||||
@ -270,16 +270,16 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
/* cc[0][1] = cl[yoff * 3 + xoff + 1]; */
|
||||
/* cc[1][1] = cl[(yoff + 1) * 3 + xoff + 1]; */
|
||||
|
||||
/* /\* cout << cl[0] << " " << cl[1] << " " << cl[2] << endl; *\/ */
|
||||
/* /\* cout << cl[3] << " " << cl[4] << " " << cl[5] << endl; *\/ */
|
||||
/* /\* cout << cl[6] << " " << cl[7] << " " << cl[8] << endl; *\/ */
|
||||
/* /\* cout <<"******"<<totquad << " " << quad << endl; *\/ */
|
||||
/* /\* cout << cc[0][0]<< " " << cc[0][1] << endl; *\/ */
|
||||
/* /\* cout << cc[1][0]<< " " << cc[1][1] << endl; *\/ */
|
||||
/* /\* std::cout << cl[0] << " " << cl[1] << " " << cl[2] << std::endl; *\/ */
|
||||
/* /\* std::cout << cl[3] << " " << cl[4] << " " << cl[5] << std::endl; *\/ */
|
||||
/* /\* std::cout << cl[6] << " " << cl[7] << " " << cl[8] << std::endl; *\/ */
|
||||
/* /\* std::cout <<"******"<<totquad << " " << quad << std::endl; *\/ */
|
||||
/* /\* std::cout << cc[0][0]<< " " << cc[0][1] << std::endl; *\/ */
|
||||
/* /\* std::cout << cc[1][0]<< " " << cc[1][1] << std::endl; *\/ */
|
||||
/* // calcMyEta(totquad,quad,cl,etax, etay); */
|
||||
/* calcEta(totquad, cc, etax, etay); */
|
||||
|
||||
/* // cout <<"******"<< etax << " " << etay << endl; */
|
||||
/* // std::cout <<"******"<< etax << " " << etay << std::endl; */
|
||||
|
||||
/* return addToFlatFieldDistribution(etax, etay); */
|
||||
/* } */
|
||||
@ -331,7 +331,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
virtual int *getInterpolatedImage() {
|
||||
int ipx, ipy;
|
||||
// cout << "ff" << endl;
|
||||
// std::cout << "ff" << std::endl;
|
||||
calcDiff(1, hhx, hhy); // get flat
|
||||
double avg = 0;
|
||||
for (ipx = 0; ipx < nSubPixelsX; ipx++)
|
||||
@ -347,8 +347,8 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
ipy = iby % nSubPixelsY - nSubPixelsY / 2;
|
||||
if (ipy < 0)
|
||||
ipy = nSubPixelsY + ipy;
|
||||
// cout << ipx << " " << ipy << " " << ibx << " " << iby <<
|
||||
// endl;
|
||||
// std::cout << ipx << " " << ipy << " " << ibx << " " << iby <<
|
||||
// std::endl;
|
||||
if (flat[ipx + ipy * nSubPixelsX] > 0)
|
||||
hintcorr[ibx + iby * nSubPixelsX * nPixelsX] =
|
||||
hint[ibx + iby * nSubPixelsX * nPixelsX] *
|
||||
|
@ -21,14 +21,14 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
double emax = 0)
|
||||
: slsInterpolation(nx, ny, ns, nsy), hhx(NULL), hhy(NULL), heta(NULL),
|
||||
nbetaX(nb), nbetaY(nby), etamin(emin), etamax(emax) {
|
||||
// cout << "eb " << nb << " " << emin << " " << emax << endl;
|
||||
// cout << nb << " " << etamin << " " << etamax << endl;
|
||||
// std::cout << "eb " << nb << " " << emin << " " << emax << std::endl;
|
||||
// std::cout << nb << " " << etamin << " " << etamax << std::endl;
|
||||
if (nbetaX <= 0) {
|
||||
// cout << "aaa:" <<endl;
|
||||
// std::cout << "aaa:" <<endl;
|
||||
nbetaX = nSubPixelsX * 10;
|
||||
}
|
||||
if (nbetaY <= 0) {
|
||||
// cout << "aaa:" <<endl;
|
||||
// std::cout << "aaa:" <<endl;
|
||||
nbetaY = nSubPixelsY * 10;
|
||||
}
|
||||
if (etamin >= etamax) {
|
||||
@ -145,9 +145,9 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
uint32_t nny;
|
||||
float *gm = ReadFromTiff(imgname, nnx, nny);
|
||||
/* if (nnx!=nny) { */
|
||||
/* cout << "different number of bins in x " << nnx << " and y " <<
|
||||
* nny<< " !"<< endl; */
|
||||
/* cout << "Aborting read"<< endl; */
|
||||
/* std::cout << "different number of bins in x " << nnx << " and y " <<
|
||||
* nny<< " !"<< std::endl; */
|
||||
/* std::cout << "Aborting read"<< std::endl; */
|
||||
/* return 0; */
|
||||
/* } */
|
||||
nbetaX = nnx;
|
||||
@ -254,12 +254,12 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
if (ibx >= 0 && ibx < nSubPixelsX && iby >= 0 &&
|
||||
iby < nSubPixelsY) {
|
||||
//
|
||||
// if (ibx>0 && iby>0) cout << ibx << " " << iby << " " << ii <<
|
||||
// endl;
|
||||
// if (ibx>0 && iby>0) std::cout << ibx << " " << iby << " " << ii <<
|
||||
// std::endl;
|
||||
ftest[ibx + iby * nSubPixelsX] += heta[ii];
|
||||
} else
|
||||
cout << "Bad interpolation " << ii << " " << ibx << " " << iby
|
||||
<< endl;
|
||||
std::cout << "Bad interpolation " << ii << " " << ibx << " " << iby
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
sprintf(tit, "/scratch/ftest_%d.tiff", ind);
|
||||
@ -282,7 +282,7 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
}
|
||||
sprintf(tit, "/scratch/eta_bad_%d.tiff", ind);
|
||||
WriteToTiff(etah, tit, nbetaX, nbetaY);
|
||||
// cout << "Index: " << ind << "\t Bad bins: "<< nbad << endl;
|
||||
// std::cout << "Index: " << ind << "\t Bad bins: "<< nbad << std::endl;
|
||||
// int ibx=0, iby=0;
|
||||
|
||||
delete[] ftest;
|
||||
@ -330,9 +330,9 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
}
|
||||
}
|
||||
|
||||
// cout << endl << endl;
|
||||
// std::cout << std::endl << std::endl;
|
||||
for (ipy = 0; ipy < nSubPixelsY; ipy++) {
|
||||
cout.width(5);
|
||||
std::cout.width(5);
|
||||
// flat_y[ipy]=p_tot_y[ipy];//avg/nSubPixels;
|
||||
for (ipx = 0; ipx < nSubPixelsX; ipx++) {
|
||||
|
||||
@ -353,19 +353,19 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
//" ";
|
||||
}
|
||||
|
||||
/* cout << "** " << setprecision(4) << flat_y[ipy]; */
|
||||
// cout << "\n";
|
||||
/* std::cout << "** " << setprecision(4) << flat_y[ipy]; */
|
||||
// std::cout << "\n";
|
||||
}
|
||||
/* cout << "**" << endl; cout.width(5); */
|
||||
/* std::cout << "**" << std::endl; std::cout.width(5); */
|
||||
/* for (ipx=0; ipx<nSubPixels; ipx++) { */
|
||||
/* cout << setprecision(4) << flat_x[ipx] << " "; */
|
||||
/* std::cout << setprecision(4) << flat_x[ipx] << " "; */
|
||||
/* } */
|
||||
// cout << "**" << endl; cout.width(5);
|
||||
// cout << "Min diff: " << mindiff/sqrt(avg) << " Max diff: " <<
|
||||
// maxdiff/sqrt(avg) << " Nbad: " << nbad << endl;
|
||||
// std::cout << "**" << std::endl; std::cout.width(5);
|
||||
// std::cout << "Min diff: " << mindiff/sqrt(avg) << " Max diff: " <<
|
||||
// maxdiff/sqrt(avg) << " Nbad: " << nbad << std::endl;
|
||||
|
||||
// cout << "Bad pixels: " <<
|
||||
// 100.*(float)nbad/((float)(nSubPixels*nSubPixels)) << " %" << endl;
|
||||
// std::cout << "Bad pixels: " <<
|
||||
// 100.*(float)nbad/((float)(nSubPixels*nSubPixels)) << " %" << std::endl;
|
||||
delete[] p_tot_x;
|
||||
delete[] p_tot_y;
|
||||
delete[] p_tot;
|
||||
|
@ -14,8 +14,8 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase {
|
||||
int nb = -1, int nby = -1, double emin = 1,
|
||||
double emax = 0)
|
||||
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax){
|
||||
// cout << "epxy " << nb << " " << emin << " " << emax << endl;
|
||||
// cout << nbeta << " " << etamin << " " << etamax << endl;
|
||||
// std::cout << "epxy " << nb << " " << emin << " " << emax << std::endl;
|
||||
// std::cout << nbeta << " " << etamin << " " << etamax << std::endl;
|
||||
};
|
||||
|
||||
etaInterpolationPosXY(etaInterpolationPosXY *orig)
|
||||
@ -32,14 +32,14 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase {
|
||||
|
||||
///*Eta Distribution Rebinning*///
|
||||
// double bsize=1./nSubPixels; //precision
|
||||
// cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels
|
||||
// std::cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels
|
||||
// = "<<nSubPixels<<endl;
|
||||
double tot_eta = 0;
|
||||
double tot_eta_x = 0;
|
||||
double tot_eta_y = 0;
|
||||
for (int ip = 0; ip < nbetaX * nbetaY; ip++)
|
||||
tot_eta += heta[ip];
|
||||
cout << "total eta entries is :" << tot_eta << endl;
|
||||
std::cout << "total eta entries is :" << tot_eta << std::endl;
|
||||
if (tot_eta <= 0) {
|
||||
ok = 0;
|
||||
return;
|
||||
@ -57,7 +57,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase {
|
||||
|
||||
for (int iby = 0; iby < nbetaY; iby++) {
|
||||
etay = etamin + iby * etastepY;
|
||||
// cout << etax << endl;
|
||||
// std::cout << etax << std::endl;
|
||||
|
||||
// tot_eta_x+=hx[iby];
|
||||
if (etay >= 0 && etay <= 1)
|
||||
@ -90,7 +90,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase {
|
||||
|
||||
for (int ibx = 0; ibx < nbetaX; ibx++) {
|
||||
etax = etamin + ibx * etastepX;
|
||||
// cout << etax << endl;
|
||||
// std::cout << etax << std::endl;
|
||||
if (etax >= 0 && etax <= 1)
|
||||
hx[ibx] = heta[ibx + ib * nbetaX];
|
||||
else {
|
||||
@ -178,7 +178,7 @@ class eta2InterpolationPosXY : public virtual eta2InterpolationBase,
|
||||
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
|
||||
eta2InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
|
||||
etaInterpolationPosXY(nx, ny, ns, nsy, nb, nby, emin, emax){
|
||||
// cout << "e2pxy " << nb << " " << emin << " " << emax << endl;
|
||||
// std::cout << "e2pxy " << nb << " " << emin << " " << emax << std::endl;
|
||||
};
|
||||
|
||||
eta2InterpolationPosXY(eta2InterpolationPosXY *orig)
|
||||
@ -198,8 +198,8 @@ class eta3InterpolationPosXY : public virtual eta3InterpolationBase,
|
||||
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
|
||||
eta3InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
|
||||
etaInterpolationPosXY(nx, ny, ns, nsy, nb, nby, emin, emax){
|
||||
// cout << "e3pxy " << nbeta << " " << etamin << " " << etamax
|
||||
// << " " << nSubPixels<< endl;
|
||||
// std::cout << "e3pxy " << nbeta << " " << etamin << " " << etamax
|
||||
// << " " << nSubPixels<< std::endl;
|
||||
};
|
||||
|
||||
eta3InterpolationPosXY(eta3InterpolationPosXY *orig)
|
||||
|
@ -27,8 +27,6 @@ enum quadrant {
|
||||
//#ifdef MYROOT1
|
||||
//: public TObject
|
||||
//#endif
|
||||
using namespace std;
|
||||
|
||||
class slsInterpolation {
|
||||
|
||||
public:
|
||||
|
@ -1,58 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#ifndef COMMONMODEJF_H
|
||||
#define COMMONMODEJF_H
|
||||
|
||||
#include "commonModeSubtractionNew.h"
|
||||
|
||||
class commonModeSubtractionSuperColumnJF : public commonModeSubtraction {
|
||||
public:
|
||||
commonModeSubtractionSuperColumnJF()
|
||||
: commonModeSubtraction(32){};
|
||||
virtual int getROI(int ix, int iy) { int top=iy/256; int sc=ix/64; return sc+top*16; };
|
||||
/*
|
||||
virtual void addToCommonMode(double val, int ix = 0, int iy = 0) {
|
||||
int iroi = getROI(ix, iy);
|
||||
// cout << iy << " " << ix << " " << iroi ;
|
||||
if (iroi >= 0 && iroi < nROI) {
|
||||
mean[iroi] += val;
|
||||
mean2[iroi] += val * val;
|
||||
nCm[iroi]++;
|
||||
if (nCm[iroi] > 64*256)
|
||||
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
|
||||
|
||||
}
|
||||
};
|
||||
*/
|
||||
virtual commonModeSubtractionSuperColumnJF *Clone() {
|
||||
return new commonModeSubtractionSuperColumnJF();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class commonModeSubtractionChip : public commonModeSubtraction {
|
||||
public:
|
||||
commonModeSubtractionChip()
|
||||
: commonModeSubtraction(8){};
|
||||
virtual int getROI(int ix, int iy) { int top=iy/256; int sc=ix/256; return sc+top*4; };
|
||||
/*
|
||||
virtual void addToCommonMode(double val, int ix = 0, int iy = 0) {
|
||||
int iroi = getROI(ix, iy);
|
||||
// cout << iy << " " << ix << " " << iroi ;
|
||||
if (iroi >= 0 && iroi < nROI) {
|
||||
mean[iroi] += val;
|
||||
mean2[iroi] += val * val;
|
||||
nCm[iroi]++;
|
||||
if (nCm[iroi] > 64*256)
|
||||
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
|
||||
|
||||
}
|
||||
};
|
||||
*/
|
||||
virtual commonModeSubtractionChip *Clone() {
|
||||
return new commonModeSubtractionChip();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
1
slsDetectorCalibration/jungfrauExecutables/Makefile
Symbolic link
1
slsDetectorCalibration/jungfrauExecutables/Makefile
Symbolic link
@ -0,0 +1 @@
|
||||
Makefile.zmqrootdisp
|
@ -18,7 +18,7 @@ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3
|
||||
|
||||
default: onlinedisp_zmq
|
||||
|
||||
onlinedisp_zmq: onlinedisp_zmq.cpp onlinedisp_zmq.h
|
||||
onlinedisp_zmq: onlinedisp_zmq.cpp onlinedisp_zmq.h ../dataStructures/jungfrauLGADStrixelsData_new.h
|
||||
# flags from root-config --cflags --glibs
|
||||
g++ -o onlinedisp_zmq onlinedisp_zmq.cpp -I. -I$(ROOTSYS)/include -Wall -g -lm -L. -lzmq -pthread -lrt -L$(ROOTSYS)/lib -lGui -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -m64 $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||
|
||||
|
@ -2,12 +2,8 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
//#include "sls/ansi.h"
|
||||
#include <iostream>
|
||||
|
||||
//enable common mode subtraction
|
||||
#define CMS
|
||||
//disable common mode subtraction
|
||||
//#undef CMS
|
||||
#undef CORR
|
||||
|
||||
#define C_GHOST 0.0004
|
||||
|
||||
#define CM_ROWS 50
|
||||
@ -40,17 +36,15 @@
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
//#include "commonModeSubtractionNew.h"
|
||||
#include "jungfrauCommonMode.h"
|
||||
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc < 6) {
|
||||
if (argc < 5) {
|
||||
cout << "Usage is " << argv[0]
|
||||
<< " indir outdir fname(no extension) fextension csize [runmin] [runmax] [pedfile (raw or tiff)] [threshold]"
|
||||
<< "indir outdir fname(no extension) fextension [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
|
||||
"[nframes] [xmin xmax ymin ymax] [gainmap]"
|
||||
<< endl;
|
||||
cout << "threshold <0 means analog; threshold=0 means cluster finder; "
|
||||
@ -59,12 +53,11 @@ int main(int argc, char *argv[]) {
|
||||
cout << "nframes <0 means sum everything; nframes=0 means one file per "
|
||||
"run; nframes>0 means one file every nframes"
|
||||
<< endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fifosize = 1000;
|
||||
int nthreads = 1;
|
||||
int nthreads = 10;
|
||||
int csize = 3; //3
|
||||
int nsigma = 5;
|
||||
int nped = 10000;
|
||||
@ -74,12 +67,10 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
#if !defined JFSTRX && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && !defined JFSTRXCHIP6
|
||||
#ifndef MODULE
|
||||
cout << "This is a JF single chip!" <<endl;
|
||||
jungfrauHighZSingleChipData *decoder = new jungfrauHighZSingleChipData();
|
||||
int nx = 256, ny = 256;
|
||||
#endif
|
||||
#ifdef MODULE
|
||||
cout << "This is a JF module!" <<endl;
|
||||
jungfrauModuleData *decoder = new jungfrauModuleData();
|
||||
int nx = 1024, ny = 512;
|
||||
#endif
|
||||
@ -89,7 +80,7 @@ int main(int argc, char *argv[]) {
|
||||
cout << "Jungfrau strixel full module readout" << endl;
|
||||
jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData();
|
||||
int nx = 1024/5, ny = 512*5;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef JFSTRXCHIP1
|
||||
std::cout << "Jungfrau strixel LGAD single chip 1" << std::endl;
|
||||
jungfrauLGADStrixelsDataSingleChip *decoder = new jungfrauLGADStrixelsDataSingleChip(1);
|
||||
@ -108,9 +99,20 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
decoder->getDetectorSize(nx, ny);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cout << "Detector size is " << nx << " " << ny << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
double *gainmap = NULL;
|
||||
//float *gm;
|
||||
|
||||
@ -122,48 +124,47 @@ int main(int argc, char *argv[]) {
|
||||
char *outdir = argv[2];
|
||||
char *fformat = argv[3];
|
||||
char *fext = argv[4];
|
||||
sscanf(argv[5], "%d", &csize);
|
||||
int runmin = 0;
|
||||
|
||||
// cout << "argc is " << argc << endl;
|
||||
if (argc >= 7) {
|
||||
runmin = atoi(argv[6]);
|
||||
if (argc >= 6) {
|
||||
runmin = atoi(argv[5]);
|
||||
}
|
||||
|
||||
int runmax = runmin;
|
||||
|
||||
if (argc >= 8) {
|
||||
runmax = atoi(argv[7]);
|
||||
if (argc >= 7) {
|
||||
runmax = atoi(argv[6]);
|
||||
}
|
||||
|
||||
char *pedfile = NULL;
|
||||
if (argc >= 9) {
|
||||
pedfile = argv[8];
|
||||
if (argc >= 8) {
|
||||
pedfile = argv[7];
|
||||
}
|
||||
double thr = 0;
|
||||
double thr1 = 1;
|
||||
|
||||
if (argc >= 10) {
|
||||
thr = atof(argv[9]);
|
||||
if (argc >= 9) {
|
||||
thr = atof(argv[8]);
|
||||
}
|
||||
|
||||
int nframes = 0;
|
||||
|
||||
if (argc >= 11) {
|
||||
nframes = atoi(argv[10]);
|
||||
if (argc >= 10) {
|
||||
nframes = atoi(argv[9]);
|
||||
}
|
||||
|
||||
int xmin = 0, xmax = nx, ymin = 0, ymax = ny;
|
||||
if (argc >= 15) {
|
||||
xmin = atoi(argv[11]);
|
||||
xmax = atoi(argv[12]);
|
||||
ymin = atoi(argv[13]);
|
||||
ymax = atoi(argv[14]);
|
||||
if (argc >= 14) {
|
||||
xmin = atoi(argv[10]);
|
||||
xmax = atoi(argv[11]);
|
||||
ymin = atoi(argv[12]);
|
||||
ymax = atoi(argv[13]);
|
||||
}
|
||||
|
||||
char *gainfname = NULL;
|
||||
if (argc > 15) {
|
||||
gainfname = argv[15];
|
||||
if (argc > 14) {
|
||||
gainfname = argv[14];
|
||||
cout << "Gain map file name is: " << gainfname << endl;
|
||||
}
|
||||
|
||||
@ -187,13 +188,9 @@ int main(int argc, char *argv[]) {
|
||||
cout << "Nframes is " << nframes << endl;
|
||||
|
||||
uint32_t nnx, nny;
|
||||
commonModeSubtraction *cm = NULL;
|
||||
#ifdef CMS
|
||||
cm = new commonModeSubtractionChip();//commonModeSubtraction(1,5);//commonModeSubtractionSuperColumnJF();
|
||||
std::cout << "Enabled common mode subtraction" << std::endl;
|
||||
#endif
|
||||
|
||||
singlePhotonDetector *filter = new singlePhotonDetector(
|
||||
decoder, 3, nsigma, 1, cm, nped, 200, -1, -1, gainmap, NULL);
|
||||
decoder, 3, nsigma, 1, NULL, nped, 200, -1, -1, gainmap, NULL);
|
||||
|
||||
if (gainfname) {
|
||||
|
||||
@ -253,14 +250,13 @@ int main(int argc, char *argv[]) {
|
||||
double *ped=new double[nx * ny];//, *ped1;
|
||||
|
||||
int pos,pos1;
|
||||
int ipixX=351, ipixY=331;
|
||||
|
||||
if (pedfile) {
|
||||
|
||||
if (string(pedfile).find(".raw") != std::string::npos) {
|
||||
if (string(pedfile).find(".dat") != std::string::npos) {
|
||||
pos1=string(pedfile).rfind("/");
|
||||
strcpy(froot,pedfile+pos1);
|
||||
pos=string(froot).find(".raw");
|
||||
pos=string(froot).find(".dat");
|
||||
froot[pos]='\0';
|
||||
}
|
||||
|
||||
@ -281,43 +277,19 @@ int main(int argc, char *argv[]) {
|
||||
ff = -1;
|
||||
while (decoder->readNextFrame(filebin, ff, np, buff)) {
|
||||
// if (np == 40) {
|
||||
// if ((ifr+1) % 100 == 0) {
|
||||
// cout << " ****" << decoder->getValue(buff,20,20);// << endl;
|
||||
// }
|
||||
if ((ifr+1) % 100 == 0) {
|
||||
cout << " ****" << decoder->getValue(buff,20,20);// << endl;
|
||||
}
|
||||
mt->pushData(buff);
|
||||
|
||||
|
||||
// while (mt->isBusy())
|
||||
// ;
|
||||
//if ((ifr+1) % 100 == 0)
|
||||
|
||||
// double pix=0,ped=0,sub=0,cmp=0, sub0=0;
|
||||
|
||||
// for (int ix=-1; ix<2; ix++) {
|
||||
// for (int iy=-1; iy<2; iy++) {
|
||||
// pix+=decoder->getValue(buff, ipixX+ix, ipixY+iy);
|
||||
// sub+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 1);
|
||||
// sub0+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 0);
|
||||
// ped+=filter->getPedestal(ipixX+ix, ipixY+iy);
|
||||
// cmp+=filter->getCommonMode(ipixX+ix, ipixY+iy);
|
||||
// }
|
||||
// }
|
||||
|
||||
// cout << pix << " " << sub << " " sub0 << " " << ped << " " << cmp << endl;
|
||||
|
||||
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
ifr++;
|
||||
// if (ifr % 100 == 0) {
|
||||
// cout << " ****" << ifr << " " << ff << " " << np << endl;
|
||||
// }
|
||||
|
||||
//else
|
||||
if (ifr % 100 == 0) {
|
||||
cout << " ****" << ifr << " " << ff << " " << np << endl;
|
||||
} //else
|
||||
//cout << ifr << " " << ff << " " << np << endl;
|
||||
// if (ifr>=1000)
|
||||
// break;
|
||||
|
||||
if (ifr>=1000)
|
||||
break;
|
||||
ff = -1;
|
||||
}
|
||||
filebin.close();
|
||||
@ -398,25 +370,7 @@ int main(int argc, char *argv[]) {
|
||||
if ((ifr+1) % 100 == 0) {
|
||||
cout << " ****" << decoder->getValue(buff,20,20);// << endl;
|
||||
}
|
||||
mt->pushData(buff);
|
||||
|
||||
|
||||
// while (mt->isBusy())
|
||||
|
||||
// double pix=0,ped=0,sub=0,cmp=0, sub0=0;
|
||||
|
||||
// for (int ix=-1; ix<2; ix++) {
|
||||
// for (int iy=-1; iy<2; iy++) {
|
||||
// pix+=decoder->getValue(buff, ipixX+ix, ipixY+iy);
|
||||
// sub+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 1);
|
||||
// sub0+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 0);
|
||||
// ped+=filter->getPedestal(ipixX+ix, ipixY+iy);
|
||||
// cmp+=filter->getCommonMode(ipixX+ix, ipixY+iy);
|
||||
// }
|
||||
// }
|
||||
|
||||
// cout << pix << " " << sub << " " sub0 << " " << ped << " " << cmp << endl;
|
||||
|
||||
mt->pushData(buff);
|
||||
// // //pop
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
|
@ -7,17 +7,23 @@ sls::zmqHeader zHeader;
|
||||
#define NPRO 50
|
||||
#define NPRI 50
|
||||
|
||||
//#define JFSTRX
|
||||
#define JFSTRX
|
||||
#ifdef JFSTRX
|
||||
#include "jungfrauLGADStrixelsData.h"
|
||||
#else
|
||||
#include "jungfrauModuleData.h"
|
||||
#include "jungfrauLGADStrixelsData_new.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#include "slsDetectorData.h"
|
||||
using header = sls::defs::sls_receiver_header;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
goout=1;
|
||||
hasallpede=false;
|
||||
dophotonmap=true; if ((argc<3)) {printf("USAGE: command photon_energy_(peakinADC) [rx_ip] [port] \n"); return -1 ;}
|
||||
@ -43,9 +49,19 @@ int main(int argc, char* argv[])
|
||||
#ifdef JFSTRX
|
||||
cout << "JFSTRX" << endl;
|
||||
jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData();
|
||||
nx = 1024/5; ny= 512*5;
|
||||
|
||||
decoder->getDetectorSize(nx,ny);
|
||||
|
||||
|
||||
|
||||
|
||||
cout<< decoder->dataMap[22][22] <<endl;
|
||||
|
||||
|
||||
#else
|
||||
nx = 1024; ny= 512;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -57,7 +73,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
HDraw_every=20;
|
||||
fixranges=false;
|
||||
|
||||
int group;
|
||||
|
||||
hchptr = (short*) malloc(NCH*sizeof(short));
|
||||
|
||||
@ -80,29 +96,85 @@ int main(int argc, char* argv[])
|
||||
char hname[100];
|
||||
|
||||
|
||||
#ifdef JFSTRX
|
||||
int nxx=79; int nyy=165;
|
||||
his1000= new TH2F("his1000","2d, chip 1 group 1 (25um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
his1060= new TH2F("his1060","2d, chip 6 group 1 (25um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
nxx=47; nyy=320; //320;
|
||||
his1001= new TH2F("his1001","2d, chip 1 group 2 (15um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
his1061= new TH2F("his1061","2d, chip 6 group 2 (15um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
nxx=59; nyy=476; //476;
|
||||
his1002= new TH2F("his1002","2d, chip 1 group 3 (18.75um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
his1062= new TH2F("his1002","2d, chip 6 group 3 (18.75um) pede corr.",nxx,-0.5,nxx-0.5,nyy,-0.5,nyy-0.5);
|
||||
|
||||
his1000->SetOption("colz");
|
||||
his1001->SetOption("colz");
|
||||
his1002->SetOption("colz");
|
||||
his1060->SetOption("colz");
|
||||
his1061->SetOption("colz");
|
||||
his1062->SetOption("colz");
|
||||
|
||||
#else
|
||||
his1000= new TH2F("his1000","2d , ev. pede corrected",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
|
||||
his1000->SetOption("colz");
|
||||
#endif
|
||||
|
||||
his2000= new TH2F("his2000","2d gain ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
|
||||
his2000->GetZaxis()->SetRangeUser(0,4);
|
||||
|
||||
if (dophotonmap) {
|
||||
his3000= new TH2F("his3000"," photon map ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
|
||||
his3000= new TH2F("his3000"," photon map ",1024,-0.5,1024-0.5,512,-0.5,512-0.5);
|
||||
}
|
||||
else {
|
||||
his3000= new TH2F("his3000"," raw adc ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
|
||||
his3000= new TH2F("his3000"," raw adc ",1024,-0.5,1024-0.5,512,-0.5,512-0.5);
|
||||
}
|
||||
|
||||
his4500= new TH2F("his45000","L vs R",101,-50,500,101,-50,500);
|
||||
his4500= new TH2F("his4500","T vs B",101,-500,MAX_POS,101,-500,MAX_POS);
|
||||
hchip=new TH1I*[8];
|
||||
#ifdef JFSTRX
|
||||
for (i=0;i<8;i++) {
|
||||
if(i<3)
|
||||
sprintf(hname,"%d_hchip1group%d",i,i+1);
|
||||
else if (i>4)
|
||||
sprintf(hname,"%d_hchip6group%d",i, i-4);
|
||||
else
|
||||
sprintf(hname,"%d_",i);
|
||||
hchip[i] = new TH1I(hname,hname,NBIN,MIN_POS,MAX_POS);
|
||||
}
|
||||
#else
|
||||
for (i=0;i<8;i++) {
|
||||
sprintf(hname,"hchip%d",i);
|
||||
hchip[i] = new TH1I(hname,hname,NBIN,MIN_POS,MAX_POS);
|
||||
}
|
||||
#endif
|
||||
|
||||
cout <<"end of histo booking" <<endl;
|
||||
if (A2==NULL) A2 = new TCanvas("A2","Plotting Canvas gain",150,10,500,250);
|
||||
if (A3==NULL) A3 = new TCanvas("A3","Plotting Canvas ADC",150,360,1200,550);
|
||||
if (A3==NULL) {
|
||||
#ifdef JFSTRX
|
||||
A3 = new TCanvas("A3","Plotting Canvas ADC",150,360,1200,750);
|
||||
p1 = new TPad("p1","p1",0.01,0.5,0.49,1.);
|
||||
p1->Draw();
|
||||
p2 = new TPad("p2","p2",0.51,0.75,0.99,0.97);
|
||||
p2->Draw();
|
||||
p3 = new TPad("p3","p3",0.01,0.25,0.49,0.47);
|
||||
p3->Draw();
|
||||
p4 = new TPad("p4","p4",0.51,0.53,0.99,0.75);
|
||||
p4->Draw();
|
||||
p5 = new TPad("p5","p5",0.01,0.03,0.49,0.25);
|
||||
p5->Draw();
|
||||
p6 = new TPad("p6","p6",0.51,0.,0.99,0.5);
|
||||
p6->Draw();
|
||||
//A3->Divide(2,3);
|
||||
|
||||
// TVirtualPad* g=A3->cd(1);
|
||||
// g->SetCanvasSize( g->GetWw(), 2*g->GetWw());
|
||||
// g=A3->cd(6);
|
||||
// g->SetCanvasSize( g->GetWw(), 2*g->GetWw());
|
||||
#else
|
||||
A3 = new TCanvas("A3","Plotting Canvas ADC",150,360,1200,550);
|
||||
#endif
|
||||
}
|
||||
if (A4==NULL) A4 = new TCanvas("A4","Plotting Canvas PHs",750,300,1000,800);
|
||||
A4->Clear();
|
||||
A4->Divide(4,2,0.005,0.005);
|
||||
@ -131,7 +203,14 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
memcpy(&croi, &zHeader.detSpec1, 8);
|
||||
ROIxmin=croi.xmin;
|
||||
ROIxmax=croi.xmax;
|
||||
ROIymin=croi.ymin;
|
||||
ROIymax=croi.ymax;
|
||||
cout<<" ROIymin "<< ROIymin<<endl;
|
||||
framesinstream++;
|
||||
running++;
|
||||
|
||||
@ -143,7 +222,19 @@ int main(int argc, char* argv[])
|
||||
|
||||
npacket=0;
|
||||
if (show2Ds) {
|
||||
#ifdef JFSTRX
|
||||
his1000->Reset();
|
||||
his1001->Reset();
|
||||
his1002->Reset();
|
||||
his1060->Reset();
|
||||
his1061->Reset();
|
||||
his1062->Reset();
|
||||
#else
|
||||
|
||||
his1000->Reset();
|
||||
#endif
|
||||
|
||||
|
||||
his2000->Reset();
|
||||
if (!dophotonmap) his3000->Reset(); //FOR RAW ADC DISPLAY
|
||||
}
|
||||
@ -187,10 +278,28 @@ int main(int argc, char* argv[])
|
||||
if (fill1Ds) {
|
||||
if (((i%1024)<1004)&&((i%1024)>20)&&((i/1024)>20)) { //skip the pix near guardring for PH plots
|
||||
ichip= i/(256*256*4)*4+((i/256)%4) ;
|
||||
|
||||
#ifdef JFSTRX
|
||||
int new_ichip=0;
|
||||
//exclude border rows of each group
|
||||
if (ichip==1) {
|
||||
if (i<=(1024*(64-2))) new_ichip=0; //chip 1 group 1
|
||||
if (i>(1024*(64+6))&&(i<=(1024*(64*2-4)))) new_ichip=1; //chip 1 group 2
|
||||
if (i>(1024*(64*2+5))) new_ichip=2; //chip 1 group 3
|
||||
}
|
||||
|
||||
if (ichip==6) {
|
||||
if (i<=(1024*(256+2*64-5))) new_ichip=7; //chip 6 group 3
|
||||
if (i>(1024*(256+2*64+4))&&(i<=(1024*(256+64*3-6)))) new_ichip=6; //chip 6 group 2
|
||||
if (i>(1024*(256+64*3-4))) new_ichip=5; //chip 6 group 1
|
||||
}
|
||||
|
||||
hchip[new_ichip]->Fill(adcpedecorr,1);
|
||||
|
||||
#else
|
||||
hchip[ichip]->Fill(adcpedecorr,1);
|
||||
#endif
|
||||
|
||||
if (((i%256)<253)&&((i%256)>2)) his4500->Fill(adcpedecorrold,adcpedecorr,1);
|
||||
// if (((i%256)<253)&&((i%256)>2)) his4500->Fill(adcpedecorrold,adcpedecorr,1);
|
||||
adcpedecorrold=adcpedecorr;
|
||||
|
||||
|
||||
@ -200,33 +309,110 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
|
||||
if ((show2Ds)) {
|
||||
factor=2.0;
|
||||
value=adcpedecorr;
|
||||
if ((i%256==0)||(i%256==255)) value=int(value/factor);
|
||||
if ((i/1024==255)||(i/1024==256)||(i/1024==767)||(i/1024==768)) value=int(value/factor);
|
||||
|
||||
his1000->Fill(float(i%1024),float(int (i/1024)),value);
|
||||
|
||||
if (!dophotonmap) his3000->Fill(float(i%1024),float(int (i/1024)) ,adcvalue);
|
||||
|
||||
his2000->Fill(float(i%1024),float(int (i/1024)) ,gain);
|
||||
|
||||
value=(int)(hchptr[i]);
|
||||
|
||||
if ((i%256==0)||(i%256==255)) value=int(value/factor);
|
||||
if ((i/1024==255)||(i/1024==256)||(i/1024==767)||(i/1024==768)) value=int(value/factor);
|
||||
if (dophotonmap) his3000->Fill(float(i%1024),float(int (i/1024)),float(value));
|
||||
|
||||
}
|
||||
}// for (i=0 ;i<NCH-0;i++)
|
||||
|
||||
|
||||
if ((show2Ds)) {
|
||||
for (ipx=0;ipx<nx;ipx++){
|
||||
for (ipy=0;ipy<ny;ipy++){
|
||||
// for (ipx=0;ipx<nx;ipx++){
|
||||
#ifdef JFSTRX
|
||||
|
||||
//cout<<i<< " cdcsdcvsvcsc " << group << " " << (decoder->dataMap[ipy][ipx])/2 << endl;
|
||||
i=int (((decoder->dataMap[ipy][ipx])-sizeof(header)) /2);
|
||||
group=(decoder->groupmap[ipy][ipx]);
|
||||
|
||||
// cout<<i<< " "<<ipx<<" "<<ipy<< " " << group <<endl;
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
i=ipx+ipy*1024;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
value= ((image_data[i]) & 0x3fff) -fpeded[i];
|
||||
#ifndef JFSTRX
|
||||
if ((i%256==0)||(i%256==255)) value=int(value/factor);
|
||||
if ((i/1024==255)||(i/1024==256)||(i/1024==767)||(i/1024==768)) value=int(value/factor);
|
||||
#endif
|
||||
|
||||
// his1000->Fill(float(ipx),float(ipy),value);
|
||||
// if ((ipy>165)&&(ipy<320+165)){ his1000->Fill(float(ipx)*5/3.0,float(ipy),value);}
|
||||
// else { his1000->Fill(float(ipx),float(ipy),value);}
|
||||
|
||||
#ifdef JFSTRX
|
||||
static const int mc1g1y_start = 0;
|
||||
static const int mc1g2y_start = g1_nrows;
|
||||
static const int mc1g3y_start = g1_nrows+g2_nrows;
|
||||
|
||||
static const int mc6g3y_start = g1_nrows+g2_nrows+g3_nrows;
|
||||
static const int mc6g2y_start = mc6g3y_start + g3_nrows;
|
||||
static const int mc6g1y_start = mc6g3y_start + g3_nrows + g2_nrows;
|
||||
|
||||
if (group==0) {
|
||||
if (ipy<165){
|
||||
his1000->Fill(float(ipx),float(ipy-mc1g1y_start),value);}
|
||||
if (ipy>=mc6g1y_start){
|
||||
his1060->Fill(float(ipx),float(ipy-mc6g1y_start),value);}
|
||||
}
|
||||
if (group==1) {
|
||||
if (ipy<(165+320)){
|
||||
his1001->Fill(float(ipx),float(ipy-mc1g2y_start),value);}
|
||||
if ( (ipy>=mc6g2y_start) && (ipy<mc6g1y_start) ){his4500->Fill(value,oldvalue,1.0);
|
||||
oldvalue=value;
|
||||
his1061->Fill(float(ipx),float(ipy-mc6g2y_start),value);}
|
||||
}
|
||||
if (group==2) {
|
||||
if (ipy<(165+320+476))
|
||||
his1002->Fill(float(ipx),float(ipy-mc1g3y_start),value);
|
||||
if ( (ipy>=mc6g3y_start) && (ipy<mc6g2y_start) )
|
||||
his1062->Fill(float(ipx),float(ipy-mc6g3y_start),value);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
his1000->Fill(float(ipx),float(ipy),value);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
his2000->Fill(float(ipx),float(ipy) ,gain);
|
||||
|
||||
// if (!dophotonmap)his3000->Fill(float(ipx),float(ipy) ,value);
|
||||
// value=(int)(hchptr[i]);
|
||||
// if (dophotonmap) his3000->Fill(float(ipx),float(ipy),float(value));
|
||||
|
||||
}// for ipx
|
||||
} //for ipy
|
||||
|
||||
for (ipx=0;ipx<1024;ipx++){
|
||||
for (ipy=0;ipy<512;ipy++){
|
||||
i=ipx+ipy*1024;
|
||||
value= ((image_data[i]) & 0x3fff) -fpeded[i];
|
||||
if (!dophotonmap)his3000->Fill(float(ipx),float(ipy) ,value);
|
||||
value=(int)(hchptr[i]);
|
||||
if (dophotonmap) his3000->Fill(float(ipx),float(ipy),float(value));
|
||||
}
|
||||
}
|
||||
|
||||
}// endo of show2d
|
||||
|
||||
|
||||
|
||||
}// /end of do something
|
||||
|
||||
|
||||
|
||||
if ((show2Ds)) {
|
||||
|
||||
for (ipx=0;ipx<NCH;ipx++) hchptr[(ipx)]=0;
|
||||
for (i=0;i<NCH;i++) hchptr[(i)]=0;
|
||||
|
||||
|
||||
|
||||
@ -419,10 +605,31 @@ void SetRanges() {
|
||||
|
||||
void axisreset(){
|
||||
fixranges=false;
|
||||
#ifdef JFSTRX
|
||||
his1000->GetXaxis()->UnZoom();
|
||||
his1000->GetYaxis()->UnZoom();
|
||||
his1000->GetZaxis()->UnZoom();
|
||||
his1001->GetXaxis()->UnZoom();
|
||||
his1001->GetYaxis()->UnZoom();
|
||||
his1001->GetZaxis()->UnZoom();
|
||||
his1002->GetXaxis()->UnZoom();
|
||||
his1002->GetYaxis()->UnZoom();
|
||||
his1002->GetZaxis()->UnZoom();
|
||||
his1060->GetXaxis()->UnZoom();
|
||||
his1060->GetYaxis()->UnZoom();
|
||||
his1060->GetZaxis()->UnZoom();
|
||||
his1061->GetXaxis()->UnZoom();
|
||||
his1061->GetYaxis()->UnZoom();
|
||||
his1061->GetZaxis()->UnZoom();
|
||||
his1062->GetXaxis()->UnZoom();
|
||||
his1062->GetYaxis()->UnZoom();
|
||||
his1062->GetZaxis()->UnZoom();
|
||||
#else
|
||||
his1000->GetXaxis()->UnZoom();
|
||||
|
||||
his1000->GetYaxis()->UnZoom();
|
||||
his1000->GetZaxis()->UnZoom();
|
||||
#endif
|
||||
his2000->GetXaxis()->UnZoom();
|
||||
his2000->GetYaxis()->UnZoom();
|
||||
|
||||
@ -540,7 +747,6 @@ void Plot1DHistos(void){
|
||||
|
||||
void Plot2DHistos(void){
|
||||
gStyle->SetOptStat(0);
|
||||
A3->cd();
|
||||
|
||||
// if (bw_flag) LoadPaletteBW(1.0);
|
||||
|
||||
@ -553,8 +759,24 @@ void Plot2DHistos(void){
|
||||
}
|
||||
|
||||
his1000->SetMinimum(-200);
|
||||
his1000->Draw();
|
||||
|
||||
#ifdef JFSTRX
|
||||
p5->cd();
|
||||
his1000->Draw("colz");
|
||||
p3->cd();
|
||||
his1001->Draw("colz");
|
||||
p1->cd();
|
||||
his1002->Draw("colz");
|
||||
p2->cd();
|
||||
his1060->Draw("colz");
|
||||
p4->cd();
|
||||
his1061->Draw("colz");
|
||||
p6->cd();
|
||||
his1062->Draw("colz");
|
||||
#else
|
||||
A3->cd();
|
||||
his1000->Draw("colz");
|
||||
#endif
|
||||
A3->Update();
|
||||
A2->cd();
|
||||
// if (bw_flag) LoadPaletteFalse();
|
||||
@ -565,9 +787,16 @@ void Plot2DHistos(void){
|
||||
A2->Update();
|
||||
A5->cd();
|
||||
|
||||
his3000->GetXaxis()->SetRange(his1000->GetXaxis()->GetFirst(),his1000->GetXaxis()->GetLast());
|
||||
his3000->GetYaxis()->SetRange(his1000->GetYaxis()->GetFirst(),his1000->GetYaxis()->GetLast());
|
||||
//his3000->GetXaxis()->SetRange(his1000->GetXaxis()->GetFirst(),his1000->GetXaxis()->GetLast());
|
||||
//his3000->GetYaxis()->SetRange(his1000->GetYaxis()->GetFirst(),his1000->GetYaxis()->GetLast());
|
||||
his3000->Draw("colz");
|
||||
|
||||
box = new TBox(ROIxmin,ROIymin,ROIxmax,ROIymax);
|
||||
box->SetLineColor(kRed);
|
||||
|
||||
box->SetFillStyle(0);
|
||||
box->SetLineWidth(2);
|
||||
box->Draw();
|
||||
A5->Update();
|
||||
|
||||
A6->cd();
|
||||
|
@ -56,6 +56,7 @@ using namespace sls;
|
||||
#include "TMath.h"
|
||||
#include "TFile.h"
|
||||
#include "TStyle.h"
|
||||
#include "TBox.h"
|
||||
#include "TSystem.h"
|
||||
#include "TTimer.h"
|
||||
#include "TProfile.h"
|
||||
@ -81,7 +82,7 @@ using namespace sls;
|
||||
#define OFFSET 0
|
||||
#define NBIN 500
|
||||
#define MIN_POS -500.5 // 400.5
|
||||
#define MAX_POS 3499.5 //-100.5
|
||||
#define MAX_POS 8499.5 //-100.5
|
||||
|
||||
|
||||
#define NCH 524288
|
||||
@ -92,7 +93,7 @@ int portnum;
|
||||
FILE * sfilefd;
|
||||
|
||||
short* hchptr; // photon counted map "histogram"
|
||||
int value;
|
||||
int value,oldvalue;
|
||||
float factor=1.84;
|
||||
int npacket=0;
|
||||
int totalnpacket=0;
|
||||
@ -105,6 +106,7 @@ struct hostent *server;
|
||||
|
||||
int i=0;
|
||||
int ipx=0;
|
||||
int ipy=0;
|
||||
bool haveconnection;
|
||||
|
||||
|
||||
@ -112,6 +114,12 @@ TStyle *gStyle;
|
||||
TApplication* rootapp;
|
||||
TCanvas *A2;
|
||||
TCanvas *A3;
|
||||
TPad *p1;
|
||||
TPad *p2;
|
||||
TPad *p3;
|
||||
TPad *p4;
|
||||
TPad *p5;
|
||||
TPad *p6;
|
||||
TCanvas *A4;
|
||||
TCanvas *A5;
|
||||
TCanvas *A6;
|
||||
@ -139,6 +147,18 @@ bool fill1Ds;
|
||||
bool pede_flag;
|
||||
bool dophotonmap;
|
||||
|
||||
typedef struct {
|
||||
uint16_t xmin;
|
||||
uint16_t xmax;
|
||||
uint16_t ymin;
|
||||
uint16_t ymax;
|
||||
} receriverRoi_compact;
|
||||
receriverRoi_compact croi;
|
||||
TBox *box;
|
||||
uint16_t ROIxmin;
|
||||
uint16_t ROIxmax;
|
||||
uint16_t ROIymin;
|
||||
uint16_t ROIymax;
|
||||
int nx, ny;
|
||||
int nframes;
|
||||
int goout;
|
||||
@ -154,7 +174,8 @@ int frameIndex_old;
|
||||
char pedefilename[128];
|
||||
int framenum,bunchid;
|
||||
|
||||
TH2F* his1000;
|
||||
TH2F* his1000;TH2F* his1001;TH2F* his1002;
|
||||
TH2F* his1060;TH2F* his1061;TH2F* his1062;
|
||||
TH2F* his2000;
|
||||
TH2F* his3000;
|
||||
TH2F* his4500;
|
||||
|
@ -30,13 +30,14 @@ int main(int argc, char *argv[]) {
|
||||
int runmax = atoi(argv[5]);
|
||||
int nsubpix = atoi(argv[6]);
|
||||
|
||||
int etabins = 1000; // nsubpix*2*100;
|
||||
double etamin = -1, etamax = 2;
|
||||
// int etabins = 1000; // nsubpix*2*100;
|
||||
// double etamin = -1, etamax = 2;
|
||||
int quad;
|
||||
double sum, totquad;
|
||||
double sDum[2][2];
|
||||
double etax, etay, int_x, int_y;
|
||||
int ok;
|
||||
// double etax, etay;
|
||||
double int_x, int_y;
|
||||
// int ok;
|
||||
|
||||
int ix, iy, isx, isy;
|
||||
|
||||
|
@ -86,17 +86,10 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int nx = 400, ny = 400;
|
||||
|
||||
//Read detector size from decoder
|
||||
int nx , ny;
|
||||
decoder->getDetectorSize(nx, ny);
|
||||
#ifdef CORR
|
||||
int ncol_cm = CM_ROWS;
|
||||
double xt_ghost = C_GHOST;
|
||||
#endif
|
||||
moench03CommonMode *cm = NULL;
|
||||
moench03GhostSummation *gs;
|
||||
double *gainmap = NULL;
|
||||
|
||||
//float *gm;
|
||||
|
||||
int ff, np;
|
||||
@ -171,8 +164,15 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
uint32_t nnx, nny;
|
||||
|
||||
|
||||
moench03CommonMode *cm = nullptr;
|
||||
moench03GhostSummation *gs = nullptr;
|
||||
double *gainmap = nullptr;
|
||||
|
||||
#ifdef CORR
|
||||
cout << "Applying common mode " << ncol_cm << endl;
|
||||
int ncol_cm = CM_ROWS;
|
||||
double xt_ghost = C_GHOST;
|
||||
std::cout << "Applying common mode " << ncol_cm << endl;
|
||||
cm = new moench03CommonMode(ncol_cm);
|
||||
|
||||
// cout << "Applying ghost corrections " << xt_ghost << endl;
|
||||
|
@ -396,14 +396,14 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
||||
return 0;
|
||||
}
|
||||
newFrame(data);
|
||||
/*
|
||||
|
||||
if (cmSub) {
|
||||
addToCommonMode(data);
|
||||
cm = 1;
|
||||
}
|
||||
*/
|
||||
|
||||
double *val = new double[ny * nx];
|
||||
cm=0;
|
||||
|
||||
for (iy = ymin; iy < ymax; ++iy) {
|
||||
for (ix = xmin; ix < xmax; ++ix) {
|
||||
if (det->isGood(ix, iy) == 0)
|
||||
@ -547,50 +547,12 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
||||
|
||||
} else if (ee == PEDESTAL) {
|
||||
addToPedestal(data, ix, iy, cm);
|
||||
if (cmSub) {
|
||||
addToCommonMode(data, ix, iy);
|
||||
}
|
||||
} /*else {
|
||||
eventMask[iy][ix]=PHOTON;
|
||||
}*/
|
||||
// eventMask[iy][ix]=ee;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmSub) {
|
||||
|
||||
double cmv=0;
|
||||
for (int iph=0; iph<nph; iph++) {
|
||||
ix=(clusters + iph)->x ;
|
||||
iy=(clusters + nph)->y;
|
||||
|
||||
for (ir = -(clusterSizeY / 2); ir < (clusterSizeY / 2) + 1;
|
||||
ir++) {
|
||||
for (ic = -(clusterSize / 2);
|
||||
ic < (clusterSize / 2) + 1; ic++) {
|
||||
if ((iy + ir) >= 0 && (iy + ir) < ny &&
|
||||
(ix + ic) >= 0 && (ix + ic) < nx) {
|
||||
|
||||
cmv=getCommonMode(ix+ic, iy+ir);
|
||||
//if (ir==0 && ic==0)
|
||||
//cout << cmv << endl;
|
||||
(clusters + iph)
|
||||
->set_data((clusters + iph)
|
||||
->get_data(ic,ir)-cmv, ic,ir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nphFrame = nph;
|
||||
nphTot += nph;
|
||||
|
@ -3,8 +3,7 @@
|
||||
|
||||
#include "sls/tiffIO.h"
|
||||
#include <iostream>
|
||||
#include "/usr/include/tiffio.h"
|
||||
//#include <tiffio.h>
|
||||
#include <tiffio.h>
|
||||
|
||||
void *WriteToTiff(float *imgData, const char *imgname, int ncol, int nrow) {
|
||||
constexpr uint32_t sampleperpixel = 1;
|
||||
|
@ -332,7 +332,7 @@ void getServerVersion(char *version) { strcpy(version, APICTB); }
|
||||
|
||||
uint64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return REQRD_FRMWR_VRSN;
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_VERSION_BRD_RVSN_MSK) >>
|
||||
FPGA_VERSION_BRD_RVSN_OFST);
|
||||
|
@ -256,7 +256,7 @@ void getServerVersion(char *version) { strcpy(version, APIGOTTHARD2); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return REQRD_FRMWRE_VRSN;
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_COMPILATION_DATE_MSK) >>
|
||||
FPGA_COMPILATION_DATE_OFST);
|
||||
|
@ -275,7 +275,7 @@ void getServerVersion(char *version) { strcpy(version, APIGOTTHARD); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return 1;
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_VERSION_MSK) >> FPGA_VERSION_OFST);
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ void getServerVersion(char *version) { strcpy(version, APIJUNGFRAU); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return REQRD_FRMWRE_VRSN;
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_COMPILATION_DATE_MSK) >>
|
||||
FPGA_COMPILATION_DATE_OFST);
|
||||
|
@ -270,7 +270,8 @@ void getServerVersion(char *version) { strcpy(version, APIMOENCH); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return (isHardwareVersion_1_0() ? REQRD_FRMWRE_VRSN
|
||||
: REQRD_FRMWRE_VRSN_BOARD2);
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_COMPILATION_DATE_MSK) >>
|
||||
FPGA_COMPILATION_DATE_OFST);
|
||||
|
@ -250,7 +250,7 @@ void getServerVersion(char *version) { strcpy(version, APIMYTHEN3); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
return REQRD_FRMWRE_VRSN;
|
||||
#endif
|
||||
return ((bus_r(FPGA_VERSION_REG) & FPGA_COMPILATION_DATE_MSK) >>
|
||||
FPGA_COMPILATION_DATE_OFST);
|
||||
|
Reference in New Issue
Block a user