- 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:
174
hardsup/sinqhm.c
174
hardsup/sinqhm.c
@@ -315,6 +315,143 @@ extern int close(int fp);
|
||||
}
|
||||
return 1; /* success, finally */
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
int SINQHMConfigurePSD(pSINQHM self, int iMode,
|
||||
int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac,
|
||||
int iBinWidth,
|
||||
float *iEdges, int iEdgeLength)
|
||||
{
|
||||
int status, iRet;
|
||||
struct req_buff_struct Req_buff;
|
||||
struct rply_buff_struct Rply_buff;
|
||||
int iLength, i, iDelay;
|
||||
unsigned int iExtra;
|
||||
char *pBuffer = NULL, *pPtr;
|
||||
struct tof_edge_arr tea;
|
||||
int iTeaLength;
|
||||
struct tof_bank toba;
|
||||
|
||||
assert(self);
|
||||
|
||||
/* set up detector bank information. This code supports only
|
||||
one detector bank as of now. Which is appropriate for the
|
||||
detector at hand.
|
||||
*/
|
||||
self->iBinWidth = iBinWidth;
|
||||
SINQHMDefineBank(self,0,0,xSize*ySize,
|
||||
iEdges,iEdgeLength);
|
||||
|
||||
/* figure out how long we are going to be*/
|
||||
iLength = 36 + self->iBanks*sizeof(struct tof_bank);
|
||||
for(i = 0; i < self->iBanks; i++)
|
||||
{
|
||||
iLength += 8 + self->pBank[i].iEdgeLength*sizeof(SQint32);
|
||||
}
|
||||
if(iLength < 64)
|
||||
iLength = 64;
|
||||
/* allocate send buffer */
|
||||
pBuffer = (char *)malloc(iLength*sizeof(char));
|
||||
if(!pBuffer)
|
||||
{
|
||||
return HIST_BAD_ALLOC;
|
||||
}
|
||||
memset(pBuffer,0,iLength);
|
||||
|
||||
/* do the message header */
|
||||
iExtra = iLength - sizeof(Req_buff);
|
||||
if(iExtra < 0)
|
||||
iExtra = 0;
|
||||
iDelay = self->pBank[0].iEdges[0];
|
||||
Req_buff.bigend = htonl (0x12345678);
|
||||
Req_buff.cmnd = htonl (SQHM_CONFIG);
|
||||
Req_buff.u.cnfg.mode = htonl (iMode);
|
||||
Req_buff.u.cnfg.u.psd.n_extra_bytes = htonl (iExtra);
|
||||
Req_buff.u.cnfg.u.psd.n_edges = htons (1);
|
||||
Req_buff.u.cnfg.u.psd.n_banks = htons (1);
|
||||
Req_buff.u.cnfg.u.psd.xOffset = htons (xOff);
|
||||
Req_buff.u.cnfg.u.psd.yOffset = htons (yOff);
|
||||
Req_buff.u.cnfg.u.psd.xFactor = htons (xFac);
|
||||
Req_buff.u.cnfg.u.psd.yFactor = htons (yFac);
|
||||
Req_buff.u.cnfg.u.psd.xSize = htons (xSize);
|
||||
Req_buff.u.cnfg.u.psd.ySize = htons (ySize);
|
||||
Req_buff.u.cnfg.u.psd.preset_delay = htonl((int)iEdges[0]);
|
||||
memcpy(pBuffer,&Req_buff,36);
|
||||
pPtr = pBuffer + 36;
|
||||
|
||||
/* do the edge thingies */
|
||||
for(i = 0; i < self->iBanks; i++)
|
||||
{
|
||||
tea.n_bins = htonl(self->pBank[i].iEdgeLength-1);
|
||||
if(self->pBank[i].iEdgeLength == 2)
|
||||
{
|
||||
tea.flag = htonl(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
tea.flag = htonl(1);
|
||||
}
|
||||
tea.edges = self->pBank[i].iEdges;
|
||||
memcpy(pPtr,&tea,8);
|
||||
pPtr += 8;
|
||||
iTeaLength = self->pBank[i].iEdgeLength*4;
|
||||
memcpy(pPtr,self->pBank[i].iEdges,iTeaLength);
|
||||
pPtr += iTeaLength;
|
||||
}
|
||||
|
||||
/* do the swiss bank structures */
|
||||
for(i = 0; i < self->iBanks; i++)
|
||||
{
|
||||
toba.first = htons(self->pBank[i].iStart);
|
||||
toba.n_cntrs = htons(self->pBank[i].iEnd);
|
||||
toba.edge_indx = htons(i);
|
||||
toba.bytes_per_bin = htons(self->iBinWidth);
|
||||
memcpy(pPtr,&toba,sizeof(struct tof_bank));
|
||||
pPtr += sizeof(struct tof_bank);
|
||||
}
|
||||
|
||||
/* all packed up neat and nicely, send it */
|
||||
/* try, get a connection to master server */
|
||||
status = OpenMasterConnection(self);
|
||||
if(status < 0)
|
||||
{
|
||||
if(pBuffer)
|
||||
free(pBuffer);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* send request */
|
||||
status = send(self->iMasterSocket,pBuffer,iLength ,0);
|
||||
if(pBuffer)
|
||||
{
|
||||
free(pBuffer);
|
||||
}
|
||||
if(status == -1)
|
||||
{
|
||||
return SEND_ERROR;
|
||||
}
|
||||
|
||||
/* get a reply */
|
||||
iRet = GetMasterReply(self,&Rply_buff,sizeof(Rply_buff));
|
||||
if(iRet < 0)
|
||||
{
|
||||
/* try close the socket */
|
||||
close(self->iMasterSocket);
|
||||
self->iMasterSocket = 0;
|
||||
return iRet;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* close the socket */
|
||||
status = close(self->iMasterSocket);
|
||||
self->iMasterSocket = 0;
|
||||
if((status != 0) && (errno != ECONNRESET))
|
||||
{
|
||||
return CLOSE_ERROR;
|
||||
}
|
||||
}
|
||||
return 1; /* success, finally */
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
int SINQHMDeconfigure(pSINQHM self, int iHarsh)
|
||||
{
|
||||
@@ -1272,26 +1409,39 @@ extern int close(int fp);
|
||||
free(pWork->iEdges);
|
||||
pWork->iEdges = NULL;
|
||||
}
|
||||
iDelay = (int)iEdges[0];
|
||||
pWork->iStart = iStart;
|
||||
pWork->iEnd = iEnd;
|
||||
pWork->iEdgeLength = iEdgeLength;
|
||||
if(iEdgeLength == 2)
|
||||
{
|
||||
{ /*
|
||||
fixed binwidth: two values required: start stop in
|
||||
edge[0], edge[1]
|
||||
*/
|
||||
pWork->iFlag = 0;
|
||||
pWork->iDelay = iDelay;
|
||||
pWork->iEdges = (unsigned int *)malloc(2*sizeof(unsigned int));
|
||||
if(!pWork->iEdges)
|
||||
{
|
||||
return HIST_BAD_ALLOC;
|
||||
}
|
||||
pWork->iEdges[0] = htonl((unsigned int)iEdges[0]);
|
||||
pWork->iEdges[1] = htonl((unsigned int)(iEdges[1] - iDelay));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pWork->iFlag = 1;
|
||||
pWork->iEdgeLength++;
|
||||
iEdgeLength++;
|
||||
}
|
||||
|
||||
/*
|
||||
normal case: create the bin boundaries
|
||||
*/
|
||||
pWork->iFlag = 1;
|
||||
pWork->iEdgeLength++;
|
||||
iEdgeLength++;
|
||||
pWork->iEdges = (unsigned int *)malloc(iEdgeLength *
|
||||
sizeof(unsigned int));
|
||||
if(!pWork->iEdges)
|
||||
{
|
||||
return HIST_BAD_ALLOC;
|
||||
}
|
||||
iDelay = iEdges[0];
|
||||
pWork->iDelay = iDelay;
|
||||
for(i = 0; i < iEdgeLength-1; i++)
|
||||
{
|
||||
@@ -1361,14 +1511,6 @@ extern int close(int fp);
|
||||
tofi.preset_delay = htonl(self->pBank[0].iDelay);
|
||||
memcpy(pPtr,&tofi,12);
|
||||
pPtr += 12;
|
||||
/*
|
||||
Req_buff.u.cnfg.u.tof.n_extra_bytes = htonl(iExtra);
|
||||
Req_buff.u.cnfg.u.tof.n_edges = htons((short int)self->iBanks);
|
||||
Req_buff.u.cnfg.u.tof.n_banks = htons((short int)self->iBanks);
|
||||
Req_buff.u.cnfg.u.tof.preset_delay = htonl(self->pBank[0].iDelay);
|
||||
memcpy(pBuffer,&Req_buff,24);
|
||||
pPtr = pBuffer + 24;
|
||||
*/
|
||||
|
||||
/* do the edge thingies */
|
||||
for(i = 0; i < self->iBanks; i++)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#line 317 "sinqhm.w"
|
||||
#line 346 "sinqhm.w"
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
S I N Q H M
|
||||
@@ -17,7 +17,7 @@
|
||||
typedef struct __SINQHM *pSINQHM;
|
||||
/*------------------------------ Error codes -----------------------------*/
|
||||
|
||||
#line 295 "sinqhm.w"
|
||||
#line 324 "sinqhm.w"
|
||||
|
||||
#define HMCOMPUTER_NOT_FOUND -2
|
||||
#define SOCKET_ERROR -3
|
||||
@@ -39,26 +39,32 @@
|
||||
#define DAQ_INHIBIT -19
|
||||
#define DAQ_NOTSTOPPED -20
|
||||
|
||||
#line 333 "sinqhm.w"
|
||||
#line 362 "sinqhm.w"
|
||||
|
||||
|
||||
/*------------------------------ Prototypes ------------------------------*/
|
||||
|
||||
#line 113 "sinqhm.w"
|
||||
#line 118 "sinqhm.w"
|
||||
|
||||
pSINQHM CreateSINQHM(char *pHMComputer, int iMasterPort);
|
||||
pSINQHM CopySINQHM(pSINQHM self);
|
||||
void DeleteSINQHM(pSINQHM self);
|
||||
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
|
||||
|
||||
#line 133 "sinqhm.w"
|
||||
|
||||
#line 142 "sinqhm.w"
|
||||
|
||||
int SINQHMError2Text(int iErr, char *pBuffer, int iBufLen);
|
||||
|
||||
#line 146 "sinqhm.w"
|
||||
#line 155 "sinqhm.w"
|
||||
|
||||
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
|
||||
int iBinWidth, int iLowBin, int iCompress);
|
||||
int SINQHMConfigurePSD(pSINQHM self, int iMode,
|
||||
int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac,
|
||||
int iBinWidth,
|
||||
float *iEdges, int iEdgeLength);
|
||||
|
||||
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
|
||||
int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,
|
||||
@@ -68,7 +74,7 @@
|
||||
int SINQHMKill(pSINQHM self);
|
||||
|
||||
|
||||
#line 232 "sinqhm.w"
|
||||
#line 261 "sinqhm.w"
|
||||
|
||||
int SINQHMOpenDAQ(pSINQHM self);
|
||||
int SINQHMCloseDAQ(pSINQHM self);
|
||||
@@ -85,14 +91,14 @@
|
||||
void *pData, int iDataLen);
|
||||
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
|
||||
#line 336 "sinqhm.w"
|
||||
#line 365 "sinqhm.w"
|
||||
|
||||
|
||||
#line 204 "sinqhm.w"
|
||||
#line 232 "sinqhm.w"
|
||||
|
||||
int SINQHMDefineBank(pSINQHM self, int iBankNumber, int iStart, int iEnd,
|
||||
float *iEdges, int iEdgeLength);
|
||||
|
||||
#line 337 "sinqhm.w"
|
||||
#line 366 "sinqhm.w"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
int iRank;
|
||||
int iPacket;
|
||||
int iBanks;
|
||||
int xSize, ySize;
|
||||
int xOff, xFac;
|
||||
int yOff, yFac;
|
||||
SBank pBank[MAXBANK];
|
||||
} SINQHM;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ This information is kept in a bank data structure:
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap1}
|
||||
$\langle$SBank {\footnotesize 2a}$\rangle\equiv$
|
||||
$\langle$SBank {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -90,7 +90,7 @@ the lower edges of all time bins.
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap2}
|
||||
$\langle$SType {\footnotesize 2b}$\rangle\equiv$
|
||||
$\langle$SType {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -105,6 +105,9 @@ $\langle$SType {\footnotesize 2b}$\rangle\equiv$
|
||||
\mbox{}\verb@ int iRank;@\\
|
||||
\mbox{}\verb@ int iPacket;@\\
|
||||
\mbox{}\verb@ int iBanks;@\\
|
||||
\mbox{}\verb@ int xSize, ySize;@\\
|
||||
\mbox{}\verb@ int xOff, xFac;@\\
|
||||
\mbox{}\verb@ int yOff, yFac;@\\
|
||||
\mbox{}\verb@ SBank pBank[MAXBANK];@\\
|
||||
\mbox{}\verb@ } SINQHM;@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
@@ -112,7 +115,7 @@ $\langle$SType {\footnotesize 2b}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 2bc.
|
||||
\item Macro defined by scraps ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -122,7 +125,9 @@ computer, the second the port number at which the master server is
|
||||
listening. iClientPort defines a port for data communication. If no such
|
||||
port is open, this value will be 0. iStatus is a status flag. iBanks is the
|
||||
number of detector banks defined. pSBank is an array of bank data structures
|
||||
describing the detector banks. In order to
|
||||
describing the detector banks.
|
||||
xOff, xFac and yOff and yFac are the offset and factor values needed for
|
||||
the PSD calculation for TRICS and AMOR. In order to
|
||||
maintain this data structure two functions are defined:
|
||||
|
||||
\section{Byte swapping}
|
||||
@@ -132,7 +137,7 @@ types for your compiler and computer.
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap3}
|
||||
$\langle$SType {\footnotesize 2c}$\rangle\equiv$
|
||||
$\langle$SType {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -144,14 +149,14 @@ $\langle$SType {\footnotesize 2c}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 2bc.
|
||||
\item Macro defined by scraps ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap4}
|
||||
$\langle$Protos {\footnotesize 3a}$\rangle\equiv$
|
||||
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -159,12 +164,14 @@ $\langle$Protos {\footnotesize 3a}$\rangle\equiv$
|
||||
\mbox{}\verb@ pSINQHM CopySINQHM(pSINQHM self);@\\
|
||||
\mbox{}\verb@ void DeleteSINQHM(pSINQHM self); @\\
|
||||
\mbox{}\verb@ void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);@\\
|
||||
\mbox{}\verb@ void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,@\\
|
||||
\mbox{}\verb@ int ySize, int yOff, int yFac);@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
\end{list}
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 3abc, 6a.
|
||||
\item Macro defined by scraps ?, ?, ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -175,6 +182,8 @@ mentioned above for the description of the data structure. DeleteSINQHM
|
||||
frees all memory associated with a SINQHM structure given by self. The
|
||||
pointer to self is invalid ever afterwards.
|
||||
CopySINQHM creates a copy of the SINQHM structure passed in with self.
|
||||
SINQHMSetPar sets time of flight parameters.
|
||||
SINQHMSetPSD defines PSD parameters for TRICS/AMOR type detectors.
|
||||
|
||||
\section{SINQHM error handling}
|
||||
If not denoted otherwise all public SINQHM functions return an integer 1 on
|
||||
@@ -184,7 +193,7 @@ call to:
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap5}
|
||||
$\langle$Protos {\footnotesize 3b}$\rangle\equiv$
|
||||
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -194,7 +203,7 @@ $\langle$Protos {\footnotesize 3b}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 3abc, 6a.
|
||||
\item Macro defined by scraps ?, ?, ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -210,12 +219,17 @@ needed:
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap6}
|
||||
$\langle$Protos {\footnotesize 3c}$\rangle\equiv$
|
||||
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength, @\\
|
||||
\mbox{}\verb@ int iBinWidth, int iLowBin, int iCompress);@\\
|
||||
\mbox{}\verb@ int SINQHMConfigurePSD(pSINQHM self, int iMode,@\\
|
||||
\mbox{}\verb@ int xSize, int xOff, int xFac,@\\
|
||||
\mbox{}\verb@ int ySize, int yOff, int yFac,@\\
|
||||
\mbox{}\verb@ int iBinWidth, @\\
|
||||
\mbox{}\verb@ float *iEdges, int iEdgeLength);@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ int SINQHMDeconfigure(pSINQHM self, int iHarsh);@\\
|
||||
\mbox{}\verb@ int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,@\\
|
||||
@@ -229,14 +243,14 @@ $\langle$Protos {\footnotesize 3c}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 3abc, 6a.
|
||||
\item Macro defined by scraps ?, ?, ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap7}
|
||||
$\langle$IProtos {\footnotesize 4}$\rangle\equiv$
|
||||
$\langle$IProtos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -245,7 +259,7 @@ $\langle$IProtos {\footnotesize 4}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 4, 6b.
|
||||
\item Macro defined by scraps ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -262,6 +276,20 @@ may choose to strat at a different memory location. iCompress is for
|
||||
compression. All data will be right shifted by iCompress bits before
|
||||
storage. To my knowledge this feature is currently not implemented.
|
||||
|
||||
SINQHMConfigurePSD configures a TRICS/AMOR type detector. The parameters are:
|
||||
\begin{description}
|
||||
\item[self] The histogram memory data structure.
|
||||
\item[iMode] The actual histogram mode with all submask bits.
|
||||
\item[xSize] The x size of the detector.
|
||||
\item[xOff] The offset in x for the detector position decoding.
|
||||
\item[xFac] The factor used in decoding the x detector position.
|
||||
\item[ySize] The y size of the detector.
|
||||
\item[yOff] The offset in y for the detector position decoding.
|
||||
\item[yFac] The factor used in decoding the y detector position.
|
||||
\item[iBinWidth] The binwidth of the histograms.
|
||||
\item[iEdges] An array holding the time binning edges.
|
||||
\item[iEdgeLength] The length of iEdges.
|
||||
\end{description}
|
||||
|
||||
SINQHMDeconfigure deconfigures the histogram memory. This is necessary prior
|
||||
to reconfiguration. The only parameter iHarsh defines how brutal the master
|
||||
@@ -294,7 +322,7 @@ Thus the following functions are required:
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap8}
|
||||
$\langle$TOFProto {\footnotesize 5a}$\rangle\equiv$
|
||||
$\langle$TOFProto {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -311,7 +339,7 @@ $\langle$TOFProto {\footnotesize 5a}$\rangle\equiv$
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap9}
|
||||
$\langle$TOFintern {\footnotesize 5b}$\rangle\equiv$
|
||||
$\langle$TOFintern {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -332,6 +360,7 @@ is the array of time binnings. iEdgeLength is the length of the edges array.
|
||||
|
||||
SINQHMTimeBin actually sends the new time binning to the histogram memory.
|
||||
SINQHMTimeBin is a static internal function.
|
||||
|
||||
|
||||
|
||||
\section{Data aquisition functions}
|
||||
@@ -348,7 +377,7 @@ cleared by default.
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap10}
|
||||
$\langle$Protos {\footnotesize 6a}$\rangle\equiv$
|
||||
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -371,7 +400,7 @@ $\langle$Protos {\footnotesize 6a}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 3abc, 6a.
|
||||
\item Macro defined by scraps ?, ?, ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -410,7 +439,7 @@ to any serious data aquisition.
|
||||
\section{Further internal routines}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap11}
|
||||
$\langle$IProtos {\footnotesize 6b}$\rangle\equiv$
|
||||
$\langle$IProtos {\footnotesize ?}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
@@ -423,7 +452,7 @@ $\langle$IProtos {\footnotesize 6b}$\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\footnotesize\addtolength{\baselineskip}{-1ex}
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item Macro defined by scraps 4, 6b.
|
||||
\item Macro defined by scraps ?, ?.
|
||||
\item Macro referenced in scrap ?.
|
||||
\end{list}
|
||||
\end{minipage}\\[4ex]
|
||||
@@ -494,8 +523,8 @@ $\langle$ErrCode {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@@$\langle$ErrCode {\footnotesize ?}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@/*------------------------------ Prototypes ------------------------------*/@\\
|
||||
\mbox{}\verb@@$\langle$Protos {\footnotesize 3a, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$TOFProto {\footnotesize 5a}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$Protos {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$TOFProto {\footnotesize ?}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@#endif@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
\end{list}
|
||||
@@ -517,10 +546,10 @@ $\langle$ErrCode {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@#ifndef SINQHMINTERNAL@\\
|
||||
\mbox{}\verb@#define SINQHMINTERNAL@\\
|
||||
\mbox{}\verb@#define MAXBANK 1@\\
|
||||
\mbox{}\verb@@$\langle$SBank {\footnotesize 2a}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$SType {\footnotesize 2b, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$IProtos {\footnotesize 4, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$TOFintern {\footnotesize 5b}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$SBank {\footnotesize ?}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$SType {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$IProtos {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@$\langle$TOFintern {\footnotesize ?}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@#endif@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
|
||||
@@ -87,6 +87,9 @@ the lower edges of all time bins.
|
||||
int iRank;
|
||||
int iPacket;
|
||||
int iBanks;
|
||||
int xSize, ySize;
|
||||
int xOff, xFac;
|
||||
int yOff, yFac;
|
||||
SBank pBank[MAXBANK];
|
||||
} SINQHM;
|
||||
@}
|
||||
@@ -96,7 +99,9 @@ computer, the second the port number at which the master server is
|
||||
listening. iClientPort defines a port for data communication. If no such
|
||||
port is open, this value will be 0. iStatus is a status flag. iBanks is the
|
||||
number of detector banks defined. pSBank is an array of bank data structures
|
||||
describing the detector banks. In order to
|
||||
describing the detector banks.
|
||||
xOff, xFac and yOff and yFac are the offset and factor values needed for
|
||||
the PSD calculation for TRICS and AMOR. In order to
|
||||
maintain this data structure two functions are defined:
|
||||
|
||||
\section{Byte swapping}
|
||||
@@ -115,6 +120,8 @@ types for your compiler and computer.
|
||||
pSINQHM CopySINQHM(pSINQHM self);
|
||||
void DeleteSINQHM(pSINQHM self);
|
||||
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
|
||||
void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac);
|
||||
@}
|
||||
|
||||
The first function creates a new SINQHM data structure and initialises the
|
||||
@@ -123,6 +130,8 @@ mentioned above for the description of the data structure. DeleteSINQHM
|
||||
frees all memory associated with a SINQHM structure given by self. The
|
||||
pointer to self is invalid ever afterwards.
|
||||
CopySINQHM creates a copy of the SINQHM structure passed in with self.
|
||||
SINQHMSetPar sets time of flight parameters.
|
||||
SINQHMSetPSD defines PSD parameters for TRICS/AMOR type detectors.
|
||||
|
||||
\section{SINQHM error handling}
|
||||
If not denoted otherwise all public SINQHM functions return an integer 1 on
|
||||
@@ -146,6 +155,11 @@ needed:
|
||||
@d Protos @{
|
||||
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
|
||||
int iBinWidth, int iLowBin, int iCompress);
|
||||
int SINQHMConfigurePSD(pSINQHM self, int iMode,
|
||||
int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac,
|
||||
int iBinWidth,
|
||||
float *iEdges, int iEdgeLength);
|
||||
|
||||
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
|
||||
int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,
|
||||
@@ -171,6 +185,20 @@ may choose to strat at a different memory location. iCompress is for
|
||||
compression. All data will be right shifted by iCompress bits before
|
||||
storage. To my knowledge this feature is currently not implemented.
|
||||
|
||||
SINQHMConfigurePSD configures a TRICS/AMOR type detector. The parameters are:
|
||||
\begin{description}
|
||||
\item[self] The histogram memory data structure.
|
||||
\item[iMode] The actual histogram mode with all submask bits.
|
||||
\item[xSize] The x size of the detector.
|
||||
\item[xOff] The offset in x for the detector position decoding.
|
||||
\item[xFac] The factor used in decoding the x detector position.
|
||||
\item[ySize] The y size of the detector.
|
||||
\item[yOff] The offset in y for the detector position decoding.
|
||||
\item[yFac] The factor used in decoding the y detector position.
|
||||
\item[iBinWidth] The binwidth of the histograms.
|
||||
\item[iEdges] An array holding the time binning edges.
|
||||
\item[iEdgeLength] The length of iEdges.
|
||||
\end{description}
|
||||
|
||||
SINQHMDeconfigure deconfigures the histogram memory. This is necessary prior
|
||||
to reconfiguration. The only parameter iHarsh defines how brutal the master
|
||||
@@ -215,6 +243,7 @@ is the array of time binnings. iEdgeLength is the length of the edges array.
|
||||
|
||||
SINQHMTimeBin actually sends the new time binning to the histogram memory.
|
||||
SINQHMTimeBin is a static internal function.
|
||||
|
||||
|
||||
|
||||
\section{Data aquisition functions}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#ifdef __alpha
|
||||
#ifndef __vms
|
||||
#pragma nomember_alignment
|
||||
#pragma pack 1
|
||||
#endif
|
||||
#endif
|
||||
/*------------------------------------------------------------------------------
|
||||
@@ -23,6 +23,7 @@
|
||||
#define MAX_CLIENTS 8 /* The maximum number of active clients */
|
||||
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
|
||||
** which can be handled in TOF mode */
|
||||
#define MAX_PSD_CNTR 65536 /* maximum number of PSD elements */
|
||||
#define MAX_TOF_NBINS 32768 /* The maximum number of bins in a TOF histog */
|
||||
#define MAX_TOF_EDGE 16 /* The maximum number of TOF edge arrays */
|
||||
#define VMIO_BASE_ADDR 0x1900 /* VME address of a (possible) VMIO10 module */
|
||||
@@ -277,7 +278,7 @@
|
||||
** value) if bin width is constant. Otherwise
|
||||
** it is zero. */
|
||||
uint hi_edge; /* Top edge of last bin (20-bit value) */
|
||||
uint edges[2]; /* Array of edge data (20-bit values). There
|
||||
uint edges[2]; /* Array of edge data (20-bit values). There
|
||||
** are actually (n_bins+1) items in the array
|
||||
** and give the bottom edges of the bin */
|
||||
};
|
||||
@@ -287,7 +288,7 @@
|
||||
struct tof_edge_arr {
|
||||
uint n_bins; /* Number of bins in histogram */
|
||||
uint flag; /* Flag (0/1) for fixed/variable bin size */
|
||||
uint *edges; /* Array of bottom edges (20-bit values) */
|
||||
uint *edges; /* Array of bottom edges (20-bit values) */
|
||||
};
|
||||
|
||||
/* Define structure of a TOF 'bank' in SQHM__TOF config command
|
||||
@@ -332,6 +333,20 @@
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} tof;
|
||||
struct {
|
||||
uint n_extra_bytes;
|
||||
usint n_edges;
|
||||
usint n_banks;
|
||||
uint preset_delay;
|
||||
usint xFactor;
|
||||
usint yFactor;
|
||||
usint xOffset;
|
||||
usint yOffset;
|
||||
usint xSize;
|
||||
usint ySize;
|
||||
struct tof_edge_arr edge_0;
|
||||
struct tof_bank bank_0;
|
||||
} psd;
|
||||
} u;
|
||||
} cnfg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user