gotthard compression bug fix with geteventtype iy going out of bounds

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@738 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2014-02-20 10:46:02 +00:00
parent 1b88f322b3
commit 400611f38a

View File

@ -682,9 +682,7 @@ int slsReceiverFunctionList::setupWriter(){
ret = createNewFile(); ret = createNewFile();
else{ else{
for(int i=0;i<numWriterThreads;i++){ for(int i=0;i<numWriterThreads;i++){
pthread_mutex_lock(&write_mutex);
ret1 = createCompressionFile(i,0); ret1 = createCompressionFile(i,0);
pthread_mutex_unlock(&write_mutex);
if(ret1 == FAIL) if(ret1 == FAIL)
ret = FAIL; ret = FAIL;
} }
@ -1287,11 +1285,11 @@ int slsReceiverFunctionList::startWriting(){
if (cbAction < DO_EVERYTHING) if (cbAction < DO_EVERYTHING)
rawDataReadyCallBack(currframenum, wbuf, numpackets * onePacketSize, sfilefd, guiData,pRawDataReady); rawDataReadyCallBack(currframenum, wbuf, numpackets * onePacketSize, sfilefd, guiData,pRawDataReady);
else if (numpackets > 0){ else if (numpackets > 0){
if(numWriterThreads >1) /*if(numWriterThreads >1)
pthread_mutex_lock(&progress_mutex); pthread_mutex_lock(&progress_mutex);*/
writeToFile_withoutCompression(wbuf, numpackets); writeToFile_withoutCompression(wbuf, numpackets);
if(numWriterThreads >1) /*if(numWriterThreads >1)
pthread_mutex_unlock(&progress_mutex); pthread_mutex_unlock(&progress_mutex);*/
} }
//copy to gui //copy to gui
copyFrameToGui(wbuf + HEADER_SIZE_NUM_TOT_PACKETS); copyFrameToGui(wbuf + HEADER_SIZE_NUM_TOT_PACKETS);
@ -1326,7 +1324,7 @@ int slsReceiverFunctionList::startWriting(){
xmax = MOENCH_PIXELS_IN_ONE_ROW-1, ymax = MOENCH_PIXELS_IN_ONE_ROW-1; xmax = MOENCH_PIXELS_IN_ONE_ROW-1, ymax = MOENCH_PIXELS_IN_ONE_ROW-1;
while(buff = mdecoder[ithread]->findNextFrame(data,ndata,remainingsize )){/**need mutex??????????*/ while(buff = mdecoder[ithread]->findNextFrame(data,ndata,remainingsize )){
np = ndata/onePacketSize; np = ndata/onePacketSize;
//cout<<"buff framnum:"<<ithread <<":"<< ((((uint32_t)(*((uint32_t*)buff)))& (frameIndexMask)) >> frameIndexOffset)<<endl; //cout<<"buff framnum:"<<ithread <<":"<< ((((uint32_t)(*((uint32_t*)buff)))& (frameIndexMask)) >> frameIndexOffset)<<endl;
@ -1337,14 +1335,14 @@ int slsReceiverFunctionList::startWriting(){
singlePhotonDet[ithread]->newFrame(); singlePhotonDet[ithread]->newFrame();
if(commonModeSubtractionEnable){ if(commonModeSubtractionEnable){
for(ix = xmin - 1; ix < xmax + 1; ix++){ for(ix = xmin - 1; ix < xmax; ix++){
for(iy = ymin - 1; iy < ymax + 1; iy++){ for(iy = ymin - 1; iy < ymax; iy++){
thisEvent = singlePhotonDet[ithread]->getEventType(buff, ix, iy, 0); thisEvent = singlePhotonDet[ithread]->getEventType(buff, ix, iy, 0);
} }
} }
} }
for(ix = xmin - 1; ix < xmax + 1; ix++) for(ix = xmin - 1; ix < xmax; ix++)
for(iy = ymin - 1; iy < ymax + 1; iy++){ for(iy = ymin - 1; iy < ymax; iy++){
thisEvent=singlePhotonDet[ithread]->getEventType(buff, ix, iy, commonModeSubtractionEnable); thisEvent=singlePhotonDet[ithread]->getEventType(buff, ix, iy, commonModeSubtractionEnable);
if (nf>1000) { if (nf>1000) {
tot=0; tot=0;
@ -1354,10 +1352,8 @@ int slsReceiverFunctionList::startWriting(){
br=0; br=0;
if (thisEvent==PHOTON_MAX) { if (thisEvent==PHOTON_MAX) {
iFrame=mdecoder[ithread]->getFrameNumber(buff);/**need mutex??????????*/ iFrame=mdecoder[ithread]->getFrameNumber(buff);
pthread_mutex_lock(&write_mutex);
myTree[ithread]->Fill(); myTree[ithread]->Fill();
pthread_mutex_unlock(&write_mutex);
//cout << "Fill in event: frmNr: " << iFrame << " ix " << ix << " iy " << iy << " type " << thisEvent << endl; //cout << "Fill in event: frmNr: " << iFrame << " ix " << ix << " iy " << iy << " type " << thisEvent << endl;
} }
} }
@ -1408,9 +1404,8 @@ int slsReceiverFunctionList::startWriting(){
singlePhotonDet[ithread]->newFrame(); singlePhotonDet[ithread]->newFrame();
for(ix = xmin - 1; ix < xmax; ix++)
for(ix = xmin - 1; ix < xmax + 1; ix++) for(iy = ymin - 1; iy < ymax; iy++){
for(iy = ymin - 1; iy < ymax + 1; iy++){
thisEvent=singlePhotonDet[ithread]->getEventType(buff, ix, iy, 0); thisEvent=singlePhotonDet[ithread]->getEventType(buff, ix, iy, 0);
if (nf>1000) { if (nf>1000) {
tot=0; tot=0;
@ -1420,10 +1415,8 @@ int slsReceiverFunctionList::startWriting(){
br=0; br=0;
if (thisEvent==PHOTON_MAX) { if (thisEvent==PHOTON_MAX) {
iFrame=gdecoder[ithread]->getFrameNumber(buff);/**need mutex??????????*/ iFrame=gdecoder[ithread]->getFrameNumber(buff);
pthread_mutex_lock(&write_mutex);
myTree[ithread]->Fill(); myTree[ithread]->Fill();
pthread_mutex_unlock(&write_mutex);
//cout << "Fill in event: frmNr: " << iFrame << " ix " << ix << " iy " << iy << " type " << thisEvent << endl; //cout << "Fill in event: frmNr: " << iFrame << " ix " << ix << " iy " << iy << " type " << thisEvent << endl;
} }
} }