Changed HM-configuration at FOCUS
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 461 "histogram.w"
|
#line 462 "histogram.w"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
H I S T D R I V
|
H I S T D R I V
|
||||||
@ -68,7 +68,7 @@
|
|||||||
void *pPriv;
|
void *pPriv;
|
||||||
} HistDriver;
|
} HistDriver;
|
||||||
|
|
||||||
#line 473 "histogram.w"
|
#line 474 "histogram.w"
|
||||||
|
|
||||||
|
|
||||||
#line 228 "histogram.w"
|
#line 228 "histogram.w"
|
||||||
@ -78,7 +78,7 @@
|
|||||||
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
|
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
|
||||||
SConnection *pCon);
|
SConnection *pCon);
|
||||||
|
|
||||||
#line 474 "histogram.w"
|
#line 475 "histogram.w"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
11
HistMem.h
11
HistMem.h
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 434 "histogram.w"
|
#line 435 "histogram.w"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
H I S T M E M
|
H I S T M E M
|
||||||
@ -42,7 +42,7 @@
|
|||||||
eReflect
|
eReflect
|
||||||
} OverFlowMode;
|
} OverFlowMode;
|
||||||
|
|
||||||
#line 454 "histogram.w"
|
#line 455 "histogram.w"
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -70,9 +70,10 @@
|
|||||||
float GetHistCountTime(pHistMem self,SConnection *pCon);
|
float GetHistCountTime(pHistMem self,SConnection *pCon);
|
||||||
int HistDoCount(pHistMem self, SConnection *pCon);
|
int HistDoCount(pHistMem self, SConnection *pCon);
|
||||||
int HistBlockCount(pHistMem self, SConnection *pCon);
|
int HistBlockCount(pHistMem self, SConnection *pCon);
|
||||||
|
void HistDirty(pHistMem self);
|
||||||
|
|
||||||
|
|
||||||
#line 360 "histogram.w"
|
#line 361 "histogram.w"
|
||||||
|
|
||||||
int SetHistogram(pHistMem self, SConnection *pCon,
|
int SetHistogram(pHistMem self, SConnection *pCon,
|
||||||
int i,int iStart, int iEnd, HistInt *lData);
|
int i,int iStart, int iEnd, HistInt *lData);
|
||||||
@ -84,7 +85,7 @@
|
|||||||
HistInt *lData, int iDataLen);
|
HistInt *lData, int iDataLen);
|
||||||
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
|
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
|
||||||
|
|
||||||
#line 403 "histogram.w"
|
#line 404 "histogram.w"
|
||||||
|
|
||||||
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
@ -93,7 +94,7 @@
|
|||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
#line 456 "histogram.w"
|
#line 457 "histogram.w"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#line 479 "histogram.w"
|
#line 480 "histogram.w"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
H I S T M E M -- Internal
|
H I S T M E M -- Internal
|
||||||
@ -24,7 +24,7 @@
|
|||||||
pStringDict pOption;
|
pStringDict pOption;
|
||||||
} HistMem;
|
} HistMem;
|
||||||
|
|
||||||
#line 489 "histogram.w"
|
#line 490 "histogram.w"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
242
faverage.c
242
faverage.c
@ -22,6 +22,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "sics.h"
|
#include "sics.h"
|
||||||
|
#include "sicsvar.h"
|
||||||
#include "counter.h"
|
#include "counter.h"
|
||||||
#include "HistMem.h"
|
#include "HistMem.h"
|
||||||
#include "fomerge.h"
|
#include "fomerge.h"
|
||||||
@ -33,10 +34,16 @@
|
|||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
typedef struct __FocusAverager {
|
typedef struct __FocusAverager {
|
||||||
pObjectDescriptor pDes;
|
pObjectDescriptor pDes;
|
||||||
pHistMem pHist;
|
pHistMem pHistogram1;
|
||||||
|
pHistMem pHistogram2;
|
||||||
|
pHistMem pHistogram3;
|
||||||
} FocusAverager, *pFocusAverager;
|
} FocusAverager, *pFocusAverager;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
HistInt *CheckBank(pFocusAverager self, SConnection *pCon,
|
||||||
|
int iLength, int iBank);
|
||||||
|
|
||||||
static void KillFA(void *pData)
|
static void KillFA(void *pData)
|
||||||
{
|
{
|
||||||
pFocusAverager self = NULL;
|
pFocusAverager self = NULL;
|
||||||
@ -61,7 +68,11 @@
|
|||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
HistInt *hiData = NULL, *hiPtr;
|
HistInt *hiData = NULL, *hiPtr;
|
||||||
time_t tStart, tEnd;
|
time_t tStart, tEnd;
|
||||||
int iBank = MIDDLE;
|
int iBank = MIDDLE;
|
||||||
|
pSicsVariable var1 = NULL;
|
||||||
|
pSicsVariable var2 = NULL;
|
||||||
|
pSicsVariable var3 = NULL;
|
||||||
|
int lbank, mbank, ubank;
|
||||||
|
|
||||||
self = (pFocusAverager)pData;
|
self = (pFocusAverager)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
@ -129,7 +140,36 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* do work! first retrieve time binning data */
|
/* do work! first retrieve time binning data */
|
||||||
fTimeBin = GetHistTimeBin(self->pHist,&iLength);
|
|
||||||
|
var2 = FindVariable(pServ->pSics,"mbank");
|
||||||
|
if(var2)
|
||||||
|
{
|
||||||
|
VarGetInt(var2,&mbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: mbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(var2)
|
||||||
|
{
|
||||||
|
fTimeBin = GetHistTimeBin(self->pHistogram2,&iLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
VarGetInt(var1,&lbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
fTimeBin = GetHistTimeBin(self->pHistogram1,&iLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fTimeBin = GetHistTimeBin(self->pHistogram3,&iLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
assert(fTimeBin);
|
assert(fTimeBin);
|
||||||
if(iLength <= 0)
|
if(iLength <= 0)
|
||||||
{
|
{
|
||||||
@ -157,23 +197,19 @@
|
|||||||
printf("Getting histogram....\n");
|
printf("Getting histogram....\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
hiData = GetHistogramPointer(self->pHist,pCon);
|
|
||||||
if(hiData == NULL)
|
hiData = CheckBank(self,pCon,iLength,iBank);
|
||||||
{
|
|
||||||
SCWrite(pCon,"ERROR: failed to read histogram memory data",eError);
|
|
||||||
free(iData);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
setFMDataPointer(hiData, iLength);
|
|
||||||
hiData = getFMBankPointer(iBank);
|
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
tEnd = time(NULL);
|
tEnd = time(NULL);
|
||||||
printf("Histogram received in %d seconds\n", tStart - tEnd);
|
printf("Histogram received in %d seconds\n", tStart - tEnd);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(hiData == NULL)
|
if(hiData == NULL)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: BAD Configuration",eError);
|
SCWrite(pCon,"ERROR: BAD Configuration",eError);
|
||||||
|
free(iData);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +264,10 @@
|
|||||||
const float *timeBin;
|
const float *timeBin;
|
||||||
HistInt *hiData = NULL, *hiPtr;
|
HistInt *hiData = NULL, *hiPtr;
|
||||||
int iBank = MIDDLE;
|
int iBank = MIDDLE;
|
||||||
|
pSicsVariable var1 = NULL;
|
||||||
|
pSicsVariable var2 = NULL;
|
||||||
|
pSicsVariable var3 = NULL;
|
||||||
|
int lbank, mbank, ubank;
|
||||||
|
|
||||||
self = (pFocusAverager)pData;
|
self = (pFocusAverager)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
@ -250,23 +290,38 @@
|
|||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
var2 = FindVariable(pServ->pSics,"mbank");
|
||||||
timeBin = GetHistTimeBin(self->pHist,&iLength);
|
if(var2)
|
||||||
assert(timeBin);
|
|
||||||
hiData = GetHistogramPointer(self->pHist,pCon);
|
|
||||||
if(hiData == NULL)
|
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: failed to read histogram memory data",eError);
|
VarGetInt(var2,&mbank);
|
||||||
return 0;
|
} else {
|
||||||
}
|
SCWrite(pCon,"ERROR: mbank value not found!",eError);
|
||||||
setFMDataPointer(hiData, iLength);
|
}
|
||||||
hiData = getFMBankPointer(iBank);
|
if(var2)
|
||||||
if(hiData == NULL)
|
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: BAD Configuration",eError);
|
timeBin = GetHistTimeBin(self->pHistogram2,&iLength);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
VarGetInt(var1,&lbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
timeBin = GetHistTimeBin(self->pHistogram1,&iLength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeBin = GetHistTimeBin(self->pHistogram3,&iLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(timeBin);
|
||||||
|
hiData = CheckBank(self, pCon, iLength, iBank);
|
||||||
|
|
||||||
/* get histogram length */
|
/* get histogram length */
|
||||||
iLength = getFMdim(iBank);
|
iLength = getFMdim(iBank);
|
||||||
noTimebin = getFMdim(TIMEBIN);
|
noTimebin = getFMdim(TIMEBIN);
|
||||||
@ -305,7 +360,11 @@
|
|||||||
pDummy pDum = NULL;
|
pDummy pDum = NULL;
|
||||||
char pBueffel[256];
|
char pBueffel[256];
|
||||||
int iRet;
|
int iRet;
|
||||||
|
pSicsVariable var1 = NULL;
|
||||||
|
pSicsVariable var2 = NULL;
|
||||||
|
pSicsVariable var3 = NULL;
|
||||||
|
int lbank, mbank, ubank;
|
||||||
|
|
||||||
assert(pCon);
|
assert(pCon);
|
||||||
assert(pSics);
|
assert(pSics);
|
||||||
|
|
||||||
@ -334,9 +393,9 @@
|
|||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(strcmp(pDum->pDescriptor->name,"HistMem") != 0)
|
if(strcmp(pDum->pDescriptor->name,"HMcontrol") != 0)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"ERROR: %s is NO histogram memory object!", argv[2]);
|
sprintf(pBueffel,"ERROR: %s is NO histogram control object!", argv[2]);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -356,8 +415,45 @@
|
|||||||
SCWrite(pCon,"ERROR: out of memory in MakeFA",eError);
|
SCWrite(pCon,"ERROR: out of memory in MakeFA",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pNew->pHist = (pHistMem)pDum;
|
var2 = FindVariable(pServ->pSics,"mbank");
|
||||||
|
if(var2)
|
||||||
|
{
|
||||||
|
VarGetInt(var2,&mbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: mbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(mbank==1)
|
||||||
|
{
|
||||||
|
pCom = FindCommand(pSics,"hm2");
|
||||||
|
pDum = (pDummy)pCom->pData;
|
||||||
|
pNew->pHistogram2 = (pHistMem)pDum;
|
||||||
|
}
|
||||||
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
VarGetInt(var1,&lbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(lbank==1)
|
||||||
|
{
|
||||||
|
pCom = FindCommand(pSics,"hm1");
|
||||||
|
pDum = (pDummy)pCom->pData;
|
||||||
|
pNew->pHistogram1 = (pHistMem)pDum;
|
||||||
|
}
|
||||||
|
var3 = FindVariable(pServ->pSics,"ubank");
|
||||||
|
if(var3)
|
||||||
|
{
|
||||||
|
VarGetInt(var3,&ubank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: ubank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(ubank==1)
|
||||||
|
{
|
||||||
|
pCom = FindCommand(pSics,"hm3");
|
||||||
|
pDum = (pDummy)pCom->pData;
|
||||||
|
pNew->pHistogram3 = (pHistMem)pDum;
|
||||||
|
}
|
||||||
iRet = AddCommand(pSics,argv[1],FocusAverageDo, KillFA, pNew);
|
iRet = AddCommand(pSics,argv[1],FocusAverageDo, KillFA, pNew);
|
||||||
if(!iRet)
|
if(!iRet)
|
||||||
{
|
{
|
||||||
@ -375,3 +471,87 @@
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HistInt *CheckBank(pFocusAverager self, SConnection *pCon,
|
||||||
|
int iLength, int iBank)
|
||||||
|
{
|
||||||
|
|
||||||
|
pSicsVariable var1 = NULL;
|
||||||
|
pSicsVariable var2 = NULL;
|
||||||
|
pSicsVariable var3 = NULL;
|
||||||
|
HistInt *lData = NULL;
|
||||||
|
HistInt *mData = NULL;
|
||||||
|
HistInt *uData = NULL;
|
||||||
|
HistInt *mergData = NULL;
|
||||||
|
int lbank, mbank, ubank;
|
||||||
|
|
||||||
|
if (iBank==2)
|
||||||
|
{
|
||||||
|
var2 = FindVariable(pServ->pSics,"mbank");
|
||||||
|
if(var2)
|
||||||
|
{
|
||||||
|
VarGetInt(var2,&mbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: mbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(mbank==1)
|
||||||
|
{
|
||||||
|
mData = GetHistogramPointer(self->pHistogram2,pCon);
|
||||||
|
if(mData == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
setFMDataPointer(mData, iLength,1);
|
||||||
|
mData = getFMBankPointer(1);
|
||||||
|
return mData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iBank==3)
|
||||||
|
{
|
||||||
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
VarGetInt(var1,&lbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(lbank==1)
|
||||||
|
{
|
||||||
|
lData = GetHistogramPointer(self->pHistogram1,pCon);
|
||||||
|
if(lData == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
setFMDataPointer(lData, iLength, 3);
|
||||||
|
lData = getFMBankPointer(3);
|
||||||
|
return lData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iBank==1)
|
||||||
|
{
|
||||||
|
var3 = FindVariable(pServ->pSics,"ubank");
|
||||||
|
if(var3)
|
||||||
|
{
|
||||||
|
VarGetInt(var3,&ubank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: ubank value not found!",eError);
|
||||||
|
}
|
||||||
|
if(ubank==1)
|
||||||
|
{
|
||||||
|
uData = GetHistogramPointer(self->pHistogram3,pCon);
|
||||||
|
if(uData == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
setFMDataPointer(uData, iLength, 2);
|
||||||
|
uData = getFMBankPointer(2);
|
||||||
|
return uData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iBank==4)
|
||||||
|
{
|
||||||
|
setFMDataPointer(mergData, iLength,4);
|
||||||
|
mergData = getFMBankPointer(4);
|
||||||
|
return mergData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -18,3 +18,4 @@
|
|||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -75,6 +75,8 @@ cnmon2=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS beam_monitor \
|
|||||||
-type DFNT_INT32 -attr {units,counts}
|
-type DFNT_INT32 -attr {units,counts}
|
||||||
cnmon3=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS proton_beam_monitor \
|
cnmon3=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS proton_beam_monitor \
|
||||||
-type DFNT_INT32 -attr {units,counts}
|
-type DFNT_INT32 -attr {units,counts}
|
||||||
|
tofmon=/entry1,NXentry/FOCUS,NXinstrument/SDS \
|
||||||
|
tof_monitor -type DFNT_INT32 -rank 1 -dim {$(timebin)}
|
||||||
#-------------- detector bank
|
#-------------- detector bank
|
||||||
dname=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS type \
|
dname=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS type \
|
||||||
-type DFNT_CHAR -rank 1 -dim {132}
|
-type DFNT_CHAR -rank 1 -dim {132}
|
||||||
|
414
focusmerge.dat
414
focusmerge.dat
@ -1,5 +1,5 @@
|
|||||||
#---- Merge Table
|
#---- Merge Table
|
||||||
383
|
375
|
||||||
001 10.050 000 001 000
|
001 10.050 000 001 000
|
||||||
002 10.850 000 002 000
|
002 10.850 000 002 000
|
||||||
003 11.660 000 003 000
|
003 11.660 000 003 000
|
||||||
@ -179,212 +179,204 @@
|
|||||||
177 67.825 054 000 000
|
177 67.825 054 000 000
|
||||||
178 68.610 000 074 000
|
178 68.610 000 074 000
|
||||||
179 68.650 055 000 000
|
179 68.650 055 000 000
|
||||||
180 68.650 000 000 051
|
180 69.410 000 075 000
|
||||||
181 69.410 000 075 000
|
181 70.350 000 000 051
|
||||||
182 69.850 056 000 000
|
182 71.175 000 000 052
|
||||||
183 70.350 000 000 052
|
183 72.000 000 000 053
|
||||||
184 70.675 057 000 000
|
184 72.825 000 000 054
|
||||||
185 71.175 000 000 053
|
185 72.900 000 076 000
|
||||||
186 71.500 058 000 000
|
186 73.650 000 000 055
|
||||||
187 72.000 000 000 054
|
187 73.700 000 077 000
|
||||||
188 72.325 059 000 000
|
188 74.510 000 078 000
|
||||||
189 72.825 000 000 055
|
189 74.850 000 000 056
|
||||||
190 72.900 000 076 000
|
190 75.310 000 079 000
|
||||||
191 73.650 000 000 056
|
191 75.675 000 000 057
|
||||||
192 73.700 000 077 000
|
192 76.110 000 080 000
|
||||||
193 74.510 000 078 000
|
193 76.500 000 000 058
|
||||||
194 74.850 000 000 057
|
194 76.910 000 081 000
|
||||||
195 75.310 000 079 000
|
195 77.325 000 000 059
|
||||||
196 75.675 000 000 058
|
196 77.710 000 082 000
|
||||||
197 76.110 000 080 000
|
197 78.150 000 000 060
|
||||||
198 76.500 060 000 000
|
198 78.520 000 083 000
|
||||||
199 76.500 000 000 059
|
199 79.320 000 084 000
|
||||||
200 76.910 000 081 000
|
200 79.350 056 000 000
|
||||||
201 77.325 061 000 000
|
201 79.350 000 000 061
|
||||||
202 77.325 000 000 060
|
202 80.120 000 085 000
|
||||||
203 77.710 000 082 000
|
203 80.175 057 000 000
|
||||||
204 78.150 062 000 000
|
204 80.175 000 000 062
|
||||||
205 78.150 000 000 061
|
205 80.920 000 086 000
|
||||||
206 78.520 000 083 000
|
206 81.000 058 000 000
|
||||||
207 79.320 000 084 000
|
207 81.000 000 000 063
|
||||||
208 79.350 063 000 000
|
208 81.720 000 087 000
|
||||||
209 79.350 000 000 062
|
209 81.825 059 000 000
|
||||||
210 80.120 000 085 000
|
210 81.825 000 000 064
|
||||||
211 80.175 064 000 000
|
211 82.530 000 088 000
|
||||||
212 80.175 000 000 063
|
212 82.650 060 000 000
|
||||||
213 80.920 000 086 000
|
213 82.650 000 000 065
|
||||||
214 81.000 065 000 000
|
214 83.330 000 089 000
|
||||||
215 81.000 000 000 064
|
215 83.850 061 000 000
|
||||||
216 81.720 000 087 000
|
216 83.850 000 000 066
|
||||||
217 81.825 066 000 000
|
217 84.130 000 090 000
|
||||||
218 81.825 000 000 065
|
218 84.675 062 000 000
|
||||||
219 82.530 000 088 000
|
219 84.675 000 000 067
|
||||||
220 82.650 067 000 000
|
220 84.930 000 091 000
|
||||||
221 82.650 000 000 066
|
221 85.500 063 000 000
|
||||||
222 83.330 000 089 000
|
222 85.500 000 000 068
|
||||||
223 83.850 068 000 000
|
223 85.740 000 092 000
|
||||||
224 83.850 000 000 067
|
224 86.325 064 000 000
|
||||||
225 84.130 000 090 000
|
225 86.325 000 000 069
|
||||||
226 84.675 069 000 000
|
226 86.540 000 093 000
|
||||||
227 84.675 000 000 068
|
227 87.150 065 000 000
|
||||||
228 84.930 000 091 000
|
228 87.150 000 000 070
|
||||||
229 85.500 070 000 000
|
229 87.340 000 094 000
|
||||||
230 85.500 000 000 069
|
230 88.140 000 095 000
|
||||||
231 85.740 000 092 000
|
231 88.350 066 000 000
|
||||||
232 86.325 071 000 000
|
232 88.350 000 000 071
|
||||||
233 86.325 000 000 070
|
233 88.940 000 096 000
|
||||||
234 86.540 000 093 000
|
234 89.175 067 000 000
|
||||||
235 87.150 072 000 000
|
235 89.175 000 000 072
|
||||||
236 87.150 000 000 071
|
236 89.750 000 097 000
|
||||||
237 87.340 000 094 000
|
237 90.000 068 000 000
|
||||||
238 88.140 000 095 000
|
238 90.000 000 000 073
|
||||||
239 88.350 073 000 000
|
239 90.550 000 098 000
|
||||||
240 88.350 000 000 072
|
240 90.825 069 000 000
|
||||||
241 88.940 000 096 000
|
241 90.825 000 000 074
|
||||||
242 89.175 074 000 000
|
242 91.350 000 099 000
|
||||||
243 89.175 000 000 073
|
243 91.650 070 000 000
|
||||||
244 89.750 000 097 000
|
244 91.650 000 000 075
|
||||||
245 90.000 075 000 000
|
245 92.150 000 100 000
|
||||||
246 90.000 000 000 074
|
246 92.850 071 000 000
|
||||||
247 90.550 000 098 000
|
247 92.850 000 000 076
|
||||||
248 90.825 076 000 000
|
248 92.960 000 101 000
|
||||||
249 90.825 000 000 075
|
249 93.675 072 000 000
|
||||||
250 91.350 000 099 000
|
250 93.675 000 000 077
|
||||||
251 91.650 077 000 000
|
251 93.760 000 102 000
|
||||||
252 91.650 000 000 076
|
252 94.500 073 000 000
|
||||||
253 92.150 000 100 000
|
253 94.500 000 000 078
|
||||||
254 92.850 078 000 000
|
254 94.560 000 103 000
|
||||||
255 92.850 000 000 077
|
255 95.325 074 000 000
|
||||||
256 92.960 000 101 000
|
256 95.325 000 000 079
|
||||||
257 93.675 079 000 000
|
257 95.360 000 104 000
|
||||||
258 93.675 000 000 078
|
258 96.150 075 000 000
|
||||||
259 93.760 000 102 000
|
259 96.150 000 000 080
|
||||||
260 94.500 080 000 000
|
260 96.160 000 105 000
|
||||||
261 94.500 000 000 079
|
261 96.970 000 106 000
|
||||||
262 94.560 000 103 000
|
262 97.350 076 000 000
|
||||||
263 95.325 081 000 000
|
263 97.350 000 000 081
|
||||||
264 95.325 000 000 080
|
264 97.770 000 107 000
|
||||||
265 95.360 000 104 000
|
265 98.175 077 000 000
|
||||||
266 96.150 082 000 000
|
266 98.175 000 000 082
|
||||||
267 96.150 000 000 081
|
267 98.570 000 108 000
|
||||||
268 96.160 000 105 000
|
268 99.000 078 000 000
|
||||||
269 96.970 000 106 000
|
269 99.000 000 000 083
|
||||||
270 97.350 083 000 000
|
270 99.370 000 109 000
|
||||||
271 97.350 000 000 082
|
271 99.825 079 000 000
|
||||||
272 97.770 000 107 000
|
272 99.825 000 000 084
|
||||||
273 98.175 084 000 000
|
273 100.180 000 110 000
|
||||||
274 98.175 000 000 083
|
274 100.650 080 000 000
|
||||||
275 98.570 000 108 000
|
275 100.650 000 000 085
|
||||||
276 99.000 085 000 000
|
276 100.980 000 111 000
|
||||||
277 99.000 000 000 084
|
277 101.780 000 112 000
|
||||||
278 99.370 000 109 000
|
278 101.850 081 000 000
|
||||||
279 99.825 086 000 000
|
279 101.850 000 000 086
|
||||||
280 99.825 000 000 085
|
280 102.580 000 113 000
|
||||||
281 100.180 000 110 000
|
281 102.675 082 000 000
|
||||||
282 100.650 087 000 000
|
282 102.675 000 000 087
|
||||||
283 100.650 000 000 086
|
283 103.380 000 114 000
|
||||||
284 100.980 000 111 000
|
284 103.500 083 000 000
|
||||||
285 101.780 000 112 000
|
285 103.500 000 000 088
|
||||||
286 101.850 088 000 000
|
286 104.190 000 115 000
|
||||||
287 101.850 000 000 087
|
287 104.325 084 000 000
|
||||||
288 102.580 000 113 000
|
288 104.325 000 000 089
|
||||||
289 102.675 089 000 000
|
289 104.990 000 116 000
|
||||||
290 102.675 000 000 088
|
290 105.150 085 000 000
|
||||||
291 103.380 000 114 000
|
291 105.150 000 000 090
|
||||||
292 103.500 090 000 000
|
292 105.790 000 117 000
|
||||||
293 103.500 000 000 089
|
293 106.350 086 000 000
|
||||||
294 104.190 000 115 000
|
294 106.350 000 000 091
|
||||||
295 104.325 091 000 000
|
295 106.590 000 118 000
|
||||||
296 104.325 000 000 090
|
296 107.175 087 000 000
|
||||||
297 104.990 000 116 000
|
297 107.175 000 000 092
|
||||||
298 105.150 092 000 000
|
298 107.390 000 119 000
|
||||||
299 105.150 000 000 091
|
299 108.000 088 000 000
|
||||||
300 105.790 000 117 000
|
300 108.000 000 000 093
|
||||||
301 106.350 093 000 000
|
301 108.200 000 120 000
|
||||||
302 106.350 000 000 092
|
302 108.825 089 000 000
|
||||||
303 106.590 000 118 000
|
303 108.825 000 000 094
|
||||||
304 107.175 094 000 000
|
304 109.000 000 121 000
|
||||||
305 107.175 000 000 093
|
305 109.650 090 000 000
|
||||||
306 107.390 000 119 000
|
306 109.650 000 000 095
|
||||||
307 108.000 095 000 000
|
307 109.800 000 122 000
|
||||||
308 108.000 000 000 094
|
308 110.600 000 123 000
|
||||||
309 108.200 000 120 000
|
309 110.850 091 000 000
|
||||||
310 108.825 096 000 000
|
310 110.850 000 000 096
|
||||||
311 108.825 000 000 095
|
311 111.410 000 124 000
|
||||||
312 109.000 000 121 000
|
312 111.675 092 000 000
|
||||||
313 109.650 097 000 000
|
313 111.675 000 000 097
|
||||||
314 109.650 000 000 096
|
314 112.210 000 125 000
|
||||||
315 109.800 000 122 000
|
315 112.500 093 000 000
|
||||||
316 110.600 000 123 000
|
316 112.500 000 000 098
|
||||||
317 110.850 098 000 000
|
317 113.010 000 126 000
|
||||||
318 110.850 000 000 097
|
318 113.325 094 000 000
|
||||||
319 111.410 000 124 000
|
319 113.325 000 000 099
|
||||||
320 111.675 099 000 000
|
320 113.810 000 127 000
|
||||||
321 111.675 000 000 098
|
321 114.150 095 000 000
|
||||||
322 112.210 000 125 000
|
322 114.150 000 000 100
|
||||||
323 112.500 100 000 000
|
323 114.610 000 128 000
|
||||||
324 112.500 000 000 099
|
324 115.350 096 000 000
|
||||||
325 113.010 000 126 000
|
325 115.350 000 000 101
|
||||||
326 113.325 101 000 000
|
326 115.420 000 129 000
|
||||||
327 113.325 000 000 100
|
327 116.175 097 000 000
|
||||||
328 113.810 000 127 000
|
328 116.175 000 000 102
|
||||||
329 114.150 102 000 000
|
329 116.220 000 130 000
|
||||||
330 114.150 000 000 101
|
330 117.000 098 000 000
|
||||||
331 114.610 000 128 000
|
331 117.000 000 000 103
|
||||||
332 115.350 103 000 000
|
332 117.020 000 131 000
|
||||||
333 115.350 000 000 102
|
333 117.820 000 132 000
|
||||||
334 115.420 000 129 000
|
334 117.825 099 000 000
|
||||||
335 116.175 104 000 000
|
335 117.825 000 000 104
|
||||||
336 116.175 000 000 103
|
336 118.630 000 133 000
|
||||||
337 116.220 000 130 000
|
337 118.650 100 000 000
|
||||||
338 117.000 105 000 000
|
338 118.650 000 000 105
|
||||||
339 117.000 000 000 104
|
339 119.430 000 134 000
|
||||||
340 117.020 000 131 000
|
340 119.850 101 000 000
|
||||||
341 117.820 000 132 000
|
341 119.850 000 000 106
|
||||||
342 117.825 106 000 000
|
342 120.230 000 135 000
|
||||||
343 117.825 000 000 105
|
343 120.675 102 000 000
|
||||||
344 118.630 000 133 000
|
344 120.675 000 000 107
|
||||||
345 118.650 107 000 000
|
345 121.030 000 136 000
|
||||||
346 118.650 000 000 106
|
346 121.500 103 000 000
|
||||||
347 119.430 000 134 000
|
347 121.500 000 000 108
|
||||||
348 119.850 108 000 000
|
348 121.830 000 137 000
|
||||||
349 119.850 000 000 107
|
349 122.325 104 000 000
|
||||||
350 120.230 000 135 000
|
350 122.325 000 000 109
|
||||||
351 120.675 109 000 000
|
351 122.640 000 138 000
|
||||||
352 120.675 000 000 108
|
352 123.150 105 000 000
|
||||||
353 121.030 000 136 000
|
353 123.150 000 000 110
|
||||||
354 121.500 110 000 000
|
354 123.440 000 139 000
|
||||||
355 121.500 000 000 109
|
355 124.240 000 140 000
|
||||||
356 121.830 000 137 000
|
356 124.350 106 000 000
|
||||||
357 122.325 111 000 000
|
357 124.350 000 000 111
|
||||||
358 122.325 000 000 110
|
358 125.040 000 141 000
|
||||||
359 122.640 000 138 000
|
359 125.175 107 000 000
|
||||||
360 123.150 112 000 000
|
360 125.175 000 000 112
|
||||||
361 123.150 000 000 111
|
361 125.850 000 142 000
|
||||||
362 123.440 000 139 000
|
362 126.000 108 000 000
|
||||||
363 124.240 000 140 000
|
363 126.000 000 000 113
|
||||||
364 124.350 113 000 000
|
364 126.650 000 143 000
|
||||||
365 124.350 000 000 112
|
365 126.825 109 000 000
|
||||||
366 125.040 000 141 000
|
366 126.825 000 000 114
|
||||||
367 125.175 114 000 000
|
367 127.450 000 144 000
|
||||||
368 125.175 000 000 113
|
368 127.650 110 000 000
|
||||||
369 125.850 000 142 000
|
369 127.650 000 000 115
|
||||||
370 126.000 115 000 000
|
370 128.250 000 145 000
|
||||||
371 126.000 000 000 114
|
371 129.050 000 146 000
|
||||||
372 126.650 000 143 000
|
372 129.860 000 147 000
|
||||||
373 126.825 116 000 000
|
373 130.660 000 148 000
|
||||||
374 126.825 000 000 115
|
374 131.460 000 149 000
|
||||||
375 127.450 000 144 000
|
375 132.260 000 150 000
|
||||||
376 127.650 117 000 000
|
|
||||||
377 127.650 000 000 116
|
|
||||||
378 128.250 000 145 000
|
|
||||||
379 129.050 000 146 000
|
|
||||||
380 129.860 000 147 000
|
|
||||||
381 130.660 000 148 000
|
|
||||||
382 131.460 000 149 000
|
|
||||||
383 132.260 000 150 000
|
|
||||||
#----- upper bank two theta
|
#----- upper bank two theta
|
||||||
117
|
110
|
||||||
18.35
|
18.35
|
||||||
19.175
|
19.175
|
||||||
20
|
20
|
||||||
@ -440,13 +432,6 @@
|
|||||||
67
|
67
|
||||||
67.825
|
67.825
|
||||||
68.65
|
68.65
|
||||||
69.85
|
|
||||||
70.675
|
|
||||||
71.5
|
|
||||||
72.325
|
|
||||||
76.5
|
|
||||||
77.325
|
|
||||||
78.15
|
|
||||||
79.35
|
79.35
|
||||||
80.175
|
80.175
|
||||||
81
|
81
|
||||||
@ -655,7 +640,7 @@
|
|||||||
131.46
|
131.46
|
||||||
132.26
|
132.26
|
||||||
#------- lower bank two theta
|
#------- lower bank two theta
|
||||||
116
|
115
|
||||||
18.35
|
18.35
|
||||||
19.175
|
19.175
|
||||||
20
|
20
|
||||||
@ -706,7 +691,6 @@
|
|||||||
62.5
|
62.5
|
||||||
63.325
|
63.325
|
||||||
64.15
|
64.15
|
||||||
68.65
|
|
||||||
70.35
|
70.35
|
||||||
71.175
|
71.175
|
||||||
72
|
72
|
||||||
|
68
fomerge.c
68
fomerge.c
@ -22,10 +22,13 @@
|
|||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
|
|
||||||
/* change this in line with HistMem.h */
|
/* change this in line with HistMem.h */
|
||||||
|
|
||||||
typedef int HistInt;
|
typedef int HistInt;
|
||||||
|
|
||||||
|
|
||||||
#include "fomerge.h"
|
#include "fomerge.h"
|
||||||
|
|
||||||
|
|
||||||
/*================== module static data items ==========================*/
|
/*================== module static data items ==========================*/
|
||||||
static HistInt *masterData, *upperData, *mediumData, *lowerData,
|
static HistInt *masterData, *upperData, *mediumData, *lowerData,
|
||||||
*mergedData = NULL;
|
*mergedData = NULL;
|
||||||
@ -100,7 +103,7 @@ int initializeFM(char *mergefile)
|
|||||||
iTest = sscanf(pBuffer,"%d",&nUpper);
|
iTest = sscanf(pBuffer,"%d",&nUpper);
|
||||||
if((iTest != 1) || (nUpper <= 0) )
|
if((iTest != 1) || (nUpper <= 0) )
|
||||||
{
|
{
|
||||||
fprintf(stdout,"ERROR: Invalid or corrupt merge data file");
|
fprintf(stdout,"ERROR: Invalid or corrupt merge data file");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
upperTheta = (float *)malloc(nUpper*sizeof(float));
|
upperTheta = (float *)malloc(nUpper*sizeof(float));
|
||||||
@ -161,7 +164,7 @@ int initializeFM(char *mergefile)
|
|||||||
timeBin = 0;
|
timeBin = 0;
|
||||||
iMerged = 0;
|
iMerged = 0;
|
||||||
medium =1;
|
medium =1;
|
||||||
upper = lower = 0;
|
upper = lower = 1;
|
||||||
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return 1;
|
return 1;
|
||||||
@ -171,7 +174,7 @@ int initializeFM(char *mergefile)
|
|||||||
banks. This routine contains the knowledge how the detector banks are
|
banks. This routine contains the knowledge how the detector banks are
|
||||||
laid out in the histogram returned from the histogram memory.
|
laid out in the histogram returned from the histogram memory.
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
int setFMDataPointer(HistInt *lData, int mytimeBins)
|
int setFMDataPointer(HistInt *lData, int mytimeBins, int bank)
|
||||||
{
|
{
|
||||||
HistInt *dataPtr;
|
HistInt *dataPtr;
|
||||||
|
|
||||||
@ -180,37 +183,38 @@ int setFMDataPointer(HistInt *lData, int mytimeBins)
|
|||||||
|
|
||||||
/* the first set is the medium bank */
|
/* the first set is the medium bank */
|
||||||
masterData = dataPtr = lData;
|
masterData = dataPtr = lData;
|
||||||
if(medium)
|
if (bank==1){
|
||||||
{
|
if(medium)
|
||||||
mediumData = masterData;
|
{
|
||||||
|
mediumData = masterData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mediumData = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
mediumData = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the next set is the upper bank */
|
/* the next set is the upper bank */
|
||||||
if(upper)
|
if (bank==2){
|
||||||
{
|
if(upper)
|
||||||
upperData = dataPtr + mytimeBins*nMedium;
|
{
|
||||||
dataPtr = upperData;
|
upperData = masterData;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
upperData = NULL;
|
upperData = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* the last is the lower bank */
|
/* the last is the lower bank */
|
||||||
if(lower)
|
if (bank==3) {
|
||||||
{
|
if(lower)
|
||||||
lowerData = dataPtr + mytimeBins*nUpper;
|
{
|
||||||
dataPtr = lowerData;
|
lowerData = masterData;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowerData = NULL;
|
lowerData = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deal with data allocation for merged data */
|
/* deal with data allocation for merged data */
|
||||||
if(mytimeBins != timeBin)
|
if(mytimeBins != timeBin)
|
||||||
{
|
{
|
||||||
@ -234,6 +238,7 @@ int setFMDataPointer(HistInt *lData, int mytimeBins)
|
|||||||
iMerged = 0;
|
iMerged = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
void setFMconfiguration(int up, int med, int low)
|
void setFMconfiguration(int up, int med, int low)
|
||||||
{
|
{
|
||||||
@ -253,6 +258,7 @@ static void mergeData(void)
|
|||||||
if(!mergedData)
|
if(!mergedData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
memset(mergedData,0,nMerged*sizeof(HistInt));
|
||||||
for(i = 0; i < nMerged; i++)
|
for(i = 0; i < nMerged; i++)
|
||||||
{
|
{
|
||||||
startMerge = mergedData + i * timeBin;
|
startMerge = mergedData + i * timeBin;
|
||||||
@ -396,3 +402,5 @@ int getFMdim(int which)
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#define MERGED 4
|
#define MERGED 4
|
||||||
#define TIMEBIN 5
|
#define TIMEBIN 5
|
||||||
|
|
||||||
int setFMDataPointer(HistInt *lData, int timeBins);
|
int setFMDataPointer(HistInt *lData, int timeBins, int bank);
|
||||||
/*
|
/*
|
||||||
sets the data array with the unmerged data. timeBins is the
|
sets the data array with the unmerged data. timeBins is the
|
||||||
length of the time binning used. upper, medium and lower are flags
|
length of the time binning used. upper, medium and lower are flags
|
||||||
@ -65,6 +65,7 @@
|
|||||||
the length of the time binning if TIMEBIN has been specified.
|
the length of the time binning if TIMEBIN has been specified.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
228
fowrite.c
228
fowrite.c
@ -30,6 +30,7 @@
|
|||||||
#include "scan.h"
|
#include "scan.h"
|
||||||
#include "sicsvar.h"
|
#include "sicsvar.h"
|
||||||
#include "fitcenter.h"
|
#include "fitcenter.h"
|
||||||
|
#include "hmcontrol.h"
|
||||||
#include "fomerge.h"
|
#include "fomerge.h"
|
||||||
|
|
||||||
/* histogram memory names */
|
/* histogram memory names */
|
||||||
@ -50,10 +51,12 @@
|
|||||||
int iInterval;
|
int iInterval;
|
||||||
int iEnd;
|
int iEnd;
|
||||||
SConnection *pCon;
|
SConnection *pCon;
|
||||||
|
pCounter pCount;
|
||||||
char *pFile;
|
char *pFile;
|
||||||
char *pDictFile;
|
char *pDictFile;
|
||||||
pFit pFitter;
|
pFit pFitter;
|
||||||
float fElastic;
|
float fElastic;
|
||||||
|
pICallBack pCall;
|
||||||
int iUpper, iMiddle, iLower;
|
int iUpper, iMiddle, iLower;
|
||||||
/* detector availability flags */
|
/* detector availability flags */
|
||||||
} FoWrite, *pFoWrite;
|
} FoWrite, *pFoWrite;
|
||||||
@ -92,7 +95,9 @@
|
|||||||
assert(self);
|
assert(self);
|
||||||
self->tUpdate = time(NULL);
|
self->tUpdate = time(NULL);
|
||||||
self->iEnd = 1;
|
self->iEnd = 1;
|
||||||
|
/*
|
||||||
FoUpdate(self,self->pCon);
|
FoUpdate(self,self->pCon);
|
||||||
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -362,7 +367,7 @@
|
|||||||
if(self->iMiddle)
|
if(self->iMiddle)
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","bank1");
|
NXDupdate(pDict,"bank","bank1");
|
||||||
iLength = getFMdim(MIDDLE);
|
iLength = 150;
|
||||||
sprintf(pBuffer,"%d",iLength);
|
sprintf(pBuffer,"%d",iLength);
|
||||||
NXDupdate(pDict,"noofdetectors",pBuffer);
|
NXDupdate(pDict,"noofdetectors",pBuffer);
|
||||||
fArray = getFMBankTheta(MIDDLE);
|
fArray = getFMBankTheta(MIDDLE);
|
||||||
@ -371,7 +376,7 @@
|
|||||||
if(self->iLower)
|
if(self->iLower)
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","lowerbank");
|
NXDupdate(pDict,"bank","lowerbank");
|
||||||
iLength = getFMdim(LOWER);
|
iLength = 115;
|
||||||
sprintf(pBuffer,"%d",iLength);
|
sprintf(pBuffer,"%d",iLength);
|
||||||
NXDupdate(pDict,"noofdetectors",pBuffer);
|
NXDupdate(pDict,"noofdetectors",pBuffer);
|
||||||
fArray = getFMBankTheta(LOWER);
|
fArray = getFMBankTheta(LOWER);
|
||||||
@ -380,7 +385,7 @@
|
|||||||
if(self->iUpper)
|
if(self->iUpper)
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","upperbank");
|
NXDupdate(pDict,"bank","upperbank");
|
||||||
iLength = getFMdim(UPPER);
|
iLength = 110;
|
||||||
sprintf(pBuffer,"%d",iLength);
|
sprintf(pBuffer,"%d",iLength);
|
||||||
NXDupdate(pDict,"noofdetectors",pBuffer);
|
NXDupdate(pDict,"noofdetectors",pBuffer);
|
||||||
fArray = getFMBankTheta(UPPER);
|
fArray = getFMBankTheta(UPPER);
|
||||||
@ -389,7 +394,7 @@
|
|||||||
if(self->iMiddle && ( self->iLower || self->iUpper) )
|
if(self->iMiddle && ( self->iLower || self->iUpper) )
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","merged");
|
NXDupdate(pDict,"bank","merged");
|
||||||
iLength = getFMdim(MERGED);
|
iLength = 375;
|
||||||
sprintf(pBuffer,"%d",iLength);
|
sprintf(pBuffer,"%d",iLength);
|
||||||
NXDupdate(pDict,"noofdetectors",pBuffer);
|
NXDupdate(pDict,"noofdetectors",pBuffer);
|
||||||
fArray = getFMBankTheta(MERGED);
|
fArray = getFMBankTheta(MERGED);
|
||||||
@ -415,7 +420,7 @@
|
|||||||
static void FoUpdate(pFoWrite self, SConnection *pCon)
|
static void FoUpdate(pFoWrite self, SConnection *pCon)
|
||||||
{
|
{
|
||||||
char pBueffel[512];
|
char pBueffel[512];
|
||||||
int iInt, iStat, iTime, i, j, iDet, iIndex;
|
int iInt, iStat, iTime, i,ii, j, iDet, iIndex;
|
||||||
pSicsVariable var1 = NULL;
|
pSicsVariable var1 = NULL;
|
||||||
pSicsVariable var2 = NULL;
|
pSicsVariable var2 = NULL;
|
||||||
pSicsVariable var3 = NULL;
|
pSicsVariable var3 = NULL;
|
||||||
@ -492,7 +497,7 @@
|
|||||||
var1 = FindVariable(pServ->pSics,"lbank");
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
if(var1)
|
if(var1)
|
||||||
{
|
{
|
||||||
VarGetInt(var2,&lbank);
|
VarGetInt(var1,&lbank);
|
||||||
} else {
|
} else {
|
||||||
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
}
|
}
|
||||||
@ -526,7 +531,13 @@
|
|||||||
iTime = iInt;
|
iTime = iInt;
|
||||||
sprintf(pBueffel,"%d",iInt);
|
sprintf(pBueffel,"%d",iInt);
|
||||||
NXDupdate(pDict,"timebin",pBueffel);
|
NXDupdate(pDict,"timebin",pBueffel);
|
||||||
|
var1 = FindVariable(pServ->pSics,"lbank");
|
||||||
|
if(var1)
|
||||||
|
{
|
||||||
|
VarGetInt(var1,&lbank);
|
||||||
|
} else {
|
||||||
|
SCWrite(pCon,"ERROR: lbank value not found!",eError);
|
||||||
|
}
|
||||||
if (var1)
|
if (var1)
|
||||||
{
|
{
|
||||||
lData = GetHistogramPointer(self->pHistogram1,pCon);
|
lData = GetHistogramPointer(self->pHistogram1,pCon);
|
||||||
@ -550,7 +561,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var3 = FindVariable(pServ->pSics,"ubank");
|
var3 = FindVariable(pServ->pSics,"ubank");
|
||||||
if(var1)
|
if(var3)
|
||||||
{
|
{
|
||||||
VarGetInt(var3,&ubank);
|
VarGetInt(var3,&ubank);
|
||||||
} else {
|
} else {
|
||||||
@ -567,39 +578,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setFMDataPointer(lData,iTime);
|
setFMDataPointer(lData,iTime,3);
|
||||||
setFMDataPointer(mData,iTime);
|
setFMDataPointer(mData,iTime,1);
|
||||||
setFMDataPointer(uData,iTime);
|
setFMDataPointer(uData,iTime,2);
|
||||||
if(self->iUpper)
|
|
||||||
{
|
|
||||||
NXDupdate(pDict,"bank","upperbank");
|
|
||||||
iDet = 117;
|
|
||||||
sprintf(pBueffel,"%d",iDet);
|
|
||||||
NXDupdate(pDict,"noofdetectors",pBueffel);
|
|
||||||
uData = getFMBankPointer(UPPER);
|
|
||||||
NXDputalias(pFile,pDict,"dcounts",uData);
|
|
||||||
/* summed counts for each detector */
|
|
||||||
iSum = (int *)malloc(iDet*sizeof(int));
|
|
||||||
if(iSum)
|
|
||||||
{
|
|
||||||
memset(iSum,0,iDet*sizeof(int));
|
|
||||||
for(i = 0; i < iDet; i++)
|
|
||||||
{
|
|
||||||
iIndex = i * iTime;
|
|
||||||
for(j = 0; j < iTime; j++)
|
|
||||||
{
|
|
||||||
iSum[i] += uData[iIndex+j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NXDputalias(pFile,pDict,"dsums",iSum);
|
|
||||||
free(iSum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SCWrite(pCon,"WARNING: out of memory, failed to do sums",
|
|
||||||
eWarning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* middle bank */
|
/* middle bank */
|
||||||
if(self->iMiddle)
|
if(self->iMiddle)
|
||||||
{
|
{
|
||||||
@ -631,10 +612,40 @@
|
|||||||
eWarning);
|
eWarning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(self->iUpper)
|
||||||
|
{
|
||||||
|
NXDupdate(pDict,"bank","upperbank");
|
||||||
|
iDet = 110;
|
||||||
|
sprintf(pBueffel,"%d",iDet);
|
||||||
|
NXDupdate(pDict,"noofdetectors",pBueffel);
|
||||||
|
uData = getFMBankPointer(UPPER);
|
||||||
|
NXDputalias(pFile,pDict,"dcounts",uData);
|
||||||
|
/* summed counts for each detector */
|
||||||
|
iSum = (int *)malloc(iDet*sizeof(int));
|
||||||
|
if(iSum)
|
||||||
|
{
|
||||||
|
memset(iSum,0,iDet*sizeof(int));
|
||||||
|
for(i = 0; i < iDet; i++)
|
||||||
|
{
|
||||||
|
iIndex = i * iTime;
|
||||||
|
for(j = 0; j < iTime; j++)
|
||||||
|
{
|
||||||
|
iSum[i] += uData[iIndex+j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NXDputalias(pFile,pDict,"dsums",iSum);
|
||||||
|
free(iSum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"WARNING: out of memory, failed to do sums",
|
||||||
|
eWarning);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(self->iLower)
|
if(self->iLower)
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","lowerbank");
|
NXDupdate(pDict,"bank","lowerbank");
|
||||||
iDet = 116;
|
iDet = 115;
|
||||||
sprintf(pBueffel,"%d",iDet);
|
sprintf(pBueffel,"%d",iDet);
|
||||||
NXDupdate(pDict,"noofdetectors",pBueffel);
|
NXDupdate(pDict,"noofdetectors",pBueffel);
|
||||||
lData = getFMBankPointer(LOWER);
|
lData = getFMBankPointer(LOWER);
|
||||||
@ -659,13 +670,30 @@
|
|||||||
{
|
{
|
||||||
SCWrite(pCon,"WARNING: out of memory, failed to do sums",
|
SCWrite(pCon,"WARNING: out of memory, failed to do sums",
|
||||||
eWarning);
|
eWarning);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
now get and write tof_monitor
|
||||||
|
*/
|
||||||
|
|
||||||
|
lData = (HistInt *)malloc(iTime*sizeof(HistInt));
|
||||||
|
if(!lData)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: out of memory while writing tof-monitor",
|
||||||
|
eError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(lData,0,iTime*sizeof(HistInt));
|
||||||
|
GetHistogramDirect(self->pHistogram1,pCon,0,115*iTime,
|
||||||
|
116*iTime, lData, iTime*sizeof(HistInt));
|
||||||
|
NXDputalias(pFile,pDict,"tofmon",lData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* merged data */
|
/* merged data */
|
||||||
if( (self->iUpper || self->iLower) && self->iMiddle)
|
if( (self->iUpper || self->iLower) && self->iMiddle)
|
||||||
{
|
{
|
||||||
NXDupdate(pDict,"bank","merged");
|
NXDupdate(pDict,"bank","merged");
|
||||||
iDet = getFMdim(MERGED);
|
iDet = 375;
|
||||||
sprintf(pBueffel,"%d",iDet);
|
sprintf(pBueffel,"%d",iDet);
|
||||||
NXDupdate(pDict,"noofdetectors",pBueffel);
|
NXDupdate(pDict,"noofdetectors",pBueffel);
|
||||||
lData = getFMBankPointer(MERGED);
|
lData = getFMBankPointer(MERGED);
|
||||||
@ -696,8 +724,8 @@
|
|||||||
|
|
||||||
/* calculate elastic peak position */
|
/* calculate elastic peak position */
|
||||||
NXDupdate(pDict,"bank","bank1");
|
NXDupdate(pDict,"bank","bank1");
|
||||||
lData = getFMBankPointer(MIDDLE);
|
mData = getFMBankPointer(MIDDLE);
|
||||||
if(lData)
|
if(mData)
|
||||||
{
|
{
|
||||||
lSum = (long *)malloc(iTime *sizeof(long));
|
lSum = (long *)malloc(iTime *sizeof(long));
|
||||||
fAxis = (float *)malloc(iTime *sizeof(float));
|
fAxis = (float *)malloc(iTime *sizeof(float));
|
||||||
@ -710,7 +738,7 @@
|
|||||||
iIndex = i * iTime;
|
iIndex = i * iTime;
|
||||||
for(j = 0; j < iTime; j++)
|
for(j = 0; j < iTime; j++)
|
||||||
{
|
{
|
||||||
lSum[j] += lData[iIndex+j];
|
lSum[j] += mData[iIndex+j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = 0; i < iTime; i++)
|
for(i = 0; i < iTime; i++)
|
||||||
@ -858,6 +886,7 @@
|
|||||||
self->tUpdate = 0;
|
self->tUpdate = 0;
|
||||||
iWrite = 0;
|
iWrite = 0;
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
|
FoUpdate(self,self->pCon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iWrite)
|
if(iWrite)
|
||||||
@ -910,7 +939,8 @@
|
|||||||
pFoWrite pNew = NULL;
|
pFoWrite pNew = NULL;
|
||||||
pICallBack pCall = NULL;
|
pICallBack pCall = NULL;
|
||||||
pDummy pDum;
|
pDummy pDum;
|
||||||
|
pHMcontrol pHMC = NULL;
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if(argc < 4 )
|
if(argc < 4 )
|
||||||
{
|
{
|
||||||
@ -918,22 +948,52 @@
|
|||||||
eError);
|
eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* find things in interpreter */
|
|
||||||
pCom = FindCommand(pSics,HM1);
|
/* allocate data structure */
|
||||||
if(pCom)
|
pNew = (pFoWrite)malloc(sizeof(FoWrite));
|
||||||
|
if(!pNew)
|
||||||
{
|
{
|
||||||
pNew->pHistogram1 = (pHistMem)pCom->pData;
|
SCWrite(pCon,"ERROR: out of memory in FoInstall",eError);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
memset(pNew,0,sizeof(FoWrite));
|
||||||
|
pNew->pDes = CreateDescriptor("FocusWrite");
|
||||||
|
pNew->pCall = CreateCallBackInterface();
|
||||||
|
pNew->pFitter = CreateFitCenter(NULL);
|
||||||
|
if( (!pNew->pDes) || (!pNew->pFitter) )
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: out of memory in FoInstall",eError);
|
||||||
|
free(pNew);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pNew->pDictFile = strdup(argv[2]);
|
||||||
|
pNew->iInterval = 20*60;
|
||||||
|
|
||||||
|
pHMC = FindCommandData(pSics,argv[1],"HMcontrol");
|
||||||
|
if(!pHMC){
|
||||||
|
SCWrite(pCon,"ERROR: no histogram memory control found!",eError);
|
||||||
|
free(pNew);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find things in interpreter */
|
||||||
|
pCom = FindCommand(pSics,"hm1");
|
||||||
|
if(!pCom)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: Histogram memory for lower detector bank NOT found",eError);
|
SCWrite(pCon,"ERROR: Histogram memory for lower detector bank NOT found",eError);
|
||||||
pNew->pHistogram1 = NULL;
|
pNew->pHistogram1 = NULL;
|
||||||
}
|
} else
|
||||||
|
{
|
||||||
|
pNew->pHistogram1 = (pHistMem)pCom->pData;
|
||||||
|
pNew->iLower =1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pCom = FindCommand(pSics,HM2);
|
pCom = FindCommand(pSics,HM2);
|
||||||
if(pCom)
|
if(pCom)
|
||||||
{
|
{
|
||||||
pNew->pHistogram2 = (pHistMem)pCom->pData;
|
pNew->pHistogram2 = (pHistMem)pCom->pData;
|
||||||
|
pNew->iMiddle =1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -944,73 +1004,29 @@
|
|||||||
pCom = FindCommand(pSics,HM3);
|
pCom = FindCommand(pSics,HM3);
|
||||||
if(pCom)
|
if(pCom)
|
||||||
{
|
{
|
||||||
pNew->pHistogram3 = (pHistMem)pCom->pData;
|
pNew->pHistogram3 = (pHistMem)pCom->pData;
|
||||||
|
pNew->iUpper =1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: Histogram memory for upper detector bank NOT found",eError);
|
SCWrite(pCon,"ERROR: Histogram memory for upper detector bank NOT found",eError);
|
||||||
pNew->pHistogram3 = NULL;
|
pNew->pHistogram3 = NULL;
|
||||||
}
|
}
|
||||||
if(!initializeFM(argv[2]))
|
|
||||||
|
if(!initializeFM(argv[3]))
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: bad merge data file",eError);
|
SCWrite(pCon,"ERROR: bad merge data file",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate data structure */
|
|
||||||
pNew = (pFoWrite)malloc(sizeof(FoWrite));
|
|
||||||
if(!pNew)
|
|
||||||
{
|
|
||||||
SCWrite(pCon,"ERROR: out of memory in FoInstall",eError);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
memset(pNew,0,sizeof(FoWrite));
|
|
||||||
pNew->pDes = CreateDescriptor("FocusWrite");
|
|
||||||
pNew->pFitter = CreateFitCenter(NULL);
|
|
||||||
if( (!pNew->pDes) || (!pNew->pFitter) )
|
|
||||||
{
|
|
||||||
SCWrite(pCon,"ERROR: out of memory in FoInstall",eError);
|
|
||||||
free(pNew);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
pNew->pDictFile = strdup(argv[1]);
|
|
||||||
pNew->iInterval = 20*60;
|
|
||||||
pNew->iMiddle =1;
|
|
||||||
|
|
||||||
/* install callbacks */
|
pCom = FindCommand(pSics,"counter");
|
||||||
pCom = FindCommand(pSics,HM2);
|
|
||||||
if(pCom)
|
if(pCom)
|
||||||
{
|
{
|
||||||
pDum = (pDummy)pNew->pHistogram2;
|
pNew->pCount = (pCounter)pCom->pData;
|
||||||
pCall = (pICallBack)pDum->pDescriptor->GetInterface(pNew->pHistogram2,
|
|
||||||
CALLBACKINTERFACE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pCom = FindCommand(pSics,HM1);
|
|
||||||
if(pCom)
|
|
||||||
{
|
|
||||||
pDum = (pDummy)pNew->pHistogram1;
|
|
||||||
pCall = (pICallBack)pDum->pDescriptor->GetInterface(pNew->pHistogram1,
|
|
||||||
CALLBACKINTERFACE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pDum = (pDummy)pNew->pHistogram3;
|
|
||||||
pCall = (pICallBack)pDum->pDescriptor->GetInterface(pNew->pHistogram3, CALLBACKINTERFACE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pCall)
|
RegisterCallback(pHMC->pCall,COUNTSTART,Countstartcallback,pNew,NULL);
|
||||||
{
|
RegisterCallback(pHMC->pCall,COUNTEND,Countendcallback,pNew,NULL);
|
||||||
SCWrite(pCon,
|
|
||||||
"ERROR: no callback interface found at your histogram memories",
|
|
||||||
eError);
|
|
||||||
KillFoWrite(pNew);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
RegisterCallback(pCall,COUNTSTART,Countstartcallback,pNew,NULL);
|
|
||||||
RegisterCallback(pCall,COUNTEND,Countendcallback,pNew,NULL);
|
|
||||||
|
|
||||||
/* install command */
|
/* install command */
|
||||||
AddCommand(pSics,"StoreFocus",FoAction,KillFoWrite,pNew);
|
AddCommand(pSics,"StoreFocus",FoAction,KillFoWrite,pNew);
|
||||||
|
@ -436,6 +436,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
|||||||
\mbox{}\verb@ float GetHistCountTime(pHistMem self,SConnection *pCon);@\\
|
\mbox{}\verb@ float GetHistCountTime(pHistMem self,SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int HistDoCount(pHistMem self, SConnection *pCon);@\\
|
\mbox{}\verb@ int HistDoCount(pHistMem self, SConnection *pCon);@\\
|
||||||
\mbox{}\verb@ int HistBlockCount(pHistMem self, SConnection *pCon);@\\
|
\mbox{}\verb@ int HistBlockCount(pHistMem self, SConnection *pCon);@\\
|
||||||
|
\mbox{}\verb@ void HistDirty(pHistMem self); @\\
|
||||||
\mbox{}\verb@@\\
|
\mbox{}\verb@@\\
|
||||||
\mbox{}\verb@@$\diamond$
|
\mbox{}\verb@@$\diamond$
|
||||||
\end{list}
|
\end{list}
|
||||||
|
@ -340,6 +340,7 @@ controlled by the following functions:
|
|||||||
float GetHistCountTime(pHistMem self,SConnection *pCon);
|
float GetHistCountTime(pHistMem self,SConnection *pCon);
|
||||||
int HistDoCount(pHistMem self, SConnection *pCon);
|
int HistDoCount(pHistMem self, SConnection *pCon);
|
||||||
int HistBlockCount(pHistMem self, SConnection *pCon);
|
int HistBlockCount(pHistMem self, SConnection *pCon);
|
||||||
|
void HistDirty(pHistMem self);
|
||||||
|
|
||||||
@}
|
@}
|
||||||
The first four functions are simple parameter enquiry and manipulation
|
The first four functions are simple parameter enquiry and manipulation
|
||||||
|
23
hmcontrol.c
23
hmcontrol.c
@ -16,6 +16,7 @@
|
|||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
#include "fortify.h"
|
#include "fortify.h"
|
||||||
#include "hmcontrol.h"
|
#include "hmcontrol.h"
|
||||||
|
#include "HistMem.h"
|
||||||
#include "devexec.h"
|
#include "devexec.h"
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ static int HMCStart(void *pData, SConnection *pCon)
|
|||||||
|
|
||||||
self = (pHMcontrol)pData;
|
self = (pHMcontrol)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
for(i = 0; i < self->nSlaves; i++)
|
for(i = 0; i < self->nSlaves; i++)
|
||||||
{
|
{
|
||||||
status = self->slaves[i]->StartCount(self->slaveData[i],pCon);
|
status = self->slaves[i]->StartCount(self->slaveData[i],pCon);
|
||||||
@ -72,7 +73,7 @@ static int HMCStart(void *pData, SConnection *pCon)
|
|||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
static int HMCStatus(void *pData, SConnection *pCon)
|
static int HMCStatus(void *pData, SConnection *pCon)
|
||||||
{
|
{
|
||||||
int status;
|
int status,i;
|
||||||
pHMcontrol self = NULL;
|
pHMcontrol self = NULL;
|
||||||
|
|
||||||
self = (pHMcontrol)pData;
|
self = (pHMcontrol)pData;
|
||||||
@ -85,8 +86,22 @@ static int HMCStatus(void *pData, SConnection *pCon)
|
|||||||
stop counting on slaves when finished or when an error
|
stop counting on slaves when finished or when an error
|
||||||
occurred.
|
occurred.
|
||||||
*/
|
*/
|
||||||
|
InvokeCallBack(self->pCall,COUNTEND,pCon);
|
||||||
HMCHalt(self);
|
HMCHalt(self);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Warning: this assumes that salves 1 - MAXSLAVE are histogram memories.
|
||||||
|
If this assumption does not hold, change this code to check if this
|
||||||
|
is really a histogram memory.
|
||||||
|
*/
|
||||||
|
for(i = 1; i < MAXSLAVE; i++)
|
||||||
|
{
|
||||||
|
if(self->slaves[i] != NULL)
|
||||||
|
{
|
||||||
|
HistDirty((pHistMem)self->slaveData[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
@ -214,6 +229,7 @@ int MakeHMControl(SConnection *pCon, SicsInterp *pSics,
|
|||||||
memset(pNew,0,sizeof(HMcontrol));
|
memset(pNew,0,sizeof(HMcontrol));
|
||||||
pNew->pDes = CreateDescriptor("HMcontrol");
|
pNew->pDes = CreateDescriptor("HMcontrol");
|
||||||
pNew->pCount = CreateCountableInterface();
|
pNew->pCount = CreateCountableInterface();
|
||||||
|
pNew->pCall = CreateCallBackInterface();
|
||||||
if(!pNew->pDes || ! pNew->pCount)
|
if(!pNew->pDes || ! pNew->pCount)
|
||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: out of memory in MakeHMControl",eError);
|
SCWrite(pCon,"ERROR: out of memory in MakeHMControl",eError);
|
||||||
@ -334,7 +350,8 @@ int HMControlAction(SConnection *pCon, SicsInterp *pSics,
|
|||||||
{
|
{
|
||||||
SCWrite(pCon,"ERROR: failed to start counting",eError);
|
SCWrite(pCon,"ERROR: failed to start counting",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
InvokeCallBack(self->pCall,COUNTSTART,pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -31,6 +31,7 @@ the maximum number of slaves
|
|||||||
int nSlaves;
|
int nSlaves;
|
||||||
float fPreset;
|
float fPreset;
|
||||||
CounterMode eMode;
|
CounterMode eMode;
|
||||||
|
pICallBack pCall;
|
||||||
} HMcontrol, *pHMcontrol;
|
} HMcontrol, *pHMcontrol;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user