1 - Add cmake for jungfrauExecutables rawdataprocess (#717)

* Fix ROI mapping

* intial draft of cmake for jungfrau executables Makefile.rawdataprocess

* added the cmake file

* missed Makefile

* added libfmt

* Fix some compiler warnings


---------

Co-authored-by: vhinger182 <hinger_v@hv_home_lt1.localdomain>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
hinger_v 2023-04-27 13:59:13 +02:00 committed by GitHub
parent cb4f733350
commit f4e05f7a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 178 additions and 56 deletions

View File

@ -55,6 +55,7 @@ option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
option(SLS_USE_JUNGFRAU "compile post processing for Jungfrau" OFF)
#Convenience option to switch off defaults when building Moench binaries only
option(SLS_BUILD_ONLY_MOENCH "compile only Moench" OFF)
@ -68,6 +69,18 @@ if(SLS_BUILD_ONLY_MOENCH)
set(SLS_USE_MOENCH ON CACHE BOOL "Enable" FORCE)
endif()
#Convenience option to switch off defaults when building Jungfrau binaries only
option(SLS_BUILD_ONLY_JUNGFRAU "compile only Jungfrau" OFF)
if(SLS_BUILD_ONLY_JUNGFRAU)
message(STATUS "Build JUNGFRAU binaries only!")
set(SLS_BUILD_SHARED_LIBRARIES OFF CACHE BOOL "Disabled for JUNGFRAU_ONLY" FORCE)
set(SLS_USE_TEXTCLIENT OFF CACHE BOOL "Disabled for JUNGFRAU_ONLY" FORCE)
set(SLS_USE_DETECTOR OFF CACHE BOOL "Disabled for JUNGFRAU_ONLY" FORCE)
set(SLS_USE_RECEIVER OFF CACHE BOOL "Disabled for JUNGFRAU_ONLY" FORCE)
set(SLS_USE_RECEIVER_BINARIES OFF CACHE BOOL "Disabled for JUNGFRAU_ONLY" FORCE)
set(SLS_USE_JUNGFRAU ON CACHE BOOL "Enable" FORCE)
endif()
option(SLS_EXT_BUILD "external build of part of the project" OFF)
if(SLS_EXT_BUILD)
@ -264,6 +277,11 @@ if(SLS_USE_MOENCH)
add_subdirectory(slsDetectorCalibration/moenchExecutables)
endif(SLS_USE_MOENCH)
if(SLS_USE_JUNGFRAU)
add_subdirectory(slsDetectorCalibration/tiffio)
add_subdirectory(slsDetectorCalibration/jungfrauExecutables)
endif(SLS_USE_JUNGFRAU)
if(SLS_MASTER_PROJECT)
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)

View File

@ -69,7 +69,7 @@ class jungfrauLGADStrixelsDataSingleChip : public slsDetectorData<uint16_t> {
int mchip;
void remapGroup( const int group ) {
int ix, iy;
int ix, iy=0;
int x0, y0, x1, y1, shifty;
int multiplicator;
@ -261,15 +261,15 @@ class jungfrauLGADStrixelsDataSingleChip : public slsDetectorData<uint16_t> {
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np,char *data) {
char *retval = 0;
int nd;
int fnum = -1;
//char *retval = 0;
//int nd;
//int fnum = -1;
np = 0;
int pn;
//int pn;
// cout << dataSize << endl;
if (ff >= 0)
fnum = ff;
// fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {

View File

@ -193,7 +193,7 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
void remapGroup(const int group) {
int multiplicator = getMultiplicator(group);
int shiftx;
//int shiftx;
int ix, iy = 0;
setMappingShifts(group);
@ -236,6 +236,9 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} else if (ymax <= c6g1_yend - bond_shift_y) {
group = 1;
mchip = 6;
} else { //to fix compiler warning
group = -1;
mchip = -1;
}
int multiplicator = getMultiplicator(group);
setMappingShifts(group);
@ -315,14 +318,13 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} else {
mchip = 1;
remapGroup(1);
remapGroup(2);
remapGroup(3);
for (int group=1; group!=4; ++group)
remapGroup(group);
mchip = 6;
remapGroup(1);
remapGroup(2);
remapGroup(3);
for (int group=1; group!=4; ++group)
remapGroup(group);
}
iframe = 0;
@ -353,10 +355,9 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
int getFrameNumber(char *buff) {
#ifdef ALDO // VH
return ((header *)buff)->bunchNumber; // VH
#else // VH
return ((header *)buff)->detHeader.frameNumber;
return ((jf_header *)buff)->bunchNumber; // VH
#endif // VH
return ((header *)buff)->detHeader.frameNumber;
};
/**
@ -374,9 +375,8 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
// 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
return ((header *)buff)->detHeader.packetNumber;
};
char *readNextFrame(std::ifstream &filebin) {
@ -400,15 +400,15 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np, char *data) {
char *retval = 0;
int nd;
int fnum = -1;
//char *retval = 0;
//int nd;
//int fnum = -1;
np = 0;
int pn;
//int pn;
// std::cout << dataSize << std::endl;
if (ff >= 0)
fnum = ff;
// fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {

View File

@ -142,15 +142,15 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
};
char *readNextFrame(ifstream &filebin, int &ff, int &np,char *data) {
char *retval = 0;
int nd;
int fnum = -1;
//char *retval = 0;
//int nd;
//int fnum = -1;
np = 0;
int pn;
//int pn;
// cout << dataSize << endl;
if (ff >= 0)
fnum = ff;
//fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {

View File

@ -227,15 +227,15 @@ class jungfrauStrixelsHalfModuleOldDesign : public slsDetectorData<uint16_t> {
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np,char *data) {
char *retval = 0;
int nd;
int fnum = -1;
//char *retval = 0;
//int nd;
//int fnum = -1;
np = 0;
int pn;
//int pn;
// cout << dataSize << endl;
if (ff >= 0)
fnum = ff;
//fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {

View File

@ -0,0 +1,101 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
# Initial draft for Makefile.rawdataprocess
set(JUNGFRAU_EXECUTABLES)
find_package(fmt REQUIRED)
# jungfrauRawDataProcess
add_executable(jungfrauRawDataProcess jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcess PRIVATE MODULE)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcess)
# jungfrauRawDataProcessStrx
add_executable(jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrx PRIVATE JFSTRX)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrx)
# jungfrauRawDataProcessStrxChip1
add_executable(jungfrauRawDataProcessStrxChip1 jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxChip1 PRIVATE JFSTRXCHIP1)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxChip1)
# jungfrauRawDataProcessStrxChip6
add_executable(jungfrauRawDataProcessStrxChip6 jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxChip6 PRIVATE JFSTRXCHIP6)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxChip6)
# jungfrauRawDataProcessStrxChip1Aldo
add_executable(jungfrauRawDataProcessStrxChip1Aldo jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxChip1Aldo PRIVATE JFSTRXCHIP1 ALDO)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxChip1Aldo)
# jungfrauRawDataProcessStrxChip6Aldo
add_executable(jungfrauRawDataProcessStrxChip6Aldo jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxChip6Aldo PRIVATE JFSTRXCHIP6 ALDO)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxChip6Aldo)
# jungfrauRawDataProcessStrxAldo
add_executable(jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxAldo PRIVATE JFSTRX ALDO)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxAldo)
# jungfrauRawDataProcessStrxOld
add_executable(jungfrauRawDataProcessStrxOld jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxOld PRIVATE JFSTRXOLD)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxOld)
# jungfrauRawDataProcessStrxOldAldo
add_executable(jungfrauRawDataProcessStrxOldAldo jungfrauRawDataProcess.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxOldAldo PRIVATE JFSTRXOLD ALDO)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxOldAldo)
# others to be added if needed (might already be there in Makefile.cluster_finder TO BE CHECKED)
foreach(exe ${JUNGFRAU_EXECUTABLES})
#TODO! At a later stage clean up include dirs and have a proper lib
target_include_directories(${exe} PRIVATE
../
../interpolations
../dataStructures
../interpolations/etaVEL
../../slsSupportLib/include/
../../slsReceiverSoftware/include/
../tiffio/include
${fmt_INCLUDE_DIRS}
)
target_link_libraries(${exe}
PUBLIC
slsSupportStatic
pthread
tiffio
fmt::fmt
#-L/usr/lib64/
#-lm -lstdc++ -lrt
PRIVATE
slsProjectWarnings
slsProjectOptions
)
set_target_properties(${exe} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET ${exe} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
endforeach(exe ${JUNGFRAU_EXECUTABLES})
install(TARGETS ${JUNGFRAU_EXECUTABLES} DESTINATION bin)

View File

@ -1,6 +1,8 @@
# 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/ -I../tiffio/include
LDFLAG= ../tiffio/src/tiffIO.cpp -L/usr/lib64/ -lpthread -lm -lstdc++ -pthread -lrt -ltiff -O3 -std=c++11
@ -11,64 +13,65 @@ MAIN=jungfrauClusterFinder.cpp
all: jungfrauRawDataProcess
jungfrauRawDataProcess: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcess jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DMODULE
g++ -o jungfrauRawDataProcess jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DMODULE
jungfrauRawDataProcessStrx: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX
g++ -o jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRX
jungfrauRawDataProcessStrxChip1: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip1 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP1
g++ -o jungfrauRawDataProcessStrxChip1 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXCHIP1
jungfrauRawDataProcessStrxChip6: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip6 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP6
g++ -o jungfrauRawDataProcessStrxChip6 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXCHIP6
jungfrauRawDataProcessStrxChip1Aldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip1Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP1 -DALDO
g++ -o jungfrauRawDataProcessStrxChip1Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXCHIP1 -DALDO
jungfrauRawDataProcessStrxChip6Aldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip6Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP6 -DALDO
g++ -o jungfrauRawDataProcessStrxChip6Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXCHIP6 -DALDO
jungfrauRawDataProcessStrxAldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX -DALDO
g++ -o jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRX -DALDO
jungfrauRawDataProcessStrxOld: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxOld jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXOLD
g++ -o jungfrauRawDataProcessStrxOld jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXOLD
jungfrauRawDataProcessStrxOldAldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxOldAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXOLD -DALDO
g++ -o jungfrauRawDataProcessStrxOldAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) -DJFSTRXOLD -DALDO
jungfrauClusterFinder: jungfrauClusterFinder.cpp $(INCS) clean
g++ -o jungfrauClusterFinder jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
g++ -o jungfrauClusterFinder jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR)
jungfrauClusterFinderHighZ: jungfrauClusterFinder.cpp $(INCS) clean
g++ -o jungfrauClusterFinderHighZ jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DHIGHZ
g++ -o jungfrauClusterFinderHighZ jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR) -DHIGHZ
# doesnt compile
jungfrauMakeEta: jungfrauInterpolation.cpp $(INCS) clean
g++ -o jungfrauMakeEta jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF
g++ -o jungfrauMakeEta jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR) -DFF
jungfrauInterpolation: jungfrauInterpolation.cpp $(INCS) clean
g++ -o jungfrauInterpolation jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
g++ -o jungfrauInterpolation jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR)
jungfrauNoInterpolation: jungfrauNoInterpolation.cpp $(INCS) clean
g++ -o jungfrauNoInterpolation jungfrauNoInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
# cpp doesnt exist
#jungfrauNoInterpolation: jungfrauNoInterpolation.cpp $(INCS) clean
# g++ -o jungfrauNoInterpolation jungfrauNoInterpolation.cpp $(LDFLAG) $(INCDIR)
jungfrauPhotonCounter: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauPhotonCounter jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER
g++ -o jungfrauPhotonCounter jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) -DNEWRECEIVER
jungfrauAnalog: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauAnalog jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG
g++ -o jungfrauAnalog jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) -DNEWRECEIVER -DANALOG
jungfrauPhotonCounterHighZ: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauPhotonCounterHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DHIGHZ
g++ -o jungfrauPhotonCounterHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) -DNEWRECEIVER -DHIGHZ
jungfrauAnalogHighZ: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauAnalogHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG -DHIGHZ
g++ -o jungfrauAnalogHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) -DNEWRECEIVER -DANALOG -DHIGHZ
clean:
rm -f jungfrauClusterFinder jungfrauMakeEta jungfrauInterpolation jungfrauNoInterpolation jungfrauPhotonCounter jungfrauAnalog

View File

@ -39,7 +39,7 @@
#include <sys/stat.h>
#include <ctime>
// using namespace std;
#include <fmt/core.h>
int main(int argc, char *argv[]) {