mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-05 12:20:02 +02:00
warnings fixed
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@343 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
09982d84f2
commit
e0a1e4ab36
@ -428,7 +428,7 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
|
|||||||
static string nameToMac(string inf) {
|
static string nameToMac(string inf) {
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int sock, j, k;
|
int sock, j, k;
|
||||||
char *p, addr[32], mask[32], mac[32];
|
char mac[32];
|
||||||
|
|
||||||
sock=getSock(inf,&ifr);
|
sock=getSock(inf,&ifr);
|
||||||
|
|
||||||
@ -450,8 +450,8 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
|
|||||||
|
|
||||||
static string nameToIp(string inf){
|
static string nameToIp(string inf){
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int sock, j, k;
|
int sock;
|
||||||
char *p, addr[32], mask[32], mac[32];
|
char *p, addr[32];
|
||||||
|
|
||||||
sock=getSock(inf,&ifr);
|
sock=getSock(inf,&ifr);
|
||||||
|
|
||||||
@ -469,8 +469,7 @@ protocol(p), is_a_server(0), socketDescriptor(-1),file_des(-1), packet_size(DEFA
|
|||||||
|
|
||||||
static int getSock(string inf, struct ifreq *ifr) {
|
static int getSock(string inf, struct ifreq *ifr) {
|
||||||
|
|
||||||
int sock, j, k;
|
int sock;
|
||||||
char *p, addr[32], mask[32], mac[32];
|
|
||||||
sock=socket(PF_INET, SOCK_STREAM, 0);
|
sock=socket(PF_INET, SOCK_STREAM, 0);
|
||||||
if (-1==sock) {
|
if (-1==sock) {
|
||||||
perror("socket() ");
|
perror("socket() ");
|
||||||
|
@ -432,7 +432,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
|
|||||||
int nChans, nchanold=myMod->nchan, nchandiff;
|
int nChans, nchanold=myMod->nchan, nchandiff;
|
||||||
int nDacs, ndold=myMod->ndac, ndacdiff;
|
int nDacs, ndold=myMod->ndac, ndacdiff;
|
||||||
int nAdcs, naold=myMod->nadc, nadcdiff;
|
int nAdcs, naold=myMod->nadc, nadcdiff;
|
||||||
int id=0;
|
// int id=0;
|
||||||
|
|
||||||
ts+= receiveDataOnly(file_des,myMod,sizeof(sls_detector_module));
|
ts+= receiveDataOnly(file_des,myMod,sizeof(sls_detector_module));
|
||||||
|
|
||||||
|
@ -605,6 +605,7 @@ int multiSlsDetector::addSlsDetector(detectorType t, int pos) {
|
|||||||
cout << "Creating detector " << id << " of type " << getDetectorType(t) << endl;
|
cout << "Creating detector " << id << " of type " << getDetectorType(t) << endl;
|
||||||
#endif
|
#endif
|
||||||
slsDetector *s=new slsDetector(t, id, this);
|
slsDetector *s=new slsDetector(t, id, this);
|
||||||
|
s=NULL;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Adding it to the multi detector structure" << endl;
|
cout << "Adding it to the multi detector structure" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -862,7 +863,7 @@ slsDetectorDefs::synchronizationMode multiSlsDetector::setSynchronization(synchr
|
|||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setOnline(int off) {
|
int multiSlsDetector::setOnline(int off) {
|
||||||
int retdet;
|
// int retdet;
|
||||||
|
|
||||||
if (off!=GET_ONLINE_FLAG) {
|
if (off!=GET_ONLINE_FLAG) {
|
||||||
thisMultiDetector->onlineFlag=off;
|
thisMultiDetector->onlineFlag=off;
|
||||||
@ -1641,13 +1642,13 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setFlatFieldCorrection(string fname){
|
int multiSlsDetector::setFlatFieldCorrection(string fname){
|
||||||
double data[thisMultiDetector->numberOfChannels], xmed[thisMultiDetector->numberOfChannels];
|
double data[thisMultiDetector->numberOfChannels];//, xmed[thisMultiDetector->numberOfChannels];
|
||||||
double ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels];
|
double ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels];
|
||||||
int nmed=0;
|
// int nmed=0;
|
||||||
int idet=0, ichdet=-1;
|
// int idet=0, ichdet=-1;
|
||||||
char ffffname[MAX_STR_LENGTH*2];
|
char ffffname[MAX_STR_LENGTH*2];
|
||||||
int nbad=0, nch;
|
int nch;//nbad=0,
|
||||||
int badlist[MAX_BADCHANS];
|
//int badlist[MAX_BADCHANS];
|
||||||
int im=0;
|
int im=0;
|
||||||
|
|
||||||
if (fname=="default") {
|
if (fname=="default") {
|
||||||
@ -1920,7 +1921,7 @@ int multiSlsDetector::getRateCorrection(double &t){
|
|||||||
|
|
||||||
double multiSlsDetector::getRateCorrectionTau(){
|
double multiSlsDetector::getRateCorrectionTau(){
|
||||||
|
|
||||||
int ret1=-100,ret;
|
double ret1=-100,ret;
|
||||||
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||||
@ -2892,7 +2893,7 @@ int multiSlsDetector::setNumberOfModules(int p, dimension d) {
|
|||||||
|
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
|
|
||||||
cout << "detector " << idet << endl;
|
// cout << "detector " << idet << endl;
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
if (p<0)
|
if (p<0)
|
||||||
nm=p;
|
nm=p;
|
||||||
@ -3152,7 +3153,7 @@ int multiSlsDetector::readConfigurationFile(string const fname){
|
|||||||
thisMultiDetector->numberOfDetectors=0;
|
thisMultiDetector->numberOfDetectors=0;
|
||||||
|
|
||||||
multiSlsDetectorClient *cmd;
|
multiSlsDetectorClient *cmd;
|
||||||
char ext[100];
|
// char ext[100];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3272,7 +3273,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
|
|
||||||
int nvar=14;
|
int nvar=14;
|
||||||
|
|
||||||
char ext[100];
|
// char ext[100];
|
||||||
|
|
||||||
int iv=0;
|
int iv=0;
|
||||||
char *args[100];
|
char *args[100];
|
||||||
@ -3355,7 +3356,7 @@ int multiSlsDetector::writeDataFile(string fname, double *data, double *err, dou
|
|||||||
ofstream outfile;
|
ofstream outfile;
|
||||||
int choff=0, off=0; //idata,
|
int choff=0, off=0; //idata,
|
||||||
double *pe=err, *pa=ang;
|
double *pe=err, *pa=ang;
|
||||||
int nch_left=nch, n, nd;
|
int nch_left=nch, n;//, nd;
|
||||||
|
|
||||||
if (nch_left<=0)
|
if (nch_left<=0)
|
||||||
nch_left=getTotalNumberOfChannels();
|
nch_left=getTotalNumberOfChannels();
|
||||||
|
@ -31,7 +31,6 @@ class multiSlsDetectorClient {
|
|||||||
return; \
|
return; \
|
||||||
}; \
|
}; \
|
||||||
int id=-1, iv=0, pos=-1; \
|
int id=-1, iv=0, pos=-1; \
|
||||||
char *c; \
|
|
||||||
char cmd[100]; \
|
char cmd[100]; \
|
||||||
if (action==slsDetectorDefs::PUT_ACTION && argc<2) { \
|
if (action==slsDetectorDefs::PUT_ACTION && argc<2) { \
|
||||||
cout << "Wrong usage - should be: "<< argv[0] << \
|
cout << "Wrong usage - should be: "<< argv[0] << \
|
||||||
|
@ -723,13 +723,13 @@ int slsDetector::initializeDetectorStructure() {
|
|||||||
|
|
||||||
/** initializes the dacs values to 0 */
|
/** initializes the dacs values to 0 */
|
||||||
for (int idac=0; idac<thisDetector->nDacs; idac++) {
|
for (int idac=0; idac<thisDetector->nDacs; idac++) {
|
||||||
*(dacs+idac+thisDetector->nDacs*imod)=0.;
|
*(dacs+idac+thisDetector->nDacs*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** initializes the adc values to 0 */
|
/** initializes the adc values to 0 */
|
||||||
for (int iadc=0; iadc<thisDetector->nAdcs; iadc++) {
|
for (int iadc=0; iadc<thisDetector->nAdcs; iadc++) {
|
||||||
*(adcs+iadc+thisDetector->nAdcs*imod)=0.;
|
*(adcs+iadc+thisDetector->nAdcs*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1276,7 +1276,7 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (controlSocket) {
|
||||||
cout << "connected" << endl;
|
// cout << "connected" << endl;
|
||||||
if (controlSocket->Connect()>=0) {
|
if (controlSocket->Connect()>=0) {
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
@ -1292,7 +1292,7 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
cout << "no control socket?!??!?" << endl;
|
cout << "no control socket?" << endl;
|
||||||
} else {
|
} else {
|
||||||
cout << "offline" << endl;
|
cout << "offline" << endl;
|
||||||
ret=OK;
|
ret=OK;
|
||||||
@ -5297,7 +5297,7 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
|||||||
|
|
||||||
/*receiver*/
|
/*receiver*/
|
||||||
int slsDetector::setReceiverOnline(int off) {
|
int slsDetector::setReceiverOnline(int off) {
|
||||||
int prev = thisDetector->receiverOnlineFlag;
|
// int prev = thisDetector->receiverOnlineFlag;
|
||||||
if (off!=GET_ONLINE_FLAG) {
|
if (off!=GET_ONLINE_FLAG) {
|
||||||
if(strcmp(thisDetector->receiverIP,"none")){
|
if(strcmp(thisDetector->receiverIP,"none")){
|
||||||
thisDetector->receiverOnlineFlag=off;
|
thisDetector->receiverOnlineFlag=off;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "angleConversionConstant.h"
|
#include "angleConversionConstant.h"
|
||||||
#include "MySocketTCP.h"
|
#include "MySocketTCP.h"
|
||||||
|
|
||||||
#include "angleConversionConstant.h";
|
#include "angleConversionConstant.h"
|
||||||
|
|
||||||
#include "receiverInterface.h"
|
#include "receiverInterface.h"
|
||||||
|
|
||||||
|
@ -470,21 +470,6 @@ int slsDetectorActions::executeAction(int level) {
|
|||||||
fName=getCurrentFileName();
|
fName=getCurrentFileName();
|
||||||
nowIndex=getFileIndexFromFileName(getCurrentFileName());
|
nowIndex=getFileIndexFromFileName(getCurrentFileName());
|
||||||
case headerAfter:
|
case headerAfter:
|
||||||
// sprintf(cmd,"%s nrun=%d fn=%s acqtime=%f gainmode=%d threshold=%d badfile=%s angfile=%s bloffset=%f fineoffset=%f fffile=%s/%s tau=%f par=%s", \
|
|
||||||
// getActionScript(level).c_str(), \
|
|
||||||
// getFileIndexFromFileName(currentFileName), \
|
|
||||||
// currentFileName.c_str(), \
|
|
||||||
// ((double)timerValue[ACQUISITION_TIME])*1E-9, \
|
|
||||||
// *currentSettings, \
|
|
||||||
// *currentThresholdEV, \
|
|
||||||
// getBadChannelCorrectionFile().c_str(), \
|
|
||||||
// angularConversion::getAngularConversionFile().c_str(), \
|
|
||||||
// *globalOffset, \
|
|
||||||
// *fineOffset, \
|
|
||||||
// getFlatFieldCorrectionDir().c_str(), \
|
|
||||||
// getFlatFieldCorrectionFile().c_str(), \
|
|
||||||
// getRateCorrectionTau(), \
|
|
||||||
// getActionParameter(level).c_str());
|
|
||||||
|
|
||||||
// all other parameters should be taken using text client calls in the header scripts!
|
// all other parameters should be taken using text client calls in the header scripts!
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
|
|
||||||
/* Detector structure configuration and debugging commands */
|
/* Detector structure configuration and debugging commands */
|
||||||
|
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="free";//OK
|
descrToFuncMap[i].m_pFuncName="free";//OK
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdFree;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdFree;
|
||||||
i++;
|
i++;
|
||||||
@ -83,6 +84,8 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
/* data processing commands */
|
/* data processing commands */
|
||||||
|
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="flatfield"; //
|
descrToFuncMap[i].m_pFuncName="flatfield"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdFlatField;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdFlatField;
|
||||||
i++;
|
i++;
|
||||||
@ -1965,10 +1968,30 @@ string slsDetectorCommand::cmdScripts(int narg, char *args[], int action) {
|
|||||||
string slsDetectorCommand::helpScripts(int narg, char *args[], int action) {
|
string slsDetectorCommand::helpScripts(int narg, char *args[], int action) {
|
||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
|
||||||
os << "positions np [pos0 pos1...posnp] \t sets the number of positions at which the detector is moved during the acquisition and their values"<< std::endl;
|
if (narg>0) {
|
||||||
if (action==GET_ACTION || action==HELP_ACTION)
|
if ((string(args[0]).find("start")!=string::npos) || (string(args[0]).find("stop")!=string::npos) || (string(args[0]).find("scriptbefore")!=string::npos) || \
|
||||||
os << "positions \t returns the number of positions at which the detector is moved during the acquisition and their values"<< std::endl;
|
(string(args[0]).find("scriptafter")!=string::npos) || (string(args[0]).find("headerafter")!=string::npos) || (string(args[0]).find("headerbefore")!=string::npos)) {
|
||||||
|
|
||||||
|
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " script \t sets the script to execute for the corresponding action"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the script to execute for the corresponding action"<< std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((string(args[0]).find("encallog")!=string::npos) || (string(args[0]).find("angcallog")!=string::npos)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " i \t enables (1) or disables (0) the logging for the calibration"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the calibration log mode"<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2119,10 +2142,46 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
|
|||||||
string slsDetectorCommand::helpScans(int narg, char *args[], int action) {
|
string slsDetectorCommand::helpScans(int narg, char *args[], int action) {
|
||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
|
||||||
os << "positions np [pos0 pos1...posnp] \t sets the number of positions at which the detector is moved during the acquisition and their values"<< std::endl;
|
if ((string(args[0])).find("script")!=string::npos) {
|
||||||
if (action==GET_ACTION || action==HELP_ACTION)
|
|
||||||
os << "positions \t returns the number of positions at which the detector is moved during the acquisition and their values"<< std::endl;
|
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " script \t sets the script to execute for the corresponding scan level (threshold, energy, trimbits or positions are internally defined)"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the script to execute for the corresponding scan level (threshold, energy, trimbits or positions are internally defined)"<< std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((string(args[0])).find("prec")!=string::npos) {
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " i \t sets the number of decimals for the scan variable in the file name"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the number of decimals for the scan variable in the file name"<< std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((string(args[0])).find("steps")!=string::npos) {
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " n [st0...stn] \t sets the number of steps and steps value for the corresponding scan level"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the the number of steps and steps value for the corresponding scan level"<< std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((string(args[0])).find("range")!=string::npos) {
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " min max step \t sets the minimum, maximum and step size for the corresponding scan level"<< std::endl;
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
|
os << args[0] << " \t returns the the number of steps and steps value for the corresponding scan level"<< std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
|
|
||||||
slsDetectorCommand(slsDetectorUtils *det);
|
slsDetectorCommand(slsDetectorUtils *det);
|
||||||
|
virtual ~slsDetectorCommand(){};
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
|
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
|
||||||
@ -175,8 +175,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class slsDetectorUsers
|
|||||||
|
|
||||||
|
|
||||||
/** @short virtual destructor */
|
/** @short virtual destructor */
|
||||||
~slsDetectorUsers();
|
virtual ~slsDetectorUsers();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
executeAction(headerBefore);
|
executeAction(headerBefore);
|
||||||
|
|
||||||
if (*correctionMask&(1<< ANGULAR_CONVERSION) || aclog || eclog) {
|
if (*correctionMask&(1<< ANGULAR_CONVERSION) || aclog){// || eclog) {
|
||||||
positionFinished(0);
|
positionFinished(0);
|
||||||
setCurrentPosition(getDetectorPosition());
|
setCurrentPosition(getDetectorPosition());
|
||||||
}
|
}
|
||||||
@ -431,9 +431,11 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
if (eclog)
|
if (eclog)
|
||||||
delete eclog;
|
delete eclog;
|
||||||
|
|
||||||
if (acquisition_finished)
|
if (acquisition_finished) {
|
||||||
|
cout << "Acquisition " << endl;
|
||||||
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);
|
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);
|
||||||
|
cout << "finished " << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ class angCalLogClass {
|
|||||||
nmod=0; chanspermod=0; globaloff=0; fineoff=0; angdir=1; \
|
nmod=0; chanspermod=0; globaloff=0; fineoff=0; angdir=1; \
|
||||||
strcpy(angconvfile,"none"); strcpy(ffdir,"none"); strcpy(fffile,"none"); strcpy(badfile,"none"); \
|
strcpy(angconvfile,"none"); strcpy(ffdir,"none"); strcpy(fffile,"none"); strcpy(badfile,"none"); \
|
||||||
char line[1000], myvar[100], myarg[100]; \
|
char line[1000], myvar[100], myarg[100]; \
|
||||||
int dum; \
|
|
||||||
float v; \
|
float v; \
|
||||||
for (int iv=0; iv<nvars; iv++) { \
|
for (int iv=0; iv<nvars; iv++) { \
|
||||||
infile.getline(line,1000); \
|
infile.getline(line,1000); \
|
||||||
|
@ -60,7 +60,7 @@ int angularConversion::deleteMerging() {
|
|||||||
|
|
||||||
if (mergingErrors)
|
if (mergingErrors)
|
||||||
delete [] mergingErrors;
|
delete [] mergingErrors;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ double angularConversion::setAngularConversionParameter(angleConversionParameter
|
|||||||
case BIN_SIZE:
|
case BIN_SIZE:
|
||||||
if (v>0) {
|
if (v>0) {
|
||||||
*binSize=v;
|
*binSize=v;
|
||||||
nBins=360./(*binSize);
|
nBins=(int)(360./(*binSize))+1;
|
||||||
}
|
}
|
||||||
return *binSize;
|
return *binSize;
|
||||||
case MOVE_FLAG:
|
case MOVE_FLAG:
|
||||||
@ -226,7 +226,7 @@ double angularConversion::getAngularConversionParameter(angleConversionParameter
|
|||||||
return *fineOffset;
|
return *fineOffset;
|
||||||
case BIN_SIZE:
|
case BIN_SIZE:
|
||||||
if (*binSize>0)
|
if (*binSize>0)
|
||||||
nBins=360./(*binSize);
|
nBins=(int)(360./(*binSize))+1;
|
||||||
else
|
else
|
||||||
nBins=0;
|
nBins=0;
|
||||||
return *binSize;
|
return *binSize;
|
||||||
|
@ -152,7 +152,7 @@ class angularConversion : public virtual slsDetectorBase, public angularConversi
|
|||||||
\param bs bin size to be set
|
\param bs bin size to be set
|
||||||
\returns actual bin size
|
\returns actual bin size
|
||||||
*/
|
*/
|
||||||
double setBinSize(double bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);};
|
double setBinSize(double bs){if (bs>0) nBins=(int)(360./bs); return setAngularConversionParameter(BIN_SIZE,bs);};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
get detector bin size
|
get detector bin size
|
||||||
|
@ -136,7 +136,7 @@ double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerM
|
|||||||
|
|
||||||
int imod=0;
|
int imod=0;
|
||||||
double ang;
|
double ang;
|
||||||
double enc=0, trans=0;
|
// double enc=0, trans=0;
|
||||||
angleConversionConstant *p=NULL;
|
angleConversionConstant *p=NULL;
|
||||||
|
|
||||||
int ch0=0;
|
int ch0=0;
|
||||||
|
@ -69,31 +69,18 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
|
|||||||
return ang;
|
return ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir) {
|
|
||||||
|
|
||||||
int imod=0;
|
|
||||||
double ang;
|
|
||||||
|
|
||||||
|
|
||||||
|
double angularConversionStatic::convertAngle(double pos, int ich, angleConversionConstant *p, int mF, double fo, double go, int angdir) {
|
||||||
|
|
||||||
|
|
||||||
double enc=0, trans=0;
|
double enc=0, trans=0;
|
||||||
angleConversionConstant *p=NULL;
|
double ang;
|
||||||
|
|
||||||
int ch0=0;
|
switch (mF) {
|
||||||
int chlast=chansPerMod[0]-1;
|
|
||||||
int nchmod=chansPerMod[0];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (ich>chlast) {
|
|
||||||
imod++;
|
|
||||||
ch0=chlast+1;
|
|
||||||
nchmod=chansPerMod[imod];
|
|
||||||
chlast=ch0+nchmod-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
p=angOff[imod];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (mF[imod]) {
|
|
||||||
case 0:
|
case 0:
|
||||||
enc=0;
|
enc=0;
|
||||||
trans=0;
|
trans=0;
|
||||||
@ -119,10 +106,8 @@ double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerM
|
|||||||
trans=0;
|
trans=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
ang=angle(ich-ch0, \
|
ang=angle(ich, \
|
||||||
enc, \
|
enc, \
|
||||||
fo+go, \
|
fo+go, \
|
||||||
p->r_conversion, \
|
p->r_conversion, \
|
||||||
@ -133,6 +118,47 @@ double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerM
|
|||||||
|
|
||||||
return ang;
|
return ang;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir) {
|
||||||
|
|
||||||
|
int imod=0;
|
||||||
|
double ang;
|
||||||
|
double enc=0, trans=0;
|
||||||
|
angleConversionConstant *p=NULL;
|
||||||
|
|
||||||
|
int ch0=0;
|
||||||
|
int chlast=chansPerMod[0]-1;
|
||||||
|
int nchmod=chansPerMod[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (ich>chlast) {
|
||||||
|
imod++;
|
||||||
|
ch0=chlast+1;
|
||||||
|
nchmod=chansPerMod[imod];
|
||||||
|
chlast=ch0+nchmod-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p=angOff[imod];
|
||||||
|
|
||||||
|
|
||||||
|
ang=convertAngle(pos, ich-ch0, p, mF[imod], fo, go, angdir);
|
||||||
|
|
||||||
|
return ang;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,12 +188,13 @@ int angularConversionStatic::readAngularConversion(string fname, int nmod, angle
|
|||||||
int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
|
int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
|
||||||
string str;
|
string str;
|
||||||
int mod;
|
int mod;
|
||||||
double center, ecenter;
|
double center, ecenter, pitch, epitch;
|
||||||
double r_conv, er_conv;
|
double r_conv, er_conv;
|
||||||
double off, eoff;
|
double off, eoff;
|
||||||
string ss;
|
string ss;
|
||||||
int interrupt=0;
|
int interrupt=0;
|
||||||
int nm=0;
|
int nm=0;
|
||||||
|
int newangconv=0;
|
||||||
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
|
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
|
||||||
while (infile.good() and interrupt==0) {
|
while (infile.good() and interrupt==0) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
@ -178,18 +205,31 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
|
|||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> ss >> mod;
|
ssstr >> ss >> mod;
|
||||||
ssstr >> ss >> center;
|
ssstr >> ss >> center;
|
||||||
|
if (ss==string("center"))
|
||||||
|
newangconv=1;
|
||||||
ssstr >> ss >> ecenter;
|
ssstr >> ss >> ecenter;
|
||||||
|
if (newangconv) {
|
||||||
|
ssstr >> ss >> pitch;
|
||||||
|
ssstr >> ss >> epitch;
|
||||||
|
}
|
||||||
ssstr >> ss >> r_conv;
|
ssstr >> ss >> r_conv;
|
||||||
ssstr >> ss >> er_conv;
|
ssstr >> ss >> er_conv;
|
||||||
ssstr >> ss >> off;
|
ssstr >> ss >> off;
|
||||||
ssstr >> ss >> eoff;
|
ssstr >> ss >> eoff;
|
||||||
if (nm<nmod && nm>=0 ) {
|
if (nm<nmod && nm>=0 ) {
|
||||||
angOff[nm].center=center;
|
if (newangconv==0) {
|
||||||
angOff[nm].r_conversion=r_conv;
|
angOff[nm].center=center;
|
||||||
angOff[nm].offset=off;
|
angOff[nm].r_conversion=r_conv;
|
||||||
angOff[nm].ecenter=ecenter;
|
angOff[nm].offset=off;
|
||||||
angOff[nm].er_conversion=er_conv;
|
angOff[nm].ecenter=ecenter;
|
||||||
angOff[nm].eoffset=eoff;
|
angOff[nm].er_conversion=er_conv;
|
||||||
|
angOff[nm].eoffset=eoff;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
angOff[nm].tilt=pitch;
|
||||||
|
angOff[nm].etilt=epitch;
|
||||||
|
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
//cout << nm<<" " << angOff[nm].offset << endl;
|
//cout << nm<<" " << angOff[nm].offset << endl;
|
||||||
|
@ -65,7 +65,7 @@ class enCalLogClass {
|
|||||||
|
|
||||||
int readHeader(ifstream &infile, char *settings, int &nmod, int &chanspermod, int *mods ) { \
|
int readHeader(ifstream &infile, char *settings, int &nmod, int &chanspermod, int *mods ) { \
|
||||||
nmod=0; strcpy(settings,"unknown"); chanspermod=0; \
|
nmod=0; strcpy(settings,"unknown"); chanspermod=0; \
|
||||||
char line[1000], myvar[100], myarg[100]; \
|
char line[1000],myarg[100]; \
|
||||||
int dum; \
|
int dum; \
|
||||||
for (int iv=0; iv<3; iv++) { \
|
for (int iv=0; iv<3; iv++) { \
|
||||||
infile.getline(line,1000); \
|
infile.getline(line,1000); \
|
||||||
|
@ -621,11 +621,11 @@ class fileIOStatic {
|
|||||||
} else { \
|
} else { \
|
||||||
interrupt=1; \
|
interrupt=1; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
return iline; \
|
return iline; \
|
||||||
}; \
|
}; \
|
||||||
|
return iline; \
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,6 +8,21 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void* startProcessData(void *n){\
|
||||||
|
postProcessing *myDet=(postProcessing*)n;\
|
||||||
|
myDet->processData(1);\
|
||||||
|
pthread_exit(NULL);\
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static void* startProcessDataNoDelete(void *n){\
|
||||||
|
postProcessing *myDet=(postProcessing*)n;\
|
||||||
|
myDet->processData(0);\
|
||||||
|
pthread_exit(NULL);\
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0){
|
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0){
|
||||||
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
@ -120,11 +135,6 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
delete thisData;
|
delete thisData;
|
||||||
fdata=NULL;
|
fdata=NULL;
|
||||||
}
|
}
|
||||||
// #ifdef VERBOSE
|
|
||||||
// cout << "findex incremented " << endl;
|
|
||||||
// #endif
|
|
||||||
// if(*correctionMask&(1<<WRITE_FILE))
|
|
||||||
// IncrementFileIndex();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getFrameIndex()>=0)
|
if (getFrameIndex()>=0)
|
||||||
|
@ -248,7 +248,7 @@ s
|
|||||||
int positionFinished(int v=-1){pthread_mutex_lock(&mp); if (v>=0) posfinished=v; int retval=posfinished; pthread_mutex_unlock(&mp); return retval;};
|
int positionFinished(int v=-1){pthread_mutex_lock(&mp); if (v>=0) posfinished=v; int retval=posfinished; pthread_mutex_unlock(&mp); return retval;};
|
||||||
|
|
||||||
double getCurrentPosition() {double p; pthread_mutex_lock(&mp); p=currentPosition; pthread_mutex_unlock(&mp); return p;};
|
double getCurrentPosition() {double p; pthread_mutex_lock(&mp); p=currentPosition; pthread_mutex_unlock(&mp); return p;};
|
||||||
int setCurrentPosition(double v) { pthread_mutex_lock(&mp); currentPosition=v; pthread_mutex_unlock(&mp); return currentPosition;};
|
double setCurrentPosition(double v) { pthread_mutex_lock(&mp); currentPosition=v; pthread_mutex_unlock(&mp); return currentPosition;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -353,19 +353,19 @@ s
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void* startProcessData(void *n){\
|
/* static void* startProcessData(void *n){\ */
|
||||||
postProcessing *myDet=(postProcessing*)n;\
|
/* postProcessing *myDet=(postProcessing*)n;\ */
|
||||||
myDet->processData(1);\
|
/* myDet->processData(1);\ */
|
||||||
pthread_exit(NULL);\
|
/* pthread_exit(NULL);\ */
|
||||||
|
|
||||||
};
|
/* }; */
|
||||||
|
|
||||||
static void* startProcessDataNoDelete(void *n){\
|
/* static void* startProcessDataNoDelete(void *n){\ */
|
||||||
postProcessing *myDet=(postProcessing*)n;\
|
/* postProcessing *myDet=(postProcessing*)n;\ */
|
||||||
myDet->processData(0);\
|
/* myDet->processData(0);\ */
|
||||||
pthread_exit(NULL);\
|
/* pthread_exit(NULL);\ */
|
||||||
|
|
||||||
};
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
|
|||||||
me[ich]+=eout*eout;
|
me[ich]+=eout*eout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
|
|||||||
nBins=0;
|
nBins=0;
|
||||||
if (angRadius && angOffset && angCenter && (binSize>0)) {
|
if (angRadius && angOffset && angCenter && (binSize>0)) {
|
||||||
angConv=new angleConversionConstant*[nMods];
|
angConv=new angleConversionConstant*[nMods];
|
||||||
nBins=360./binSize+1;
|
nBins=(int)(360./binSize)+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int im=0; im<nMods; im++) {
|
for (int im=0; im<nMods; im++) {
|
||||||
|
@ -45,7 +45,9 @@ char sendbuffer[BUFFER_LENGTH*2];
|
|||||||
|
|
||||||
char onebuffer[BUFFER_LENGTH];
|
char onebuffer[BUFFER_LENGTH];
|
||||||
int sd = -1;
|
int sd = -1;
|
||||||
int sockfd, sfilefd;
|
int sockfd;
|
||||||
|
|
||||||
|
FILE *sfilefd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +197,7 @@ void* startListening(void *arg){
|
|||||||
struct sockaddr_in serveraddr;
|
struct sockaddr_in serveraddr;
|
||||||
struct sockaddr_in clientaddr;
|
struct sockaddr_in clientaddr;
|
||||||
|
|
||||||
int clientaddrlen = sizeof(clientaddr);
|
socklen_t clientaddrlen = sizeof(clientaddr);
|
||||||
framesInFile=0;
|
framesInFile=0;
|
||||||
frameIndex=0;
|
frameIndex=0;
|
||||||
startFrameIndex=-1;
|
startFrameIndex=-1;
|
||||||
@ -272,7 +274,7 @@ void* startListening(void *arg){
|
|||||||
else
|
else
|
||||||
sprintf(savefilename, "%s/%s_f%012d_%d.dat", filePath,fileName,framesCaught,fileIndex);
|
sprintf(savefilename, "%s/%s_f%012d_%d.dat", filePath,fileName,framesCaught,fileIndex);
|
||||||
|
|
||||||
printf("saving to %s\t\tpacket loss %f \%\t\tframenum %d\n", savefilename,((currframenum-prevframenum-(2*framesInFile))/(double)(2*framesInFile))*100.000,currframenum);
|
printf("saving to %s\t\tpacket loss %f %%\t\tframenum %d\n", savefilename,((currframenum-prevframenum-(2*framesInFile))/(double)(2*framesInFile))*100.000,currframenum);
|
||||||
sfilefd = fopen((const char *) (savefilename), "w");
|
sfilefd = fopen((const char *) (savefilename), "w");
|
||||||
prevframenum=currframenum;
|
prevframenum=currframenum;
|
||||||
framesInFile = 0;
|
framesInFile = 0;
|
||||||
@ -326,7 +328,7 @@ void* startListening(void *arg){
|
|||||||
|
|
||||||
//close file
|
//close file
|
||||||
fclose(sfilefd);
|
fclose(sfilefd);
|
||||||
printf("sfield:%d\n",sfilefd);
|
printf("sfield:%d\n",(int)sfilefd);
|
||||||
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -26,4 +26,8 @@ int stopReceiver();
|
|||||||
|
|
||||||
char* readFrame();
|
char* readFrame();
|
||||||
|
|
||||||
|
//int setUDPPortNumber(int p=-1); //sets/gets port number to listen to for data from the detector
|
||||||
|
//int setTCPPortNumber(int p=-1); //sets/get port number for communication to client
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@short
|
|
||||||
*/
|
|
||||||
class receiverInterface{
|
class receiverInterface{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -87,7 +84,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int executeFunction(int fnum);
|
int executeFunction(int fnum);
|
||||||
|
|
||||||
|
//here one should implement the funcs listed in
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user