mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
enCalLog and angCalLog added
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@233 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
d50ac0fe30
commit
7093e92c08
@ -1,5 +1,6 @@
|
|||||||
CFLAGS= -DC_ONLY
|
CFLAGS= -DC_ONLY
|
||||||
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
|
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
|
||||||
|
|
||||||
DFLAGS= -DDACS_INT
|
DFLAGS= -DDACS_INT
|
||||||
|
|
||||||
INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis
|
INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis
|
||||||
@ -8,11 +9,11 @@ INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsD
|
|||||||
CC=g++
|
CC=g++
|
||||||
|
|
||||||
|
|
||||||
SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp
|
SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp
|
||||||
|
|
||||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||||
|
|
||||||
HEADERS = $(SRC_CLNT:.cpp=.h) commonFiles/sls_detector_defs.h slsDetectorAnalysis/detectorData.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorUsers.h multiSlsDetector/multiSlsDetectorCommand.h
|
HEADERS = $(SRC_CLNT:.cpp=.h) commonFiles/sls_detector_defs.h slsDetectorAnalysis/detectorData.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorUsers.h multiSlsDetector/multiSlsDetectorCommand.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/angCalLogClass.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class slsDetectorDefs {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS};
|
enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, enCalLog, angCalLog, MAX_ACTIONS};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ class multiSlsDetectorClient {
|
|||||||
};
|
};
|
||||||
del=1;
|
del=1;
|
||||||
} \
|
} \
|
||||||
cout << "multislsdetector id "<< id << endl; \
|
|
||||||
iv=sscanf(argv[0],"%d:%s",&pos, cmd); \
|
iv=sscanf(argv[0],"%d:%s",&pos, cmd); \
|
||||||
if (iv==2 && pos>=0) { \
|
if (iv==2 && pos>=0) { \
|
||||||
argv[0]=cmd; \
|
argv[0]=cmd; \
|
||||||
|
@ -30,7 +30,6 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
|||||||
|
|
||||||
string executeLine(int narg, char *args[], int action, int id=-1) { \
|
string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||||
string s; \
|
string s; \
|
||||||
printf("mess %d of %d\n",id, myDet->getNumberOfDetectors()); \
|
|
||||||
if (id>=0) {
|
if (id>=0) {
|
||||||
slsDetector *d=myDet->getSlsDetector(id); \
|
slsDetector *d=myDet->getSlsDetector(id); \
|
||||||
if (d) { \
|
if (d) { \
|
||||||
|
@ -146,19 +146,21 @@ int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *v
|
|||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
||||||
|
|
||||||
if (script=="") {
|
if (script=="") {
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
} else {
|
} else {
|
||||||
strcpy(scanScript[iscan],script.c_str());
|
strcpy(scanScript[iscan],script.c_str());
|
||||||
if (script=="none") {
|
if (script=="none") {
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
} else if (script=="energy") {
|
} else if (script=="energy") {
|
||||||
scanMode[iscan]=1;
|
scanMode[iscan]=energyScan;
|
||||||
} else if (script=="threshold") {
|
} else if (script=="threshold") {
|
||||||
scanMode[iscan]=2;
|
scanMode[iscan]=thresholdScan;
|
||||||
} else if (script=="trimbits") {
|
} else if (script=="trimbits") {
|
||||||
scanMode[iscan]=3;
|
scanMode[iscan]=trimbitsScan;
|
||||||
|
} else if (script=="position") {
|
||||||
|
scanMode[iscan]=positionScan;
|
||||||
} else {
|
} else {
|
||||||
scanMode[iscan]=4;
|
scanMode[iscan]=scriptScan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +174,7 @@ int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *v
|
|||||||
|
|
||||||
if (nvalues>=0) {
|
if (nvalues>=0) {
|
||||||
if (nvalues==0)
|
if (nvalues==0)
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
else {
|
else {
|
||||||
nScanSteps[iscan]=nvalues;
|
nScanSteps[iscan]=nvalues;
|
||||||
if (nvalues>MAX_SCAN_STEPS)
|
if (nvalues>MAX_SCAN_STEPS)
|
||||||
@ -217,19 +219,21 @@ int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *v
|
|||||||
int slsDetectorActions::setScanScript(int iscan, string script) {
|
int slsDetectorActions::setScanScript(int iscan, string script) {
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
||||||
if (script=="") {
|
if (script=="") {
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
} else {
|
} else {
|
||||||
strcpy(scanScript[iscan],script.c_str());
|
strcpy(scanScript[iscan],script.c_str());
|
||||||
if (script=="none") {
|
if (script=="none") {
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
} else if (script=="energy") {
|
} else if (script=="energy") {
|
||||||
scanMode[iscan]=1;
|
scanMode[iscan]=energyScan;
|
||||||
} else if (script=="threshold") {
|
} else if (script=="threshold") {
|
||||||
scanMode[iscan]=2;
|
scanMode[iscan]=thresholdScan;
|
||||||
} else if (script=="trimbits") {
|
} else if (script=="trimbits") {
|
||||||
scanMode[iscan]=3;
|
scanMode[iscan]=trimbitsScan;
|
||||||
|
} else if (script=="position") {
|
||||||
|
scanMode[iscan]=positionScan;
|
||||||
} else {
|
} else {
|
||||||
scanMode[iscan]=4;
|
scanMode[iscan]=scriptScan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +284,7 @@ int slsDetectorActions::setScanSteps(int iscan, int nvalues, double *values) {
|
|||||||
|
|
||||||
if (nvalues>=0) {
|
if (nvalues>=0) {
|
||||||
if (nvalues==0)
|
if (nvalues==0)
|
||||||
scanMode[iscan]=0;
|
scanMode[iscan]=noScan;
|
||||||
else {
|
else {
|
||||||
nScanSteps[iscan]=nvalues;
|
nScanSteps[iscan]=nvalues;
|
||||||
if (nvalues>MAX_SCAN_STEPS)
|
if (nvalues>MAX_SCAN_STEPS)
|
||||||
@ -414,26 +418,33 @@ int slsDetectorActions::executeScan(int level, int istep) {
|
|||||||
currentScanIndex[level]=istep;
|
currentScanIndex[level]=istep;
|
||||||
|
|
||||||
switch(scanMode[level]) {
|
switch(scanMode[level]) {
|
||||||
case 1:
|
case energyScan:
|
||||||
setThresholdEnergy((int)currentScanVariable[level]); //energy scan
|
setThresholdEnergy((int)currentScanVariable[level]); //energy scan
|
||||||
break;
|
break;
|
||||||
case 2:
|
case thresholdScan:
|
||||||
setDAC(currentScanVariable[level],THRESHOLD); // threshold scan
|
setDAC((dacs_t)currentScanVariable[level],THRESHOLD); // threshold scan
|
||||||
break;
|
break;
|
||||||
case 3:
|
case trimbitsScan:
|
||||||
trimbit=(int)currentScanVariable[level];
|
trimbit=(int)currentScanVariable[level];
|
||||||
setChannel((trimbit<<((int)TRIMBIT_OFF))|((int)COMPARATOR_ENABLE)); // trimbit scan
|
setChannel((trimbit<<((int)TRIMBIT_OFF))|((int)COMPARATOR_ENABLE)); // trimbit scan
|
||||||
break;
|
break;
|
||||||
case 0:
|
case positionScan:
|
||||||
|
//check if channels are connected!
|
||||||
|
moveDetector(currentScanVariable[level]);
|
||||||
|
break;
|
||||||
|
case noScan:
|
||||||
currentScanVariable[level]=0;
|
currentScanVariable[level]=0;
|
||||||
break;
|
break;
|
||||||
default:
|
case scriptScan:
|
||||||
//Custom scan script level 1. The arguments are passed as nrun=n fn=filename var=v par=p"
|
//Custom scan script level 1. The arguments are passed as nrun=n fn=filename var=v par=p"
|
||||||
sprintf(cmd,"%s nrun=%d fn=%s var=%f par=%s",getScanScript(level).c_str(),getFileIndex(),createFileName().c_str(),currentScanVariable[level],getScanParameter(level).c_str());
|
sprintf(cmd,"%s nrun=%d fn=%s var=%f par=%s",getScanScript(level).c_str(),getFileIndex(),createFileName().c_str(),currentScanVariable[level],getScanParameter(level).c_str());
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Executing scan script "<< level << " " << cmd << endl;
|
cout << "Executing scan script "<< level << " " << cmd << endl;
|
||||||
#endif
|
#endif
|
||||||
system(cmd);
|
system(cmd);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cout << "Scan mode unknown "<< level << " " <<scanMode[level] << endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -482,6 +493,12 @@ int slsDetectorActions::executeAction(int level) {
|
|||||||
fName.c_str(), \
|
fName.c_str(), \
|
||||||
getActionParameter(level).c_str());
|
getActionParameter(level).c_str());
|
||||||
break;
|
break;
|
||||||
|
case enCalLog:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case angCalLog:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(cmd,"");
|
strcpy(cmd,"");
|
||||||
}
|
}
|
||||||
@ -495,3 +512,6 @@ int slsDetectorActions::executeAction(int level) {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,10 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
// : public virtual postProcessing
|
// : public virtual postProcessing
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
|
enum {noScan, energyScan, thresholdScan, trimbitsScan, scriptScan, positionScan};
|
||||||
|
|
||||||
|
|
||||||
/** default constructor */
|
/** default constructor */
|
||||||
slsDetectorActions(){};
|
slsDetectorActions(){};
|
||||||
|
|
||||||
@ -202,6 +206,11 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
int setLastIndex(int i=-1){if (i>=0 && i>lastIndex) lastIndex=i; return lastIndex;};
|
int setLastIndex(int i=-1){if (i>=0 && i>lastIndex) lastIndex=i; return lastIndex;};
|
||||||
|
|
||||||
|
|
||||||
|
virtual double moveDetector(double)=0;
|
||||||
|
virtual double getDetectorPosition()=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,6 +234,21 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="encallog"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="angcallog"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="headerbefore"; //
|
descrToFuncMap[i].m_pFuncName="headerbefore"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdScripts;
|
||||||
i++;
|
i++;
|
||||||
@ -1306,15 +1321,20 @@ string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int action){
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
char ans[100];
|
char ans[100];
|
||||||
|
|
||||||
if (action==HELP_ACTION) {
|
if (action==HELP_ACTION) {
|
||||||
return helpFileName(narg, args, action);
|
return helpFileName(narg, args, action);
|
||||||
}
|
}
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if (sscanf(args[1],"%d",&i))
|
if (sscanf(args[1],"%d",&i))
|
||||||
myDet->enableWriteToFile(i);
|
myDet->enableWriteToFile(i);
|
||||||
return string("Write to File Enabled");
|
else
|
||||||
|
return string("could not decode enable file write");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else return string("Write to File 'Not' Enabled");
|
sprintf(ans,"%d",myDet->enableWriteToFile());
|
||||||
|
return string(ans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1805,7 +1825,7 @@ string slsDetectorCommand::helpPositions(int narg, char *args[], int action) {
|
|||||||
string slsDetectorCommand::cmdScripts(int narg, char *args[], int action) {
|
string slsDetectorCommand::cmdScripts(int narg, char *args[], int action) {
|
||||||
|
|
||||||
int ia=-1;
|
int ia=-1;
|
||||||
|
char answer[100];
|
||||||
if (action==HELP_ACTION)
|
if (action==HELP_ACTION)
|
||||||
return helpScripts(narg,args,action);
|
return helpScripts(narg,args,action);
|
||||||
|
|
||||||
@ -1816,6 +1836,11 @@ string slsDetectorCommand::cmdScripts(int narg, char *args[], int action) {
|
|||||||
if (cmd.find("headerafter")!=string::npos) ia=headerAfter;
|
if (cmd.find("headerafter")!=string::npos) ia=headerAfter;
|
||||||
if (cmd.find("headerbefore")!=string::npos) ia=headerBefore;
|
if (cmd.find("headerbefore")!=string::npos) ia=headerBefore;
|
||||||
|
|
||||||
|
if (cmd.find("encallog")!=string::npos) ia=enCalLog;
|
||||||
|
if (cmd.find("angcallog")!=string::npos) ia=angCalLog;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ia==-1) return string("cannot define action ")+cmd;
|
if (ia==-1) return string("cannot define action ")+cmd;
|
||||||
|
|
||||||
if (cmd.find("par")!=string::npos) {
|
if (cmd.find("par")!=string::npos) {
|
||||||
@ -1827,6 +1852,29 @@ string slsDetectorCommand::cmdScripts(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (ia==enCalLog || ia==angCalLog) {
|
||||||
|
|
||||||
|
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
|
int arg=-1;
|
||||||
|
|
||||||
|
|
||||||
|
sscanf(args[1],"%d",&arg);
|
||||||
|
|
||||||
|
if (arg==0)
|
||||||
|
myDet->setActionScript(ia,"none");
|
||||||
|
else
|
||||||
|
myDet->setActionScript(ia,args[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(answer,"%d",myDet->getActionMode(ia));
|
||||||
|
return string(answer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
myDet->setActionScript(ia, args[1]);
|
myDet->setActionScript(ia, args[1]);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "usersFunctions.h"
|
#include "usersFunctions.h"
|
||||||
#include "slsDetectorCommand.h"
|
#include "slsDetectorCommand.h"
|
||||||
#include "postProcessing.h"
|
#include "postProcessing.h"
|
||||||
|
#include "enCalLogClass.h"
|
||||||
|
#include "angCalLogClass.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
@ -37,7 +39,9 @@ slsDetectorUtils::slsDetectorUtils() {
|
|||||||
void slsDetectorUtils::acquire(int delflag){
|
void slsDetectorUtils::acquire(int delflag){
|
||||||
|
|
||||||
|
|
||||||
|
angCalLogClass *aclog=NULL;
|
||||||
|
enCalLogClass *eclog=NULL;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Acquire function "<< delflag << endl;
|
cout << "Acquire function "<< delflag << endl;
|
||||||
cout << "Stopped flag is "<< stoppedFlag << delflag << endl;
|
cout << "Stopped flag is "<< stoppedFlag << delflag << endl;
|
||||||
@ -47,14 +51,26 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
|
|
||||||
// int lastindex=startindex, nowindex=startindex;
|
// int lastindex=startindex, nowindex=startindex;
|
||||||
|
int connectChannels=0;
|
||||||
|
|
||||||
|
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(0)==positionScan)) {
|
||||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
if (connectChannels==0)
|
||||||
connect_channels(NULL);
|
if (connect_channels) {
|
||||||
|
connect_channels(CCarg);
|
||||||
|
connectChannels=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (getActionMode(angCalLog))
|
||||||
|
aclog=new angCalLogClass(this);
|
||||||
|
|
||||||
|
if (getActionMode(enCalLog))
|
||||||
|
eclog=new enCalLogClass(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// setTotalProgress();
|
// setTotalProgress();
|
||||||
progressIndex=0;
|
progressIndex=0;
|
||||||
*stoppedFlag=0;
|
*stoppedFlag=0;
|
||||||
@ -137,8 +153,7 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
// cout << "positions " << endl;
|
// cout << "positions " << endl;
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
if (*numberOfPositions>0) {
|
if (*numberOfPositions>0) {
|
||||||
if (go_to_position)
|
moveDetector(detPositions[ip]);
|
||||||
go_to_position (detPositions[ip],NULL);
|
|
||||||
currentPositionIndex=ip+1;
|
currentPositionIndex=ip+1;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "moving to position" << std::endl;
|
std::cout<< "moving to position" << std::endl;
|
||||||
@ -160,26 +175,45 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
executeAction(headerBefore);
|
executeAction(headerBefore);
|
||||||
|
|
||||||
if (*correctionMask&(1<< ANGULAR_CONVERSION)) {
|
if (*correctionMask&(1<< ANGULAR_CONVERSION)) {
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
if (get_position)
|
currentPosition=getDetectorPosition();
|
||||||
currentPosition=get_position(NULL);
|
posfinished=0;
|
||||||
|
pthread_mutex_unlock(&mp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aclog) {
|
||||||
|
if ((*correctionMask&(1<< ANGULAR_CONVERSION))==0) {
|
||||||
|
pthread_mutex_lock(&mp);
|
||||||
|
currentPosition=getDetectorPosition();
|
||||||
posfinished=0;
|
posfinished=0;
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
aclog->addStep(currentPosition, getCurrentFileName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eclog)
|
||||||
|
eclog->addStep(setDAC(-1,THRESHOLD), getCurrentFileName());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||||
if (get_i0)
|
if (get_i0)
|
||||||
get_i0(0);
|
get_i0(0, IOarg);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
startAndReadAll();
|
startAndReadAll();
|
||||||
|
|
||||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||||
if (get_i0)
|
if (get_i0)
|
||||||
currentI0=get_i0(1,NULL); // this is the correct i0!!!!!
|
currentI0=get_i0(1,IOarg); // this is the correct i0!!!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
@ -278,10 +312,17 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
if (connectChannels) {
|
||||||
if (disconnect_channels)
|
if (disconnect_channels)
|
||||||
disconnect_channels(NULL);
|
disconnect_channels(DCarg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aclog)
|
||||||
|
delete aclog;
|
||||||
|
|
||||||
|
if (eclog)
|
||||||
|
delete eclog;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,6 +518,8 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
*/
|
*/
|
||||||
virtual int getMaxNumberOfModules(dimension d=X)=0;
|
virtual int getMaxNumberOfModules(dimension d=X)=0;
|
||||||
|
|
||||||
|
double moveDetector(double pos){if (go_to_position) go_to_position (pos,GTarg); else cout << "no move detector callback registered" << endl; return getDetectorPosition();};
|
||||||
|
double getDetectorPosition(){double pos=-1; if (get_position) pos=get_position(POarg); else cout << "no get position callback registered" << endl; return pos;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels etc.)
|
Writes the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels etc.)
|
||||||
|
62
slsDetectorSoftware/slsDetectorAnalysis/angCalLogClass.h
Normal file
62
slsDetectorSoftware/slsDetectorAnalysis/angCalLogClass.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#ifndef ANGCALLOGCLASS_H
|
||||||
|
#define ANGCALLOGCLASS_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include "slsDetectorCommand.h"
|
||||||
|
#include "slsDetectorUtils.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class angCalLogClass {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
angCalLogClass(slsDetectorUtils *det){ \
|
||||||
|
char cmd[1000];
|
||||||
|
char *argv[2]; \
|
||||||
|
argv[0]=cmd; \
|
||||||
|
sprintf(cmd,"_%d.angcal",det->getFileIndex()); \
|
||||||
|
outfile.open(string(det->getFilePath()+string("/")+det->getFileName()+string(cmd)).c_str()); \
|
||||||
|
myDet=new slsDetectorCommand(det); \
|
||||||
|
strcpy(cmd,"nmod"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"angconv"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"globaloff"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"fineoff"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"angdir"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"ffdir"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"flatfield"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"badchannels"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
};
|
||||||
|
|
||||||
|
~angCalLogClass(){delete myDet; outfile.close();};
|
||||||
|
|
||||||
|
int addStep(double pos, string fname) {outfile << pos << " " << fname << endl; return 0;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
slsDetectorCommand *myDet;
|
||||||
|
ofstream outfile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
54
slsDetectorSoftware/slsDetectorAnalysis/enCalLogClass.h
Normal file
54
slsDetectorSoftware/slsDetectorAnalysis/enCalLogClass.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef ENCALLOGCLASS_H
|
||||||
|
#define ENCALLOGCLASS_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include "slsDetectorCommand.h"
|
||||||
|
#include "slsDetectorUtils.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class enCalLogClass {
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
enCalLogClass(slsDetectorUtils *det){ \
|
||||||
|
char cmd[1000];
|
||||||
|
char *argv[2]; \
|
||||||
|
argv[0]=cmd; \
|
||||||
|
sprintf(cmd,"_%d.encal",det->getFileIndex()); \
|
||||||
|
outfile.open(string(det->getFilePath()+string("/")+det->getFileName()+string(cmd)).c_str()); \
|
||||||
|
myDet=new slsDetectorCommand(det); \
|
||||||
|
strcpy(cmd,"settings"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
strcpy(cmd,"nmod"); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
for (int im=0; im<det->setNumberOfModules(); im++) { \
|
||||||
|
sprintf(cmd,"modulenumber:%d",im); \
|
||||||
|
outfile << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
|
||||||
|
}; \
|
||||||
|
};
|
||||||
|
|
||||||
|
~enCalLogClass(){delete myDet; outfile.close();};
|
||||||
|
|
||||||
|
int addStep(double threshold, string fname) {outfile << threshold << " " << fname << endl; return 0;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
slsDetectorCommand *myDet;
|
||||||
|
ofstream outfile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -119,17 +119,17 @@ class postProcessing : public angularConversion, public fileIO {
|
|||||||
static int rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t);
|
static int rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t);
|
||||||
|
|
||||||
|
|
||||||
int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
|
int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); else if (i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return (((*correctionMask)&(1<< WRITE_FILE ))>>WRITE_FILE) ;};
|
||||||
|
|
||||||
|
|
||||||
int setAngularCorrectionMask(int i=-1){if (i==0) (*correctionMask)&=~(1<< ANGULAR_CONVERSION); if (i>0) (*correctionMask)|=(1<< ANGULAR_CONVERSION); return ((*correctionMask)&(1<< ANGULAR_CONVERSION));};
|
int setAngularCorrectionMask(int i=-1){if (i==0) (*correctionMask)&=~(1<< ANGULAR_CONVERSION); if (i>0) (*correctionMask)|=(1<< ANGULAR_CONVERSION); return (((*correctionMask)&(1<< ANGULAR_CONVERSION))>>ANGULAR_CONVERSION);};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int enableAngularConversion(int i=-1) {if (i>0) return setAngularConversionFile("default"); if (i==0) return setAngularConversionFile(""); return setAngularCorrectionMask();};
|
int enableAngularConversion(int i=-1) {if (i>0) return setAngularConversionFile("default"); if (i==0) return setAngularConversionFile(""); return setAngularCorrectionMask();};
|
||||||
|
|
||||||
|
|
||||||
int enableBadChannelCorrection(int i=-1) {if (i>0) return setBadChannelCorrection("default"); if (i==0) return setBadChannelCorrection(""); return ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS));};
|
int enableBadChannelCorrection(int i=-1) {if (i>0) return setBadChannelCorrection("default"); if (i==0) return setBadChannelCorrection(""); return (((*correctionMask)&(1<< DISCARD_BAD_CHANNELS))>>DISCARD_BAD_CHANNELS);};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,6 +154,8 @@ double defaultGetPosition(void *d) {
|
|||||||
pos=value;
|
pos=value;
|
||||||
} else
|
} else
|
||||||
printf(ca_message(status));
|
printf(ca_message(status));
|
||||||
|
#else
|
||||||
|
printf("\nmotor position is %f\n",pos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -184,10 +186,13 @@ int defaultGoToPosition(double p,void *d) {
|
|||||||
printf(ca_message(status));
|
printf(ca_message(status));
|
||||||
#else
|
#else
|
||||||
pos=p;
|
pos=p;
|
||||||
|
printf("\nmoving motor to position %f\n",p);
|
||||||
#endif
|
#endif
|
||||||
//"caputq X04SA-ES2-TH2:RO p"
|
//"caputq X04SA-ES2-TH2:RO p"
|
||||||
//cawait -nounit -timeout 3600 X04SA-ES2-TH2:RO.DMOV '==1'
|
//cawait -nounit -timeout 3600 X04SA-ES2-TH2:RO.DMOV '==1'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (int)p;
|
return (int)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user