mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Make a library for writing and reading tiff, added tests (#347)
* removed Makefile for moench and integrated the build in CMake * broke out tiff reading and writing to its own library * moved tiff includes to include/sls * moved tiffio source to src * removed incorrectly used bps * cleanup and tests for tiffio * removed using namespace std from header * some fixing for moench04 * Program for offline processing renamed Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch>
This commit is contained in:
@ -1,19 +1,53 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
find_package(TIFF REQUIRED)
|
||||
|
||||
|
||||
set(MOENCH_EXECUTABLES)
|
||||
|
||||
#Moench ZMQ
|
||||
add_executable(moenchZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
|
||||
target_compile_definitions(moenchZmqProcess PRIVATE NEWZMQ INTERP)
|
||||
add_executable(moench03ZmqProcess moenchZmqProcess.cpp)
|
||||
target_compile_definitions(moench03ZmqProcess PRIVATE NEWZMQ INTERP)
|
||||
list(APPEND MOENCH_EXECUTABLES moench03ZmqProcess)
|
||||
|
||||
#Moench HighZ ZMQ
|
||||
add_executable(moenchHighZZmqProcess moenchZmqProcess.cpp)
|
||||
target_compile_definitions(moenchHighZZmqProcess PRIVATE NEWZMQ INTERP HIGHZ)
|
||||
list(APPEND MOENCH_EXECUTABLES moenchHighZZmqProcess)
|
||||
|
||||
#Moench04 ZMQ
|
||||
add_executable(moench04ZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
|
||||
add_executable(moench04ZmqProcess moenchZmqProcess.cpp)
|
||||
target_compile_definitions(moench04ZmqProcess PRIVATE NEWZMQ INTERP MOENCH04)
|
||||
list(APPEND MOENCH_EXECUTABLES moench04ZmqProcess)
|
||||
|
||||
|
||||
#Both executables should have the same includes and output dirs
|
||||
set(MOENCH_EXECUTABLES "moenchZmqProcess" "moench04ZmqProcess")
|
||||
#OFFLINE Processing?
|
||||
add_executable(moench03RawDataProcess moenchRawDataProcess.cpp)
|
||||
target_compile_definitions(moench03RawDataProcess PRIVATE)
|
||||
list(APPEND MOENCH_EXECUTABLES moench03RawDataProcess)
|
||||
|
||||
add_executable(moenchHighZRawDataProcess moenchRawDataProcess.cpp)
|
||||
target_compile_definitions(moenchHighZRawDataProcess PRIVATE HIGHZ)
|
||||
list(APPEND MOENCH_EXECUTABLES moenchHighZRawDataProcess)
|
||||
|
||||
add_executable(moench04RawDataProcess moenchRawDataProcess.cpp)
|
||||
target_compile_definitions(moench04RawDataProcess PRIVATE MOENCH04)
|
||||
list(APPEND MOENCH_EXECUTABLES moench04RawDataProcess)
|
||||
|
||||
#interpolation stuff
|
||||
|
||||
add_executable(moench03MakeEta moench03Interpolation.cpp)
|
||||
target_compile_definitions(moench03MakeEta PRIVATE FF)
|
||||
list(APPEND MOENCH_EXECUTABLES moench03MakeEta)
|
||||
|
||||
add_executable(moench03Interpolation moench03Interpolation.cpp)
|
||||
#no compile defs
|
||||
list(APPEND MOENCH_EXECUTABLES moench03Interpolation)
|
||||
|
||||
add_executable(moench03NoInterpolation moench03NoInterpolation.cpp)
|
||||
#no compile defs
|
||||
list(APPEND MOENCH_EXECUTABLES moench03NoInterpolation)
|
||||
|
||||
|
||||
foreach(exe ${MOENCH_EXECUTABLES})
|
||||
#TODO! At a later stage clean up include dirs and have a proper lib
|
||||
@ -22,6 +56,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
../dataStructures
|
||||
../interpolations
|
||||
../../slsReceiverSoftware/include/
|
||||
../../slsSupportLib/include/
|
||||
)
|
||||
|
||||
target_link_libraries(${exe}
|
||||
@ -29,10 +64,11 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
slsSupportStatic
|
||||
${ZeroMQ_LIBRARIES}
|
||||
pthread
|
||||
TIFF::TIFF
|
||||
tiffio
|
||||
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
slsProjectOptions
|
||||
)
|
||||
|
||||
|
||||
@ -44,8 +80,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
endforeach(exe ${MOENCH_EXECUTABLES})
|
||||
|
||||
install(TARGETS ${MOENCH_EXECUTABLES} DESTINATION bin)
|
@ -1,49 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#module add CBFlib/0.9.5
|
||||
INCDIR=-I. -I../ -I../interpolations -I../interpolations/etaVEL -I../dataStructures -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/
|
||||
|
||||
LDFLAG= ../tiffIO.cpp -L/usr/lib64/ -lpthread -lm -lstdc++ -pthread -lrt -ltiff -O3 -std=c++11
|
||||
|
||||
MAIN=moench03ClusterFinder.cpp
|
||||
|
||||
|
||||
all: moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
|
||||
|
||||
|
||||
moenchClusterFinder: moench03ClusterFinder.cpp $(INCS) clean
|
||||
g++ -o moenchClusterFinder moench03ClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER
|
||||
|
||||
|
||||
moenchClusterFinderHighZ: moench03ClusterFinder.cpp $(INCS) clean
|
||||
g++ -o moenchClusterFinderHighZ moench03ClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER -DHIGHZ
|
||||
|
||||
|
||||
|
||||
|
||||
moenchMakeEta: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchMakeEta moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF
|
||||
|
||||
moenchInterpolation: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchInterpolation moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||
|
||||
moenchNoInterpolation: moench03NoInterpolation.cpp $(INCS) clean
|
||||
g++ -o moenchNoInterpolation moench03NoInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||
|
||||
moenchPhotonCounter: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchPhotonCounter moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER
|
||||
|
||||
moenchAnalog: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchAnalog moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG
|
||||
|
||||
moenchPhotonCounterHighZ: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchPhotonCounterHighZ moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DHIGHZ
|
||||
|
||||
moenchAnalogHighZ: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchAnalogHighZ moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG -DHIGHZ
|
||||
|
||||
clean:
|
||||
rm -f moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -std=c++11 -Wall -L../../build/bin/ -lSlsSupport
|
||||
#-L../../bin -lhdf5 -L.
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchZmqProcess
|
||||
#moenchZmq04Process
|
||||
#moenchZmqProcessCtbGui
|
||||
|
||||
moenchZmqProcess: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
|
||||
|
||||
#moenchZmq04Process: moenchZmqProcess.cpp clean#
|
||||
# g++ -o moench04ZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DMOENCH04
|
||||
|
||||
#moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
|
||||
# g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI
|
||||
|
||||
clean:
|
||||
rm -f moenchZmqProcess
|
||||
|
||||
|
@ -1,219 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
//#include "sls/ansi.h"
|
||||
#include <iostream>
|
||||
|
||||
//#include "moench03T1ZmqData.h"
|
||||
#ifdef NEWRECEIVER
|
||||
#ifndef RECT
|
||||
#include "moench03T1ReceiverDataNew.h"
|
||||
#endif
|
||||
|
||||
#ifdef RECT
|
||||
#include "moench03T1ReceiverDataNewRect.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CSAXS_FP
|
||||
#include "moench03T1ReceiverData.h"
|
||||
#endif
|
||||
#ifdef OLDDATA
|
||||
#include "moench03Ctb10GbT1Data.h"
|
||||
#endif
|
||||
|
||||
#ifdef REORDERED
|
||||
#include "moench03T1ReorderedData.h"
|
||||
#endif
|
||||
|
||||
// #include "interpolatingDetector.h"
|
||||
//#include "etaInterpolationPosXY.h"
|
||||
// #include "linearInterpolation.h"
|
||||
// #include "noInterpolation.h"
|
||||
#include "multiThreadedAnalogDetector.h"
|
||||
#include "singlePhotonDetector.h"
|
||||
//#include "interpolatingDetector.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <ctime>
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc < 6) {
|
||||
cout << "Usage is " << argv[0] << "indir outdir fname runmin runmax "
|
||||
<< endl;
|
||||
return 1;
|
||||
}
|
||||
int p = 10000;
|
||||
int fifosize = 1000;
|
||||
int nthreads = 1;
|
||||
int nsubpix = 25;
|
||||
int etabins = nsubpix * 10;
|
||||
double etamin = -1, etamax = 2;
|
||||
int csize = 3;
|
||||
int nx = 400, ny = 400;
|
||||
int save = 1;
|
||||
int nsigma = 5;
|
||||
int nped = 1000;
|
||||
int ndark = 100;
|
||||
int ok;
|
||||
int iprog = 0;
|
||||
|
||||
#ifdef NEWRECEIVER
|
||||
#ifdef RECT
|
||||
cout << "Should be rectangular!" << endl;
|
||||
#endif
|
||||
moench03T1ReceiverDataNew *decoder = new moench03T1ReceiverDataNew();
|
||||
cout << "RECEIVER DATA WITH ONE HEADER!" << endl;
|
||||
#endif
|
||||
|
||||
#ifdef CSAXS_FP
|
||||
moench03T1ReceiverData *decoder = new moench03T1ReceiverData();
|
||||
cout << "RECEIVER DATA WITH ALL HEADERS!" << endl;
|
||||
#endif
|
||||
|
||||
#ifdef OLDDATA
|
||||
moench03Ctb10GbT1Data *decoder = new moench03Ctb10GbT1Data();
|
||||
cout << "OLD RECEIVER DATA!" << endl;
|
||||
#endif
|
||||
|
||||
#ifdef REORDERED
|
||||
moench03T1ReorderedData *decoder = new moench03T1ReorderedData();
|
||||
cout << "REORDERED DATA!" << endl;
|
||||
#endif
|
||||
|
||||
decoder->getDetectorSize(nx, ny);
|
||||
cout << "nx " << nx << " ny " << ny << endl;
|
||||
|
||||
// moench03T1ZmqData *decoder=new moench03T1ZmqData();
|
||||
singlePhotonDetector *filter =
|
||||
new singlePhotonDetector(decoder, csize, nsigma, 1, 0, nped, 200);
|
||||
// char tit[10000];
|
||||
cout << "filter " << endl;
|
||||
|
||||
// filter->readPedestals("/scratch/ped_100.tiff");
|
||||
// interp->readFlatField("/scratch/eta_100.tiff",etamin,etamax);
|
||||
// cout << "filter "<< endl;
|
||||
|
||||
int size = 327680; ////atoi(argv[3]);
|
||||
|
||||
int *image;
|
||||
// int* image =new int[327680/sizeof(int)];
|
||||
filter->newDataSet();
|
||||
|
||||
int ff, np;
|
||||
int dsize = decoder->getDataSize();
|
||||
cout << " data size is " << dsize;
|
||||
|
||||
char data[dsize];
|
||||
|
||||
ifstream filebin;
|
||||
char *indir = argv[1];
|
||||
char *outdir = argv[2];
|
||||
char *fformat = argv[3];
|
||||
int runmin = atoi(argv[4]);
|
||||
int runmax = atoi(argv[5]);
|
||||
|
||||
char fname[10000];
|
||||
char outfname[10000];
|
||||
char imgfname[10000];
|
||||
char pedfname[10000];
|
||||
// strcpy(pedfname,argv[6]);
|
||||
char fn[10000];
|
||||
|
||||
std::time_t end_time;
|
||||
|
||||
FILE *of = NULL;
|
||||
cout << "input directory is " << indir << endl;
|
||||
cout << "output directory is " << outdir << endl;
|
||||
cout << "fileformat is " << fformat << endl;
|
||||
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
|
||||
char *buff;
|
||||
multiThreadedAnalogDetector *mt =
|
||||
new multiThreadedAnalogDetector(filter, nthreads, fifosize);
|
||||
|
||||
mt->setDetectorMode(ePhotonCounting);
|
||||
mt->setFrameMode(eFrame);
|
||||
mt->StartThreads();
|
||||
mt->popFree(buff);
|
||||
|
||||
cout << "mt " << endl;
|
||||
|
||||
int ifr = 0;
|
||||
|
||||
for (int irun = runmin; irun < runmax; irun++) {
|
||||
sprintf(fn, fformat, irun);
|
||||
sprintf(fname, "%s/%s.raw", indir, fn);
|
||||
sprintf(outfname, "%s/%s.clust", outdir, fn);
|
||||
sprintf(imgfname, "%s/%s.tiff", outdir, fn);
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
cout << fname << " " << outfname << " " << imgfname << endl;
|
||||
filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
// //open file
|
||||
if (filebin.is_open()) {
|
||||
of = fopen(outfname, "w");
|
||||
if (of) {
|
||||
mt->setFilePointer(of);
|
||||
// cout << "file pointer set " << endl;
|
||||
} else {
|
||||
cout << "Could not open " << outfname << " for writing "
|
||||
<< endl;
|
||||
mt->setFilePointer(NULL);
|
||||
return 1;
|
||||
}
|
||||
// //while read frame
|
||||
ff = -1;
|
||||
while (decoder->readNextFrame(filebin, ff, np, buff)) {
|
||||
// cout << "*"<<ifr++<<"*"<<ff<< endl;
|
||||
// cout << ff << " " << np << endl;
|
||||
// //push
|
||||
// for (int ix=0; ix<400; ix++)
|
||||
// for (int iy=0; iy<400; iy++) {
|
||||
// if (decoder->getChannel(buff, ix, iy)<3000 ||
|
||||
// decoder->getChannel(buff, ix, iy)>8000) {
|
||||
// cout << ifr << " " << ff << " " << ix << " " << iy <<
|
||||
// " " << decoder->getChannel(buff, ix, iy) << endl ;
|
||||
// }
|
||||
// }
|
||||
|
||||
mt->pushData(buff);
|
||||
// // //pop
|
||||
mt->nextThread();
|
||||
// // // cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
ifr++;
|
||||
if (ifr % 10000 == 0)
|
||||
cout << ifr << " " << ff << endl;
|
||||
ff = -1;
|
||||
}
|
||||
cout << "--" << endl;
|
||||
filebin.close();
|
||||
// //close file
|
||||
// //join threads
|
||||
while (mt->isBusy()) {
|
||||
;
|
||||
} // wait until all data are processed from the queues
|
||||
if (of)
|
||||
fclose(of);
|
||||
|
||||
mt->writeImage(imgfname);
|
||||
mt->clearImage();
|
||||
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
|
||||
} else
|
||||
cout << "Could not open " << fname << " for reading " << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -2,43 +2,33 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
//#include "sls/ansi.h"
|
||||
#include <iostream>
|
||||
#define CORR
|
||||
#undef CORR
|
||||
|
||||
#define C_GHOST 0.0004
|
||||
|
||||
#define CM_ROWS 50
|
||||
|
||||
//#define VERSION_V1
|
||||
#define RAWDATA
|
||||
|
||||
//#include "moench03T1ZmqData.h"
|
||||
#ifdef NEWRECEIVER
|
||||
#ifndef MOENCH04
|
||||
#ifndef RECT
|
||||
#include "moench03T1ReceiverDataNew.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RECT
|
||||
#include "moench03T1ReceiverDataNewRect.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MOENCH04
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#endif
|
||||
|
||||
#ifdef CSAXS_FP
|
||||
#include "moench03T1ReceiverData.h"
|
||||
#endif
|
||||
#ifdef OLDDATA
|
||||
#include "moench03Ctb10GbT1Data.h"
|
||||
#endif
|
||||
|
||||
// #include "interpolatingDetector.h"
|
||||
//#include "etaInterpolationPosXY.h"
|
||||
// #include "linearInterpolation.h"
|
||||
// #include "noInterpolation.h"
|
||||
#include "multiThreadedCountingDetector.h"
|
||||
//#include "multiThreadedAnalogDetector.h"
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03GhostSummation.h"
|
||||
#include "singlePhotonDetector.h"
|
||||
//#include "interpolatingDetector.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
@ -52,7 +42,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc < 4) {
|
||||
cout << "Usage is " << argv[0]
|
||||
<< "indir outdir fname [runmin] [runmax] [pedfile] [threshold] "
|
||||
<< "indir outdir fname(no extension) [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
|
||||
"[nframes] [xmin xmax ymin ymax] [gainmap]"
|
||||
<< endl;
|
||||
cout << "threshold <0 means analog; threshold=0 means cluster finder; "
|
||||
@ -64,55 +54,39 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int p = 10000;
|
||||
int fifosize = 1000;
|
||||
int nthreads = 10;
|
||||
int nsubpix = 25;
|
||||
int etabins = nsubpix * 10;
|
||||
double etamin = -1, etamax = 2;
|
||||
int csize = 3;
|
||||
int save = 1;
|
||||
int nsigma = 5;
|
||||
int nped = 10000;
|
||||
int ndark = 100;
|
||||
int ok;
|
||||
int iprog = 0;
|
||||
|
||||
int cf = 0;
|
||||
|
||||
#ifdef NEWRECEIVER
|
||||
#ifdef RECT
|
||||
cout << "Should be rectangular!" << endl;
|
||||
cout << "Should be rectangular but now it will crash! No data structure defined!" << endl;
|
||||
#endif
|
||||
#ifndef MOENCH04
|
||||
moench03T1ReceiverDataNew *decoder = new moench03T1ReceiverDataNew();
|
||||
cout << "RECEIVER DATA WITH ONE HEADER!" << endl;
|
||||
cout << "MOENCH03!" << endl;
|
||||
#endif
|
||||
|
||||
#ifdef CSAXS_FP
|
||||
moench03T1ReceiverData *decoder = new moench03T1ReceiverData();
|
||||
cout << "RECEIVER DATA WITH ALL HEADERS!" << endl;
|
||||
#ifdef MOENCH04
|
||||
moench04CtbZmq10GbData *decoder = new moench04CtbZmq10GbData();
|
||||
cout << "MOENCH04!" << endl;
|
||||
#endif
|
||||
|
||||
#ifdef OLDDATA
|
||||
moench03Ctb10GbT1Data *decoder = new moench03Ctb10GbT1Data();
|
||||
cout << "OLD RECEIVER DATA!" << endl;
|
||||
#endif
|
||||
|
||||
int nx = 400, ny = 400;
|
||||
|
||||
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 size = 327680; ////atoi(argv[3]);
|
||||
|
||||
int *image;
|
||||
// int* image =new int[327680/sizeof(int)];
|
||||
//float *gm;
|
||||
|
||||
int ff, np;
|
||||
// cout << " data size is " << dsize;
|
||||
@ -169,7 +143,6 @@ int main(int argc, char *argv[]) {
|
||||
char fname[10000];
|
||||
char imgfname[10000];
|
||||
char cfname[10000];
|
||||
char fn[10000];
|
||||
|
||||
std::time_t end_time;
|
||||
|
||||
@ -186,19 +159,6 @@ int main(int argc, char *argv[]) {
|
||||
cout << "Nframes is " << nframes << endl;
|
||||
|
||||
uint32_t nnx, nny;
|
||||
double *gmap;
|
||||
|
||||
// if (gainfname) {
|
||||
// gm=ReadFromTiff(gainfname, nny, nnx);
|
||||
// if (gm && nnx==nx && nny==ny) {
|
||||
// gmap=new double[nx*ny];
|
||||
// for (int i=0; i<nx*ny; i++) {
|
||||
// gmap[i]=gm[i];
|
||||
// }
|
||||
// delete gm;
|
||||
// } else
|
||||
// cout << "Could not open gain map " << gainfname << endl;
|
||||
// }
|
||||
|
||||
#ifdef CORR
|
||||
cout << "Applying common mode " << ncol_cm << endl;
|
||||
@ -220,21 +180,15 @@ int main(int argc, char *argv[]) {
|
||||
} else
|
||||
thr = 0.15 * thr;
|
||||
filter->newDataSet();
|
||||
int dsize = decoder->getDataSize();
|
||||
//int dsize = decoder->getDataSize();
|
||||
|
||||
char data[dsize];
|
||||
|
||||
//#ifndef ANALOG
|
||||
if (thr > 0) {
|
||||
cout << "threshold is " << thr << endl;
|
||||
//#ifndef ANALOG
|
||||
filter->setThreshold(thr);
|
||||
//#endif
|
||||
cf = 0;
|
||||
|
||||
} else
|
||||
cf = 1;
|
||||
//#endif
|
||||
|
||||
filter->setROI(xmin, xmax, ymin, ymax);
|
||||
std::time(&end_time);
|
||||
@ -269,7 +223,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ifr = 0;
|
||||
|
||||
double ped[nx * ny], *ped1;
|
||||
double *ped=new double[nx * ny];//, *ped1;
|
||||
|
||||
if (pedfile) {
|
||||
|
||||
@ -277,10 +231,10 @@ int main(int argc, char *argv[]) {
|
||||
sprintf(imgfname, "%s/pedestals.tiff", outdir);
|
||||
|
||||
if (string(pedfile).find(".tif") == std::string::npos) {
|
||||
sprintf(fname, "%s.raw", pedfile);
|
||||
sprintf(fname, "%s", pedfile);
|
||||
cout << fname << endl;
|
||||
std::time(&end_time);
|
||||
cout << "aaa" << std::ctime(&end_time) << endl;
|
||||
//cout << "aaa" << std::ctime(&end_time) << endl;
|
||||
|
||||
mt->setFrameMode(ePedestal);
|
||||
// sprintf(fn,fformat,irun);
|
||||
@ -310,18 +264,12 @@ int main(int argc, char *argv[]) {
|
||||
<< " for reading " << endl;
|
||||
} else {
|
||||
float *pp = ReadFromTiff(pedfile, nny, nnx);
|
||||
if (pp && nnx == nx && nny == ny) {
|
||||
if (pp && (int)nnx == nx && (int)nny == ny) {
|
||||
for (int i = 0; i < nx * ny; i++) {
|
||||
ped[i] = pp[i];
|
||||
}
|
||||
delete[] pp;
|
||||
mt->setPedestal(ped);
|
||||
// ped1=mt->getPedestal();
|
||||
|
||||
// for (int i=0; i<nx*ny; i++) {
|
||||
|
||||
// cout << ped[i]<<"/"<<ped1[i] << " " ;
|
||||
// }
|
||||
cout << "Pedestal set from tiff file " << pedfile << endl;
|
||||
} else {
|
||||
cout << "Could not open pedestal tiff file " << pedfile
|
||||
@ -342,11 +290,11 @@ int main(int argc, char *argv[]) {
|
||||
cout << "DATA ";
|
||||
// sprintf(fn,fformat,irun);
|
||||
sprintf(ffname, "%s/%s.raw", indir, fformat);
|
||||
sprintf(fname, ffname, irun);
|
||||
sprintf(fname, (const char*)ffname, irun);
|
||||
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
|
||||
sprintf(imgfname, ffname, irun);
|
||||
sprintf(imgfname, (const char*)ffname, irun);
|
||||
sprintf(ffname, "%s/%s.clust", outdir, fformat);
|
||||
sprintf(cfname, ffname, irun);
|
||||
sprintf(cfname, (const char*)ffname, irun);
|
||||
cout << fname << " ";
|
||||
cout << imgfname << endl;
|
||||
std::time(&end_time);
|
||||
@ -375,13 +323,10 @@ int main(int argc, char *argv[]) {
|
||||
ifr = 0;
|
||||
while (decoder->readNextFrame(filebin, ff, np, buff)) {
|
||||
if (np == 40) {
|
||||
// cout << "*"<<ifr++<<"*"<<ff<< endl;
|
||||
// cout << ff << " " << np << endl;
|
||||
// //push
|
||||
mt->pushData(buff);
|
||||
// // //pop
|
||||
mt->nextThread();
|
||||
// // // cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
|
||||
ifr++;
|
||||
@ -389,15 +334,9 @@ int main(int argc, char *argv[]) {
|
||||
cout << ifr << " " << ff << endl;
|
||||
if (nframes > 0) {
|
||||
if (ifr % nframes == 0) {
|
||||
// The name has an additional "_fXXXXX" at the end,
|
||||
// where "XXXXX" is the initial frame number of the
|
||||
// image (0,1000,2000...)
|
||||
|
||||
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
|
||||
ifile);
|
||||
sprintf(imgfname, ffname, irun);
|
||||
// cout << "Writing tiff to " << imgfname << " " <<
|
||||
// thr1 << endl;
|
||||
sprintf(imgfname, (const char*)ffname, irun);
|
||||
mt->writeImage(imgfname, thr1);
|
||||
mt->clearImage();
|
||||
ifile++;
|
||||
@ -409,18 +348,16 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
cout << "--" << endl;
|
||||
filebin.close();
|
||||
// //close file
|
||||
// //join threads
|
||||
while (mt->isBusy()) {
|
||||
;
|
||||
}
|
||||
if (nframes >= 0) {
|
||||
if (nframes > 0) {
|
||||
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
|
||||
sprintf(imgfname, ffname, irun);
|
||||
sprintf(imgfname, (const char*)ffname, irun);
|
||||
} else {
|
||||
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
|
||||
sprintf(imgfname, ffname, irun);
|
||||
sprintf(imgfname, (const char*)ffname, irun);
|
||||
}
|
||||
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
|
||||
mt->writeImage(imgfname, thr1);
|
@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
//#define WRITE_QUAD
|
||||
#define DEVELOPER
|
||||
//#define DEVELOPER
|
||||
#undef CORR
|
||||
#undef MOENCH04
|
||||
//#undef MOENCH04
|
||||
|
||||
#define C_GHOST 0.0004
|
||||
|
||||
@ -11,21 +11,21 @@
|
||||
|
||||
#include "sls/ZmqSocket.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#ifndef RECT
|
||||
#ifndef MOENCH04
|
||||
//#ifndef RECT
|
||||
#include "moench03T1ZmqDataNew.h"
|
||||
//#endif
|
||||
//#ifdef RECT
|
||||
//#include "moench03T1ZmqDataNewRect.h"
|
||||
//#endif
|
||||
#endif
|
||||
#ifdef MOENCH04
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef RECT
|
||||
#include "moench03T1ZmqDataNewRect.h"
|
||||
#endif
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03GhostSummation.h"
|
||||
#include "tiffIO.h"
|
||||
#include "sls/tiffIO.h"
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
|
||||
int send_something = 0;
|
||||
|
||||
int maxSize = npx * npy * 2; // 32*2*8192;//5000;//atoi(argv[3]);
|
||||
int size = maxSize; // 32*2*5000;
|
||||
int size = maxSize+sizeof(int); // 32*2*5000;
|
||||
// int multisize=size;
|
||||
// int dataSize=size;
|
||||
|
||||
@ -305,10 +305,10 @@ int main(int argc, char *argv[]) {
|
||||
// header variables
|
||||
uint64_t acqIndex = -1;
|
||||
uint64_t frameIndex = -1;
|
||||
#ifdef MOENCH_BRANCH
|
||||
uint32_t subFrameIndex = -1;
|
||||
int *flippedData = 0;
|
||||
#endif
|
||||
// #ifdef MOENCH_BRANCH
|
||||
// uint32_t subFrameIndex = -1;
|
||||
// int *flippedData = 0;
|
||||
// #endif
|
||||
|
||||
uint64_t subframes = 0;
|
||||
// uint64_t isubframe=0;
|
||||
|
Reference in New Issue
Block a user