Fixed problem in cluster finder

This commit is contained in:
bergamaschi 2020-05-06 11:59:49 +02:00
parent 7d94ad51ab
commit d76f43f5fd
7 changed files with 223 additions and 111 deletions

View File

@ -21,6 +21,7 @@ if [ -f "$infile" ]
then then
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ; gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
echo compiling echo compiling
echo gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
$exe ; $exe ;
echo cleaning echo cleaning
rm $exe rm $exe

View File

@ -156,7 +156,7 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
if (dSamples>isample) { if (dSamples>isample) {
ptr=data+32*(isample+1)+8*isample; ptr=data+32*(isample+1)+8*isample;
sample=*((uint64_t*)ptr); sample=*((uint64_t*)ptr);
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl; // cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
if (sample & (1<<ibit[isc])) if (sample & (1<<ibit[isc]))
return 1; return 1;
else else

View File

@ -120,7 +120,7 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
if (dSamples>isample) { if (dSamples>isample) {
ptr=data+aoff+8*isample; ptr=data+aoff+8*isample;
sample=*((uint64_t*)ptr); sample=*((uint64_t*)ptr);
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl; // cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
if (sample & (1<<ibit[isc])) if (sample & (1<<ibit[isc]))
return 1; return 1;
else else

View File

@ -5,12 +5,15 @@ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3
#DESTDIR?=../bin #DESTDIR?=../bin
all: moenchZmqProcess all: moenchZmqProcess moenchZmq04Process
#moenchZmqProcessCtbGui #moenchZmqProcessCtbGui
moenchZmqProcess: moenchZmqProcess.cpp clean moenchZmqProcess: moenchZmqProcess.cpp clean
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP 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 #moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
# g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI # g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI

View File

@ -8,7 +8,13 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "ZmqSocket.h" #include "ZmqSocket.h"
#ifndef RECT #ifndef RECT
#ifndef MOENCH04
#include "moench03T1ZmqDataNew.h" #include "moench03T1ZmqDataNew.h"
#endif
#ifdef MOENCH04
#include "moench04CtbZmq10GbData.h"
#endif
#endif #endif
#ifdef RECT #ifdef RECT
#include "moench03T1ZmqDataNewRect.h" #include "moench03T1ZmqDataNewRect.h"
@ -73,6 +79,10 @@ int main(int argc, char *argv[]) {
char* socketip2 = 0; char* socketip2 = 0;
uint32_t portnum2 = 0; uint32_t portnum2 = 0;
zmqHeader zHeader, outHeader;
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
uint32_t nSigma=5; uint32_t nSigma=5;
int ok; int ok;
@ -124,7 +134,12 @@ int main(int argc, char *argv[]) {
} }
//slsDetectorData *det=new moench03T1ZmqDataNew(); //slsDetectorData *det=new moench03T1ZmqDataNew();
#ifndef MOENCH04
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(); moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
#endif
#ifdef MOENCH04
moench04CtbZmq10GbData *det=new moench04CtbZmq10GbData();
#endif
cout << endl << " det" <<endl; cout << endl << " det" <<endl;
int npx, npy; int npx, npy;
det->getDetectorSize(npx, npy); det->getDetectorSize(npx, npy);
@ -140,13 +155,15 @@ int main(int argc, char *argv[]) {
char dummybuff[size]; char dummybuff[size];
int ncol_cm=CM_ROWS;
double xt_ghost=C_GHOST;
moench03CommonMode *cm=NULL; moench03CommonMode *cm=NULL;
moench03GhostSummation *gs=NULL; moench03GhostSummation *gs=NULL;
#ifdef CORR #ifdef CORR
cm=new moench03CommonMode(ncol_cm);
gs=new moench03GhostSummation(det, xt_ghost); //int ncol_cm=CM_ROWS;
//double xt_ghost=C_GHOST;
cm=new moench03CommonMode(CM_ROWS);
gs=new moench03GhostSummation(det, C_GHOST);
#endif #endif
double *gainmap=NULL; double *gainmap=NULL;
float *gm; float *gm;
@ -308,9 +325,10 @@ int main(int argc, char *argv[]) {
uint64_t bunchId = 0; uint64_t bunchId = 0;
uint64_t timestamp = 0; uint64_t timestamp = 0;
int16_t modId = 0; int16_t modId = 0;
uint32_t expLength=0;
uint16_t xCoord = 0; uint16_t xCoord = 0;
uint16_t yCoord = 0; uint16_t yCoord = 0;
uint16_t zCoord = 0; //uint16_t zCoord = 0;
uint32_t debug = 0; uint32_t debug = 0;
//uint32_t dr = 16; //uint32_t dr = 16;
//int16_t *dout;//=new int16_t [nnx*nny]; //int16_t *dout;//=new int16_t [nnx*nny];
@ -341,6 +359,7 @@ int main(int argc, char *argv[]) {
filter->getImageSize(nnx, nny,nnsx, nnsy); filter->getImageSize(nnx, nny,nnsx, nnsy);
std::map<std::string, std::string> addJsonHeader;
@ -350,16 +369,13 @@ int main(int argc, char *argv[]) {
// cout << "+++++++++++++++++++++++++++++++LOOP" << endl; // cout << "+++++++++++++++++++++++++++++++LOOP" << endl;
// get header, (if dummy, fail is on parse error or end of acquisition) // get header, (if dummy, fail is on parse error or end of acquisition)
#ifndef NEWZMQ
if (!zmqsocket->ReceiveHeader(0, acqIndex, frameIndex, subframeIndex, filename, fileindex)){
#endif
#ifdef NEWZMQ
rapidjson::Document doc;
if (!zmqsocket->ReceiveHeader(0, doc, SLS_DETECTOR_JSON_HEADER_VERSION)) { // rapidjson::Document doc;
if (!zmqsocket->ReceiveHeader(0, zHeader, SLS_DETECTOR_JSON_HEADER_VERSION)) {
/* zmqsocket->CloseHeaderMessage();*/ /* zmqsocket->CloseHeaderMessage();*/
#endif
// if (!zmqsocket->ReceiveHeader(0, acqIndex, frameIndex, subframeIndex, filename, fileindex)) { // if (!zmqsocket->ReceiveHeader(0, acqIndex, frameIndex, subframeIndex, filename, fileindex)) {
cprintf(RED, "Got Dummy\n"); cprintf(RED, "Got Dummy\n");
// t1=high_resolution_clock::now(); // t1=high_resolution_clock::now();
@ -378,7 +394,11 @@ int main(int argc, char *argv[]) {
if (newFrame>0) { if (newFrame>0) {
cprintf(RED,"DIDn't receive any data!\n"); cprintf(RED,"DIDn't receive any data!\n");
if (send) { if (send) {
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
//zHeader.data = false;
outHeader.data=false;
// zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
zmqsocket2->SendHeader(0,outHeader);
cprintf(RED, "Sent Dummy\n"); cprintf(RED, "Sent Dummy\n");
} }
} else { } else {
@ -510,14 +530,39 @@ int main(int argc, char *argv[]) {
if(send_something) { if(send_something) {
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader); // zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
outHeader.data=true;
outHeader.dynamicRange=dr;
outHeader.fileIndex=fileindex;
outHeader.ndetx=1;
outHeader.ndety=1;
outHeader.npixelsx=nnx;
outHeader.npixelsy=nny;
outHeader.imageSize=nnx*nny*dr/8;
outHeader.acqIndex=acqIndex;
outHeader.frameIndex=frameIndex;
outHeader.fname=fname;
outHeader.frameNumber=acqIndex;
outHeader.expLength=expLength;
outHeader.packetNumber=packetNumber;
outHeader.bunchId=bunchId;
outHeader.timestamp=timestamp;
outHeader.modId=modId;
outHeader.row=xCoord;
outHeader.column=yCoord;
outHeader.debug=debug;
outHeader.roundRNumber=roundRNumber;
outHeader.detType=detType;
outHeader.version=version;
zmqsocket2->SendHeader(0,outHeader);
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8); zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
cprintf(GREEN, "Sent Data\n"); cprintf(GREEN, "Sent Data\n");
} }
outHeader.data=false;
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION); zmqsocket2->SendHeader(0,outHeader);
// zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
cprintf(RED, "Sent Dummy\n"); cprintf(RED, "Sent Dummy\n");
if (dout) if (dout)
delete [] dout; delete [] dout;
@ -544,33 +589,84 @@ int main(int argc, char *argv[]) {
} }
#ifdef NEWZMQ //#ifdef NEWZMQ
if (newFrame) { if (newFrame) {
begin = std::chrono::steady_clock::now(); begin = std::chrono::steady_clock::now();
//time(&begin);
// t0 = high_resolution_clock::now();
//cout <<"new frame" << endl;
// acqIndex, frameIndex, subframeIndex, filename, fileindex size = zHeader.imageSize;//doc["size"].GetUint();
size = doc["size"].GetUint();
// multisize = size;// * zmqsocket->size();
// dynamicRange = doc["bitmode"].GetUint();
// nPixelsX = doc["shape"][0].GetUint();
// nPixelsY = doc["shape"][1].GetUint();
filename = doc["fname"].GetString();
//acqIndex = doc["acqIndex"].GetUint64();
//frameIndex = doc["fIndex"].GetUint64();
fileindex = doc["fileIndex"].GetUint64();
//subFrameIndex = doc["expLength"].GetUint();
//packetNumber=doc["packetNumber"].GetUint();
//bunchId=doc["bunchId"].GetUint();
//timestamp=doc["timestamp"].GetUint();
//modId=doc["modId"].GetUint();
//debug=doc["debug"].GetUint();
//roundRNumber=doc["roundRNumber"].GetUint();
//detType=doc["detType"].GetUint();
//version=doc["version"].GetUint();
// dynamicRange = zheader.dynamicRange; //doc["bitmode"].GetUint();
// nPixelsX = zHeader.npixelsx; //doc["shape"][0].GetUint();
// nPixelsY = zHeader.npixelsy;// doc["shape"][1].GetUint();
filename = zHeader.fname;//doc["fname"].GetString();
acqIndex = zHeader.acqIndex; //doc["acqIndex"].GetUint64();
// frameIndex = zHeader.frameIndex;//doc["fIndex"].GetUint64();
fileindex = zHeader.fileIndex;//doc["fileIndex"].GetUint64();
expLength = zHeader.expLength;//doc["expLength"].GetUint();
packetNumber=zHeader.packetNumber;//doc["packetNumber"].GetUint();
bunchId=zHeader.bunchId;//doc["bunchId"].GetUint();
timestamp=zHeader.timestamp;//doc["timestamp"].GetUint();
modId=zHeader.modId;//doc["modId"].GetUint();
debug=zHeader.debug;//doc["debug"].GetUint();
// roundRNumber=r.roundRNumber;//doc["roundRNumber"].GetUint();
detType=zHeader.detType;//doc["detType"].GetUint();
version=zHeader.version;//doc["version"].GetUint();
/*document["bitmode"].GetUint(); zHeader.dynamicRange
document["fileIndex"].GetUint64(); zHeader.fileIndex
document["detshape"][0].GetUint();
zHeader.ndetx
document["detshape"][1].GetUint();
zHeader.ndety
document["shape"][0].GetUint();
zHeader.npixelsx
document["shape"][1].GetUint();
zHeader.npixelsy
document["size"].GetUint(); zHeader.imageSize
document["acqIndex"].GetUint64(); zHeader.acqIndex
document["frameIndex"].GetUint64(); zHeader.frameIndex
document["fname"].GetString(); zHeader.fname
document["frameNumber"].GetUint64(); zHeader.frameNumber
document["expLength"].GetUint(); zHeader.expLength
document["packetNumber"].GetUint(); zHeader.packetNumber
document["bunchId"].GetUint64(); zHeader.bunchId
document["timestamp"].GetUint64(); zHeader.timestamp
document["modId"].GetUint(); zHeader.modId
document["row"].GetUint(); zHeader.row
document["column"].GetUint(); zHeader.column
document["reserved"].GetUint(); zHeader.reserved
document["debug"].GetUint(); zHeader.debug
document["roundRNumber"].GetUint(); zHeader.roundRNumber
document["detType"].GetUint(); zHeader.detType
document["version"].GetUint(); zHeader.version
document["flippedDataX"].GetUint(); zHeader.flippedDataX
document["quad"].GetUint(); zHeader.quad
document["completeImage"].GetUint(); zHeader.completeImage
*/
//dataSize=size; //dataSize=size;
//strcpy(fname,filename.c_str()); //strcpy(fname,filename.c_str());
@ -604,6 +700,8 @@ int main(int argc, char *argv[]) {
// xCoord, yCoord,zCoord, // xCoord, yCoord,zCoord,
// flippedDataX, packetNumber, bunchId, timestamp, modId, debug, roundRNumber, detType, version); // flippedDataX, packetNumber, bunchId, timestamp, modId, debug, roundRNumber, detType, version);
addJsonHeader=zHeader.addJsonHeader;
/* Analog detector commands */ /* Analog detector commands */
//isPedestal=0; //isPedestal=0;
//isFlat=0; //isFlat=0;
@ -611,9 +709,10 @@ int main(int argc, char *argv[]) {
fMode=eFrame; fMode=eFrame;
frameMode_s="frame"; frameMode_s="frame";
cprintf(MAGENTA, "Frame mode: "); cprintf(MAGENTA, "Frame mode: ");
if (doc.HasMember("frameMode")) { // if (doc.HasMember("frameMode")) {
if (doc["frameMode"].IsString()) { if (addJsonHeader.find("frameMode")!= addJsonHeader.end()) {
frameMode_s=doc["frameMode"].GetString(); // if (doc["frameMode"].IsString()) {
frameMode_s=addJsonHeader.at("frameMode");//doc["frameMode"].GetString();
if (frameMode_s == "pedestal"){ if (frameMode_s == "pedestal"){
fMode=ePedestal; fMode=ePedestal;
//isPedestal=1; //isPedestal=1;
@ -639,7 +738,7 @@ int main(int argc, char *argv[]) {
cprintf(MAGENTA, "Resetting flatfield\n"); cprintf(MAGENTA, "Resetting flatfield\n");
fMode=eFlat; fMode=eFlat;
} }
#endif //#endif
else { else {
fMode=eFrame; fMode=eFrame;
//isPedestal=0; //isPedestal=0;
@ -647,19 +746,23 @@ int main(int argc, char *argv[]) {
fMode=eFrame; fMode=eFrame;
frameMode_s="frame"; frameMode_s="frame";
} }
} //}
} }
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str()); cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
mt->setFrameMode(fMode); mt->setFrameMode(fMode);
// threshold=0; // threshold=0;
cprintf(MAGENTA, "Threshold: "); cprintf(MAGENTA, "Threshold: ");
if (doc.HasMember("threshold")) { if (addJsonHeader.find("threshold")!= addJsonHeader.end()) {
if (doc["threshold"].IsInt()) { istringstream(addJsonHeader.at("threshold")) >>threshold;
threshold=doc["threshold"].GetInt(); // threshold=atoi(addJsonHeader.at("threshold").c_str());//doc["frameMode"].GetString();
mt->setThreshold(threshold);
}
} }
//if (doc.HasMember("threshold")) {
//if (doc["threshold"].IsInt()) {
// threshold=doc["threshold"].GetInt();
mt->setThreshold(threshold);
// }
// }
cprintf(MAGENTA, "%d\n", threshold); cprintf(MAGENTA, "%d\n", threshold);
xmin=0; xmin=0;
@ -667,40 +770,47 @@ int main(int argc, char *argv[]) {
ymin=0; ymin=0;
ymax=npy; ymax=npy;
cprintf(MAGENTA, "ROI: "); cprintf(MAGENTA, "ROI: ");
if (doc.HasMember("roi")) {
if (doc["roi"].IsArray()) {
if (doc["roi"].Size() > 0 )
if (doc["roi"][0].IsInt())
xmin=doc["roi"][0].GetInt();
if (doc["roi"].Size() > 1 ) if (addJsonHeader.find("roi")!= addJsonHeader.end()) {
if (doc["roi"][1].IsInt()) istringstream(addJsonHeader.at("roi")) >> xmin >> xmax >> ymin >> ymax ;
xmax=doc["roi"][1].GetInt(); // if (doc.HasMember("roi")) {
//if (doc["roi"].IsArray()) {
// if (doc["roi"].Size() > 0 )
// if (doc["roi"][0].IsInt())
// xmin=doc["roi"][0].GetInt();
if (doc["roi"].Size() > 2 ) // if (doc["roi"].Size() > 1 )
if (doc["roi"][2].IsInt()) // if (doc["roi"][1].IsInt())
ymin=doc["roi"][2].GetInt(); // xmax=doc["roi"][1].GetInt();
if (doc["roi"].Size() > 3 ) // if (doc["roi"].Size() > 2 )
if (doc["roi"][3].IsInt()) // if (doc["roi"][2].IsInt())
ymax=doc["roi"][3].GetInt(); // ymin=doc["roi"][2].GetInt();
}
// if (doc["roi"].Size() > 3 )
// if (doc["roi"][3].IsInt())
// ymax=doc["roi"][3].GetInt();
// }
} }
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax); cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax); mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("dynamicRange")!= addJsonHeader.end()) {
if (doc.HasMember("dynamicRange")) { istringstream(addJsonHeader.at("dynamicRange")) >> dr ;
dr=doc["dynamicRange"].GetUint();
dr=32; dr=32;
} }
// if (doc.HasMember("dynamicRange")) {
// dr=doc["dynamicRange"].GetUint();
// dr=32;
// }
dMode=eAnalog; dMode=eAnalog;
detectorMode_s="analog"; detectorMode_s="analog";
cprintf(MAGENTA, "Detector mode: "); cprintf(MAGENTA, "Detector mode: ");
if (doc.HasMember("detectorMode")) { if (addJsonHeader.find("detectorMode")!= addJsonHeader.end()) {;
if (doc["detectorMode"].IsString()) { //if (doc.HasMember("detectorMode")) {
detectorMode_s=doc["detectorMode"].GetString(); //if (doc["detectorMode"].IsString()) {
detectorMode_s=addJsonHeader.at("detectorMode");//=doc["detectorMode"].GetString();
#ifdef INTERP #ifdef INTERP
if (detectorMode_s == "interpolating"){ if (detectorMode_s == "interpolating"){
dMode=eInterpolating; dMode=eInterpolating;
@ -718,7 +828,7 @@ int main(int argc, char *argv[]) {
mt->setInterpolation(NULL); mt->setInterpolation(NULL);
#endif #endif
} }
} // }
} }
@ -767,19 +877,19 @@ int main(int argc, char *argv[]) {
// } // }
// threshold=0; // threshold=0;
cprintf(MAGENTA, "Subframes: "); // cprintf(MAGENTA, "Subframes: ");
subframes=0; // subframes=0;
//isubframe=0; // //isubframe=0;
insubframe=0; // insubframe=0;
subnorm=1; // subnorm=1;
f0=0; // f0=0;
nnsubframe=0; // nnsubframe=0;
if (doc.HasMember("subframes")) { // if (doc.HasMember("subframes")) {
if (doc["subframes"].IsInt()) { // if (doc["subframes"].IsInt()) {
subframes=doc["subframes"].GetInt(); // subframes=doc["subframes"].GetInt();
} // }
} // }
cprintf(MAGENTA, "%ld\n", subframes); // cprintf(MAGENTA, "%ld\n", subframes);
newFrame=0; newFrame=0;
@ -811,13 +921,13 @@ int main(int argc, char *argv[]) {
// get data // get data
// acqIndex = doc["acqIndex"].GetUint64(); // acqIndex = doc["acqIndex"].GetUint64();
frameIndex = doc["fIndex"].GetUint64(); frameIndex = zHeader.frameIndex;////doc["fIndex"].GetUint64();
// subFrameIndex = doc["expLength"].GetUint(); // subFrameIndex = doc["expLength"].GetUint();
// bunchId=doc["bunchId"].GetUint(); // bunchId=doc["bunchId"].GetUint();
// timestamp=doc["timestamp"].GetUint(); // timestamp=doc["timestamp"].GetUint();
packetNumber=doc["packetNumber"].GetUint(); packetNumber=zHeader.packetNumber; //doc["packetNumber"].GetUint();
// cout << acqIndex << " " << frameIndex << " " << subFrameIndex << " "<< bunchId << " " << timestamp << " " << packetNumber << endl; // cout << acqIndex << " " << frameIndex << " " << subFrameIndex << " "<< bunchId << " " << timestamp << " " << packetNumber << endl;
//cprintf(GREEN, "frame\n"); //cprintf(GREEN, "frame\n");
if (packetNumber>=40) { if (packetNumber>=40) {
@ -866,8 +976,9 @@ int main(int argc, char *argv[]) {
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader); // zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
zHeader.data = true;
zmqsocket2->SendHeader(0,zHeader);
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8); zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
cprintf(GREEN, "Sent subdata\n"); cprintf(GREEN, "Sent subdata\n");

View File

@ -490,7 +490,7 @@ int *getClusters(char *data, int *ph=NULL) {
// (clusters+nph)->ped=getPedestal(ix,iy,0); // (clusters+nph)->ped=getPedestal(ix,iy,0);
for (ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) { for (ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) {
for (ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) { for (ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) {
if ((iy+ir)>=iy && (iy+ir)<ny && (ix+ic)>=ix && (ix+ic)<nx) if ((iy+ir)<ny && (ix+ic)<nx)
(clusters+nph)->set_data(val[iy+ir][ix+ic],ic,ir); (clusters+nph)->set_data(val[iy+ir][ix+ic],ic,ir);
} }
} }

View File

@ -36,19 +36,17 @@ class single_photon_hit {
\param myFile file descriptor \param myFile file descriptor
*/ */
size_t write(FILE *myFile) { size_t write(FILE *myFile) {
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile); //fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile); // if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
// if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
#ifdef OLDFORMAT #ifdef OLDFORMAT
if (fwrite((void*)&iframe, 1, sizeof(int), myFile)) {}; if (fwrite((void*)&iframe, 1, sizeof(int), myFile)) {};
#endif #endif
#ifndef WRITE_QUAD #ifndef WRITE_QUAD
//printf("no quad "); //printf("no quad ");
//if (fwrite((void*)&x, 2, sizeof(int16_t), myFile)) if (fwrite((void*)&x, sizeof(int16_t), 2, myFile))
return fwrite((void*)&x, 1, dx*dy*sizeof(int)+2*sizeof(int16_t), myFile); return fwrite((void*)data, sizeof(int), dx*dy, myFile);
#endif #endif
#ifdef WRITE_QUAD #ifdef WRITE_QUAD
// printf("quad "); // printf("quad ");
int qq[4]; int qq[4];
switch(quad) { switch(quad) {
case TOP_LEFT: case TOP_LEFT:
@ -91,8 +89,8 @@ class single_photon_hit {
default: default:
; ;
} }
if (fwrite((void*)&x, 2, sizeof(int16_t), myFile)) if (fwrite((void*)&x, sizeof(int16_t), 2, myFile))
return fwrite((void*)qq, 1, 4*sizeof(int), myFile); return fwrite((void*)qq, sizeof(int), 4, myFile);
#endif #endif
return 0; return 0;
}; };
@ -109,14 +107,14 @@ class single_photon_hit {
#endif #endif
#ifndef WRITE_QUAD #ifndef WRITE_QUAD
// printf( "no quad \n"); // printf( "no quad \n");
if (fread((void*)&x, 2, sizeof(int16_t), myFile)) if (fread((void*)&x, sizeof(int16_t),2, myFile))
return fread((void*)data, 1, dx*dy*sizeof(int), myFile); return fread((void*)data, sizeof(int), dx*dy,myFile);
#endif #endif
#ifdef WRITE_QUAD #ifdef WRITE_QUAD
int qq[4]; int qq[4];
// printf( "quad \n"); printf( "quad \n");
if (fread((void*)&x, 2, sizeof(int16_t), myFile)) if (fread((void*)&x, sizeof(int16_t), 2, myFile))
if (fread((void*)qq, 1, 4*sizeof(int), myFile)) { if (fread((void*)qq, sizeof(int), 4, myFile)) {
quad=TOP_RIGHT; quad=TOP_RIGHT;
/* int mm=qq[0]; */ /* int mm=qq[0]; */
@ -216,7 +214,6 @@ class single_photon_hit {
for (int iy=0; iy<dy; iy++) { for (int iy=0; iy<dy; iy++) {
for (int ix=0; ix<dx; ix++) { for (int ix=0; ix<dx; ix++) {
printf("%d \t",data[ix+iy*dx]); printf("%d \t",data[ix+iy*dx]);
} }
printf("\n"); printf("\n");
} }