- Fixed SICS up to run with up to three TRICS detectors.

- added 150 detectors the default for FOCUS middle bank.
- added documentation for el734_test
This commit is contained in:
cvs
2001-02-09 16:04:46 +00:00
parent 96e2fc44c0
commit 5be8359212
24 changed files with 1842 additions and 224 deletions

View File

@@ -35,6 +35,9 @@
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
Modified to work without counter in slave mode.
Mark Koennecke, January 2001
----------------------------------------------------------------------------*/
#include <string.h>
#include <stdlib.h>
@@ -86,6 +89,8 @@
CommandList *pCom = NULL;
int iStart = 0;
int iInit = 0, i;
int xOff, xFac, yOff, yFac;
int iPort;
assert(self);
assert(self->pPriv);
@@ -120,29 +125,36 @@
PrintHMError("No network name for histogram memory computer found",pCon);
return 0;
}
iPort = (int)fVal;
/* the counter */
status = StringDictGet(pOpt,"counter",pcCounter,254);
if(!status)
{
PrintHMError("No network name for histogram memory computer found",pCon);
return 0;
SCWrite(pCon,"WARNING: no counter control found for this HM",
eWarning);
pInternal->pCounter = NULL;
}
pCom = FindCommand(pSics,pcCounter);
if(!pCom)
{
PrintHMError("EL737 counter for histogram memory not found",pCon);
return 0;
}
pInternal->pCounter = (pCounter)pCom->pData;
if(!pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,COUNTID))
{
PrintHMError("EL737 counter for histogram memory is invalid",pCon);
return 0;
}
else
{
pCom = FindCommand(pSics,pcCounter);
if(!pCom)
{
PrintHMError("EL737 counter for histogram memory not found",
pCon);
return 0;
}
pInternal->pCounter = (pCounter)pCom->pData;
if(!pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
COUNTID))
{
PrintHMError("EL737 counter for histogram memory is invalid",
pCon);
return 0;
}
}
/* ok! put in HM */
pInternal->pMaster = CreateSINQHM(pHMComputer,(int)fVal);
pInternal->pMaster = CreateSINQHM(pHMComputer,iPort);
if(!pInternal->pMaster)
{
PrintHMError("No memory to allocate SINQHM",pCon);
@@ -227,6 +239,9 @@
case eHRPT:
iMode = SQHM__HRPT;
break;
case ePSD:
iMode = SQHM__HM_PSD;
break;
default:
PrintHMError("Unsupported mode requested",pCon);
return 0;
@@ -249,12 +264,63 @@
PrintHMError("Unsupported overflowmode requested",pCon);
return 0;
}
status = SINQHMConfigure(pInternal->pMaster,
iMode,
self->iRank,
self->iLength,
self->iBinWidth,
0,0);
if(self->eHistMode != ePSD)
{
status = SINQHMConfigure(pInternal->pMaster,
iMode,
self->iRank,
self->iLength,
self->iBinWidth,
0,0);
}
else
{
status = StringDictGetAsNumber(pOpt,"xoff",&fVal);
if(!status)
{
PrintHMError(
"No xOff value for PSD mode found",pCon);
return 0;
}
xOff = (int)fVal;
status = StringDictGetAsNumber(pOpt,"xfac",&fVal);
if(!status)
{
PrintHMError(
"No xFac value for PSD mode found",pCon);
return 0;
}
xFac = (int)fVal;
status = StringDictGetAsNumber(pOpt,"yoff",&fVal);
if(!status)
{
PrintHMError(
"No yOff value for PSD mode found",pCon);
return 0;
}
yOff = (int)fVal;
status = StringDictGetAsNumber(pOpt,"yfac",&fVal);
if(!status)
{
PrintHMError(
"No yFac value for PSD mode found",pCon);
return 0;
}
yFac = (int)fVal;
/* xSize and ySize are supposed to be in dim */
status = SINQHMConfigurePSD(pInternal->pMaster,
iMode,
self->iDims[0],
xOff,
xFac,
self->iDims[1],
yOff,
yFac,
self->iBinWidth,
self->fTime,
self->iTimeChan);
}
if(status < 0)
{
SINQHMError2Text(status, pError,131);
@@ -294,8 +360,11 @@
pInternal = self->pPriv;
/* tell the counter box our current status */
SetCounterMode(pInternal->pCounter,self->eCount);
pInternal->pCounter->pDriv->fPreset = self->fCountPreset;
if(pInternal->pCounter != NULL)
{
SetCounterMode(pInternal->pCounter,self->eCount);
pInternal->pCounter->pDriv->fPreset = self->fCountPreset;
}
/* first zero the HM */
@@ -328,13 +397,17 @@
/* start the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->StartCount(pInternal->pCounter,pCon);
if(pCountInt)
{
return pCountInt->StartCount(pInternal->pCounter,pCon);
}
}
return 0;
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQPause(pHistDriver self, SConnection *pCon)
@@ -359,13 +432,17 @@
}
/* pause the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->Pause(pInternal->pCounter,pCon);
if(pCountInt)
{
return pCountInt->Pause(pInternal->pCounter,pCon);
}
}
return 0;
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQContinue(pHistDriver self, SConnection *pCon)
@@ -390,13 +467,17 @@
}
/* continue the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->Continue(pInternal->pCounter,pCon);
if(pCountInt)
{
return pCountInt->Continue(pInternal->pCounter,pCon);
}
}
return 0;
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQHalt(pHistDriver self)
@@ -420,18 +501,26 @@
}
/* Halt counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
status = pCountInt->Halt(pInternal->pCounter);
if(!status)
{
iRet = 0;
}
if(pCountInt)
{
status = pCountInt->Halt(pInternal->pCounter);
if(!status)
{
iRet = 0;
}
else
{
iRet = 1;
}
}
return iRet;
}
return 0;
return 1;
}
/*---------------------------------------------------------------------------*/
static int SQStatus(pHistDriver self, SConnection *pCon)
@@ -449,18 +538,21 @@
pInternal = self->pPriv;
/* first check at counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
status = pCountInt->CheckCountStatus(pInternal->pCounter,
pCon);
if( (status == HWFault) )
{
return status;
}
if(pCountInt)
{
status = pCountInt->CheckCountStatus(pInternal->pCounter,
pCon);
if( (status == HWFault) )
{
return status;
}
}
}
/* now check at HM */
iRet = SINQHMGetStatus(pInternal->pMaster,&iMode,&iDaq,
@@ -476,6 +568,15 @@
{
return HWPause;
}
else if(iDaq == 1)
{
status = HWBusy;
}
else if(iDaq == 0)
{
status = HWIdle;
}
return status;
}
@@ -498,11 +599,18 @@
}
/* now counter errors */
return pInternal->pCounter->pDriv->GetError(pInternal->pCounter->pDriv,
if(pInternal->pCounter != NULL)
{
return pInternal->pCounter->pDriv->GetError(pInternal->pCounter->pDriv,
iCode,
pError,
iErrLen);
}
else
{
/* this can't be */
return 0;
}
}
/*--------------------------------------------------------------------------*/
static int SQFixIt(pHistDriver self, int iCode)
@@ -541,8 +649,13 @@
}
/* do counter errors */
return pInternal->pCounter->pDriv->TryAndFixIt(pInternal->pCounter->pDriv,
if(pInternal->pCounter != NULL)
{
return pInternal->pCounter->pDriv->TryAndFixIt(
pInternal->pCounter->pDriv,
iCode);
}
return COTERM;
}
/*---------------------------------------------------------------------------*/
static int SQGetData(pHistDriver self, SConnection *pCon)
@@ -575,14 +688,18 @@
/* do only counter, histograms are read on demand */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->TransferData(pInternal->pCounter,
pCon);
if(pCountInt)
{
return pCountInt->TransferData(pInternal->pCounter,
pCon);
}
}
return 0;
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQGetHistogram(pHistDriver self, SConnection *pCon,
@@ -748,8 +865,11 @@
assert(self->pPriv);
pInternal = self->pPriv;
return GetMonitor(pInternal->pCounter,i,pCon);
if(pInternal->pCounter != NULL)
{
return GetMonitor(pInternal->pCounter,i,pCon);
}
return 0;
}
/*---------------------------------------------------------------------------*/
static float SQGetTime(pHistDriver self,SConnection *pCon)
@@ -761,8 +881,11 @@
assert(self->pPriv);
pInternal = self->pPriv;
return GetCountTime(pInternal->pCounter,pCon);
if(pInternal->pCounter != NULL)
{
return GetCountTime(pInternal->pCounter,pCon);
}
return -999.99;
}
/*---------------------------------------------------------------------------*/
static int SQPreset(pHistDriver self, SConnection *pCon, HistInt iVal)
@@ -829,6 +952,12 @@
StringDictAddPair(pOption,"hmcomputer","psds02.psi.ch");
StringDictAddPair(pOption,"hmport","2400");
StringDictAddPair(pOption,"counter","Rudolf");
StringDictAddPair(pOption,"xsize","256");
StringDictAddPair(pOption,"xoff","100");
StringDictAddPair(pOption,"xfac","10");
StringDictAddPair(pOption,"ysize","256");
StringDictAddPair(pOption,"yoff","100");
StringDictAddPair(pOption,"yfac","10");
StringDictAddPair(pOption,"init","1");
/* initialise our private data structure */