diff --git a/HistDriv.i b/HistDriv.i
index bfdf4976..995674e4 100644
--- a/HistDriv.i
+++ b/HistDriv.i
@@ -1,5 +1,5 @@
-#line 469 "histogram.w"
+#line 477 "histogram.w"
/*---------------------------------------------------------------------------
H I S T D R I V
@@ -77,7 +77,7 @@
void *pPriv;
} HistDriver;
-#line 481 "histogram.w"
+#line 489 "histogram.w"
#line 239 "histogram.w"
@@ -87,7 +87,7 @@
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
SConnection *pCon);
-#line 482 "histogram.w"
+#line 490 "histogram.w"
#endif
diff --git a/HistMem.h b/HistMem.h
index 06a0ec5c..579b63e9 100644
--- a/HistMem.h
+++ b/HistMem.h
@@ -1,5 +1,5 @@
-#line 442 "histogram.w"
+#line 450 "histogram.w"
/*--------------------------------------------------------------------------
H I S T M E M
@@ -41,7 +41,7 @@
eReflect
} OverFlowMode;
-#line 462 "histogram.w"
+#line 470 "histogram.w"
/*--------------------------------------------------------------------------*/
@@ -78,9 +78,12 @@
int GetHistogram(pHistMem self, SConnection *pCon,
int i,int iStart, int iEnd, HistInt *lData, int iDataLen);
HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);
+ int GetHistogramDirect(pHistMem self, SConnection *pCon,
+ int i, int iStart, int iEnd,
+ HistInt *lData, int iDataLen);
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
-#line 411 "histogram.w"
+#line 419 "histogram.w"
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
@@ -89,7 +92,7 @@
int argc, char *argv[]);
-#line 464 "histogram.w"
+#line 472 "histogram.w"
#endif
diff --git a/HistMem.i b/HistMem.i
index a449b909..67d47a75 100644
--- a/HistMem.i
+++ b/HistMem.i
@@ -1,5 +1,5 @@
-#line 487 "histogram.w"
+#line 495 "histogram.w"
/*---------------------------------------------------------------------------
H I S T M E M -- Internal
@@ -29,7 +29,7 @@
int iUpdateIntervall;
} HistMem;
-#line 497 "histogram.w"
+#line 505 "histogram.w"
#endif
diff --git a/SCinter.c b/SCinter.c
index 9fcfd259..79020144 100644
--- a/SCinter.c
+++ b/SCinter.c
@@ -37,6 +37,8 @@
MODIFICATIONS.
M. Zolliker, Sept 2000, introduced formal aliases, modifications marked M.Z
+ Mark Koennecke, August 2001, modified SicsWriteStatus to write motor
+ positions on demand.
---------------------------------------------------------------------------*/
#include
#include
@@ -45,12 +47,8 @@
#include
#include
#include "fortify.h"
-#include "conman.h"
+#include "sics.h"
#include "splitter.h"
-#include "Scommon.h"
-#include "SCinter.h"
-#include "obdes.h"
-#include "devexec.h"
#include "servlog.h"
#include "macro.h"
/* M.Z. */
@@ -311,12 +309,15 @@ extern char *SkipSpace(char *pPtr);
return NULL;
}
/*------------------------------------------------------------------------*/
- int WriteSicsStatus(SicsInterp *self, char *file)
+ int WriteSicsStatus(SicsInterp *self, char *file, int iMot)
{
CommandList *pCurrent = NULL;
FILE *fd = NULL;
Dummy *pDum = NULL;
-
+ float fVal;
+ pIDrivable pDriv = NULL;
+ void *pTest = NULL;
+
assert(self);
assert(file);
@@ -346,9 +347,30 @@ extern char *SkipSpace(char *pPtr);
if(pDum)
{
pDum->pDescriptor->SaveStatus(pCurrent->pData,pCurrent->pName,fd);
+ if(iMot)
+ {
+ /*
+ save values of motors but not of environment devices as they
+ may not be present the next time round
+ */
+ pDriv = pDum->pDescriptor->GetInterface(pDum,DRIVEID);
+ pTest = pDum->pDescriptor->GetInterface(pDum,ENVIRINTERFACE);
+ if(pDriv && !pTest)
+ {
+ fVal = pDriv->GetValue(pDum,pServ->dummyCon);
+ if(fVal > -990.)
+ {
+ fprintf(fd,"run %s %f\n",pCurrent->pName, fVal);
+ }
+ }
+ }
}
pCurrent = pCurrent->pNext;
}
+ if(iMot)
+ {
+ fprintf(fd,"Success \n");
+ }
fclose(fd);
return 1;
}
diff --git a/SCinter.h b/SCinter.h
index 1b83e597..f9f372a3 100644
--- a/SCinter.h
+++ b/SCinter.h
@@ -86,7 +86,7 @@ typedef struct __SINTER
with name. Returns ist datastructure if found, NULL else
*/
/*-------------------------------------------------------------------------*/
- int WriteSicsStatus(SicsInterp *pSics,char *file);
+ int WriteSicsStatus(SicsInterp *pSics,char *file, int iMot);
/*
SICS needs a way to save the status of each object into a file.
This is done by invoking for each object the object descriptor
@@ -95,6 +95,7 @@ typedef struct __SINTER
Parameters:
pSics : the interpreter to use.
file : the file to write the information to.
+ iMot : flag if motor position shall be saved or not
Returns: 1 on success, 0 on failure.
---------------------------------------------------------------------------*/
int InterpWrite(SicsInterp *pSics, char *buffer);
diff --git a/amor.dic b/amor.dic
index bec39713..e2a0c37d 100644
--- a/amor.dic
+++ b/amor.dic
@@ -11,8 +11,9 @@
# AMOR may have variable time binning. In order
# to cope with that, we use NXDICT's text replacement feature and define
# these things
-timebin = 512
-detsize = 255
+timebin=512
+detxsize=255
+detysize=255
scanlength = 10
#---------- NXentry level
etitle=/entry1,NXentry/SDS title -type DFNT_CHAR -rank 1 -dim {132}
@@ -89,6 +90,8 @@ d3dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm3,NXfilter/SDS distan
#---------------- sample table
saname=/entry1,NXentry/sample,NXsample/SDS name \
-type DFNT_CHAR -rank 1 -dim {132}
+baseheight=/entry1,NXentry/sample,NXsample/SDS base_height \
+ -attr {units,mm}
somheight=/entry1,NXentry/sample,NXsample/SDS omega_height \
-attr {units,mm}
schi=/entry1,NXentry/sample,NXsample/SDS chi \
@@ -108,13 +111,19 @@ d4t=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS top \
-attr {units,mm}
d4b=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS bottom \
-attr {units,mm}
-d4dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS distance \
- -attr {units,mm}
+d4dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS \
+ distance_to_sample -attr {units,mm}
+d4base =/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS \
+ base_height -attr {units,mm}
#------------ analyzer
anname=/entry1,NXentry/reflectometer,NXinstrument/polarizer,NXfilter/SDS name \
-type DFNT_CHAR -rank 1 -dim {132}
anoz=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS omega_height \
-attr {units,mm}
+abase=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS base_height \
+ -attr {units,mm}
+adis=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS \
+ distance_to_sample -attr {units,mm}
anom=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS omega \
-attr {units,degree}
antz=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS height \
@@ -130,8 +139,10 @@ d5t=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS top \
-attr {units,mm}
d5b=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS bottom \
-attr {units,mm}
-d5dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS distance \
- -attr {units,mm}
+d5dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS \
+ distance_to_sample -attr {units,mm}
+d5base =/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS \
+ base_height -attr {units,mm}
#---------- count control
cnmode=/entry1,NXentry/reflectometer,NXinstrument/counter,NXmonitor/SDS count_mode \
-type DFNT_CHAR -rank 1 -dim {30}
@@ -147,13 +158,13 @@ cnmon2=/entry1,NXentry/reflectometer,NXinstrument/counter,NXmonitor/SDS monitor2
dettype=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS type \
-type DFNT_CHAR -rank 1 -dim {132}
dety=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS y_detector \
- -type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,1} \
+ -type DFNT_FLOAT32 -rank 1 -dim {$(detysize)} -attr {axis,1} \
-attr {units,mm}
detxx=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS x_detector \
- -type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,2} \
+ -type DFNT_FLOAT32 -rank 1 -dim {$(detxsize)} -attr {axis,2} \
-attr {units,mm}
detz=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS z \
- -type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,2} \
+ -type DFNT_FLOAT32 -rank 1 -dim {$(detxsize)} -attr {axis,2} \
-attr {units,mm}
detx=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS x \
-type DFNT_FLOAT32 -attr {units,mm}
@@ -161,17 +172,32 @@ detom=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS omega \
-type DFNT_FLOAT32 -attr {units,degree}
detheight=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS height \
-type DFNT_FLOAT32 -attr {units,mm}
-detdist=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS distance \
- -type DFNT_FLOAT32 -attr {units,mm}
+detdist=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
+ distance_to_sample -type DFNT_FLOAT32 -attr {units,mm}
+detbase=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
+ base_height -type DFNT_FLOAT32 -attr {units,mm}
dettime=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS time_binning \
-type DFNT_FLOAT32 -rank 1 -dim {$(timebin)} -attr {axis,3} \
-attr {units,ms}
spinup=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
- -type DFNT_INT32 -rank 3 -dim {$(detsize),$(detsize),$(timebin)} \
- -attr {signal,1}
+ -type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
+ -LZW -attr {signal,1}
+spinup2d=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
+ -type DFNT_INT32 -rank 2 -dim {$(detxsize),$(detysize)} \
+ -LZW -attr {signal,1}
spindown=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spindown \
- -type DFNT_INT32 -rank 3 -dim {$(detsize),$(detsize),$(timebin)} \
- -attr {signal,1}
+ -type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
+ -LZW -attr {signal,1}
+#------------ single detectors TOF -------------------------------------
+singleup=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
+ spinup -type DFNT_INT32 -rank 2 -dim {2, $(timebin)} -LZW \
+ -attr {signal,1}
+singledown=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
+ spinup -type DFNT_INT32 -rank 2 -dim {2, $(timebin)} -LZW \
+ -attr {signal,1}
+singletime=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
+ time_binning -type DFNT_FLOAT32 -rank 1 -dim {$(timebin)} \
+ -attr {axis,2}
#------------ detector: scan mode
scanroot=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS
sdetx=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS x \
@@ -206,5 +232,6 @@ sdetdist=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS distance
-type DFNT_FLOAT32 -attr {units,mm}
#------------------- data vGroup
dana=/entry1,NXentry/TOF,NXdata/NXVGROUP
+singledana=/entry1,NXentry/single,NXdata/NXVGROUP
sdana=/entry1,NXentry/scan,NXdata/NXVGROUP
diff --git a/amor2t.c b/amor2t.c
index bf75c42e..a6576388 100644
--- a/amor2t.c
+++ b/amor2t.c
@@ -67,32 +67,6 @@
/* detector 2 movement */
#define MOTC3Z 11
-/* distance detector sample */
-#define PARDS 0
-/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
-#define PARDH 1
-/* distance diaphragm 4 - sample */
-#define PARDD4 2
-/* distance to diaphragm 5 */
-#define PARDD5 3
-/* interrupt to issue when a motor fails on this */
-#define PARINT 4
-/* base height of counter station */
-#define PARDDH 5
-/* height of D4 */
-#define PARD4H 6
-/* height of D5 */
-#define PARD5H 7
-/* base height of analyzer */
-#define PARANA 8
-/* distance of analyzer from sample */
-#define PARADIS 9
-/* flag analyzer calculation on/off */
-#define ANAFLAG 10
-/* constant for second detector */
-#define PARDDD 11
-/* constant part of AOM */
-#define PARAOM 12
/*======================================================================
The core of it all: The calculation of the settings for the various
diff --git a/amor2t.i b/amor2t.i
index caf1bcf2..2bcf2ae0 100644
--- a/amor2t.i
+++ b/amor2t.i
@@ -7,6 +7,34 @@
Mark Koennecke, September 1999
----------------------------------------------------------------------------*/
+/* distance detector sample */
+#define PARDS 0
+/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
+#define PARDH 1
+/* distance diaphragm 4 - sample */
+#define PARDD4 2
+/* distance to diaphragm 5 */
+#define PARDD5 3
+/* interrupt to issue when a motor fails on this */
+#define PARINT 4
+/* base height of counter station */
+#define PARDDH 5
+/* height of D4 */
+#define PARD4H 6
+/* height of D5 */
+#define PARD5H 7
+/* base height of analyzer */
+#define PARANA 8
+/* distance of analyzer from sample */
+#define PARADIS 9
+/* flag analyzer calculation on/off */
+#define ANAFLAG 10
+/* constant for second detector */
+#define PARDDD 11
+/* constant part of AOM */
+#define PARAOM 12
+
+
typedef struct {
pMotor pMot;
char pName[80];
diff --git a/amor2t.tex b/amor2t.tex
index 6badd4b2..c458706b 100644
--- a/amor2t.tex
+++ b/amor2t.tex
@@ -10,7 +10,7 @@ This object implements this complex movement as a virtual motor.
The following formulas are used for the necessary calculations:
\begin{eqnarray}
-delta height & = & h_{s} - R \sin \alpha \\
+delta height & = & h_{s} - \sin \alpha \\
delta x & = & |x_{c} - x_{s}| - R \cos \alpha \\
omega & = & -2 MOM + 2 SOM \\
\end{eqnarray}
@@ -18,7 +18,7 @@ with
\begin{eqnarray}
h_{s} & = & \tan(2MOM)|x_{c} - x_{s}| \\
R & = & \sqrt{hs^{2} - |x_{c} - x_{s}|^{2}} \\
-\alpha & = & 180 -90 - \beta - 2SOM \\
+\alpha & = & ATT - 2SOM \\
\beta & = & 180 - 90 - 2MOM \\
MOM & = & polarizer \omega \\
SOM & = & sample \omega \\
@@ -141,6 +141,34 @@ $\langle$amorinterface {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@@\\
\mbox{}\verb@ Mark Koennecke, September 1999@\\
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
+\mbox{}\verb@@\\
+\mbox{}\verb@/* distance detector sample */@\\
+\mbox{}\verb@#define PARDS 0@\\
+\mbox{}\verb@/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */@\\
+\mbox{}\verb@#define PARDH 1@\\
+\mbox{}\verb@/* distance diaphragm 4 - sample */@\\
+\mbox{}\verb@#define PARDD4 2@\\
+\mbox{}\verb@/* distance to diaphragm 5 */@\\
+\mbox{}\verb@#define PARDD5 3@\\
+\mbox{}\verb@/* interrupt to issue when a motor fails on this */@\\
+\mbox{}\verb@#define PARINT 4@\\
+\mbox{}\verb@/* base height of counter station */@\\
+\mbox{}\verb@#define PARDDH 5@\\
+\mbox{}\verb@/* height of D4 */@\\
+\mbox{}\verb@#define PARD4H 6@\\
+\mbox{}\verb@/* height of D5 */@\\
+\mbox{}\verb@#define PARD5H 7@\\
+\mbox{}\verb@/* base height of analyzer */@\\
+\mbox{}\verb@#define PARANA 8@\\
+\mbox{}\verb@/* distance of analyzer from sample */@\\
+\mbox{}\verb@#define PARADIS 9@\\
+\mbox{}\verb@/* flag analyzer calculation on/off */@\\
+\mbox{}\verb@#define ANAFLAG 10@\\
+\mbox{}\verb@/* constant for second detector */@\\
+\mbox{}\verb@#define PARDDD 11@\\
+\mbox{}\verb@/* constant part of AOM */@\\
+\mbox{}\verb@#define PARAOM 12@\\
+\mbox{}\verb@@\\
\mbox{}\verb@@$\langle$putput {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@@$\langle$amoredata {\footnotesize ?}$\rangle$\verb@@\\
diff --git a/amor2t.w b/amor2t.w
index c8121322..9c28a7f5 100644
--- a/amor2t.w
+++ b/amor2t.w
@@ -98,6 +98,34 @@ functions for interacting with the interpreter.
Mark Koennecke, September 1999
----------------------------------------------------------------------------*/
+
+/* distance detector sample */
+#define PARDS 0
+/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
+#define PARDH 1
+/* distance diaphragm 4 - sample */
+#define PARDD4 2
+/* distance to diaphragm 5 */
+#define PARDD5 3
+/* interrupt to issue when a motor fails on this */
+#define PARINT 4
+/* base height of counter station */
+#define PARDDH 5
+/* height of D4 */
+#define PARD4H 6
+/* height of D5 */
+#define PARD5H 7
+/* base height of analyzer */
+#define PARANA 8
+/* distance of analyzer from sample */
+#define PARADIS 9
+/* flag analyzer calculation on/off */
+#define ANAFLAG 10
+/* constant for second detector */
+#define PARDDD 11
+/* constant part of AOM */
+#define PARAOM 12
+
@
@
diff --git a/amorstat.c b/amorstat.c
index 7ef6a0bc..daa504f3 100644
--- a/amorstat.c
+++ b/amorstat.c
@@ -8,6 +8,13 @@
copyright: see copyright.h
Mark Koennecke, September 1999
+
+ As AMOR's histogram memory becomes too big in tof mode to transfer it
+ for status information the collapse and subsample functionalities have
+ been moved to the histogram memory. This code had to be modified to
+ call SINQHMProject directly.
+
+ Mark Koennecke, August 2001
--------------------------------------------------------------------------*/
#include
#include
@@ -16,7 +23,12 @@
#include "fortify.h"
#include "sics.h"
#include "counter.h"
+#include "stringdict.h"
#include "HistMem.h"
+#include "HistMem.i"
+#include "HistDriv.i"
+#include "hardsup/sinqhm.h"
+#include "sinqhmdriv.i"
#include "scan.h"
#include "lld.h"
#include "amorstat.i"
@@ -483,22 +495,18 @@
static int Collapse(pAmorStat self, SConnection *pCon)
{
HistInt *lData = NULL;
- int i, i2, i3, iDim[MAXDIM], iIdx, iSum;
+ int i, i2, i3, iDim[MAXDIM], iIdx, iSum, status, length;
int *iImage = NULL, *iPtr;
+ pSINQHM pHist;
+ SinqHMDriv *pTata;
/* get size of our problem */
GetHistDim(self->pHM,iDim,&i3);
assert(i3 == 3);
- /* get data */
- lData = GetHistogramPointer(self->pHM,pCon);
- if(!lData)
- {
- return 0;
- }
-
/* allocate some data */
- iImage = (int *)malloc((2 + iDim[0]*iDim[1])*sizeof(int));
+ length = 2 + iDim[0]*iDim[1];
+ iImage = (int *)malloc(length*sizeof(int));
if(iImage == NULL)
{
SCWrite(pCon,"ERROR: failed to allocate memory in Collapse",eError);
@@ -510,20 +518,46 @@
iImage[0] = htonl(iDim[0]);
iImage[1] = htonl(iDim[1]);
- /* loop the loop */
- for(i = 0; i < iDim[0]; i++)
+
+ if(isSINQHMDriv(self->pHM->pDriv))
{
- for(i2 = 0; i2 < iDim[1]; i2++)
- {
- iPtr = lData + i*iDim[1]*iDim[2] +
- i2*iDim[2];
- iIdx = i*iDim[1] + i2;
- for(i3 = 0, iSum = 0; i3 < iDim[2]; i3++)
+ /*
+ send a Project request to the histogram memory
+ */
+ pTata = (SinqHMDriv *)self->pHM->pDriv->pPriv;
+ pHist = (pSINQHM)pTata->pMaster;
+ /*
+ The 3 in the following call has to be identical to
+ PROJECT__COLL in sinqhm_def.h
+ */
+ status = SINQHMProject(pHist, 3, 0, iDim[0],
+ 0, iDim[1], iImage+2, (length-2)*sizeof(int));
+ /*
+ Byte swapping
+ */
+ for(i = 2; i < length; i++)
+ {
+ iImage[i] = htonl(iImage[i]);
+ }
+ if(status != 1)
+ {
+ SCWrite(pCon,"ERROR: histogram memory refused to Collapse",eError);
+ return 0;
+ }
+ }
+ else
+ {
+ /*
+ we are in simulation and justcreate some random numbers
+ */
+ for(i = 0; i < iDim[0]; i++)
+ {
+ for(i2 = 0; i2 < iDim[1]; i2++)
{
- iSum += iPtr[i3];
- }
- iImage[iIdx+2] = htonl(iSum);
- }
+ iIdx = i*iDim[1] + i2;
+ iImage[iIdx+2] = htonl(random());
+ }
+ }
}
/* send image */
@@ -541,17 +575,14 @@
{
int iDim[MAXDIM], i, i2, i3, *iSum = NULL, iLang, *iPtr;
HistInt *lData = NULL;
- int iLimit;
+ int iLimit, status;
char pBueffel[132];
+ pSINQHM pHist;
+ SinqHMDriv *pTata;
- /* get histogram data */
+ /* get histogram dimensions */
GetHistDim(self->pHM,iDim,&i3);
assert(i3 == 3);
- lData = GetHistogramPointer(self->pHM,pCon);
- if(!lData)
- {
- return 0;
- }
/* check limits */
if(x2 < x1)
@@ -629,25 +660,36 @@
}
memset(iSum,0,(iDim[2]+1)*sizeof(int));
- /* do it! */
- iSum[0] = iDim[2];
- for(i = x1; i < x2; i++)
+ iSum[0] = htonl(iDim[2]);
+ if(isSINQHMDriv(self->pHM->pDriv))
{
- for(i2 = x1; i2 < y2; i2++)
- {
- iPtr = lData + i*iDim[1]*iDim[2] +
- i2*iDim[2];
- for(i3 = 0; i3 < iDim[2]; i3++)
- {
- iSum[i3+1] += iPtr[i3];
- }
- }
+ /*
+ send project message to histogram memory
+ */
+ pTata = (SinqHMDriv *)self->pHM->pDriv->pPriv;
+ pHist = (pSINQHM)pTata->pMaster;
+ status = SINQHMProject(pHist, 4, x1, x2-x1,
+ y1, y2-y1, iSum+1, iDim[2]*sizeof(int));
+ /*
+ convert to network byte order
+ */
+ for(i = 1; i < iDim[2]+1; i++)
+ {
+ iSum[i] = htonl(iSum[i]);
+ }
+ if(status != 1)
+ {
+ SCWrite(pCon,"ERROR: histogram memory refused to SubSample",eError);
+ return 0;
+ }
}
-
- /* network byte order */
- for(i = 0; i < iDim[2]+1; i++)
+ else
{
- iSum[i] = htonl(iSum[i]);
+ /* do acouple of random numbers! */
+ for(i = 1; i < iDim[2]+1; i++)
+ {
+ iSum[i] = htonl(random());
+ }
}
/* send */
@@ -766,6 +808,18 @@
InvokeCallBack(self->pCall, FILELOADED,self);
SCSendOK(pCon);
}
+ else if(strcmp(argv[1],"tofmode") == 0)
+ {
+ HMCountStartCallback(COUNTSTART,NULL,pCon);
+ return 1;
+ }
+ else
+ {
+ sprintf(pBueffel,"ERROR: %s nor recognized as subcommand to %s",
+ argv[1], argv[2]);
+ SCWrite(pCon,pBueffel,eError);
+ return 0;
+ }
return 1;
}
diff --git a/amortest.tcl b/amortest.tcl
index 4b54e306..82785625 100644
--- a/amortest.tcl
+++ b/amortest.tcl
@@ -177,7 +177,7 @@ Motor D5B SIM 0. 1000. .1 2. # bottom
#======================== counter
VarMake detectordist Float Mugger
detectordist 200.
-MakeCounter counter SIM
+MakeCounter counter SIM .0001
Motor COZ SIM 0. 1000. .1 2. # counter table height
Motor C3Z SIM 0. 300. .1 2. # counter height
Motor COM SIM -30. 30. .1 2. # counter omega
@@ -185,19 +185,25 @@ Motor COX SIM -100. 100. .1 2. # counter x
ClientPut "Motors initialized"
#======================== histogram memory
-MakeHM hm SIM
-hm configure HistMode TOF
+MakeHM hm SinqHM
+hm configure HistMode PSD
hm configure OverFlowMode Ceil
hm configure Rank 1
-hm configure dim0 128
-hm configure dim1 128
-hm configure Length 16384
+hm configure dim0 256
+hm configure dim1 256
+hm configure xfac 10
+hm configure yfac 10
+hm configure xoff 128
+hm configure yoff 128
+hm configure Length 65536
hm configure BinWidth 4
hm preset 100.
hm CountMode Timer
+hm configure HMComputer psds03.psi.ch
+hm configure HMPort 2400
hm configure Counter counter
hm configure init 0
-hm genbin 0. 35. 100
+hm genbin 0. 33 5
hm init
ClientPut "Histogram Memory Initialized"
@@ -216,7 +222,6 @@ SicsDataPostFix lock
MakeDataNumber SicsDataNumber $home/danu.dat
-MakeStoreAmor hm
#--------------------------------------------------------------------------
# C o m m a n d I n i t i a l i z a t i o n
@@ -253,6 +258,8 @@ set a2t(aoz) aoz
set a2t(c3z) c3z
MakeAmor2T a2t a2t aom2t
+MakeStoreAmor hm a2t
+
#=========== Status Display Support
MakeAmorStatus amorstatus xxxscan hm
source amorpar.tcl
diff --git a/crysconv.c b/crysconv.c
new file mode 100644
index 00000000..e6e14dbf
--- /dev/null
+++ b/crysconv.c
@@ -0,0 +1,536 @@
+/* crysconv.f -- translated by f2c (version 20000817).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include "f2c.h"
+
+/* Common Block Declarations */
+
+struct {
+ doublereal s[16] /* was [4][4] */, sinv[16] /* was [4][4] */;
+ integer iok;
+} osolem_;
+
+#define osolem_1 osolem_
+
+/* ================ */
+
+/* dec$ Ident 'V01A' */
+/* ------------------------------------------------------------------ */
+/* Updates: */
+/* V01A 7-May-1996 DM. Put error output to IOLUN, use IMPLICIT NONE and */
+/* get the code indented so that it is readable! */
+/* made F77 compliant. Mark Koennecke July 1996 */
+/* ------------------------------------------------------------------ */
+/* Routines to deal with the reciprocical lattice PB */
+/* ------------------------------------------------------------------ */
+/* Entry points in this file: */
+
+/* SETRLP : CALCULATION OF S AND INVS , ORIENTATION MATRIX */
+/* RL2SPV : TRANSFO FROM RECIP LAT TO SCAT PLANE */
+/* SP2RLV : TRANSFO FROM SCAT PLANE TO RECIP LAT */
+/* INVS : INVERT MATRIX S, GENERATED BY SETRLP. */
+/* ERRESO : DEAL ITH ERROR MESSAGES FOR ALL MODULES */
+
+/* SUBROUTINE SETRLP(SAM,IER) */
+/* SUBROUTINE RL2SPV(QHKL,QT,QM,QS,IER) */
+/* SUBROUTINE SP2RLV(QHKL,QT,QM,QS,IER) */
+/* SUBROUTINE INVS(S,SINV,IER) */
+/* SUBROUTINE ERRESO(MODULE,IER) */
+/* ------------------------------------------------------------------ */
+/* Subroutine */ int setrlp_(doublereal *sam, integer *ier)
+{
+ /* System generated locals */
+ doublereal d__1;
+
+ /* Builtin functions */
+ double cos(doublereal), sin(doublereal), sqrt(doublereal), atan(
+ doublereal);
+
+ /* Local variables */
+ static doublereal alfa[3], cosa[3], cosb[3];
+ static integer imod;
+ static doublereal sina[3], sinb[3], aspv[6] /* was [3][2] */;
+ extern /* Subroutine */ int invs_(doublereal *, doublereal *, integer *);
+ static doublereal a[3], b[3], c__[3], bb[9] /* was [3][3] */, cc;
+ static integer id, ie, jd, je, jf, kg, lf, lh, md, me, ne;
+ static doublereal zp, vv[9] /* was [3][3] */;
+ extern /* Subroutine */ int erreso_(integer *, integer *);
+ static doublereal rlb[6] /* was [3][2] */;
+
+/* ============================ */
+
+/* SETRLP: Computation of matrix S which transforms (QH,QK,QL) to */
+/* vector (Q1,Q2) in scattering plane (defined by vectors A1,A2) */
+/* and SINV matrix for the inverse transformation */
+
+/* INPUT SAM SAMPLE CHARACTERISTICS */
+/* SAM(1)=AS LATTICE PARAMETERS */
+/* SAM(2)=BS ------------------ */
+/* SAM(3)=CS ------------------ */
+/* SAM(4)=AA LATTICE ANGLES */
+/* SAM(5)=BB -------------- */
+/* SAM(6)=CC -------------- */
+/* SAM(7)=AX VECTOR A IN SCATTERING PLANE */
+/* SAM(8)=AY ---------------------------- */
+/* SAM(9)=AZ ---------------------------- */
+/* SAM(10)=BX VECTOR B IN SCATTERING PLANE */
+/* SAM(11)=BY ---------------------------- */
+/* SAM(12)=BZ ---------------------------- */
+/* OUTPUT IER ERROR RETURN TO BE TREATED BY ERRESO */
+/* IER=1 ERROR ON LATTICE PARAMETERS */
+/* IER=2 ERROR ON LATTICE ANGLES */
+/* IER=3 ERROR ON VECTORS A1, A2 */
+/* ------------------------------------------------------------------ */
+
+/* ------------------------------------------------------------------ */
+/* Define the dummy arguments */
+/* ------------------------------------------------------------------ */
+/* DO NOT EXPORT THE FOLLOWING COMMON ! */
+/* IT IS JUST FOR PERMANENT STORAGE USE */
+
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/* SOME TESTS AND INIT OF CALCUALTION */
+
+ /* Parameter adjustments */
+ --sam;
+
+ /* Function Body */
+ *ier = 0;
+ imod = 1;
+ zp = 6.2831853071795862;
+ osolem_1.iok = 0;
+ for (id = 1; id <= 3; ++id) {
+ a[id - 1] = sam[id];
+ alfa[id - 1] = sam[id + 3];
+ aspv[id - 1] = sam[id + 6];
+ aspv[id + 2] = sam[id + 9];
+/* L10: */
+ }
+
+ for (id = 1; id <= 3; ++id) {
+ *ier = 1;
+ if ((d__1 = a[id - 1], abs(d__1)) <= 1e-8) {
+ goto L999;
+ }
+ *ier = 0;
+/* L20: */
+ }
+ for (id = 1; id <= 3; ++id) {
+ a[id - 1] /= zp;
+ alfa[id - 1] /= 57.29577951308232087679815481410517;
+ cosa[id - 1] = cos(alfa[id - 1]);
+ sina[id - 1] = sin(alfa[id - 1]);
+/* L30: */
+ }
+ cc = cosa[0] * cosa[0] + cosa[1] * cosa[1] + cosa[2] * cosa[2];
+ cc = cosa[0] * 2. * cosa[1] * cosa[2] + 1. - cc;
+ *ier = 2;
+ if (cc <= .1) {
+ goto L999;
+ }
+ *ier = 0;
+ cc = sqrt(cc);
+ je = 2;
+ kg = 3;
+ for (id = 1; id <= 3; ++id) {
+ b[id - 1] = sina[id - 1] / (a[id - 1] * cc);
+ cosb[id - 1] = (cosa[je - 1] * cosa[kg - 1] - cosa[id - 1]) / (sina[
+ je - 1] * sina[kg - 1]);
+ sinb[id - 1] = sqrt(1. - cosb[id - 1] * cosb[id - 1]);
+ rlb[id + 2] = (d__1 = atan(sinb[id - 1] / cosb[id - 1]), abs(d__1)) *
+ 57.29577951308232087679815481410517;
+ je = kg;
+ kg = id;
+/* L40: */
+ }
+ bb[0] = b[0];
+ bb[1] = 0.;
+ bb[2] = 0.;
+ bb[3] = b[1] * cosb[2];
+ bb[4] = b[1] * sinb[2];
+ bb[5] = 0.;
+ bb[6] = b[2] * cosb[1];
+ bb[7] = -b[2] * sinb[1] * cosa[0];
+ bb[8] = 1. / a[2];
+
+ for (id = 1; id <= 3; ++id) {
+ rlb[id - 1] = 0.;
+ for (je = 1; je <= 3; ++je) {
+/* Computing 2nd power */
+ d__1 = bb[je + id * 3 - 4];
+ rlb[id - 1] += d__1 * d__1;
+/* L60: */
+ }
+ *ier = 1;
+ if ((d__1 = rlb[id - 1], abs(d__1)) <= 1e-8) {
+ goto L999;
+ }
+ *ier = 0;
+ rlb[id - 1] = sqrt(rlb[id - 1]);
+/* L50: */
+ }
+/* ----------------------------------------------------------------------- */
+/* GENERATION OF S ORIENTATION MATRIX REC. LATTICE TO SCATTERING PLANE */
+
+ for (kg = 1; kg <= 2; ++kg) {
+ for (ie = 1; ie <= 3; ++ie) {
+ vv[kg + ie * 3 - 4] = 0.;
+ for (jf = 1; jf <= 3; ++jf) {
+ vv[kg + ie * 3 - 4] += bb[ie + jf * 3 - 4] * aspv[jf + kg * 3
+ - 4];
+/* L90: */
+ }
+/* L80: */
+ }
+/* L70: */
+ }
+ for (md = 3; md >= 2; --md) {
+ for (ne = 1; ne <= 3; ++ne) {
+ id = md % 3 + 1;
+ je = (md + 1) % 3 + 1;
+ kg = ne % 3 + 1;
+ lh = (ne + 1) % 3 + 1;
+ vv[md + ne * 3 - 4] = vv[id + kg * 3 - 4] * vv[je + lh * 3 - 4] -
+ vv[id + lh * 3 - 4] * vv[je + kg * 3 - 4];
+/* L110: */
+ }
+/* L100: */
+ }
+
+ for (id = 1; id <= 3; ++id) {
+ c__[id - 1] = 0.;
+ for (je = 1; je <= 3; ++je) {
+/* Computing 2nd power */
+ d__1 = vv[id + je * 3 - 4];
+ c__[id - 1] += d__1 * d__1;
+/* L130: */
+ }
+ *ier = 3;
+ if ((d__1 = c__[id - 1], abs(d__1)) <= 1e-6) {
+ goto L999;
+ }
+ *ier = 0;
+ c__[id - 1] = sqrt(c__[id - 1]);
+/* L120: */
+ }
+
+ for (id = 1; id <= 3; ++id) {
+ for (je = 1; je <= 3; ++je) {
+ vv[je + id * 3 - 4] /= c__[je - 1];
+/* L160: */
+ }
+/* L150: */
+ }
+ for (kg = 1; kg <= 3; ++kg) {
+ for (me = 1; me <= 3; ++me) {
+ osolem_1.s[kg + (me << 2) - 5] = 0.;
+ for (lf = 1; lf <= 3; ++lf) {
+ osolem_1.s[kg + (me << 2) - 5] += vv[kg + lf * 3 - 4] * bb[lf
+ + me * 3 - 4];
+/* L190: */
+ }
+/* L180: */
+ }
+/* L170: */
+ }
+ osolem_1.s[15] = 1.;
+ for (jd = 1; jd <= 3; ++jd) {
+ osolem_1.s[(jd << 2) - 1] = 0.;
+ osolem_1.s[jd + 11] = 0.;
+/* L200: */
+ }
+/* ----------------------------------------------------------------------- */
+/* INVERT TRANSFORMATION MATRIX S AND PU RESULT IN SINV */
+
+ *ier = 3;
+ invs_(osolem_1.s, osolem_1.sinv, ier);
+ *ier = 0;
+ if (*ier != 0) {
+ goto L999;
+ }
+ osolem_1.iok = 123;
+/* --------------------------------------------------------------------------- */
+/* SORTIE */
+
+L999:
+ if (*ier != 0) {
+ erreso_(&imod, ier);
+ }
+ return 0;
+} /* setrlp_ */
+
+/* =========================================================================== */
+/* Subroutine */ int rl2spv_(doublereal *qhkl, doublereal *qt, doublereal *qm,
+ doublereal *qs, integer *ier)
+{
+ /* System generated locals */
+ doublereal d__1;
+
+ /* Builtin functions */
+ double sqrt(doublereal);
+
+ /* Local variables */
+ static integer id, je;
+
+/* ========================================= */
+
+/* ------------------------------------------------------------------ */
+/* INPUT QHKL QHKL -> QT */
+/* A Q-VECTOR TO BE TRANSFORM FROM RECIP LATTICE TO SCATTERING PLANE */
+/* CHECK THAT Q-VECTOR IS IN THE PLANE */
+
+/* INPUT Q-VECTOR QHKL(3) Q-VECTOR IN RECIPROCICAL LATTICVE */
+
+/* OUTPUT Q-VECTOR QT(3) Q-VECTOR IN SCATTERING PLANE */
+/* OUTPUT QM AND QS QMODULUS AND ITS SQUARE ( TO BE VERIFIED ) */
+/* OUTPUT ERROR IER */
+/* IER=1 MATRIX S NOT OK */
+/* IER=2 Q NOT IN SCATTERING PLANE */
+/* IER=3 Q MODULUS TOO SMALL */
+/* ------------------------------------------------------------------ */
+
+/* ------------------------------------------------------------------ */
+/* Define the dummy arguments */
+/* ------------------------------------------------------------------ */
+/* DO NOT EXPORT THE FOLLWING COOMON ! */
+/* IT IS JUST FOR PERMANENT STORAGE USE */
+
+/* --------------------------------------------------------------------------- */
+/* --------------------------------------------------------------------------- */
+/* INIT AND TEST IF TRANSFO MATRICES ARE OK */
+ /* Parameter adjustments */
+ --qt;
+ --qhkl;
+
+ /* Function Body */
+ *ier = 1;
+ if (osolem_1.iok != 123) {
+ goto L999;
+ }
+ *ier = 0;
+/* ----------------------------------------------------------------------- */
+
+ for (id = 1; id <= 3; ++id) {
+ qt[id] = 0.;
+ for (je = 1; je <= 3; ++je) {
+ qt[id] += qhkl[je] * osolem_1.s[id + (je << 2) - 5];
+/* L20: */
+ }
+/* L10: */
+ }
+ *ier = 2;
+ if (abs(qt[3]) > 1e-4) {
+ goto L999;
+ }
+ *ier = 0;
+ *qs = 0.;
+ for (id = 1; id <= 3; ++id) {
+/* Computing 2nd power */
+ d__1 = qt[id];
+ *qs += d__1 * d__1;
+/* L30: */
+ }
+ if (*qs < 1e-8) {
+ *ier = 3;
+ } else {
+ *qm = sqrt(*qs);
+ }
+/* --------------------------------------------------------------------------- */
+
+L999:
+ return 0;
+} /* rl2spv_ */
+
+/* =========================================================================== */
+/* Subroutine */ int sp2rlv_(doublereal *qhkl, doublereal *qt, doublereal *qm,
+ doublereal *qs, integer *ier)
+{
+ /* System generated locals */
+ doublereal d__1;
+
+ /* Builtin functions */
+ double sqrt(doublereal);
+
+ /* Local variables */
+ static integer id, je;
+
+/* ========================================= */
+
+/* ------------------------------------------------------------------ */
+/* INPUT QT QHKL <- QT */
+/* A Q-VECTOR TO BE TRANSFORM FROM SCATTERING PLANE TO RECIP LATTICE */
+/* CHECK THAT Q, D & G VECTORS ARE IN THE SCATTERING PLANE */
+
+/* INPUT Q-VECTOR QT(3) Q-VECTOR IN SCATTERING PLANE */
+
+/* OUTPUT Q-VECTOR QHKL(3) Q-VECTOR IN RECIPROCICAL LATTICVE */
+/* OUTPUT QM AND QS QMODULUS AND ITS SQUARE ( TO BE VERIFIED ) */
+/* OUTPUT ERROR IER */
+/* IER=1 MATRIX S NOT OK */
+/* IER=2 Q NOT IN SCATTERING PLANE */
+/* IER=3 Q MODULUS TOO SMALL */
+/* ------------------------------------------------------------------ */
+
+/* ------------------------------------------------------------------ */
+/* Define the dummy arguments */
+/* ------------------------------------------------------------------ */
+/* DO NOT EXPORT THE FOLLWING COOMON ! */
+/* IT IS JUST FOR PERMANENT STORAGE USE */
+
+/* --------------------------------------------------------------------------- */
+/* --------------------------------------------------------------------------- */
+/* INIT AND TEST IF TRANSFO MATRICES ARE OK */
+ /* Parameter adjustments */
+ --qt;
+ --qhkl;
+
+ /* Function Body */
+ *ier = 1;
+ if (osolem_1.iok != 123) {
+ goto L999;
+ }
+ *ier = 2;
+ if (abs(qt[3]) > 1e-4) {
+ goto L999;
+ }
+ *ier = 0;
+/* ----------------------------------------------------------------------- */
+ *qs = 0.;
+ for (id = 1; id <= 3; ++id) {
+/* Computing 2nd power */
+ d__1 = qt[id];
+ *qs += d__1 * d__1;
+/* L10: */
+ }
+ if (*qs < 1e-8) {
+ *ier = 3;
+ } else {
+ *qm = sqrt(*qs);
+ }
+/* ----------------------------------------------------------------------- */
+
+ for (id = 1; id <= 3; ++id) {
+ qhkl[id] = 0.;
+ for (je = 1; je <= 3; ++je) {
+ qhkl[id] += osolem_1.sinv[id + (je << 2) - 5] * qt[je];
+/* L30: */
+ }
+/* L20: */
+ }
+/* --------------------------------------------------------------------------- */
+
+L999:
+ return 0;
+} /* sp2rlv_ */
+
+/* ========================================================================== */
+/* Subroutine */ int invs_(doublereal *s, doublereal *sinv, integer *ier)
+{
+ /* Initialized data */
+
+ static integer m[3] = { 2,3,1 };
+ static integer n[3] = { 3,1,2 };
+
+ static integer id, je, mi, mj, ni, nj;
+ static doublereal det;
+
+/* ============================== */
+
+/* ------------------------------------------------------------------ */
+/* ROUTINE TO INVERT MATRIX S, GENERATED BY SETRLP, WHICH TRANSFORMS */
+/* (QH,QK,QL) TO (Q1,Q2) IN THE SCATTERING PLANE */
+/* INPUT MATRIX DOUBLE PRECISION S(4,4) */
+/* OUTPUT MATRIX DOUBLE PRECISION SINV(4,4) */
+/* OUTPUT ERROR IER */
+/* IER=1 DETERMINANT OF MATRIX S TOO SMALL */
+/* ------------------------------------------------------------------ */
+
+/* ------------------------------------------------------------------ */
+/* Define the dummy arguments */
+/* ------------------------------------------------------------------ */
+
+ /* Parameter adjustments */
+ sinv -= 5;
+ s -= 5;
+
+ /* Function Body */
+/* ------------------------------------------------------------------ */
+ *ier = 0;
+ for (id = 1; id <= 4; ++id) {
+ for (je = 1; je <= 4; ++je) {
+ sinv[id + (je << 2)] = 0.;
+/* L20: */
+ }
+/* L10: */
+ }
+ det = 0.;
+ for (id = 1; id <= 3; ++id) {
+ for (je = 1; je <= 3; ++je) {
+ mi = m[id - 1];
+ mj = m[je - 1];
+ ni = n[id - 1];
+ nj = n[je - 1];
+ sinv[je + (id << 2)] = s[mi + (mj << 2)] * s[ni + (nj << 2)] - s[
+ ni + (mj << 2)] * s[mi + (nj << 2)];
+/* L40: */
+ }
+ det += s[id + 4] * sinv[(id << 2) + 1];
+/* L30: */
+ }
+ if (abs(det) < 1e-6) {
+ *ier = 1;
+ } else {
+ for (id = 1; id <= 3; ++id) {
+ for (je = 1; je <= 3; ++je) {
+ sinv[id + (je << 2)] /= det;
+/* L70: */
+ }
+/* L60: */
+ }
+ }
+ sinv[20] = 1.;
+ return 0;
+} /* invs_ */
+
+/* ========================================================================= */
+/* Subroutine */ int erreso_(integer *module, integer *ier)
+{
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Local variables */
+ static integer lmod, lier;
+
+/* ============================= */
+
+/* ------------------------------------------------------------------ */
+/* SUBROUTINE TO TREAT ERRORS FROM RESOLUTION CALCULATIONS */
+/* MODULE = 1 -> SETRLP */
+/* MODULE = 2 -> RL2SPV */
+/* MODULE = 3 -> EX_CASE */
+/* ------------------------------------------------------------------ */
+
+
+/* INCLUDE 'MAD_DEF:IOLSDDEF.INC' */
+/* ------------------------------------------------------------------ */
+/* Define the dummy arguments */
+/* ------------------------------------------------------------------ */
+
+
+/* --------------------------------------------------------------------------- */
+/* Computing MIN */
+ i__1 = max(*ier,1);
+ lier = min(i__1,4);
+/* Computing MIN */
+ i__1 = max(*module,1);
+ lmod = min(i__1,3);
+/* WRITE(6,501) MESER(LIER,LMOD) */
+/* 501 FORMAT(A) */
+ return 0;
+} /* erreso_ */
+
diff --git a/cryst.c b/cryst.c
new file mode 100644
index 00000000..5ae01f8b
--- /dev/null
+++ b/cryst.c
@@ -0,0 +1,114 @@
+/*---------------------------------------------------------------------------
+ C r y s t
+
+ This is a library of crystallographic utility routines for four
+ circle diffractometers. It deals with all sorts of rotations and
+ stuff. This is based on code originally developed by John Allibon
+ at ILL and reimplemented in C using a matrix-library.
+
+ Mark Koennecke, July 2000
+----------------------------------------------------------------------------*/
+#include
+#include
+#include
+#include
+#include "matrix/matrix.h"
+#include "cryst.h"
+
+#define PIR 57.30
+
+/*-------------------------------------------------------------------------
+ chimat, calculate chi rotation matrix. The input angle is in degrees.
+ The setting is Busing & Levy.
+--------------------------------------------------------------------------*/
+
+MATRIX chimat(double dAngle)
+{
+ MATRIX res;
+ double dChi;
+
+ res = mat_creat(3,3,ZERO_MATRIX);
+ dChi = dAngle/PIR;
+
+ res[0][0] = cos(dChi);
+ res[0][2] = sin(dChi);
+ res[1][1] = 1.;
+ res[2][0] = -res[0][2];
+ res[2][2] = res[0][0];
+
+ return res;
+}
+
+
+/*-------------------------------------------------------------------------
+ phimat, calculate phi rotation matrix. The input angle is in degrees.
+ The setting is Busing & Levy.
+--------------------------------------------------------------------------*/
+
+MATRIX phimat(double dAngle)
+{
+ MATRIX res;
+ double dPhi;
+
+ res = mat_creat(3,3,ZERO_MATRIX);
+ dPhi = dAngle/PIR;
+
+ res[0][0] = cos(dPhi);
+ res[0][1] = sin(dChi);
+ res[2][2] = 1.;
+ res[1][0] = -res[0][1];
+ res[1][1] = res[0][0];
+
+ return res;
+}
+/*-------------------------------------------------------------------------
+ psimat, calculate psi rotation matrix. The input angle is in degrees.
+ The setting is Busing & Levy.
+--------------------------------------------------------------------------*/
+
+MATRIX psimat(double dAngle)
+{
+ MATRIX res;
+ double dPsi;
+
+ res = mat_creat(3,3,ZERO_MATRIX);
+ dPsi = dAngle/PIR;
+
+ res[0][0] = 1.;
+ res[1][1] = cos(dPsi);
+ res[1][2] = -sin(dPsi);
+ res[2][1] = -res[1][2];
+ res[2][2] = res[1][1];
+
+ return res;
+}
+
+/*-------------------------------------------------------------------------
+ diffFromAngles calculates the diffraction vector from two theta, omega
+ chi and phi. The angled need not be bissecting but it is assumed that
+ the diffraction vector is in the equatorial plane.
+--------------------------------------------------------------------------*/
+
+MATRIX diffFromAngles(double wave, double tth, double om,
+ double chi, double phi)
+{
+ MATRIX res, rot, dum, z;
+ double dTh;
+
+ dTh = (tth/2.)/PIR;
+ res = mat_creat(3,1,ZERO_MATRIX);
+ res[0][0] = (2.*sin(dTh)*cos(dTh))/wave;
+ res[1][0] = (-2. *sin(dTh)*sin(dTh))/wave;
+
+ /* undo omega rotation */
+ rot = phimat(om);
+ dum = mat_tran(rot);
+ mat_free(rot);
+ z = mat_mul(dum,res);
+ mat_free(dum);
+ mat_free(res);
+
+ /* result is now z */
+
+}
+
diff --git a/danu.dat b/danu.dat
index 2142b97b..dbd081e4 100644
--- a/danu.dat
+++ b/danu.dat
@@ -1,3 +1,3 @@
- 2
+ 24
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n
\ No newline at end of file
diff --git a/doc/manager/alias.htm b/doc/manager/alias.htm
index e33e7a79..19b6e41d 100644
--- a/doc/manager/alias.htm
+++ b/doc/manager/alias.htm
@@ -5,7 +5,8 @@
Aliases in SICS
-SICS knows two different kinds of aliases: object aliases and command
+SICS knows three different kinds of aliases: object aliases,
+runtime aliases and command
aliases. This is confusing but finds its explanation in the structure
of SICS internals.
@@ -22,7 +23,20 @@ command:
SicsAlias newname oldname
This command installs newname as alias for the object oldname.
-SicsAlias can only be used within initialization scripts.
+SicsAlias can only be used within initialization scripts. SicsAlias is
+ considrered deprecated and can be replaced with the superior runtime
+ aliases described below.
+
+Runtime Aliases
+
+Runtime aliases are full object aliases which can be configured into the
+ system at run time by a SICS manager. The syntax looks like this:
+
+- definealias SICSobject aliasname
+
- This defines aliasname to be the alias for the SICS object SICSobject.
+
- definealias aliasname
+
- This command deltes the alias aliasname.
+
Command Aliases
diff --git a/doc/manager/hwini.htm b/doc/manager/hwini.htm
index 00a67819..cb950bd0 100644
--- a/doc/manager/hwini.htm
+++ b/doc/manager/hwini.htm
@@ -46,7 +46,6 @@ number of the motor in the EL734 motor controller.
El734DC motor controller. The
parameters host, port, chan have the meanings defined above. no is the
number of the motor in the EL734DC motor controller.
-
MakePIMotor name c804 pararray
Creates a motr name connected to a C804 motor controller from the
manufacturer Physik Instrumente. Pararray is a Tcl array holding the
@@ -64,6 +63,7 @@ number of the motor in the EL734DC motor controller.
Creates a piezo electric positioning device. Again the controller is a
Physik Instrumente controller. pararray has the same meaning as for the
C804 controller given above.
+
Counting Devices
@@ -79,7 +79,6 @@ failures. This can be used in a instrument simulation server.
This command creates a single
counter name, using an EL737 driver. The counter is at host host, listening
at port port and sits at serial port chan.
-
MakeHMControl name counter hm1 hm2 hm3
At some instruments (for instance TRICS) multiple counters or
histogram memories are controlled by a master counter which watches
diff --git a/doc/manager/iscan.htm b/doc/manager/iscan.htm
index 726f1ee5..1c085062 100644
--- a/doc/manager/iscan.htm
+++ b/doc/manager/iscan.htm
@@ -91,26 +91,48 @@ NeXus files.
User Defined Scans
-In some cases users wish to exert more influence about the scan. Especially
- about what gets counted. In order to cater for this a hook was implemented
- in the internal scan command. This hook allows to run a tcl procedure at each
- scan point. This Tcl procedure is required to return a string containing
- up to 11 values for counters and monitors. The first value will be the one
- used as counts in the data file. The others will be placed as monitors.
- Please note, that only the first three monitors are written to file as of
- current. In order to use this facility the following steps are required:
+
+In some cases users wish to control the scan more closely, i.e. do
+multiple counting operations at the same point etc. This is especially
+true when magnets are involved. In order to do this a facility has
+been provided which allows the user to specify a macro routine which
+is called at each point. This macro routine then performs all
+necessary operations and then is responsible for storing its data. In
+order to this commands have been defined which allow to append a line
+to the scan data file and to store measured data in the scan data
+structure. The last feature is necessary in order to make scan status
+displays and scan analysis, such as center detection, work. The
+following steps are required:
-- Write The Tcl-macro procedure to run. Make sure that is creates proper
- output.
-
- Test the Tcl-procedure in SICS.
-
- Install the Tcl-procedure into the scan object with the
- xxscan command name syntax.
-
- Make the scan command use the Tcl procedure by setting channel to -10 with
- the xxscan setchannel -10 command.
+
- Write a suitable macro procedure for the actions required at each
+scan point. The procedure signature looks like this:
+
+proc myScanPoint {point} {
+}
+
And will be called with the number of the current scan point as
+a parameter. Besides all usual Tcl and SICS commands the following
+special commands may be used:
+
+- xxxscan line text
+
- Appends all the text after line to the scan data file.
+
- xxxscan storecounts c1 c2 c3 c4 ...
+
- Stores the first number given as count data, all the others as
+monitor values in the internal scan data structure.
+
+ - Test the procedure.
+
- Switch the internal scan command command into user scan mode with
+the command:
+xxxscan configure user
+
- Assign your procedure to the internal scan command with the
+command: xxxscan command myScanPoint
+
- Use normal scan commands for doing your scan.
+
- Switch the internal scan command into normal mode with the
+command:
+xxxscan configure standard.
-A hint: If you need to control the counting operation as well (because you
- are not using a counter to count) just run the scan object with a very low
- preset and do the counting yourself in your procedure.
+In all this replace xxxscan with the name of the internal scan
+command.