- Fixes to HM code for AMOR TOF

- A couple of TAS fixes
- o2t was fixed to work with any drivable
- FOCUS was mended to include beam monitor in data file
This commit is contained in:
cvs
2002-07-19 15:09:21 +00:00
parent e0c5afcf6d
commit bde19bb973
38 changed files with 604 additions and 249 deletions

93
hkl.c
View File

@ -13,6 +13,11 @@
Updated to use fourlib.
Mark Koennecke, December 2001
Introduced HM mode in order to cope with with the fact that TRICS has
three detectors.
Mark Koennecke, May 2002
-----------------------------------------------------------------------------*/
#include <math.h>
#include <ctype.h>
@ -47,6 +52,7 @@
name,
self->fUB[0], self->fUB[1], self->fUB[2], self->fUB[3], self->fUB[4],
self->fUB[5], self->fUB[6], self->fUB[7], self->fUB[8]);
fprintf(fd,"%s hm %d\n",name, self->iHM);
return 1;
}
@ -86,6 +92,7 @@
pNew->fLambda = 1.38;
pNew->iManual = 1;
pNew->iQuad = 1;
pNew->iHM = 0;
pNew->fUB[0] = 1.;
pNew->fUB[4] = 1.;
pNew->fUB[8] = 1.;
@ -369,19 +376,49 @@
return 1;
}
/*-----------------------------------------------------------------------*/
static int checkTheta(pHKL self, double *stt){
char pError[132];
int iTest;
float fHard;
iTest = MotorCheckBoundary(self->pTheta,(float)*stt, &fHard,pError,131);
if(!iTest)
{
/*
check if it is on the other detectors
*/
if(self->iHM){
iTest = MotorCheckBoundary(self->pTheta,(float)*stt-45.,
&fHard,pError,131);
if(iTest){
*stt -= 45.;
} else {
iTest = MotorCheckBoundary(self->pTheta,(float)*stt-90.,
&fHard,pError,131);
if(iTest) {
*stt -= 90.;
}
}
}
if(!iTest){
return -1;
}
}
return 1;
}
/*-----------------------------------------------------------------------*/
static int checkBisecting(pHKL self,
double stt, double om, double chi, double phi)
double *stt, double om, double chi, double phi)
{
int iTest;
float fHard, fLimit;
char pError[132];
/* check two theta */
iTest = MotorCheckBoundary(self->pTheta,(float)stt, &fHard,pError,131);
if(!iTest)
{
iTest = checkTheta(self, stt);
if(!iTest){
return -1;
}
}
/* for omega check against the limits +- SCANBORDER in order to allow for
a omega scan
@ -409,7 +446,7 @@ static int checkBisecting(pHKL self,
return 0;
}
/*-----------------------------------------------------------------------*/
static int checkNormalBeam(double om, double gamma, double nu,
static int checkNormalBeam(double om, double *gamma, double nu,
float fSet[4], SConnection *pCon, pHKL self)
{
int iTest;
@ -418,11 +455,11 @@ static int checkNormalBeam(double om, double gamma, double nu,
/* check omega, gamma and nu */
iTest = MotorCheckBoundary(self->pOmega,(float)om, &fHard,pError,131);
iTest += MotorCheckBoundary(self->pTheta,(float)gamma, &fHard,pError,131);
iTest += checkTheta(self,gamma);
iTest += MotorCheckBoundary(self->pNu,(float)nu, &fHard,pError,131);
if(iTest == 3) /* none of them burns */
{
fSet[0] = (float)gamma;
fSet[0] = (float)*gamma;
fSet[1] = (float)om;
fSet[2] = (float)nu;
return 1;
@ -433,7 +470,7 @@ static int checkNormalBeam(double om, double gamma, double nu,
tryOmegaTweak tries to calculate a psi angle in order to put an
offending omega back into range.
-----------------------------------------------------------------------*/
static int tryOmegaTweak(pHKL self, MATRIX z1, double stt, double *om,
static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
double *chi, double *phi){
int status;
float fLower, fUpper, omTarget, omOffset;
@ -478,7 +515,7 @@ static int tryOmegaTweak(pHKL self, MATRIX z1, double stt, double *om,
return 0;
}
if(checkBisecting(self,dumstt,offom,offchi,offphi)){
if(checkBisecting(self,&dumstt,offom,offchi,offphi)){
*om = offom;
*chi = offchi;
*phi = offphi;
@ -529,7 +566,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
phi = circlify(phi);
if(iRetry > 1)
{
if(tryOmegaTweak(self,z1,stt,&om,&chi,&phi)){
if(tryOmegaTweak(self,z1,&stt,&om,&chi,&phi)){
fSet[0] = (float)stt;
fSet[1] = (float)om;
fSet[2] = (float)circlify(chi);
@ -554,7 +591,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
chipsi = circlify(chipsi);
phipsi = circlify(phipsi);
test = checkBisecting(self,stt,ompsi,chipsi,phipsi);
test = checkBisecting(self,&stt,ompsi,chipsi,phipsi);
if(test == 1)
{
fSet[0] = (float)stt;
@ -643,7 +680,7 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
if(bisToNormalBeam(stt,ompsi,chipsi,phipsi,
&om, &gamma, &nu))
{
if(checkNormalBeam(om, gamma, nu,fSet,pCon,self))
if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{
return 1;
}
@ -708,7 +745,7 @@ static int calculateNormalBeamOmega(MATRIX z1, pHKL self,
if(bisToNormalBeam(stt,ompsi,chi,phi,
&om, &gamma, &nu))
{
if(checkNormalBeam(om, gamma, nu,fSet,pCon,self))
if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{
return 1;
}
@ -1212,8 +1249,9 @@ ente:
strtolower(argv[1]);
if(strcmp(argv[1],"list") == 0 )
{
sprintf(pBueffel,"lambda = %f Normal Beam = %d Quadrant = %d",
self->fLambda, self->iNOR, self->iQuad);
sprintf(pBueffel,
"lambda = %f Normal Beam = %d Quadrant = %d HM = %d",
self->fLambda, self->iNOR, self->iQuad,self->iHM);
SCWrite(pCon,pBueffel,eValue);
sprintf(pBueffel,"UB = { %f %f %f",
self->fUB[0], self->fUB[1],self->fUB[2]);
@ -1356,6 +1394,29 @@ ente:
SCSendOK(pCon);
return 1;
}
/*------------- HM mode */
else if(strcmp(argv[1],"hm") == 0)
{
if(argc < 3)
{
sprintf(pBueffel,"%s.hm = %d", argv[0],self->iHM);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
if(!SCMatchRights(pCon,usUser))
{
return 0;
}
if(!isNumeric(argv[2]))
{
sprintf(pBueffel,"ERROR: %s was not recognized as a number", argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
self->iHM = atoi(argv[2]);
SCSendOK(pCon);
return 1;
}
/*------------- normal beam */
else if(strcmp(argv[1],"nb") == 0)
{