diff --git a/slsDetectorSoftware/Makefile b/slsDetectorSoftware/Makefile index 34d0d4a6f..d732f1281 100644 --- a/slsDetectorSoftware/Makefile +++ b/slsDetectorSoftware/Makefile @@ -82,6 +82,6 @@ install: package install_inc: $(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR)) - cp -P slsDetector/slsDetectorUsers.h slsDetectorAnalysis/detectorData.h $(DESTDIR) slsReceiver/slsReceiverUsers.h + cp -P slsDetector/slsDetectorUsers.h slsDetectorAnalysis/detectorData.h $(DESTDIR) slsReceiver/slsReceiverUsers.h $(DESTDIR) diff --git a/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp b/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp index da388e957..aa5125465 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp @@ -16,13 +16,12 @@ singlePhotonFilter::singlePhotonFilter(int nx, int ny, int16_t *m, int16_t *s, CircularFifo* f, int d, int* tfcaught, int* fcaught,uint32_t* cframenum): #ifdef MYROOT1 myTree(NULL), - myFile(NULL), #else - myFile(NULL), nHitsPerFile(0), nTotalHits(0), #endif + myFile(NULL), nHitsPerFrame(0), nChannelsX(nx), nChannelsY(ny), @@ -66,7 +65,10 @@ singlePhotonFilter::singlePhotonFilter(int nx, int ny, #ifndef MYROOT1 //photonHitList=(single_photon_hit**) (new int*[nChannelsX*nChannelsY/(nClusterX*nClusterY)*1000]); - photonHitList=new single_photon_hit*[nChannelsX*nChannelsY/(nClusterX*nClusterY)*1000]; + photonHitList=new single_photon_hit*[nChannelsX*nChannelsY/(nClusterX*nClusterY)*1000]; + for (int ii=0; iiwrite(myFile); - delete photonHitList[ii]; + // delete photonHitList[ii]; } - delete photonHitList[ii]; - + // delete photonHitList[ii]; + // photonHitList[0]=new single_photon_hit(nClusterX,nClusterY); // fwrite((void*)(photonHitList), 1, sizeof(single_photon_hit)*nHitsPerFrame, myFile); /*framesInFile += nHitsPerFrame;*/ - nHitsPerFrame = 0; + nHitsPerFrame = 0; //cout<<"Exiting writeToFile"<data; //for each pixel @@ -566,7 +563,9 @@ void singlePhotonFilter::findHits(){ #ifdef MYROOT1 myTree->Fill(); #else - // photonHitList[nHitsPerFrame].data = clusterData; + for (int ix=0; ixdata[ix] = clusterData[ix]; + photonHitList[nHitsPerFrame]->x = ic; photonHitList[nHitsPerFrame]->y = ir; photonHitList[nHitsPerFrame]->rms = clusterrms; @@ -575,7 +574,11 @@ void singlePhotonFilter::findHits(){ //hit.write(myFile); nHitsPerFrame++; - photonHitList[nHitsPerFrame]=new single_photon_hit(nClusterX,nClusterY); + + // cout << nHitsPerFrame << " " << nChannelsX*nChannelsY/(nClusterX*nClusterY)*1000 << endl; + + // photonHitList[nHitsPerFrame]=new single_photon_hit(nClusterX,nClusterY); + // cout << "done" << endl; nHitsPerFile++; nTotalHits++; if(nHitsPerFile >= MAX_HITS_PER_FILE-1) @@ -596,6 +599,7 @@ void singlePhotonFilter::findHits(){ //write for each frame, not packet pthread_mutex_lock(&write_mutex); + cout << "write to file " << nHitsPerFrame << endl; writeToFile(); pthread_mutex_unlock(&write_mutex); @@ -628,7 +632,7 @@ void singlePhotonFilter::findHits(){ - delete [] clusterData; + // delete [] clusterData; } diff --git a/slsDetectorSoftware/slsDetectorAnalysis/single_photon_hit.h b/slsDetectorSoftware/slsDetectorAnalysis/single_photon_hit.h index b8101240c..5fd89548f 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/single_photon_hit.h +++ b/slsDetectorSoftware/slsDetectorAnalysis/single_photon_hit.h @@ -21,11 +21,12 @@ typedef int int32_t; class single_photon_hit { public: - single_photon_hit(int nx, int ny): dx(nx), dy(ny) {data=new double[dx*dy];}; + single_photon_hit(int nx, int ny=1): dx(nx), dy(ny) {data=new double[dx*dy];}; ~single_photon_hit(){delete [] data;}; void write(FILE *myFile) {fwrite((void*)this, 1, 3*sizeof(int)+2*sizeof(double), myFile); fwrite((void*)data, 1, dx*dy*sizeof(double), myFile);}; void read(FILE *myFile) {fread((void*)this, 1, 3*sizeof(int)+2*sizeof(double), myFile); fread((void*)data, 1, dx*dy*sizeof(double), myFile);}; - + void set_data(double v, int ix, int iy=0){data[(iy+ny/2)*nx+ix+nx/2]=v;}; + double get_data(int ix, int iy=0){return data[(iy+ny/2)*nx+ix+nx/2];}; int x; /**< x-coordinate of the center of hit */