mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Solved problem with MYTHEN readout
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@820 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -240,17 +240,24 @@ TH1F* energyCalibration::createMedianHistogram(TH2F* h2, int ch0, int nch) {
|
||||
TH1F *h1=NULL;
|
||||
|
||||
double val=-1;
|
||||
double me=0;
|
||||
|
||||
|
||||
h1=new TH1F("median","Median",h2->GetYaxis()->GetNbins(),h2->GetYaxis()->GetXmin(),h2->GetYaxis()->GetXmax());
|
||||
|
||||
|
||||
for (int ib=0; ib<h1->GetXaxis()->GetNbins(); ib++) {
|
||||
me=0;
|
||||
for (int ich=0; ich<nch; ich++) {
|
||||
x[ich]=h2->GetBinContent(ch0+ich+1,ib+1);
|
||||
me+=x[ich];
|
||||
}
|
||||
cout << ib << " calculating median ch0=" << ch0 << " nch=" << nch << endl;
|
||||
val=energyCalibrationFunctions::median(x, nch);
|
||||
cout << "median=" << val << " mean= " << me/nch << endl;
|
||||
h1->SetBinContent(ib+1,val);
|
||||
}
|
||||
delete [] x;
|
||||
return h1;
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "usersFunctions.h"
|
||||
#endif
|
||||
|
||||
//#define VERBOSE
|
||||
|
||||
static void* startProcessData(void *n){\
|
||||
postProcessing *myDet=(postProcessing*)n;\
|
||||
@ -38,9 +39,9 @@ postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL)
|
||||
pRawDataArg = 0;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
registerDataCallback(&defaultDataReadyFunc, NULL);
|
||||
#endif
|
||||
//#ifdef VERBOSE
|
||||
// registerDataCallback(&defaultDataReadyFunc, NULL);
|
||||
//#endif
|
||||
#ifdef EXTPP
|
||||
registerRawDataCallback(&defaultRawDataReadyFunc, NULL);
|
||||
#endif
|
||||
@ -82,18 +83,18 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
||||
/** decode data */
|
||||
|
||||
// if (getDetectorsType()==MYTHEN) {
|
||||
fdata=decodeData(myData, fdata);
|
||||
fdata=decodeData(myData, fdata);
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "decode"<< endl;
|
||||
#endif
|
||||
//} else
|
||||
// } else
|
||||
// fdata=NULL;
|
||||
|
||||
if (rawDataReady) {
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
cout << "raw data ready..." << endl;
|
||||
#endif
|
||||
#endif
|
||||
rawDataReady(fdata,numberOfChannels, pRawDataArg);
|
||||
#ifdef VERBOSE
|
||||
cout << "done" << endl;
|
||||
@ -128,7 +129,8 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((*correctionMask) & ~(1<<WRITE_FILE)) {
|
||||
if ((*correctionMask) & ~((1<<WRITE_FILE) | (1<<OVERWRITE_FILE))) {
|
||||
// cout << "cmask is not 0: " << *correctionMask << " - " << ((*correctionMask) & (1<<I0_NORMALIZATION)) << "-" << ((*correctionMask) & (1<<OVERWRITE_FILE)) << endl;
|
||||
doProcessing(fdata,delflag, fname);
|
||||
} else
|
||||
if (dataReady){
|
||||
@ -232,7 +234,22 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
||||
#ifdef VERBOSE
|
||||
cout << "add frame" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
/**ot them
|
||||
start processing
|
||||
prog incremented
|
||||
decode
|
||||
fname is //run_f0_0
|
||||
??????????????????????????????????????????? do processing - data size is 30720
|
||||
arrays allocated
|
||||
npos is 0
|
||||
exptime is 10.00
|
||||
init dataset
|
||||
add frame
|
||||
data queue size lock
|
||||
data queue size unlock
|
||||
**/
|
||||
|
||||
addFrame(lfdata,currentPosition, currentI0, t, fname, 0);
|
||||
// cout << "++++++++++++++++++++" << GetCurrentPositionIndex() << " " << npos << " " << positionFinished() << " " << dataQueueSize() << endl;
|
||||
if ((GetCurrentPositionIndex()>=npos && dataQueueSize()) || npos<2) {
|
||||
@ -393,7 +410,7 @@ void* postProcessing::processData(int delflag) {
|
||||
while((queuesize=dataQueueSize())>0) {
|
||||
/** Pop data queue */
|
||||
#ifdef VERBOSE
|
||||
cout << "data found"<< endl<<endl;;
|
||||
cout << "data foun"<< endl<<endl;;
|
||||
#endif
|
||||
|
||||
myData=dataQueueFront(); // get the data from the queue
|
||||
@ -404,12 +421,18 @@ void* postProcessing::processData(int delflag) {
|
||||
if (myData) {
|
||||
processFrame(myData,delflag);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "frame processed"<< endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** IF detector acquisition is done, let the acquire() thread know to finish up and force join thread */
|
||||
if(acquiringDone){
|
||||
sem_post(&sem_queue);
|
||||
}
|
||||
// cout << "Sem posted" << endl;
|
||||
} //else
|
||||
// cout << "Sem not posted" << endl;
|
||||
|
||||
|
||||
/* IF THERE ARE NO DATA look if acquisition is finished */
|
||||
if (checkJoinThread()) {
|
||||
|
Reference in New Issue
Block a user