- Adapted indenation to new agreed upon system
- Added support for second generation scriptcontext based counter
This commit is contained in:
61
tasublib.h
61
tasublib.h
@ -13,7 +13,7 @@
|
||||
#include "matrix/matrix.h"
|
||||
/*================= error codes =====================================*/
|
||||
#define ENERGYTOBIG -700
|
||||
#define BADSYNC -701 /* mono/analyzer out of sync: 2*theta != two_theta*/
|
||||
#define BADSYNC -701 /* mono/analyzer out of sync: 2*theta != two_theta */
|
||||
#define UBNOMEMORY -200
|
||||
#define TRIANGLENOTCLOSED -703
|
||||
#define BADRMATRIX -704
|
||||
@ -21,7 +21,7 @@
|
||||
/*========================== defines for tasMode ====================*/
|
||||
#define KICONST 1
|
||||
#define KFCONST 2
|
||||
#define ELASTIC 3
|
||||
#define ELASTIC 3
|
||||
/*
|
||||
* in elastic mode A5, A5 will be disregarded and ki = kf at all times
|
||||
*/
|
||||
@ -40,10 +40,10 @@
|
||||
* data structure describing a monochromator or analyzer crystal
|
||||
*/
|
||||
typedef struct {
|
||||
double dd; /* lattice spacing */
|
||||
int ss; /* scattering sense */
|
||||
double HB1, HB2; /* horizontal curvature parameters */
|
||||
double VB1, VB2; /* vertical curvature parameters */
|
||||
double dd; /* lattice spacing */
|
||||
int ss; /* scattering sense */
|
||||
double HB1, HB2; /* horizontal curvature parameters */
|
||||
double VB1, VB2; /* vertical curvature parameters */
|
||||
} maCrystal, *pmaCrystal;
|
||||
/**
|
||||
* the machine parameters of a triple axis spectrometer
|
||||
@ -51,17 +51,17 @@ typedef struct {
|
||||
typedef struct {
|
||||
maCrystal monochromator, analyzer;
|
||||
MATRIX UB;
|
||||
MATRIX planeNormal;
|
||||
int ss_sample; /* scattering sense sample */
|
||||
}tasMachine, *ptasMachine;
|
||||
MATRIX planeNormal;
|
||||
int ss_sample; /* scattering sense sample */
|
||||
} tasMachine, *ptasMachine;
|
||||
/**
|
||||
* a position in Q - Energy space
|
||||
*/
|
||||
*/
|
||||
typedef struct {
|
||||
double ki, kf;
|
||||
double qh,qk,ql;
|
||||
double qh, qk, ql;
|
||||
double qm;
|
||||
}tasQEPosition, *ptasQEPosition;
|
||||
} tasQEPosition, *ptasQEPosition;
|
||||
/**
|
||||
* A triple axis angle position
|
||||
*/
|
||||
@ -72,14 +72,14 @@ typedef struct {
|
||||
double sgl;
|
||||
double sgu;
|
||||
double analyzer_two_theta;
|
||||
}tasAngles, *ptasAngles;
|
||||
} tasAngles, *ptasAngles;
|
||||
/**
|
||||
* a full triple axis reflection
|
||||
*/
|
||||
typedef struct {
|
||||
tasQEPosition qe;
|
||||
tasAngles angles;
|
||||
}tasReflection, *ptasReflection;
|
||||
} tasReflection, *ptasReflection;
|
||||
/*================= Monochromator/Analyzer stuff =====================*/
|
||||
/**
|
||||
* convert an energy in meV to Ki, Kf type values
|
||||
@ -92,7 +92,7 @@ double energyToK(double energy);
|
||||
* @param input K value
|
||||
* @return output energy in meV
|
||||
*/
|
||||
double KtoEnergy(double k);
|
||||
double KtoEnergy(double k);
|
||||
/*----------------------------------------------------------------------*/
|
||||
/**
|
||||
* calculate two_theta for k
|
||||
@ -135,8 +135,8 @@ double maCalcK(maCrystal data, double two_theta);
|
||||
* @param ss The scattering sense at the sample
|
||||
* @return 1 on success, a negative error code on failure.
|
||||
*/
|
||||
int makeAuxReflection(MATRIX B, tasReflection r1,
|
||||
tasReflection *r2, int ss);
|
||||
int makeAuxReflection(MATRIX B, tasReflection r1,
|
||||
tasReflection * r2, int ss);
|
||||
/**
|
||||
* calculate the scattering vector
|
||||
* @param r The reflection for which to calculate the scattering vector.
|
||||
@ -162,9 +162,9 @@ int calcTwoTheta(MATRIX B, tasQEPosition ref, int ss, double *twoTheta);
|
||||
* when an error occurs.
|
||||
* @return a UB matix on sucess, or NULL on failure. Then errorCode
|
||||
* can be inspected what caused the problem.
|
||||
*/
|
||||
*/
|
||||
MATRIX calcTasUBFromTwoReflections(lattice cell, tasReflection r1,
|
||||
tasReflection r2, int *errorCode);
|
||||
tasReflection r2, int *errorCode);
|
||||
/**
|
||||
* calcluate the normal to the plane describe by the two reflections r1, r2
|
||||
* @param r1 first reflection
|
||||
@ -181,10 +181,9 @@ MATRIX calcPlaneNormal(tasReflection r1, tasReflection r2);
|
||||
* @param qe The desired Q Energy position
|
||||
* @param angles The resulting angles.
|
||||
* @return 1 on success, a negative error code when errors are encountered
|
||||
*/
|
||||
int calcTasQAngles(MATRIX UB, MATRIX planeNormal,
|
||||
int ss, tasQEPosition qe,
|
||||
ptasAngles angles);
|
||||
*/
|
||||
int calcTasQAngles(MATRIX UB, MATRIX planeNormal,
|
||||
int ss, tasQEPosition qe, ptasAngles angles);
|
||||
/**
|
||||
* calculate QH, QK, QL from the angles given
|
||||
* @param UB The UB matrix to use
|
||||
@ -202,7 +201,7 @@ int calcTasQH(MATRIX UB, tasAngles angles, ptasQEPosition qe);
|
||||
* @return 1 on success, a negative error code in case of problems
|
||||
*/
|
||||
int calcAllTasAngles(ptasMachine machine, tasQEPosition qe,
|
||||
ptasAngles angles);
|
||||
ptasAngles angles);
|
||||
/**
|
||||
* calculate the current position of the spectrometer in Q-E space from
|
||||
* angles.
|
||||
@ -212,7 +211,7 @@ int calcAllTasAngles(ptasMachine machine, tasQEPosition qe,
|
||||
* @return 1 on success, a negative error code on errors.
|
||||
*/
|
||||
int calcTasQEPosition(ptasMachine machine, tasAngles angles,
|
||||
ptasQEPosition qe);
|
||||
ptasQEPosition qe);
|
||||
/*======================== POWDER MODE =================================
|
||||
Powder mode is driving only QM, A3, SGGU, SGL will not be touched,
|
||||
only energy and sample two theta will be driven.
|
||||
@ -225,7 +224,7 @@ int calcTasQEPosition(ptasMachine machine, tasAngles angles,
|
||||
* @return 1 on success, a negative error code else
|
||||
*/
|
||||
int calcTasPowderAngles(ptasMachine machine, tasQEPosition qe,
|
||||
ptasAngles angles);
|
||||
ptasAngles angles);
|
||||
/**
|
||||
* calculate the current energy qm position from angles.
|
||||
* @param machine The spectrometer parameters.
|
||||
@ -233,8 +232,8 @@ int calcTasPowderAngles(ptasMachine machine, tasQEPosition qe,
|
||||
* @param qe The resulting qe position
|
||||
* @return 1 on success, a negative error code on errors
|
||||
*/
|
||||
int calcTasPowderPosition(ptasMachine machine, tasAngles angles,
|
||||
ptasQEPosition qe);
|
||||
int calcTasPowderPosition(ptasMachine machine, tasAngles angles,
|
||||
ptasQEPosition qe);
|
||||
/*======================= TAS Logic =====================================*/
|
||||
/**
|
||||
* set triple axis parameters, thereby taking the tasMode into account
|
||||
@ -243,7 +242,7 @@ int calcTasPowderPosition(ptasMachine machine, tasAngles angles,
|
||||
* @param tasVar The TAS variable to handle. This MUST be one of the
|
||||
* defines at the top of this file.
|
||||
* @param value The value to set for tasPar
|
||||
*/
|
||||
*/
|
||||
void setTasPar(ptasQEPosition qe, int tasMode, int tasVar, double value);
|
||||
/**
|
||||
* calculates the value of a TAS parameter from qe.
|
||||
@ -260,7 +259,7 @@ double getTasPar(tasQEPosition qe, int tasVar);
|
||||
* @param qe The QE position to check
|
||||
* @return 0 when not in plane,1 when in plane
|
||||
*/
|
||||
int isInPlane(MATRIX scatteringPlaneNormal, tasQEPosition qe);
|
||||
int isInPlane(MATRIX scatteringPlaneNormal, tasQEPosition qe);
|
||||
/**
|
||||
* calculate the normal of the scattering plane from two reflections
|
||||
* @param qe1 QE Position of first reflection in scattering plane
|
||||
@ -268,5 +267,5 @@ int isInPlane(MATRIX scatteringPlaneNormal, tasQEPosition qe);
|
||||
* @return The scattering plane normal
|
||||
*/
|
||||
MATRIX calcScatteringPlaneNormal(tasQEPosition qe1, tasQEPosition qe2);
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user