- 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

@@ -37,6 +37,16 @@
#define DET1XS 2 /* pixel size in x of detector 1 */
#define DET1YS 2 /* pixel size in y of detector 1 */
#define DET1DESC "Non existent Detector"
#define DET2X 256 /* x -length of detector 1 */
#define DET2Y 256 /* y-length of detector 1 */
#define DET2XS 2 /* pixel size in x of detector 1 */
#define DET2YS 2 /* pixel size in y of detector 1 */
#define DET2DESC "Non existent second Detector"
#define DET3X 256 /* x -length of detector 1 */
#define DET3Y 256 /* y-length of detector 1 */
#define DET3XS 2 /* pixel size in x of detector 1 */
#define DET3YS 2 /* pixel size in y of detector 1 */
#define DET3DESC "Non existent third Detector"
#define DETAMAX 256 /* maximum length of pixelsize array */
/* histogram memory names */
@@ -44,6 +54,12 @@
#define HM2 "hm2"
#define HM3 "hm3"
/*
offset variable names
*/
#define HM2OFF "hm2off"
#define HM3OFF "hm3off"
/*------------------------ the data structure ----------------------------*/
typedef struct __NexTrics {
pObjectDescriptor pDes;
@@ -55,6 +71,7 @@
int iFirst;
int iFrameNum;
pICallBack pCall;
float hm2Off, hm3Off;
} NexTrics;
/* event type */
@@ -66,6 +83,7 @@
pNexTrics pNew = NULL;
int iRet;
CommandList *pCom = NULL;
pSicsVariable pVar = NULL;
/* allocate memory */
pNew = (pNexTrics)malloc(sizeof(NexTrics));
@@ -122,6 +140,25 @@
}
pNew->iFirst = 1;
pNew->iFrameNum = 0;
pVar = FindVariable(pSics,HM2OFF);
if(pVar)
{
pNew->hm2Off = pVar->fVal;
}
else
{
pNew->hm2Off = -45.;
}
pVar = FindVariable(pSics,HM3OFF);
if(pVar)
{
pNew->hm3Off = pVar->fVal;
}
else
{
pNew->hm3Off = 45.;
}
return pNew;
}
@@ -209,11 +246,11 @@
}
/* create the command */
iRet = AddCommand(pSics,"nexus",NexTricsAction,DeleteNexTrics,
iRet = AddCommand(pSics,"nxtrics",NexTricsAction,DeleteNexTrics,
pNew);
if(!iRet)
{
SCWrite(pCon,"ERROR: duplicate command nexus not created",eError);
SCWrite(pCon,"ERROR: duplicate command nxtrics not created",eError);
}
return iRet;
}
@@ -226,7 +263,8 @@
CounterMode eMode;
HistInt lData[DET1X*DET1Y], i, lVal;
int32 iVal;
float fVal;
float fVal, fTTheta;
pMotor pMot;
/* write motors */
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
@@ -235,10 +273,20 @@
"framephi","PHI");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frameomega","OM");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frame2theta","stt");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG1");
/*
read two theta
*/
pMot = FindMotor(pServ->pSics,"stt");
if(!pMot)
{
sprintf(pBueffel,"WARNING: cannot find motor stt");
SCWrite(pCon,pBueffel,eWarning);
return 0;
}
/* get the position */
iRet = MotorGetSoftPosition(pMot,pCon,&fTTheta);
/* write frame time */
SNXFormatTime(pBueffel,512);
@@ -266,14 +314,63 @@
NXDputalias(hfil,self->pDict,"framemonitor",&iVal);
/* write detector1 histogram */
GetHistogram(self->pHistogram1,pCon,0,0,DET1X*DET1Y,lData,DET1X*DET1Y*sizeof(HistInt));
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG1");
GetHistogram(self->pHistogram1,pCon,0,0,DET1X*DET1Y,lData,
DET1X*DET1Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
/*
do detector 2 histogram
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG2");
GetHistogram(self->pHistogram2,pCon,0,0,DET2X*DET2Y,lData,
DET2X*DET2Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta + self->hm2Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
}
/*
do detector 3 histogram
*/
if(self->pHistogram3 != NULL)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG3");
GetHistogram(self->pHistogram2,pCon,0,0,DET3X*DET3Y,lData,
DET3X*DET3Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta + self->hm3Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
}
/* temperature */
SNXSPutEVVar(hfil,self->pDict,"temperature",
pCon,
@@ -421,8 +518,10 @@
"monotheta","MUCA");
/* detector data */
/* first set detector variables in dictionary */
/* detector data
first set detector variables in dictionary
This is the first detector.
*/
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET1X);
@@ -507,7 +606,203 @@
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
/*
second frame, but only if present
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET2X);
NXDupdate(self->pDict,"framedim1",pBueffel);
sprintf(pBueffel,"%d",DET2Y);
NXDupdate(self->pDict,"framedim2",pBueffel);
strcpy(pBueffel,DET2DESC);
iRet = NXDputalias(hfil,self->pDict,"ddescription",pBueffel);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 description",eError);
}
for(i = 0; i < DET2X; i++)
{
fPix[i] = i * DET2XS;
}
iRet = NXDputalias(hfil,self->pDict,"detectorx",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 x-axis description",
eError);
}
for(i = 0; i < DET2Y; i++)
{
fPix[i] = i * DET2YS;
}
iRet = NXDputalias(hfil,self->pDict,"detectory",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector1 y-axis description",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2zerox");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector x zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzerox",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor x zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2zeroy");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector2 y zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzeroy",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor y zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2dist");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector distance not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detdist",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor2 y distance",
eError);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/*
third detector, but only if present
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET3X);
NXDupdate(self->pDict,"framedim1",pBueffel);
sprintf(pBueffel,"%d",DET3Y);
NXDupdate(self->pDict,"framedim2",pBueffel);
strcpy(pBueffel,DET3DESC);
iRet = NXDputalias(hfil,self->pDict,"ddescription",pBueffel);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 description",eError);
}
for(i = 0; i < DET3X; i++)
{
fPix[i] = i * DET3XS;
}
iRet = NXDputalias(hfil,self->pDict,"detectorx",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 x-axis description",
eError);
}
for(i = 0; i < DET3Y; i++)
{
fPix[i] = i * DET3YS;
}
iRet = NXDputalias(hfil,self->pDict,"detectory",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector1 y-axis description",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3zerox");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 x zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzerox",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor x zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3zeroy");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 y zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzeroy",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor y zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3dist");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 distance not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detdist",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor 3 y distance",
eError);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/* do sample information */
strcpy(pBueffel,"UNKNOWN");
@@ -622,7 +917,12 @@
SCWrite(pCon,"WARNING: cannot link against monochromator group",eWarning);
}
/* links in detector group */
/*
links in detector group
detector 1
*/
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
@@ -659,7 +959,109 @@
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
/*
links in detector group, detector 2
*/
if(self->pHistogram2)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector description",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectorx");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectory");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzerox");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x zero ",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzeroy");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y zero",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detdist");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector distance",
eWarning);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/*
links in detector group, detector 3
*/
if(self->pHistogram3)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector description",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectorx");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectory");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzerox");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x zero ",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzeroy");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y zero",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detdist");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector distance",
eWarning);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/* links in sample group */
iRet = NXDaliaslink(hfil,self->pDict,"samplev","samplename");
@@ -798,7 +1200,7 @@
}
/*-------------------------------------------------------------------------
NexusGetFrame opens a TRICS NeXus file and retrieves a frame for the
specified detector from it. This is a specila feature for the
specified detector from it. This is a special feature for the
status display.
---------------------------------------------------------------------------*/
static int NexusGetFrame(SConnection *pCon, pNexTrics self,