intermediate

This commit is contained in:
hinger_v 2024-08-23 11:43:32 +02:00
parent a6a4ea7f21
commit 669e5f3c7a
2 changed files with 52 additions and 39 deletions

View File

@ -252,7 +252,7 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
using header = sls::defs::sls_receiver_header; using header = sls::defs::sls_receiver_header;
jungfrauLGADStrixelsDataQuad(uint16_t xmin = 0, uint16_t xmax = 0, jungfrauLGADStrixelsDataQuadH5(uint16_t xmin = 0, uint16_t xmax = 0,
uint16_t ymin = 0, uint16_t ymax = 0) uint16_t ymin = 0, uint16_t ymax = 0)
: slsDetectorData<uint16_t>( : slsDetectorData<uint16_t>(
nc_strixel, nc_strixel,
@ -324,13 +324,14 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
\returns frame number \returns frame number
*/ */
/*
int getFrameNumber(char *buff) { int getFrameNumber(char *buff) {
#ifdef ALDO // VH #ifdef ALDO // VH
return ((jf_header *)buff)->bunchNumber; // VH return ((jf_header *)buff)->bunchNumber; // VH
#endif // VH #endif // VH
return ((header *)buff)->detHeader.frameNumber; return ((header *)buff)->detHeader.frameNumber;
}; };
*/
/** /**
@ -338,9 +339,8 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
\param buff pointer to the dataset \param buff pointer to the dataset
\returns packet number number \returns packet number number
*/ */
/*
int getPacketNumber(char *buff) { int getPacketNumber(char *buff) {
#ifdef ALDO // VH #ifdef ALDO // VH
// uint32_t fakePacketNumber = 1000; // uint32_t fakePacketNumber = 1000;
@ -350,20 +350,21 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
#endif // VH #endif // VH
return ((header *)buff)->detHeader.packetNumber; return ((header *)buff)->detHeader.packetNumber;
}; };
*/
char *readNextFrame(std::ifstream &filebin) { char* readNextFrame(const HDF5File& hfile) {
int ff = -1, np = -1; int fn = 0, iframe = 0;
return readNextFrame(filebin, ff, np); return readNextFrame(hfile, fn, iframe);
}; };
char *readNextFrame(std::ifstream &filebin, int &ff) { char* readNextFrame(const HDF5File& hfile, int& fn) {
int np = -1; int iframe = 0;
return readNextFrame(filebin, ff, np); return readNextFrame(hfile, fn, iframe);
}; };
char *readNextFrame(std::ifstream &filebin, int &ff, int &np) { char *readNextFrame(const HDF5File& hfile, int& fn, int& iframe) {
char *data = new char[dataSize]; char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data); char *d = readNextFrame(hfile, fn, iframe, data);
if (d == NULL) { if (d == NULL) {
delete[] data; delete[] data;
data = NULL; data = NULL;
@ -371,28 +372,17 @@ class jungfrauLGADStrixelsDataQuadH5 : public slsDetectorData<uint16_t> {
return data; return data;
}; };
char* readNextFrame(HDF5File& hfile, int& ff, int& np, char* data) { //framenumber: Framenumber as written in the file (defined by the time of detector power on)
//char *retval = 0; //iframe: Counter how often ReadImage has been called, ReadImage return value
//int nd; char* readNextFrame(const HDF5File& hfile, int& framenumber, int& iframe, char* data) {
//int fnum = -1;
np = 0;
//int pn;
//std::cout << dataSize << std::endl; if (iframe>=0) {
//if (ff >= 0) {
// fnum = ff; }
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
std::cout << "*"; std::cout << "*";
ff = getFrameNumber(data); iframe = hfile.ReadImage( data, framenumber )
np = getPacketNumber(data);
return data; return data;
} }
std::cout << "#"; std::cout << "#";
} else {
std::cout << "File not open" << std::endl;
}
return NULL; return NULL;
}; };

View File

@ -45,9 +45,9 @@ if (SLS_USE_HDF5)
if (HDF5_FOUND) if (HDF5_FOUND)
add_executable(jungfrauRawDataProcessStrxQuadH5 jungfrauRawDataProcess_filetxtH5.cpp) add_executable(jungfrauRawDataProcessStrxQuadH5 jungfrauRawDataProcess_filetxtH5.cpp)
target_compile_definitions(jungfrauRawDataProcessStrxQuadH5 PRIVATE JFSTRXQH5) target_compile_definitions(jungfrauRawDataProcessStrxQuadH5 PRIVATE JFSTRXQH5)
target_link_libraries(jungfrauRawDataProcessStrxQuadH5 PUBLIC ${HDF5_LIBRARIES})
target_include_directories(jungfrauRawDataProcessStrxQuadH5 PUBLIC ${HDF5_INCLUDE_DIRS}) #${CMAKE_INSTALL_PREFIX}/include)
list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxQuadH5) list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxQuadH5)
target_include_directories(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include)
target_link_libraries(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_LIBRARIES})
endif () endif ()
endif (SLS_USE_HDF5) endif (SLS_USE_HDF5)
@ -90,6 +90,16 @@ list(APPEND JUNGFRAU_EXECUTABLES jungfrauRawDataProcessStrxOldAldo)
# others to be added if needed (might already be there in Makefile.cluster_finder TO BE CHECKED) # others to be added if needed (might already be there in Makefile.cluster_finder TO BE CHECKED)
if (SLS_USE_HDF5)
if (HDF5_FOUND)
target_include_directories(jungfrauRawDataProcessStrxQuadH5 PRIVATE
${HDF5_INCLUDE_DIRS}
${CMAKE_INSTALL_PREFIX}/include
)
target_link_libraries(jungfrauRawDataProcessStrxQuadH5 PRIVATE ${HDF5_LIBRARIES})
endif ()
endif (SLS_USE_HDF5)
foreach(exe ${JUNGFRAU_EXECUTABLES}) foreach(exe ${JUNGFRAU_EXECUTABLES})
@ -99,11 +109,16 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
../interpolations ../interpolations
../dataStructures ../dataStructures
../interpolations/etaVEL ../interpolations/etaVEL
../../slsSupportLib/include/ ../../slsSupportLib/include/sls/
../../slsReceiverSoftware/include/ ../../slsReceiverSoftware/include/
../tiffio/include ../tiffio/include
${fmt_INCLUDE_DIRS} ${fmt_INCLUDE_DIRS}
) )
# if (SLS_USE_HDF5)
# if (HDF5_FOUND)
# target_include_directories(${exe} PRIVATE ${HDF5_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/include)
# endif ()
# endif (SLS_USE_HDF5)
target_link_libraries(${exe} target_link_libraries(${exe}
PUBLIC PUBLIC
@ -119,7 +134,11 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
slsProjectWarnings slsProjectWarnings
slsProjectOptions slsProjectOptions
) )
# if (SLS_USE_HDF5)
# if (HDF5_FOUND)
# target_link_libraries(${exe} PRIVATE ${HDF5_LIBRARIES})
# endif ()
# endif (SLS_USE_HDF5)
set_target_properties(${exe} PROPERTIES set_target_properties(${exe} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
@ -131,4 +150,8 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
endforeach(exe ${JUNGFRAU_EXECUTABLES}) endforeach(exe ${JUNGFRAU_EXECUTABLES})
install(TARGETS ${JUNGFRAU_EXECUTABLES} DESTINATION bin) install(TARGETS ${JUNGFRAU_EXECUTABLES} DESTINATION bin)