- Introduced a general Hipadaba table module and modified the four
circle codes to use it. - Added to functions to histmem, getdelay and formattof, to support new HM - Removed obsolete mesure.*
This commit is contained in:
63
histmem.c
63
histmem.c
@ -12,6 +12,11 @@
|
||||
|
||||
Refactored data handling into separater HMdata class.
|
||||
Mark Koennecke, January 2003
|
||||
|
||||
Added function to retrieve time delay and to format TOF bin array in order
|
||||
to speed up TOF configuration for new http based HM's
|
||||
|
||||
Mark Koennecke, March 2009
|
||||
|
||||
Copyright:
|
||||
|
||||
@ -1034,7 +1039,40 @@ void HMListOption(pHistMem self, SConnection * pCon)
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static pDynString formatTOF(pHistMem self)
|
||||
{
|
||||
const float *timebin;
|
||||
int iLength, i, delay, delta;
|
||||
char number[20];
|
||||
pDynString result = NULL;
|
||||
|
||||
timebin = GetHistTimeBin(self, &iLength);
|
||||
if(timebin != NULL){
|
||||
delay = timebin[0];
|
||||
result = CreateDynString(512,512);
|
||||
if(result == NULL){
|
||||
return NULL;
|
||||
}
|
||||
for(i = 0; i < iLength; i++){
|
||||
snprintf(number,20," %12d", (int)(timebin[i] - delay));
|
||||
DynStringConcat(result,number);
|
||||
if(i % 5 == 0 && i != 0){
|
||||
DynStringConcatChar(result,'\n');
|
||||
}
|
||||
}
|
||||
/*
|
||||
* add the extra one
|
||||
*/
|
||||
if(iLength > 3){
|
||||
delta = timebin[iLength -2] - timebin[iLength -1];
|
||||
}
|
||||
snprintf(number,20," %12d", (int)(timebin[iLength -1] + delta));
|
||||
DynStringConcat(result,number);
|
||||
return result;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
@ -1049,6 +1087,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
long lVal;
|
||||
HistInt *lData = NULL;
|
||||
int iStart, iEnd, iNum, i;
|
||||
pDynString tofres = NULL;
|
||||
CounterMode eCount;
|
||||
char *pMode[] = {
|
||||
"timer",
|
||||
@ -1527,6 +1566,28 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
Tcl_DStringFree(&tResult);
|
||||
return 1;
|
||||
}
|
||||
/* getdelay */
|
||||
else if(strcmp(argv[1],"getdelay") == 0){
|
||||
if(self->pDriv->data->nTimeChan > 1) {
|
||||
SCPrintf(pCon,eValue,"hm.delay = %d", self->pDriv->data->timeBinning[0]);
|
||||
return 1;
|
||||
} else {
|
||||
SCPrintf(pCon,eError,"ERROR: no TOF configured");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* formattof */
|
||||
else if(strcmp(argv[1],"formattof") == 0){
|
||||
tofres = formatTOF(self);
|
||||
if(tofres == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory or not TOF", eError);
|
||||
return 0;
|
||||
} else {
|
||||
SCWrite(pCon,GetCharArray(tofres), eValue);
|
||||
DeleteDynString(tofres);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* generate time binning */
|
||||
else if (strcmp(argv[1], "genbin") == 0) {
|
||||
if (isRunning(self->pCountInt)) {
|
||||
|
Reference in New Issue
Block a user