diff --git a/slsDetectorSoftware/mythenDetectorServer/Makefile b/slsDetectorSoftware/mythenDetectorServer/Makefile index 2b19aef50..99c2e4354 100755 --- a/slsDetectorSoftware/mythenDetectorServer/Makefile +++ b/slsDetectorSoftware/mythenDetectorServer/Makefile @@ -13,7 +13,8 @@ INSTMODE= 0777 SRCS= server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c OBJS= $(SRCS:%.c=%.o) -VFLAGS= -DVERBOSE +VFLAGS= +#-DVERBOSE #-DVERYVERBOSE CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS -DDACS_INT $(VFLAGS) #-Werror diff --git a/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c b/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c index beeb17d43..1d563ffff 100755 --- a/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c @@ -298,7 +298,9 @@ u_int32_t setExtSignal(int d, enum externalSignalFlag mode) { u_int32_t setFPGASignal(int d, enum externalSignalFlag mode) { - int modes[]={EXT_SIG_OFF, EXT_GATE_IN_ACTIVEHIGH, EXT_GATE_IN_ACTIVELOW,EXT_TRIG_IN_RISING,EXT_TRIG_IN_FALLING,EXT_RO_TRIG_IN_RISING, EXT_RO_TRIG_IN_FALLING,EXT_GATE_OUT_ACTIVEHIGH, EXT_GATE_OUT_ACTIVELOW, EXT_TRIG_OUT_RISING, EXT_TRIG_OUT_FALLING, EXT_RO_TRIG_OUT_RISING, EXT_RO_TRIG_OUT_FALLING}; + int modes[]={SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW,TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE,RO_TRIGGER_OUT_FALLING_EDGE}; + + // int modes[]={EXT_SIG_OFF, EXT_GATE_IN_ACTIVEHIGH, EXT_GATE_IN_ACTIVELOW,EXT_TRIG_IN_RISING,EXT_TRIG_IN_FALLING,EXT_RO_TRIG_IN_RISING, EXT_RO_TRIG_IN_FALLING,EXT_GATE_OUT_ACTIVEHIGH, EXT_GATE_OUT_ACTIVELOW, EXT_TRIG_OUT_RISING, EXT_TRIG_OUT_FALLING, EXT_RO_TRIG_OUT_RISING, EXT_RO_TRIG_OUT_FALLING}; u_int32_t c; int off=d*SIGNAL_OFFSET; @@ -383,7 +385,7 @@ int setTiming(int ti) { int g=-1, t=-1, rot=-1; int i; - + printf("*********************************Setting timing mode %d!\n", ti); switch (ti) { case AUTO_TIMING: timingMode=ti; @@ -425,6 +427,7 @@ int setTiming(int ti) { case GATE_FIX_NUMBER: timingMode=ti; + printf("*********************************Setting gating!\n"); // if one of the signals is configured to be trigger, set it and unset possible gates for (i=0; i<4; i++) { if (signals[i]==RO_TRIGGER_IN_RISING_EDGE || signals[i]==RO_TRIGGER_IN_FALLING_EDGE) @@ -1148,6 +1151,8 @@ u_int32_t fifo_full(void) u_int32_t* fifo_read_event() { + int ir=0; + #ifdef VERBOSE int ichip; int ichan; @@ -1167,24 +1172,33 @@ u_int32_t* fifo_read_event() printf("Waiting for data status %x\n",runState()); #endif if (runBusy()==0) { - if (bus_r(LOOK_AT_ME_REG)==0) { -#ifdef VERBOSE - printf("no frame found - exiting "); - - printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG)); - /* for (ichip=0; ichipwriteRegister(addr,myDet->readRegister(addr)| 1<writeRegister(addr,myDet->readRegister(addr) & ~(1<GetYaxis()->GetNbins(),h2->GetYaxis()->GetXmin(),h2->GetYaxis()->GetXmax()); for (int ib=0; ibGetXaxis()->GetNbins(); ib++) { + me=0; for (int ich=0; ichGetBinContent(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; diff --git a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp index b74d9a9c9..b529e2fcb 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp @@ -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<=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<